Merge tls1_* method hooks with the ssl3_* versions. The protocols are pretty similar; they were all basically redundant. The free of s->tlsext_session_ticket (more fallout from the EAP-FAST patch) was moved to SSL_free because that object's attached to s, not s->s3. This is relevant if SSL_set_ssl_method gets called. Change-Id: I14a896ba8a6a2c34ab1cb5f65311b117051228da Reviewed-on: https://boringssl-review.googlesource.com/1509 Reviewed-by: Adam Langley <agl@google.com>
diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c index 2efb58e..8beb002 100644 --- a/ssl/s3_lib.c +++ b/ssl/s3_lib.c
@@ -2224,7 +2224,7 @@ s->s3->total_renegotiations=0; s->s3->num_renegotiations=0; s->s3->in_read_app_data=0; - s->version=SSL3_VERSION; + s->version = s->method->version; #if !defined(OPENSSL_NO_NEXTPROTONEG) if (s->next_proto_negotiated)
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index 182b9eb..66b2528 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c
@@ -707,6 +707,11 @@ if (s->srtp_profiles) sk_SRTP_PROTECTION_PROFILE_free(s->srtp_profiles); + if (s->tlsext_session_ticket) + { + OPENSSL_free(s->tlsext_session_ticket); + } + OPENSSL_free(s); }
diff --git a/ssl/ssl_locl.h b/ssl/ssl_locl.h index 3d72a63..3555692 100644 --- a/ssl/ssl_locl.h +++ b/ssl/ssl_locl.h
@@ -710,9 +710,9 @@ { \ static const SSL_METHOD func_name##_data= { \ version, \ - tls1_new, \ - tls1_clear, \ - tls1_free, \ + ssl3_new, \ + ssl3_clear, \ + ssl3_free, \ s_accept, \ s_connect, \ ssl3_read, \ @@ -731,7 +731,7 @@ ssl3_num_ciphers, \ ssl3_get_cipher, \ s_get_meth, \ - tls1_default_timeout, \ + ssl3_default_timeout, \ &enc_data, \ ssl_undefined_void_function, \ ssl3_callback_ctrl, \ @@ -780,9 +780,9 @@ { \ static const SSL_METHOD func_name##_data= { \ TLS1_2_VERSION, \ - tls1_new, \ - tls1_clear, \ - tls1_free, \ + ssl3_new, \ + ssl3_clear, \ + ssl3_free, \ s_accept, \ s_connect, \ ssl23_read, \ @@ -1054,12 +1054,6 @@ int ssl23_read_bytes(SSL *s, int n); int ssl23_write_bytes(SSL *s); -int tls1_new(SSL *s); -void tls1_free(SSL *s); -void tls1_clear(SSL *s); -long tls1_ctrl(SSL *s,int cmd, long larg, void *parg); -long tls1_callback_ctrl(SSL *s,int cmd, void (*fp)(void)); - int dtls1_new(SSL *s); int dtls1_accept(SSL *s); int dtls1_connect(SSL *s);
diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c index a8004a7..e79d4a5 100644 --- a/ssl/t1_lib.c +++ b/ssl/t1_lib.c
@@ -182,35 +182,6 @@ ssl3_handshake_write }; -long tls1_default_timeout(void) - { - /* 2 hours, the 24 hours mentioned in the TLSv1 spec - * is way too long for http, the cache would over fill */ - return(60*60*2); - } - -int tls1_new(SSL *s) - { - if (!ssl3_new(s)) return(0); - s->method->ssl_clear(s); - return(1); - } - -void tls1_free(SSL *s) - { - if (s->tlsext_session_ticket) - { - OPENSSL_free(s->tlsext_session_ticket); - } - ssl3_free(s); - } - -void tls1_clear(SSL *s) - { - ssl3_clear(s); - s->version = s->method->version; - } - static int compare_uint16_t(const void *p1, const void *p2) { uint16_t u1 = *((const uint16_t*)p1);