Latest update
This commit is contained in:
+11
-13
@@ -46,9 +46,7 @@ static int init_etm(SSL *s, unsigned int context);
|
||||
static int init_ems(SSL *s, unsigned int context);
|
||||
static int final_ems(SSL *s, unsigned int context, int sent);
|
||||
static int init_psk_kex_modes(SSL *s, unsigned int context);
|
||||
#ifndef OPENSSL_NO_EC
|
||||
static int final_key_share(SSL *s, unsigned int context, int sent);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SRTP
|
||||
static int init_srtp(SSL *s, unsigned int context);
|
||||
#endif
|
||||
@@ -162,6 +160,10 @@ static const EXTENSION_DEFINITION ext_defs[] = {
|
||||
tls_construct_stoc_ec_pt_formats, tls_construct_ctos_ec_pt_formats,
|
||||
final_ec_pt_formats
|
||||
},
|
||||
#else
|
||||
INVALID_EXTENSION,
|
||||
#endif
|
||||
#if !defined(OPENSSL_NO_EC) || !defined(OPENSSL_NO_DH)
|
||||
{
|
||||
/*
|
||||
* "supported_groups" is spread across several specifications.
|
||||
@@ -197,7 +199,6 @@ static const EXTENSION_DEFINITION ext_defs[] = {
|
||||
},
|
||||
#else
|
||||
INVALID_EXTENSION,
|
||||
INVALID_EXTENSION,
|
||||
#endif
|
||||
{
|
||||
TLSEXT_TYPE_session_ticket,
|
||||
@@ -322,7 +323,6 @@ static const EXTENSION_DEFINITION ext_defs[] = {
|
||||
init_psk_kex_modes, tls_parse_ctos_psk_kex_modes, NULL, NULL,
|
||||
tls_construct_ctos_psk_kex_modes, NULL
|
||||
},
|
||||
#ifndef OPENSSL_NO_EC
|
||||
{
|
||||
/*
|
||||
* Must be in this list after supported_groups. We need that to have
|
||||
@@ -336,7 +336,6 @@ static const EXTENSION_DEFINITION ext_defs[] = {
|
||||
tls_construct_stoc_key_share, tls_construct_ctos_key_share,
|
||||
final_key_share
|
||||
},
|
||||
#endif
|
||||
{
|
||||
/* Must be after key_share */
|
||||
TLSEXT_TYPE_cookie,
|
||||
@@ -1040,18 +1039,18 @@ static int final_ec_pt_formats(SSL *s, unsigned int context, int sent)
|
||||
*/
|
||||
if (s->ext.ecpointformats != NULL
|
||||
&& s->ext.ecpointformats_len > 0
|
||||
&& s->session->ext.ecpointformats != NULL
|
||||
&& s->session->ext.ecpointformats_len > 0
|
||||
&& s->ext.peer_ecpointformats != NULL
|
||||
&& s->ext.peer_ecpointformats_len > 0
|
||||
&& ((alg_k & SSL_kECDHE) || (alg_a & SSL_aECDSA))) {
|
||||
/* we are using an ECC cipher */
|
||||
size_t i;
|
||||
unsigned char *list = s->session->ext.ecpointformats;
|
||||
unsigned char *list = s->ext.peer_ecpointformats;
|
||||
|
||||
for (i = 0; i < s->session->ext.ecpointformats_len; i++) {
|
||||
for (i = 0; i < s->ext.peer_ecpointformats_len; i++) {
|
||||
if (*list++ == TLSEXT_ECPOINTFORMAT_uncompressed)
|
||||
break;
|
||||
}
|
||||
if (i == s->session->ext.ecpointformats_len) {
|
||||
if (i == s->ext.peer_ecpointformats_len) {
|
||||
SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER, SSL_F_FINAL_EC_PT_FORMATS,
|
||||
SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST);
|
||||
return 0;
|
||||
@@ -1266,9 +1265,9 @@ static int final_sig_algs(SSL *s, unsigned int context, int sent)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_EC
|
||||
static int final_key_share(SSL *s, unsigned int context, int sent)
|
||||
{
|
||||
#if !defined(OPENSSL_NO_TLS1_3)
|
||||
if (!SSL_IS_TLS13(s))
|
||||
return 1;
|
||||
|
||||
@@ -1426,10 +1425,9 @@ static int final_key_share(SSL *s, unsigned int context, int sent)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !defined(OPENSSL_NO_TLS1_3) */
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int init_psk_kex_modes(SSL *s, unsigned int context)
|
||||
{
|
||||
|
||||
@@ -113,11 +113,13 @@ EXT_RETURN tls_construct_ctos_srp(SSL *s, WPACKET *pkt, unsigned int context,
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_EC
|
||||
static int use_ecc(SSL *s)
|
||||
static int use_ecc(SSL *s, int max_version)
|
||||
{
|
||||
int i, end, ret = 0;
|
||||
unsigned long alg_k, alg_a;
|
||||
STACK_OF(SSL_CIPHER) *cipher_stack = NULL;
|
||||
const uint16_t *pgroups = NULL;
|
||||
size_t num_groups, j;
|
||||
|
||||
/* See if we support any ECC ciphersuites */
|
||||
if (s->version == SSL3_VERSION)
|
||||
@@ -137,9 +139,21 @@ static int use_ecc(SSL *s)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sk_SSL_CIPHER_free(cipher_stack);
|
||||
return ret;
|
||||
if (!ret)
|
||||
return 0;
|
||||
|
||||
/* Check we have at least one EC supported group */
|
||||
tls1_get_supported_groups(s, &pgroups, &num_groups);
|
||||
for (j = 0; j < num_groups; j++) {
|
||||
uint16_t ctmp = pgroups[j];
|
||||
|
||||
if (tls_valid_group(s, ctmp, max_version)
|
||||
&& tls_group_allowed(s, ctmp, SSL_SECOP_CURVE_SUPPORTED))
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXT_RETURN tls_construct_ctos_ec_pt_formats(SSL *s, WPACKET *pkt,
|
||||
@@ -148,8 +162,15 @@ EXT_RETURN tls_construct_ctos_ec_pt_formats(SSL *s, WPACKET *pkt,
|
||||
{
|
||||
const unsigned char *pformats;
|
||||
size_t num_formats;
|
||||
int reason, min_version, max_version;
|
||||
|
||||
if (!use_ecc(s))
|
||||
reason = ssl_get_min_max_version(s, &min_version, &max_version, NULL);
|
||||
if (reason != 0) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR,
|
||||
SSL_F_TLS_CONSTRUCT_CTOS_EC_PT_FORMATS, reason);
|
||||
return EXT_RETURN_FAIL;
|
||||
}
|
||||
if (!use_ecc(s, max_version))
|
||||
return EXT_RETURN_NOT_SENT;
|
||||
|
||||
/* Add TLS extension ECPointFormats to the ClientHello message */
|
||||
@@ -167,43 +188,59 @@ EXT_RETURN tls_construct_ctos_ec_pt_formats(SSL *s, WPACKET *pkt,
|
||||
|
||||
return EXT_RETURN_SENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(OPENSSL_NO_DH) || !defined(OPENSSL_NO_EC)
|
||||
EXT_RETURN tls_construct_ctos_supported_groups(SSL *s, WPACKET *pkt,
|
||||
unsigned int context, X509 *x,
|
||||
size_t chainidx)
|
||||
{
|
||||
const uint16_t *pgroups = NULL;
|
||||
size_t num_groups = 0, i;
|
||||
int min_version, max_version, reason;
|
||||
|
||||
if (!use_ecc(s))
|
||||
reason = ssl_get_min_max_version(s, &min_version, &max_version, NULL);
|
||||
if (reason != 0) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR,
|
||||
SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_GROUPS, reason);
|
||||
return EXT_RETURN_FAIL;
|
||||
}
|
||||
|
||||
#if defined(OPENSSL_NO_EC)
|
||||
if (max_version < TLS1_3_VERSION)
|
||||
return EXT_RETURN_NOT_SENT;
|
||||
#else
|
||||
if (!use_ecc(s, max_version) && max_version < TLS1_3_VERSION)
|
||||
return EXT_RETURN_NOT_SENT;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Add TLS extension supported_groups to the ClientHello message
|
||||
*/
|
||||
/* TODO(TLS1.3): Add support for DHE groups */
|
||||
tls1_get_supported_groups(s, &pgroups, &num_groups);
|
||||
|
||||
if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_supported_groups)
|
||||
/* Sub-packet for supported_groups extension */
|
||||
|| !WPACKET_start_sub_packet_u16(pkt)
|
||||
|| !WPACKET_start_sub_packet_u16(pkt)) {
|
||||
|| !WPACKET_start_sub_packet_u16(pkt)
|
||||
|| !WPACKET_set_flags(pkt, WPACKET_FLAGS_NON_ZERO_LENGTH)) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR,
|
||||
SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_GROUPS,
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
return EXT_RETURN_FAIL;
|
||||
}
|
||||
/* Copy curve ID if supported */
|
||||
/* Copy group ID if supported */
|
||||
for (i = 0; i < num_groups; i++) {
|
||||
uint16_t ctmp = pgroups[i];
|
||||
|
||||
if (tls_curve_allowed(s, ctmp, SSL_SECOP_CURVE_SUPPORTED)) {
|
||||
if (tls_valid_group(s, ctmp, max_version)
|
||||
&& tls_group_allowed(s, ctmp, SSL_SECOP_CURVE_SUPPORTED)) {
|
||||
if (!WPACKET_put_bytes_u16(pkt, ctmp)) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR,
|
||||
SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_GROUPS,
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
return EXT_RETURN_FAIL;
|
||||
}
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR,
|
||||
SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_GROUPS,
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
return EXT_RETURN_FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!WPACKET_close(pkt) || !WPACKET_close(pkt)) {
|
||||
@@ -674,7 +711,7 @@ EXT_RETURN tls_construct_ctos_key_share(SSL *s, WPACKET *pkt,
|
||||
} else {
|
||||
for (i = 0; i < num_groups; i++) {
|
||||
|
||||
if (!tls_curve_allowed(s, pgroups[i], SSL_SECOP_CURVE_SUPPORTED))
|
||||
if (!tls_group_allowed(s, pgroups[i], SSL_SECOP_CURVE_SUPPORTED))
|
||||
continue;
|
||||
|
||||
curve_id = pgroups[i];
|
||||
@@ -1374,19 +1411,19 @@ int tls_parse_stoc_ec_pt_formats(SSL *s, PACKET *pkt, unsigned int context,
|
||||
return 0;
|
||||
}
|
||||
|
||||
s->session->ext.ecpointformats_len = 0;
|
||||
OPENSSL_free(s->session->ext.ecpointformats);
|
||||
s->session->ext.ecpointformats = OPENSSL_malloc(ecpointformats_len);
|
||||
if (s->session->ext.ecpointformats == NULL) {
|
||||
s->ext.peer_ecpointformats_len = 0;
|
||||
OPENSSL_free(s->ext.peer_ecpointformats);
|
||||
s->ext.peer_ecpointformats = OPENSSL_malloc(ecpointformats_len);
|
||||
if (s->ext.peer_ecpointformats == NULL) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR,
|
||||
SSL_F_TLS_PARSE_STOC_EC_PT_FORMATS, ERR_R_INTERNAL_ERROR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
s->session->ext.ecpointformats_len = ecpointformats_len;
|
||||
s->ext.peer_ecpointformats_len = ecpointformats_len;
|
||||
|
||||
if (!PACKET_copy_bytes(&ecptformatlist,
|
||||
s->session->ext.ecpointformats,
|
||||
s->ext.peer_ecpointformats,
|
||||
ecpointformats_len)) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR,
|
||||
SSL_F_TLS_PARSE_STOC_EC_PT_FORMATS, ERR_R_INTERNAL_ERROR);
|
||||
@@ -1834,7 +1871,7 @@ int tls_parse_stoc_key_share(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
|
||||
break;
|
||||
}
|
||||
if (i >= num_groups
|
||||
|| !tls_curve_allowed(s, group_id, SSL_SECOP_CURVE_SUPPORTED)) {
|
||||
|| !tls_group_allowed(s, group_id, SSL_SECOP_CURVE_SUPPORTED)) {
|
||||
SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER,
|
||||
SSL_F_TLS_PARSE_STOC_KEY_SHARE, SSL_R_BAD_KEY_SHARE);
|
||||
return 0;
|
||||
|
||||
@@ -254,8 +254,8 @@ int tls_parse_ctos_ec_pt_formats(SSL *s, PACKET *pkt, unsigned int context,
|
||||
|
||||
if (!s->hit) {
|
||||
if (!PACKET_memdup(&ec_point_format_list,
|
||||
&s->session->ext.ecpointformats,
|
||||
&s->session->ext.ecpointformats_len)) {
|
||||
&s->ext.peer_ecpointformats,
|
||||
&s->ext.peer_ecpointformats_len)) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR,
|
||||
SSL_F_TLS_PARSE_CTOS_EC_PT_FORMATS, ERR_R_INTERNAL_ERROR);
|
||||
return 0;
|
||||
@@ -946,7 +946,7 @@ int tls_parse_ctos_cookie(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_EC
|
||||
#if !defined(OPENSSL_NO_EC) || !defined(OPENSSL_NO_DH)
|
||||
int tls_parse_ctos_supported_groups(SSL *s, PACKET *pkt, unsigned int context,
|
||||
X509 *x, size_t chainidx)
|
||||
{
|
||||
@@ -962,12 +962,12 @@ int tls_parse_ctos_supported_groups(SSL *s, PACKET *pkt, unsigned int context,
|
||||
}
|
||||
|
||||
if (!s->hit || SSL_IS_TLS13(s)) {
|
||||
OPENSSL_free(s->session->ext.supportedgroups);
|
||||
s->session->ext.supportedgroups = NULL;
|
||||
s->session->ext.supportedgroups_len = 0;
|
||||
OPENSSL_free(s->ext.peer_supportedgroups);
|
||||
s->ext.peer_supportedgroups = NULL;
|
||||
s->ext.peer_supportedgroups_len = 0;
|
||||
if (!tls1_save_u16(&supported_groups_list,
|
||||
&s->session->ext.supportedgroups,
|
||||
&s->session->ext.supportedgroups_len)) {
|
||||
&s->ext.peer_supportedgroups,
|
||||
&s->ext.peer_supportedgroups_len)) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR,
|
||||
SSL_F_TLS_PARSE_CTOS_SUPPORTED_GROUPS,
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
@@ -1379,7 +1379,7 @@ EXT_RETURN tls_construct_stoc_ec_pt_formats(SSL *s, WPACKET *pkt,
|
||||
unsigned long alg_k = s->s3.tmp.new_cipher->algorithm_mkey;
|
||||
unsigned long alg_a = s->s3.tmp.new_cipher->algorithm_auth;
|
||||
int using_ecc = ((alg_k & SSL_kECDHE) || (alg_a & SSL_aECDSA))
|
||||
&& (s->session->ext.ecpointformats != NULL);
|
||||
&& (s->ext.peer_ecpointformats != NULL);
|
||||
const unsigned char *plist;
|
||||
size_t plistlen;
|
||||
|
||||
@@ -1400,7 +1400,7 @@ EXT_RETURN tls_construct_stoc_ec_pt_formats(SSL *s, WPACKET *pkt,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_EC
|
||||
#if !defined(OPENSSL_NO_EC) || !defined(OPENSSL_NO_DH)
|
||||
EXT_RETURN tls_construct_stoc_supported_groups(SSL *s, WPACKET *pkt,
|
||||
unsigned int context, X509 *x,
|
||||
size_t chainidx)
|
||||
@@ -1424,7 +1424,8 @@ EXT_RETURN tls_construct_stoc_supported_groups(SSL *s, WPACKET *pkt,
|
||||
for (i = 0; i < numgroups; i++) {
|
||||
uint16_t group = groups[i];
|
||||
|
||||
if (tls_curve_allowed(s, group, SSL_SECOP_CURVE_SUPPORTED)) {
|
||||
if (tls_valid_group(s, group, SSL_version(s))
|
||||
&& tls_group_allowed(s, group, SSL_SECOP_CURVE_SUPPORTED)) {
|
||||
if (first) {
|
||||
/*
|
||||
* Check if the client is already using our preferred group. If
|
||||
|
||||
@@ -474,12 +474,6 @@ static WRITE_TRAN ossl_statem_client13_write_transition(SSL *s)
|
||||
return WRITE_TRAN_CONTINUE;
|
||||
|
||||
case TLS_ST_CR_KEY_UPDATE:
|
||||
if (s->key_update != SSL_KEY_UPDATE_NONE) {
|
||||
st->hand_state = TLS_ST_CW_KEY_UPDATE;
|
||||
return WRITE_TRAN_CONTINUE;
|
||||
}
|
||||
/* Fall through */
|
||||
|
||||
case TLS_ST_CW_KEY_UPDATE:
|
||||
case TLS_ST_CR_SESSION_TICKET:
|
||||
case TLS_ST_CW_FINISHED:
|
||||
|
||||
+17
-14
@@ -286,9 +286,13 @@ int tls_construct_cert_verify(SSL *s, WPACKET *pkt)
|
||||
}
|
||||
if (s->version == SSL3_VERSION) {
|
||||
if (EVP_DigestSignUpdate(mctx, hdata, hdatalen) <= 0
|
||||
|| !EVP_MD_CTX_ctrl(mctx, EVP_CTRL_SSL3_MASTER_SECRET,
|
||||
(int)s->session->master_key_length,
|
||||
s->session->master_key)
|
||||
/*
|
||||
* TODO(3.0) Replace this when EVP_MD_CTX_ctrl() is deprecated
|
||||
* with a call to ssl3_digest_master_key_set_params()
|
||||
*/
|
||||
|| EVP_MD_CTX_ctrl(mctx, EVP_CTRL_SSL3_MASTER_SECRET,
|
||||
(int)s->session->master_key_length,
|
||||
s->session->master_key) <= 0
|
||||
|| EVP_DigestSignFinal(mctx, sig, &siglen) <= 0) {
|
||||
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CERT_VERIFY,
|
||||
@@ -473,10 +477,14 @@ MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt)
|
||||
}
|
||||
}
|
||||
if (s->version == SSL3_VERSION) {
|
||||
/*
|
||||
* TODO(3.0) Replace this when EVP_MD_CTX_ctrl() is deprecated
|
||||
* with a call to ssl3_digest_master_key_set_params()
|
||||
*/
|
||||
if (EVP_DigestVerifyUpdate(mctx, hdata, hdatalen) <= 0
|
||||
|| !EVP_MD_CTX_ctrl(mctx, EVP_CTRL_SSL3_MASTER_SECRET,
|
||||
(int)s->session->master_key_length,
|
||||
s->session->master_key)) {
|
||||
|| EVP_MD_CTX_ctrl(mctx, EVP_CTRL_SSL3_MASTER_SECRET,
|
||||
(int)s->session->master_key_length,
|
||||
s->session->master_key) <= 0) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CERT_VERIFY,
|
||||
ERR_R_EVP_LIB);
|
||||
goto err;
|
||||
@@ -643,12 +651,9 @@ MSG_PROCESS_RETURN tls_process_key_update(SSL *s, PACKET *pkt)
|
||||
/*
|
||||
* If we get a request for us to update our sending keys too then, we need
|
||||
* to additionally send a KeyUpdate message. However that message should
|
||||
* not also request an update (otherwise we get into an infinite loop). We
|
||||
* ignore a request for us to update our sending keys too if we already
|
||||
* sent close_notify.
|
||||
* not also request an update (otherwise we get into an infinite loop).
|
||||
*/
|
||||
if (updatetype == SSL_KEY_UPDATE_REQUESTED
|
||||
&& (s->shutdown & SSL_SENT_SHUTDOWN) == 0)
|
||||
if (updatetype == SSL_KEY_UPDATE_REQUESTED)
|
||||
s->key_update = SSL_KEY_UPDATE_NOT_REQUESTED;
|
||||
|
||||
if (!tls13_update_key(s, 0)) {
|
||||
@@ -2132,7 +2137,6 @@ int ssl_set_client_hello_version(SSL *s)
|
||||
* used. Returns 1 if the group is in the list (and allowed if |checkallow| is
|
||||
* 1) or 0 otherwise.
|
||||
*/
|
||||
#ifndef OPENSSL_NO_EC
|
||||
int check_in_list(SSL *s, uint16_t group_id, const uint16_t *groups,
|
||||
size_t num_groups, int checkallow)
|
||||
{
|
||||
@@ -2146,14 +2150,13 @@ int check_in_list(SSL *s, uint16_t group_id, const uint16_t *groups,
|
||||
|
||||
if (group_id == group
|
||||
&& (!checkallow
|
||||
|| tls_curve_allowed(s, group, SSL_SECOP_CURVE_CHECK))) {
|
||||
|| tls_group_allowed(s, group, SSL_SECOP_CURVE_CHECK))) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Replace ClientHello1 in the transcript hash with a synthetic message */
|
||||
int create_synthetic_message_hash(SSL *s, const unsigned char *hashval,
|
||||
|
||||
@@ -199,9 +199,9 @@ int tls_parse_ctos_early_data(SSL *s, PACKET *pkt, unsigned int context,
|
||||
#ifndef OPENSSL_NO_EC
|
||||
int tls_parse_ctos_ec_pt_formats(SSL *s, PACKET *pkt, unsigned int context,
|
||||
X509 *x, size_t chainidx);
|
||||
#endif
|
||||
int tls_parse_ctos_supported_groups(SSL *s, PACKET *pkt, unsigned int context,
|
||||
X509 *x, size_t chainidxl);
|
||||
#endif
|
||||
int tls_parse_ctos_session_ticket(SSL *s, PACKET *pkt, unsigned int context,
|
||||
X509 *x, size_t chainidx);
|
||||
int tls_parse_ctos_sig_algs_cert(SSL *s, PACKET *pkt, unsigned int context,
|
||||
@@ -314,10 +314,11 @@ EXT_RETURN tls_construct_ctos_srp(SSL *s, WPACKET *pkt, unsigned int context, X5
|
||||
EXT_RETURN tls_construct_ctos_ec_pt_formats(SSL *s, WPACKET *pkt,
|
||||
unsigned int context, X509 *x,
|
||||
size_t chainidx);
|
||||
#endif
|
||||
EXT_RETURN tls_construct_ctos_supported_groups(SSL *s, WPACKET *pkt,
|
||||
unsigned int context, X509 *x,
|
||||
size_t chainidx);
|
||||
#endif
|
||||
|
||||
EXT_RETURN tls_construct_ctos_early_data(SSL *s, WPACKET *pkt,
|
||||
unsigned int context, X509 *x,
|
||||
size_t chainidx);
|
||||
|
||||
+23
-31
@@ -503,12 +503,6 @@ static WRITE_TRAN ossl_statem_server13_write_transition(SSL *s)
|
||||
return WRITE_TRAN_CONTINUE;
|
||||
|
||||
case TLS_ST_SR_KEY_UPDATE:
|
||||
if (s->key_update != SSL_KEY_UPDATE_NONE) {
|
||||
st->hand_state = TLS_ST_SW_KEY_UPDATE;
|
||||
return WRITE_TRAN_CONTINUE;
|
||||
}
|
||||
/* Fall through */
|
||||
|
||||
case TLS_ST_SW_KEY_UPDATE:
|
||||
st->hand_state = TLS_ST_OK;
|
||||
return WRITE_TRAN_CONTINUE;
|
||||
@@ -1930,14 +1924,14 @@ static int tls_early_post_process_client_hello(SSL *s)
|
||||
&& master_key_length > 0) {
|
||||
s->session->master_key_length = master_key_length;
|
||||
s->hit = 1;
|
||||
s->session->ciphers = ciphers;
|
||||
s->peer_ciphers = ciphers;
|
||||
s->session->verify_result = X509_V_OK;
|
||||
|
||||
ciphers = NULL;
|
||||
|
||||
/* check if some cipher was preferred by call back */
|
||||
if (pref_cipher == NULL)
|
||||
pref_cipher = ssl3_choose_cipher(s, s->session->ciphers,
|
||||
pref_cipher = ssl3_choose_cipher(s, s->peer_ciphers,
|
||||
ssl_get_cipher_preferences(s));
|
||||
if (pref_cipher == NULL) {
|
||||
SSLfatal(s, SSL_AD_HANDSHAKE_FAILURE,
|
||||
@@ -1949,9 +1943,9 @@ static int tls_early_post_process_client_hello(SSL *s)
|
||||
s->session->cipher = pref_cipher;
|
||||
ssl_cipher_preference_list_free(s->cipher_list);
|
||||
s->cipher_list = ssl_cipher_preference_list_from_ciphers(
|
||||
s->session->ciphers);
|
||||
s->peer_ciphers);
|
||||
sk_SSL_CIPHER_free(s->cipher_list_by_id);
|
||||
s->cipher_list_by_id = sk_SSL_CIPHER_dup(s->session->ciphers);
|
||||
s->cipher_list_by_id = sk_SSL_CIPHER_dup(s->peer_ciphers);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2051,12 +2045,12 @@ static int tls_early_post_process_client_hello(SSL *s)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Given s->session->ciphers and SSL_get_ciphers, we must pick a cipher
|
||||
* Given s->peer_ciphers and SSL_get_ciphers, we must pick a cipher
|
||||
*/
|
||||
|
||||
if (!s->hit || SSL_IS_TLS13(s)) {
|
||||
sk_SSL_CIPHER_free(s->session->ciphers);
|
||||
s->session->ciphers = ciphers;
|
||||
sk_SSL_CIPHER_free(s->peer_ciphers);
|
||||
s->peer_ciphers = ciphers;
|
||||
if (ciphers == NULL) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR,
|
||||
SSL_F_TLS_EARLY_POST_PROCESS_CLIENT_HELLO,
|
||||
@@ -2072,6 +2066,10 @@ static int tls_early_post_process_client_hello(SSL *s)
|
||||
#else
|
||||
s->session->compress_meth = (comp == NULL) ? 0 : comp->id;
|
||||
#endif
|
||||
if (!tls1_set_server_sigalgs(s)) {
|
||||
/* SSLfatal() already called */
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
sk_SSL_CIPHER_free(ciphers);
|
||||
@@ -2239,31 +2237,25 @@ WORK_STATE tls_post_process_client_hello(SSL *s, WORK_STATE wst)
|
||||
if (wst == WORK_MORE_B) {
|
||||
if (!s->hit || SSL_IS_TLS13(s)) {
|
||||
/* Let cert callback update server certificates if required */
|
||||
if (!s->hit) {
|
||||
if (s->cert->cert_cb != NULL) {
|
||||
int rv = s->cert->cert_cb(s, s->cert->cert_cb_arg);
|
||||
if (rv == 0) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR,
|
||||
SSL_F_TLS_POST_PROCESS_CLIENT_HELLO,
|
||||
SSL_R_CERT_CB_ERROR);
|
||||
goto err;
|
||||
}
|
||||
if (rv < 0) {
|
||||
s->rwstate = SSL_X509_LOOKUP;
|
||||
return WORK_MORE_B;
|
||||
}
|
||||
s->rwstate = SSL_NOTHING;
|
||||
}
|
||||
if (!tls1_set_server_sigalgs(s)) {
|
||||
/* SSLfatal already called */
|
||||
if (!s->hit && s->cert->cert_cb != NULL) {
|
||||
int rv = s->cert->cert_cb(s, s->cert->cert_cb_arg);
|
||||
if (rv == 0) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR,
|
||||
SSL_F_TLS_POST_PROCESS_CLIENT_HELLO,
|
||||
SSL_R_CERT_CB_ERROR);
|
||||
goto err;
|
||||
}
|
||||
if (rv < 0) {
|
||||
s->rwstate = SSL_X509_LOOKUP;
|
||||
return WORK_MORE_B;
|
||||
}
|
||||
s->rwstate = SSL_NOTHING;
|
||||
}
|
||||
|
||||
/* In TLSv1.3 we selected the ciphersuite before resumption */
|
||||
if (!SSL_IS_TLS13(s)) {
|
||||
cipher =
|
||||
ssl3_choose_cipher(s, s->session->ciphers, ssl_get_cipher_preferences(s));
|
||||
ssl3_choose_cipher(s, s->peer_ciphers, ssl_get_cipher_preferences(s));
|
||||
|
||||
if (cipher == NULL) {
|
||||
SSLfatal(s, SSL_AD_HANDSHAKE_FAILURE,
|
||||
|
||||
Reference in New Issue
Block a user