Move common code between two branches.

Some follow-up cleanup to bd30f8e34a38d04bf34df51ea0a2ce159e8ab273.

Change-Id: Id996c6c43f42f4db410e1e612ee1e5e8e0233356
Reviewed-on: https://boringssl-review.googlesource.com/1569
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/ssl/d1_srvr.c b/ssl/d1_srvr.c
index fd5bc11..e499f8b 100644
--- a/ssl/d1_srvr.c
+++ b/ssl/d1_srvr.c
@@ -494,10 +494,14 @@
 			ret=ssl3_get_client_key_exchange(s);
 			if (ret <= 0)
 				goto end;
+			s->state=SSL3_ST_SR_CERT_VRFY_A;
+			s->init_num=0;
+
+			/* TODO(davidben): These two blocks are different
+			 * between SSL and DTLS. Resolve the difference and code
+			 * duplication. */
 			if (SSL_USE_SIGALGS(s))
 				{
-				s->state=SSL3_ST_SR_CERT_VRFY_A;
-				s->init_num=0;
 				if (!s->session->peer)
 					break;
 				/* For sigalgs freeze the handshake buffer
@@ -514,9 +518,6 @@
 				}
 			else
 				{
-				s->state=SSL3_ST_SR_CERT_VRFY_A;
-				s->init_num=0;
-
 				/* We need to get hashes here so if there is
 				 * a client cert, it can be verified */ 
 				s->method->ssl3_enc->cert_verify_mac(s,
diff --git a/ssl/s3_srvr.c b/ssl/s3_srvr.c
index d5ff24f..c014ac3 100644
--- a/ssl/s3_srvr.c
+++ b/ssl/s3_srvr.c
@@ -492,10 +492,14 @@
 			ret=ssl3_get_client_key_exchange(s);
 			if (ret <= 0)
 				goto end;
+			s->state=SSL3_ST_SR_CERT_VRFY_A;
+			s->init_num=0;
+
+			/* TODO(davidben): These two blocks are different
+			 * between SSL and DTLS. Resolve the difference and code
+			 * duplication. */
 			if (SSL_USE_SIGALGS(s))
 				{
-				s->state=SSL3_ST_SR_CERT_VRFY_A;
-				s->init_num=0;
 				if (!s->session->peer)
 					break;
 				/* For sigalgs freeze the handshake buffer
@@ -515,9 +519,6 @@
 				int offset=0;
 				int dgst_num;
 
-				s->state=SSL3_ST_SR_CERT_VRFY_A;
-				s->init_num=0;
-
 				/* We need to get hashes here so if there is
 				 * a client cert, it can be verified
 				 * FIXME - digest processing for CertificateVerify