From a7a752285a4fdb716fa5e184b84fe1474de6dbcf Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Fri, 8 Jul 2016 11:09:02 +0100 Subject: [PATCH] Some tidy ups after the CKE construction refactor Reviewed-by: Richard Levitte --- ssl/statem/statem_clnt.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/ssl/statem/statem_clnt.c b/ssl/statem/statem_clnt.c index 125f7c4cc9..236fffc2f5 100644 --- a/ssl/statem/statem_clnt.c +++ b/ssl/statem/statem_clnt.c @@ -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; -- 2.25.1