mirror of
https://github.com/openssl/openssl.git
synced 2025-01-18 13:44:20 +08:00
Some tidy ups after the CKE construction refactor
Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
parent
840a2bf8ec
commit
a7a752285a
@ -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)
|
int tls_construct_client_key_exchange(SSL *s)
|
||||||
{
|
{
|
||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
int n;
|
int len;
|
||||||
size_t pskhdrlen = 0;
|
size_t pskhdrlen = 0;
|
||||||
unsigned long alg_k;
|
unsigned long alg_k;
|
||||||
int al = -1;
|
int al = -1;
|
||||||
@ -2467,28 +2467,26 @@ int tls_construct_client_key_exchange(SSL *s)
|
|||||||
|
|
||||||
p = ssl_handshake_start(s);
|
p = ssl_handshake_start(s);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ((alg_k & SSL_PSK)
|
if ((alg_k & SSL_PSK)
|
||||||
&& !tls_construct_cke_psk_preamble(s, &p, &pskhdrlen, &al))
|
&& !tls_construct_cke_psk_preamble(s, &p, &pskhdrlen, &al))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
if (alg_k & SSL_kPSK) {
|
if (alg_k & SSL_kPSK) {
|
||||||
n = 0;
|
len = 0;
|
||||||
} else if (alg_k & (SSL_kRSA | SSL_kRSAPSK)) {
|
} 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;
|
goto err;
|
||||||
} else if (alg_k & (SSL_kDHE | SSL_kDHEPSK)) {
|
} 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;
|
goto err;
|
||||||
} else if (alg_k & (SSL_kECDHE | SSL_kECDHEPSK)) {
|
} 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;
|
goto err;
|
||||||
} else if (alg_k & SSL_kGOST) {
|
} 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;
|
goto err;
|
||||||
} else if (alg_k & SSL_kSRP) {
|
} 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;
|
goto err;
|
||||||
} else {
|
} else {
|
||||||
ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE);
|
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;
|
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);
|
ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE);
|
||||||
SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR);
|
SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR);
|
||||||
goto err;
|
goto err;
|
||||||
|
Loading…
Reference in New Issue
Block a user