Remove redundant s->server assignments in handshake.
It should be set correctly prior to entering the handshake. Don't mask bugs by
assigning it.
Change-Id: Ib9bca8fad68916b3b242aad8819e3760e59e777a
Reviewed-on: https://boringssl-review.googlesource.com/2443
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/ssl/d1_clnt.c b/ssl/d1_clnt.c
index 88a6af4..f291549 100644
--- a/ssl/d1_clnt.c
+++ b/ssl/d1_clnt.c
@@ -136,6 +136,8 @@
int new_state,state,skip=0;
assert(s->handshake_func == dtls1_connect);
+ assert(!s->server);
+
ERR_clear_error();
ERR_clear_system_error();
@@ -160,7 +162,6 @@
case SSL_ST_CONNECT:
case SSL_ST_BEFORE|SSL_ST_CONNECT:
- s->server=0;
if (cb != NULL) cb(s,SSL_CB_HANDSHAKE_START,1);
if ((s->version & 0xff00 ) != (DTLS1_VERSION & 0xff00))
diff --git a/ssl/d1_srvr.c b/ssl/d1_srvr.c
index 5da2fa8..38da356 100644
--- a/ssl/d1_srvr.c
+++ b/ssl/d1_srvr.c
@@ -137,6 +137,8 @@
int new_state,state,skip=0;
assert(s->handshake_func == dtls1_accept);
+ assert(s->server);
+
ERR_clear_error();
ERR_clear_system_error();
@@ -166,7 +168,6 @@
case SSL_ST_ACCEPT:
case SSL_ST_BEFORE|SSL_ST_ACCEPT:
- s->server=1;
if (cb != NULL) cb(s,SSL_CB_HANDSHAKE_START,1);
if ((s->version & 0xff00) != (DTLS1_VERSION & 0xff00))
diff --git a/ssl/s23_clnt.c b/ssl/s23_clnt.c
index 71b3936..f39730b 100644
--- a/ssl/s23_clnt.c
+++ b/ssl/s23_clnt.c
@@ -106,6 +106,7 @@
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com). */
+#include <assert.h>
#include <stdio.h>
#include <openssl/buf.h>
@@ -130,6 +131,9 @@
int ret= -1;
int new_state,state;
+ assert(s->handshake_func == ssl23_connect);
+ assert(!s->server);
+
ERR_clear_error();
ERR_clear_system_error();
@@ -149,7 +153,6 @@
case SSL_ST_CONNECT:
case SSL_ST_BEFORE|SSL_ST_CONNECT:
- s->server=0;
if (cb != NULL) cb(s,SSL_CB_HANDSHAKE_START,1);
if (s->init_buf == NULL)
diff --git a/ssl/s23_srvr.c b/ssl/s23_srvr.c
index 57adbd7..aa29c4e 100644
--- a/ssl/s23_srvr.c
+++ b/ssl/s23_srvr.c
@@ -146,6 +146,9 @@
int ret= -1;
int new_state,state;
+ assert(s->handshake_func == ssl23_accept);
+ assert(s->server);
+
ERR_clear_error();
ERR_clear_system_error();
@@ -165,7 +168,6 @@
case SSL_ST_ACCEPT:
case SSL_ST_BEFORE|SSL_ST_ACCEPT:
- s->server=1;
if (cb != NULL) cb(s,SSL_CB_HANDSHAKE_START,1);
if (s->init_buf == NULL)
diff --git a/ssl/s3_clnt.c b/ssl/s3_clnt.c
index 635606e..e16e256 100644
--- a/ssl/s3_clnt.c
+++ b/ssl/s3_clnt.c
@@ -174,6 +174,8 @@
int new_state,state,skip=0;
assert(s->handshake_func == ssl3_connect);
+ assert(!s->server);
+
ERR_clear_error();
ERR_clear_system_error();
@@ -198,7 +200,6 @@
case SSL_ST_CONNECT:
case SSL_ST_BEFORE|SSL_ST_CONNECT:
- s->server=0;
if (cb != NULL) cb(s,SSL_CB_HANDSHAKE_START,1);
if ((s->version & 0xff00 ) != 0x0300)
diff --git a/ssl/s3_srvr.c b/ssl/s3_srvr.c
index 527850b..d915fc8 100644
--- a/ssl/s3_srvr.c
+++ b/ssl/s3_srvr.c
@@ -181,6 +181,8 @@
int new_state,state,skip=0;
assert(s->handshake_func == ssl3_accept);
+ assert(s->server);
+
ERR_clear_error();
ERR_clear_system_error();
@@ -210,7 +212,6 @@
case SSL_ST_ACCEPT:
case SSL_ST_BEFORE|SSL_ST_ACCEPT:
- s->server=1;
if (cb != NULL) cb(s,SSL_CB_HANDSHAKE_START,1);
if ((s->version>>8) != 3)