From: Dr. Stephen Henson Date: Sun, 21 Jun 2015 15:06:21 +0000 (+0100) Subject: Revert "Avoid duplication." X-Git-Tag: OpenSSL_1_1_0-pre1~983 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f6a103133abefd7795260af3f439d84430331e33;p=oweals%2Fopenssl.git Revert "Avoid duplication." This reverts commit d480e182fe20fcaeca7817a4693eeaf594bb1a32. Commit broke TLS handshakes due to fragility of digest caching: that will be fixed separately. Reviewed-by: Rich Salz --- diff --git a/ssl/s3_enc.c b/ssl/s3_enc.c index eedf74d392..bde19e1fb8 100644 --- a/ssl/s3_enc.c +++ b/ssl/s3_enc.c @@ -476,21 +476,15 @@ void ssl3_cleanup_key_block(SSL *s) void ssl3_init_finished_mac(SSL *s) { + BIO_free(s->s3->handshake_buffer); ssl3_free_digest_list(s); s->s3->handshake_buffer = BIO_new(BIO_s_mem()); (void)BIO_set_close(s->s3->handshake_buffer, BIO_CLOSE); } -/* - * Free digest list. Also frees handshake buffer since they are always freed - * together. - */ - void ssl3_free_digest_list(SSL *s) { int i; - BIO_free(s->s3->handshake_buffer); - s->s3->handshake_buffer = NULL; if (!s->s3->handshake_dgst) return; for (i = 0; i < SSL_MAX_DIGEST; i++) { diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c index 36b5f0d3ab..03078016e6 100644 --- a/ssl/s3_lib.c +++ b/ssl/s3_lib.c @@ -2905,6 +2905,7 @@ void ssl3_free(SSL *s) OPENSSL_free(s->s3->tmp.ciphers_raw); OPENSSL_clear_free(s->s3->tmp.pms, s->s3->tmp.pmslen); OPENSSL_free(s->s3->tmp.peer_sigalgs); + BIO_free(s->s3->handshake_buffer); ssl3_free_digest_list(s); OPENSSL_free(s->s3->alpn_selected); @@ -2939,6 +2940,8 @@ void ssl3_clear(SSL *s) #endif /* !OPENSSL_NO_EC */ init_extra = s->s3->init_extra; + BIO_free(s->s3->handshake_buffer); + s->s3->handshake_buffer = NULL; ssl3_free_digest_list(s); if (s->s3->alpn_selected) {