Don't finish the handshake twice
authorMatt Caswell <matt@openssl.org>
Fri, 6 Nov 2015 09:47:18 +0000 (09:47 +0000)
committerMatt Caswell <matt@openssl.org>
Fri, 6 Nov 2015 15:32:44 +0000 (15:32 +0000)
We finish the handshake when we move into the TLS_ST_OK state. At various
points we were also unnecessarily finishing it when we were reading/writing
the Finished message. It's much simpler just to do it in TLS_ST_OK, so
remove the other calls.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
ssl/statem/statem_clnt.c
ssl/statem/statem_lib.c
ssl/statem/statem_srvr.c

index c9d760f00e0bea4fc8672c9f95f8224ec927cbf0..4684098250f7a2359839414360947c0fc82b6551 100644 (file)
@@ -622,9 +622,6 @@ WORK_STATE ossl_statem_client_post_work(SSL *s, WORK_STATE wst)
 #endif
         if (statem_flush(s) != 1)
             return WORK_MORE_B;
-
-        if (s->hit && tls_finish_handshake(s, WORK_MORE_A) != 1)
-                return WORK_ERROR;
         break;
 
     default:
@@ -801,11 +798,6 @@ WORK_STATE ossl_statem_client_post_process_message(SSL *s, WORK_STATE wst)
         return WORK_FINISHED_STOP;
 #endif
 
-    case TLS_ST_CR_FINISHED:
-        if (!s->hit)
-            return tls_finish_handshake(s, wst);
-        else
-            return WORK_FINISHED_STOP;
     default:
         break;
     }
index 2c100dc817fcef0c0e38e0189dfbb57b6f11e85c..b0df7d26362ed97f9cb5da3cd65b7e8dd1c6b543 100644 (file)
@@ -331,7 +331,7 @@ MSG_PROCESS_RETURN tls_process_finished(SSL *s, PACKET *pkt)
         s->s3->previous_server_finished_len = i;
     }
 
-    return MSG_PROCESS_CONTINUE_PROCESSING;
+    return MSG_PROCESS_FINISHED_READING;
  f_err:
     ssl3_send_alert(s, SSL3_AL_FATAL, al);
     ossl_statem_set_error(s);
index 6f51d5dc76f9957b4cfd9bf694e313aeceac8df6..0689da0d3e94848e3ea3f10235acc8e8c8514d43 100644 (file)
@@ -876,12 +876,6 @@ WORK_STATE ossl_statem_server_post_process_message(SSL *s, WORK_STATE wst)
 #endif
         return WORK_FINISHED_CONTINUE;
 
-
-    case TLS_ST_SR_FINISHED:
-        if (s->hit)
-            return tls_finish_handshake(s, wst);
-        else
-            return WORK_FINISHED_STOP;
     default:
         break;
     }