Rename ssl3_get_key_exchange to ssl3_get_server_key_exchange.
More consistent with ssl3_send_server_key_exchange and the message name. Change-Id: If0f435a89bdf117297d349099708fff0bd5a6e98 Reviewed-on: https://boringssl-review.googlesource.com/1170 Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
committed by
Adam Langley
parent
05da6e1641
commit
8f8040dd4f
@@ -2487,7 +2487,7 @@ void ERR_load_SSL_strings(void);
|
||||
#define SSL_F_ssl3_ctrl 215
|
||||
#define SSL_F_ssl3_setup_write_buffer 216
|
||||
#define SSL_F_ssl_parse_serverhello_use_srtp_ext 217
|
||||
#define SSL_F_ssl3_get_key_exchange 218
|
||||
#define SSL_F_ssl3_get_server_key_exchange 218
|
||||
#define SSL_F_ssl3_send_server_hello 219
|
||||
#define SSL_F_SSL_add_dir_cert_subjects_to_stack 220
|
||||
#define SSL_F_ssl_check_serverhello_tlsext 221
|
||||
|
||||
+1
-1
@@ -331,7 +331,7 @@ int dtls1_connect(SSL *s)
|
||||
|
||||
case SSL3_ST_CR_KEY_EXCH_A:
|
||||
case SSL3_ST_CR_KEY_EXCH_B:
|
||||
ret=ssl3_get_key_exchange(s);
|
||||
ret=ssl3_get_server_key_exchange(s);
|
||||
if (ret <= 0) goto end;
|
||||
s->state=SSL3_ST_CR_CERT_REQ_A;
|
||||
s->init_num=0;
|
||||
|
||||
+32
-32
@@ -332,7 +332,7 @@ int ssl3_connect(SSL *s)
|
||||
|
||||
case SSL3_ST_CR_KEY_EXCH_A:
|
||||
case SSL3_ST_CR_KEY_EXCH_B:
|
||||
ret=ssl3_get_key_exchange(s);
|
||||
ret=ssl3_get_server_key_exchange(s);
|
||||
if (ret <= 0) goto end;
|
||||
s->state=SSL3_ST_CR_CERT_REQ_A;
|
||||
s->init_num=0;
|
||||
@@ -1261,7 +1261,7 @@ err:
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int ssl3_get_key_exchange(SSL *s)
|
||||
int ssl3_get_server_key_exchange(SSL *s)
|
||||
{
|
||||
EVP_MD_CTX md_ctx;
|
||||
int al,ok;
|
||||
@@ -1293,7 +1293,7 @@ int ssl3_get_key_exchange(SSL *s)
|
||||
{
|
||||
if (ssl_cipher_requires_server_key_exchange(s->s3->tmp.new_cipher))
|
||||
{
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, SSL_R_UNEXPECTED_MESSAGE);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, SSL_R_UNEXPECTED_MESSAGE);
|
||||
ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_UNEXPECTED_MESSAGE);
|
||||
return -1;
|
||||
}
|
||||
@@ -1367,7 +1367,7 @@ int ssl3_get_key_exchange(SSL *s)
|
||||
if (!CBS_get_u16_length_prefixed(&server_key_exchange, &psk_identity_hint))
|
||||
{
|
||||
al = SSL_AD_DECODE_ERROR;
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, SSL_R_DECODE_ERROR);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, SSL_R_DECODE_ERROR);
|
||||
goto f_err;
|
||||
}
|
||||
|
||||
@@ -1383,7 +1383,7 @@ int ssl3_get_key_exchange(SSL *s)
|
||||
CBS_contains_zero_byte(&psk_identity_hint))
|
||||
{
|
||||
al = SSL_AD_HANDSHAKE_FAILURE;
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, SSL_R_DATA_LENGTH_TOO_LONG);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, SSL_R_DATA_LENGTH_TOO_LONG);
|
||||
goto f_err;
|
||||
}
|
||||
|
||||
@@ -1391,7 +1391,7 @@ int ssl3_get_key_exchange(SSL *s)
|
||||
if (!CBS_strdup(&psk_identity_hint, &s->session->psk_identity_hint))
|
||||
{
|
||||
al = SSL_AD_HANDSHAKE_FAILURE;
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, ERR_R_MALLOC_FAILURE);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, ERR_R_MALLOC_FAILURE);
|
||||
goto f_err;
|
||||
}
|
||||
}
|
||||
@@ -1411,27 +1411,27 @@ int ssl3_get_key_exchange(SSL *s)
|
||||
CBS_len(&rsa_exponent) == 0)
|
||||
{
|
||||
al = SSL_AD_DECODE_ERROR;
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, SSL_R_DECODE_ERROR);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, SSL_R_DECODE_ERROR);
|
||||
goto f_err;
|
||||
}
|
||||
|
||||
if ((rsa=RSA_new()) == NULL)
|
||||
{
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, ERR_R_MALLOC_FAILURE);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!(rsa->n = BN_bin2bn(CBS_data(&rsa_modulus),
|
||||
CBS_len(&rsa_modulus), rsa->n)))
|
||||
{
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, ERR_R_BN_LIB);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, ERR_R_BN_LIB);
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!(rsa->e = BN_bin2bn(CBS_data(&rsa_exponent),
|
||||
CBS_len(&rsa_exponent), rsa->e)))
|
||||
{
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, ERR_R_BN_LIB);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, ERR_R_BN_LIB);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -1440,7 +1440,7 @@ int ssl3_get_key_exchange(SSL *s)
|
||||
pkey=X509_get_pubkey(s->session->sess_cert->peer_pkeys[SSL_PKEY_RSA_ENC].x509);
|
||||
else
|
||||
{
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, ERR_R_INTERNAL_ERROR);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, ERR_R_INTERNAL_ERROR);
|
||||
goto err;
|
||||
}
|
||||
s->session->sess_cert->peer_rsa_tmp=rsa;
|
||||
@@ -1459,29 +1459,29 @@ int ssl3_get_key_exchange(SSL *s)
|
||||
CBS_len(&dh_Ys) == 0)
|
||||
{
|
||||
al = SSL_AD_DECODE_ERROR;
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, SSL_R_DECODE_ERROR);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, SSL_R_DECODE_ERROR);
|
||||
goto f_err;
|
||||
}
|
||||
|
||||
if ((dh=DH_new()) == NULL)
|
||||
{
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, ERR_R_DH_LIB);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, ERR_R_DH_LIB);
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!(dh->p = BN_bin2bn(CBS_data(&dh_p), CBS_len(&dh_p), NULL)))
|
||||
{
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, ERR_R_BN_LIB);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, ERR_R_BN_LIB);
|
||||
goto err;
|
||||
}
|
||||
if (!(dh->g=BN_bin2bn(CBS_data(&dh_g), CBS_len(&dh_g), NULL)))
|
||||
{
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, ERR_R_BN_LIB);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, ERR_R_BN_LIB);
|
||||
goto err;
|
||||
}
|
||||
if (!(dh->pub_key = BN_bin2bn(CBS_data(&dh_Ys), CBS_len(&dh_Ys), NULL)))
|
||||
{
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, ERR_R_BN_LIB);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, ERR_R_BN_LIB);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -1499,7 +1499,7 @@ int ssl3_get_key_exchange(SSL *s)
|
||||
else if ((alg_k & SSL_kDHr) || (alg_k & SSL_kDHd))
|
||||
{
|
||||
al=SSL_AD_ILLEGAL_PARAMETER;
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHER);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHER);
|
||||
goto f_err;
|
||||
}
|
||||
#endif /* !OPENSSL_NO_DH */
|
||||
@@ -1521,31 +1521,31 @@ int ssl3_get_key_exchange(SSL *s)
|
||||
if (!tls1_check_curve(s, &server_key_exchange, &curve_id))
|
||||
{
|
||||
al = SSL_AD_DECODE_ERROR;
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, SSL_R_WRONG_CURVE);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, SSL_R_WRONG_CURVE);
|
||||
goto f_err;
|
||||
}
|
||||
|
||||
if ((curve_nid = tls1_ec_curve_id2nid(curve_id)) == 0)
|
||||
{
|
||||
al=SSL_AD_INTERNAL_ERROR;
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS);
|
||||
goto f_err;
|
||||
}
|
||||
|
||||
if ((ecdh=EC_KEY_new()) == NULL)
|
||||
{
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, ERR_R_MALLOC_FAILURE);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
ngroup = EC_GROUP_new_by_curve_name(curve_nid);
|
||||
if (ngroup == NULL)
|
||||
{
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, ERR_R_EC_LIB);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, ERR_R_EC_LIB);
|
||||
goto err;
|
||||
}
|
||||
if (EC_KEY_set_group(ecdh, ngroup) == 0)
|
||||
{
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, ERR_R_EC_LIB);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, ERR_R_EC_LIB);
|
||||
goto err;
|
||||
}
|
||||
EC_GROUP_free(ngroup);
|
||||
@@ -1556,7 +1556,7 @@ int ssl3_get_key_exchange(SSL *s)
|
||||
(EC_GROUP_get_degree(group) > 163))
|
||||
{
|
||||
al=SSL_AD_EXPORT_RESTRICTION;
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER);
|
||||
goto f_err;
|
||||
}
|
||||
|
||||
@@ -1564,14 +1564,14 @@ int ssl3_get_key_exchange(SSL *s)
|
||||
if (!CBS_get_u8_length_prefixed(&server_key_exchange, &point))
|
||||
{
|
||||
al = SSL_AD_DECODE_ERROR;
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, SSL_R_DECODE_ERROR);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, SSL_R_DECODE_ERROR);
|
||||
goto f_err;
|
||||
}
|
||||
|
||||
if (((srvr_ecpoint = EC_POINT_new(group)) == NULL) ||
|
||||
((bn_ctx = BN_CTX_new()) == NULL))
|
||||
{
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, ERR_R_MALLOC_FAILURE);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -1579,7 +1579,7 @@ int ssl3_get_key_exchange(SSL *s)
|
||||
CBS_data(&point), CBS_len(&point), bn_ctx))
|
||||
{
|
||||
al = SSL_AD_DECODE_ERROR;
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, SSL_R_BAD_ECPOINT);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, SSL_R_BAD_ECPOINT);
|
||||
goto f_err;
|
||||
}
|
||||
|
||||
@@ -1608,7 +1608,7 @@ int ssl3_get_key_exchange(SSL *s)
|
||||
else if (!(alg_k & SSL_kPSK))
|
||||
{
|
||||
al=SSL_AD_UNEXPECTED_MESSAGE;
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, SSL_R_UNEXPECTED_MESSAGE);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, SSL_R_UNEXPECTED_MESSAGE);
|
||||
goto f_err;
|
||||
}
|
||||
|
||||
@@ -1639,7 +1639,7 @@ int ssl3_get_key_exchange(SSL *s)
|
||||
CBS_len(&server_key_exchange) != 0)
|
||||
{
|
||||
al = SSL_AD_DECODE_ERROR;
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, SSL_R_DECODE_ERROR);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, SSL_R_DECODE_ERROR);
|
||||
goto f_err;
|
||||
}
|
||||
|
||||
@@ -1667,7 +1667,7 @@ int ssl3_get_key_exchange(SSL *s)
|
||||
pkey->pkey.rsa))
|
||||
{
|
||||
al = SSL_AD_DECRYPT_ERROR;
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, SSL_R_BAD_SIGNATURE);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, SSL_R_BAD_SIGNATURE);
|
||||
goto f_err;
|
||||
}
|
||||
}
|
||||
@@ -1681,7 +1681,7 @@ int ssl3_get_key_exchange(SSL *s)
|
||||
{
|
||||
/* bad signature */
|
||||
al=SSL_AD_DECRYPT_ERROR;
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, SSL_R_BAD_SIGNATURE);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, SSL_R_BAD_SIGNATURE);
|
||||
goto f_err;
|
||||
}
|
||||
}
|
||||
@@ -1693,14 +1693,14 @@ int ssl3_get_key_exchange(SSL *s)
|
||||
/* Might be wrong key type, check it */
|
||||
if (ssl3_check_cert_and_algorithm(s))
|
||||
/* Otherwise this shouldn't happen */
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, ERR_R_INTERNAL_ERROR);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, ERR_R_INTERNAL_ERROR);
|
||||
goto err;
|
||||
}
|
||||
/* still data left over */
|
||||
if (CBS_len(&server_key_exchange) > 0)
|
||||
{
|
||||
al=SSL_AD_DECODE_ERROR;
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_key_exchange, SSL_R_EXTRA_DATA_IN_MESSAGE);
|
||||
OPENSSL_PUT_ERROR(SSL, ssl3_get_server_key_exchange, SSL_R_EXTRA_DATA_IN_MESSAGE);
|
||||
goto f_err;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -2679,7 +2679,7 @@ int ssl3_get_cert_verify(SSL *s)
|
||||
|
||||
/* We now have a signature that we need to verify. */
|
||||
/* TODO(davidben): This should share code with
|
||||
* ssl3_get_key_exchange. */
|
||||
* ssl3_get_server_key_exchange. */
|
||||
|
||||
if (SSL_USE_SIGALGS(s))
|
||||
{
|
||||
|
||||
+1
-1
@@ -117,7 +117,7 @@ const ERR_STRING_DATA SSL_error_string_data[] = {
|
||||
{ERR_PACK(ERR_LIB_SSL, SSL_F_ssl3_get_client_hello, 0), "ssl3_get_client_hello"},
|
||||
{ERR_PACK(ERR_LIB_SSL, SSL_F_ssl3_get_client_key_exchange, 0), "ssl3_get_client_key_exchange"},
|
||||
{ERR_PACK(ERR_LIB_SSL, SSL_F_ssl3_get_finished, 0), "ssl3_get_finished"},
|
||||
{ERR_PACK(ERR_LIB_SSL, SSL_F_ssl3_get_key_exchange, 0), "ssl3_get_key_exchange"},
|
||||
{ERR_PACK(ERR_LIB_SSL, SSL_F_ssl3_get_server_key_exchange, 0), "ssl3_get_server_key_exchange"},
|
||||
{ERR_PACK(ERR_LIB_SSL, SSL_F_ssl3_get_message, 0), "ssl3_get_message"},
|
||||
{ERR_PACK(ERR_LIB_SSL, SSL_F_ssl3_get_new_session_ticket, 0), "ssl3_get_new_session_ticket"},
|
||||
{ERR_PACK(ERR_LIB_SSL, SSL_F_ssl3_get_next_proto, 0), "ssl3_get_next_proto"},
|
||||
|
||||
+1
-1
@@ -1168,7 +1168,7 @@ int ssl3_send_client_verify(SSL *s);
|
||||
int ssl3_send_client_certificate(SSL *s);
|
||||
int ssl_do_client_cert_cb(SSL *s, X509 **px509, EVP_PKEY **ppkey);
|
||||
int ssl3_send_client_key_exchange(SSL *s);
|
||||
int ssl3_get_key_exchange(SSL *s);
|
||||
int ssl3_get_server_key_exchange(SSL *s);
|
||||
int ssl3_get_server_certificate(SSL *s);
|
||||
int ssl3_check_cert_and_algorithm(SSL *s);
|
||||
int ssl3_check_finished(SSL *s);
|
||||
|
||||
Reference in New Issue
Block a user