Don't finish the handshake twice
[openssl.git] / ssl / statem / statem_srvr.c
index 6423522efae0efd3e575271202cb01dfcd440b12..0689da0d3e94848e3ea3f10235acc8e8c8514d43 100644 (file)
@@ -310,7 +310,7 @@ int ossl_statem_server_read_transition(SSL *s, int mt)
  *   1: Yes
  *   0: No
  */
-static inline int send_server_key_exchange(SSL *s)
+static int send_server_key_exchange(SSL *s)
 {
     unsigned long alg_k = s->s3->tmp.new_cipher->algorithm_mkey;
 
@@ -362,7 +362,7 @@ static inline int send_server_key_exchange(SSL *s)
  *   1: Yes
  *   0: No
  */
-static inline int send_certificate_request(SSL *s)
+static int send_certificate_request(SSL *s)
 {
     if (
            /* don't request cert unless asked for it: */
@@ -391,7 +391,7 @@ static inline int send_certificate_request(SSL *s)
             * With normal PSK Certificates and Certificate Requests
             * are omitted
             */
-           && !(s->s3->tmp.new_cipher->algorithm_mkey & SSL_PSK)) {
+           && !(s->s3->tmp.new_cipher->algorithm_auth & SSL_aPSK)) {
         return 1;
     }
 
@@ -635,8 +635,8 @@ WORK_STATE ossl_statem_server_post_work(SSL *s, WORK_STATE wst)
              * Add new shared key for SCTP-Auth, will be ignored if no
              * SCTP used.
              */
-            snprintf((char *)labelbuffer, sizeof(DTLS1_SCTP_AUTH_LABEL),
-                     DTLS1_SCTP_AUTH_LABEL);
+            memcpy(labelbuffer, DTLS1_SCTP_AUTH_LABEL,
+                   sizeof(DTLS1_SCTP_AUTH_LABEL));
 
             if (SSL_export_keying_material(s, sctpauthkey,
                     sizeof(sctpauthkey), labelbuffer,
@@ -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;
     }
@@ -2905,8 +2899,8 @@ WORK_STATE tls_post_process_client_key_exchange(SSL *s, WORK_STATE wst)
              * Add new shared key for SCTP-Auth, will be ignored if no SCTP
              * used.
              */
-            snprintf((char *)labelbuffer, sizeof(DTLS1_SCTP_AUTH_LABEL),
-                     DTLS1_SCTP_AUTH_LABEL);
+            memcpy(labelbuffer, DTLS1_SCTP_AUTH_LABEL,
+                   sizeof(DTLS1_SCTP_AUTH_LABEL));
 
             if (SSL_export_keying_material(s, sctpauthkey,
                                        sizeof(sctpauthkey), labelbuffer,