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>
This commit is contained in:
David Benjamin 2014-08-13 20:06:29 -04:00 committed by Adam Langley
parent 5a593af42a
commit 1b96526c6f
4 changed files with 13 additions and 43 deletions

View File

@ -2224,7 +2224,7 @@ void ssl3_clear(SSL *s)
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)

View File

@ -707,6 +707,11 @@ void SSL_free(SSL *s)
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);
}

View File

@ -710,9 +710,9 @@ const SSL_METHOD *func_name(void) \
{ \
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 @@ const SSL_METHOD *func_name(void) \
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 @@ const SSL_METHOD *func_name(void) \
{ \
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_connect(SSL *s);
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);

View File

@ -182,35 +182,6 @@ SSL3_ENC_METHOD TLSv1_2_enc_data={
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);