Some tidy ups after the CKE construction refactor
authorMatt Caswell <matt@openssl.org>
Fri, 8 Jul 2016 10:09:02 +0000 (11:09 +0100)
committerMatt Caswell <matt@openssl.org>
Mon, 18 Jul 2016 22:05:15 +0000 (23:05 +0100)
Reviewed-by: Richard Levitte <levitte@openssl.org>
ssl/statem/statem_clnt.c

index 125f7c4cc9fd44a23e33bc2908bd3d26de963fe4..236fffc2f5e8b83c93b831c19a5158fd511aeeb7 100644 (file)
@@ -2458,7 +2458,7 @@ static int tls_construct_cke_srp(SSL *s, unsigned char **p, int *len, int *al)
 int tls_construct_client_key_exchange(SSL *s)
 {
     unsigned char *p;
-    int n;
+    int len;
     size_t pskhdrlen = 0;
     unsigned long alg_k;
     int al = -1;
@@ -2467,28 +2467,26 @@ int tls_construct_client_key_exchange(SSL *s)
 
     p = ssl_handshake_start(s);
 
-
-
     if ((alg_k & SSL_PSK)
             && !tls_construct_cke_psk_preamble(s, &p, &pskhdrlen, &al))
         goto err;
 
     if (alg_k & SSL_kPSK) {
-        n = 0;
+        len = 0;
     } else if (alg_k & (SSL_kRSA | SSL_kRSAPSK)) {
-        if (!tls_construct_cke_rsa(s, &p, &n, &al))
+        if (!tls_construct_cke_rsa(s, &p, &len, &al))
             goto err;
     } else if (alg_k & (SSL_kDHE | SSL_kDHEPSK)) {
-        if (!tls_construct_cke_dhe(s, &p, &n, &al))
+        if (!tls_construct_cke_dhe(s, &p, &len, &al))
             goto err;
     } else if (alg_k & (SSL_kECDHE | SSL_kECDHEPSK)) {
-        if (!tls_construct_cke_ecdhe(s, &p, &n, &al))
+        if (!tls_construct_cke_ecdhe(s, &p, &len, &al))
             goto err;
     } else if (alg_k & SSL_kGOST) {
-        if (!tls_construct_cke_gost(s, &p, &n, &al))
+        if (!tls_construct_cke_gost(s, &p, &len, &al))
             goto err;
     } else if (alg_k & SSL_kSRP) {
-        if (!tls_construct_cke_srp(s, &p, &n, &al))
+        if (!tls_construct_cke_srp(s, &p, &len, &al))
             goto err;
     } else {
         ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE);
@@ -2496,9 +2494,9 @@ int tls_construct_client_key_exchange(SSL *s)
         goto err;
     }
 
-    n += pskhdrlen;
+    len += pskhdrlen;
 
-    if (!ssl_set_handshake_header(s, SSL3_MT_CLIENT_KEY_EXCHANGE, n)) {
+    if (!ssl_set_handshake_header(s, SSL3_MT_CLIENT_KEY_EXCHANGE, len)) {
         ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE);
         SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR);
         goto err;