summaryrefslogtreecommitdiffstats
path: root/src/ssl/ssl_lib.c
diff options
context:
space:
mode:
authorAdam Langley <agl@google.com>2015-06-23 16:20:13 -0700
committerAdam Langley <agl@google.com>2015-06-23 16:32:39 -0700
commit56d250321ea9dfa66ea9afa599f12c83a4147c86 (patch)
tree32f131cd6ff8f2c2db1ba6a533d0b2da3853f58d /src/ssl/ssl_lib.c
parent0e6bb1c72014c26289d09f4deea9c25706be5824 (diff)
downloadexternal_boringssl-56d250321ea9dfa66ea9afa599f12c83a4147c86.zip
external_boringssl-56d250321ea9dfa66ea9afa599f12c83a4147c86.tar.gz
external_boringssl-56d250321ea9dfa66ea9afa599f12c83a4147c86.tar.bz2
Fixes for CVE-2015-1791.
If a NewSessionTicket is received by a multi-threaded client when attempting to reuse a previous ticket then a race condition can occur potentially leading to a double free of the ticket data. This change cherry-picks the following BoringSSL changes: b31040d0 – Get rid of CERT_PKEY slots in SESS_CERT. fd67aa8c – Add SSL_SESSION_from_bytes. 95d31825 – Duplicate SSL_SESSIONs when renewing them. d65bb78c – Add SSL_initial_handshake_complete. 680ca961 – Preserve session->sess_cert on ticket renewal. Change-Id: I474065330842e4ab0066b2485c1489a50e4dfd5b
Diffstat (limited to 'src/ssl/ssl_lib.c')
-rw-r--r--src/ssl/ssl_lib.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/ssl/ssl_lib.c b/src/ssl/ssl_lib.c
index e95226f..9e1e308 100644
--- a/src/ssl/ssl_lib.c
+++ b/src/ssl/ssl_lib.c
@@ -1975,8 +1975,16 @@ void ssl_update_cache(SSL *s, int mode) {
return;
}
+ int has_new_session = !s->hit;
+ if (!s->server && s->tlsext_ticket_expected) {
+ /* A client may see new sessions on abbreviated handshakes if the server
+ * decides to renew the ticket. Once the handshake is completed, it should
+ * be inserted into the cache. */
+ has_new_session = 1;
+ }
+
SSL_CTX *ctx = s->initial_ctx;
- if ((ctx->session_cache_mode & mode) == mode && !s->hit &&
+ if ((ctx->session_cache_mode & mode) == mode && has_new_session &&
((ctx->session_cache_mode & SSL_SESS_CACHE_NO_INTERNAL_STORE) ||
SSL_CTX_add_session(ctx, s->session)) &&
ctx->new_session_cb != NULL) {
@@ -2960,6 +2968,10 @@ err:
return 0;
}
+int SSL_initial_handshake_complete(const SSL *ssl) {
+ return ssl->s3->initial_handshake_complete;
+}
+
int SSL_CTX_sess_connect(const SSL_CTX *ctx) { return 0; }
int SSL_CTX_sess_connect_good(const SSL_CTX *ctx) { return 0; }
int SSL_CTX_sess_connect_renegotiate(const SSL_CTX *ctx) { return 0; }