diff options
author | Benjamin Kaduk <bkaduk@akamai.com> | 2017-10-17 14:46:58 -0500 |
---|---|---|
committer | Ben Kaduk <kaduk@mit.edu> | 2017-10-30 10:18:09 -0500 |
commit | 1fcb4e4d521971caccb61df215541bf55f7ca9a5 (patch) | |
tree | 5b753dc364d8444f6b8d59abfa9c27dbd01b85bd /ssl/statem/statem_clnt.c | |
parent | ce01b1896b57f3568c5af71e5b2912280171ba6e (diff) |
Use atomics for SSL_CTX statistics
It is expected that SSL_CTX objects are shared across threads,
and as such we are responsible for ensuring coherent data accesses.
Aligned integer accesses ought to be atomic already on all supported
architectures, but we can be formally correct.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/4549)
Diffstat (limited to 'ssl/statem/statem_clnt.c')
-rw-r--r-- | ssl/statem/statem_clnt.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ssl/statem/statem_clnt.c b/ssl/statem/statem_clnt.c index af42bcb0f3..6b1bc92700 100644 --- a/ssl/statem/statem_clnt.c +++ b/ssl/statem/statem_clnt.c @@ -1266,7 +1266,7 @@ MSG_PROCESS_RETURN tls_process_server_hello(SSL *s, PACKET *pkt) unsigned int compression; unsigned int sversion; unsigned int context; - int protverr; + int protverr, discard; RAW_EXTENSION *extensions = NULL; #ifndef OPENSSL_NO_COMP SSL_COMP *comp; @@ -1430,7 +1430,8 @@ MSG_PROCESS_RETURN tls_process_server_hello(SSL *s, PACKET *pkt) || (SSL_IS_TLS13(s) && s->session->ext.tick_identity != TLSEXT_PSK_BAD_IDENTITY)) { - s->ctx->stats.sess_miss++; + CRYPTO_atomic_add(&s->ctx->stats.sess_miss, 1, &discard, + s->ctx->lock); if (!ssl_get_new_session(s, 0)) { goto f_err; } |