Drop unnecessary version checks.
These may as well be replaced with assertions. Get them out of the way of the initialization. Change-Id: Ie4ab8bdc018e4a1def7d3f6b3b172a77896bfc0a Reviewed-on: https://boringssl-review.googlesource.com/2563 Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
committed by
Adam Langley
parent
28014cb4f2
commit
138c2ac627
+1
-7
@@ -137,6 +137,7 @@ int dtls1_connect(SSL *s)
|
||||
|
||||
assert(s->handshake_func == dtls1_connect);
|
||||
assert(!s->server);
|
||||
assert(SSL_IS_DTLS(s));
|
||||
|
||||
ERR_clear_error();
|
||||
ERR_clear_system_error();
|
||||
@@ -164,13 +165,6 @@ int dtls1_connect(SSL *s)
|
||||
|
||||
if (cb != NULL) cb(s,SSL_CB_HANDSHAKE_START,1);
|
||||
|
||||
if ((s->version & 0xff00 ) != (DTLS1_VERSION & 0xff00))
|
||||
{
|
||||
OPENSSL_PUT_ERROR(SSL, dtls1_connect, ERR_R_INTERNAL_ERROR);
|
||||
ret = -1;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (s->init_buf == NULL)
|
||||
{
|
||||
if ((buf=BUF_MEM_new()) == NULL)
|
||||
|
||||
+1
-6
@@ -138,6 +138,7 @@ int dtls1_accept(SSL *s)
|
||||
|
||||
assert(s->handshake_func == dtls1_accept);
|
||||
assert(s->server);
|
||||
assert(SSL_IS_DTLS(s));
|
||||
|
||||
ERR_clear_error();
|
||||
ERR_clear_system_error();
|
||||
@@ -170,12 +171,6 @@ int dtls1_accept(SSL *s)
|
||||
|
||||
if (cb != NULL) cb(s,SSL_CB_HANDSHAKE_START,1);
|
||||
|
||||
if ((s->version & 0xff00) != (DTLS1_VERSION & 0xff00))
|
||||
{
|
||||
OPENSSL_PUT_ERROR(SSL, dtls1_accept, ERR_R_INTERNAL_ERROR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (s->init_buf == NULL)
|
||||
{
|
||||
if ((buf=BUF_MEM_new()) == NULL)
|
||||
|
||||
@@ -129,6 +129,7 @@ int ssl23_connect(SSL *s)
|
||||
|
||||
assert(s->handshake_func == ssl23_connect);
|
||||
assert(!s->server);
|
||||
assert(!SSL_IS_DTLS(s));
|
||||
|
||||
ERR_clear_error();
|
||||
ERR_clear_system_error();
|
||||
|
||||
@@ -144,6 +144,7 @@ int ssl23_accept(SSL *s)
|
||||
|
||||
assert(s->handshake_func == ssl23_accept);
|
||||
assert(s->server);
|
||||
assert(!SSL_IS_DTLS(s));
|
||||
|
||||
ERR_clear_error();
|
||||
ERR_clear_system_error();
|
||||
|
||||
+1
-7
@@ -175,6 +175,7 @@ int ssl3_connect(SSL *s)
|
||||
|
||||
assert(s->handshake_func == ssl3_connect);
|
||||
assert(!s->server);
|
||||
assert(!SSL_IS_DTLS(s));
|
||||
|
||||
ERR_clear_error();
|
||||
ERR_clear_system_error();
|
||||
@@ -202,13 +203,6 @@ int ssl3_connect(SSL *s)
|
||||
|
||||
if (cb != NULL) cb(s,SSL_CB_HANDSHAKE_START,1);
|
||||
|
||||
if ((s->version & 0xff00 ) != 0x0300)
|
||||
{
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_connect, ERR_R_INTERNAL_ERROR);
|
||||
ret = -1;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (s->init_buf == NULL)
|
||||
{
|
||||
if ((buf=BUF_MEM_new()) == NULL)
|
||||
|
||||
+1
-6
@@ -182,6 +182,7 @@ int ssl3_accept(SSL *s)
|
||||
|
||||
assert(s->handshake_func == ssl3_accept);
|
||||
assert(s->server);
|
||||
assert(!SSL_IS_DTLS(s));
|
||||
|
||||
ERR_clear_error();
|
||||
ERR_clear_system_error();
|
||||
@@ -214,12 +215,6 @@ int ssl3_accept(SSL *s)
|
||||
|
||||
if (cb != NULL) cb(s,SSL_CB_HANDSHAKE_START,1);
|
||||
|
||||
if ((s->version>>8) != 3)
|
||||
{
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_accept, ERR_R_INTERNAL_ERROR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (s->init_buf == NULL)
|
||||
{
|
||||
if ((buf=BUF_MEM_new()) == NULL)
|
||||
|
||||
Reference in New Issue
Block a user