From a5dc545bbcffd9c24cebe65e9ab5ce72d4535e3a Mon Sep 17 00:00:00 2001 From: Adam Langley Date: Fri, 20 Jun 2014 12:00:00 -0700 Subject: [PATCH] Set SID from SSL_CTX This change ensures that the session ID context of an SSL* is updated when its SSL_CTX is updated. --- ssl/ssl_lib.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index f4d6205a8..70c2b9f59 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -3166,6 +3166,11 @@ SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX* ctx) if (ssl->ctx != NULL) SSL_CTX_free(ssl->ctx); /* decrement reference count */ ssl->ctx = ctx; + + ssl->sid_ctx_length = ctx->sid_ctx_length; + assert(ssl->sid_ctx_length <= sizeof(ssl->sid_ctx)); + memcpy(ssl->sid_ctx, ctx->sid_ctx, sizeof(ssl->sid_ctx)); + return(ssl->ctx); }