X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=ssl%2Fstatem%2Fextensions_clnt.c;h=84bfb3c265ed8e7e82f80e54d835fe82a6decbe0;hp=d40c9cee11e826fbfae48e774ba2d2d23c140bfe;hb=cf3e221bd90085035d869d3a233a03970d036638;hpb=d9aea0416249bf7fb2dd330dd9dde825ac5e4b94 diff --git a/ssl/statem/extensions_clnt.c b/ssl/statem/extensions_clnt.c index d40c9cee11..84bfb3c265 100644 --- a/ssl/statem/extensions_clnt.c +++ b/ssl/statem/extensions_clnt.c @@ -146,7 +146,6 @@ int tls_construct_ctos_supported_groups(SSL *s, WPACKET *pkt, * Add TLS extension supported_groups to the ClientHello message */ /* TODO(TLS1.3): Add support for DHE groups */ - pcurves = s->ext.supportedgroups; if (!tls1_get_curvelist(s, 0, &pcurves, &num_curves)) { SSLerr(SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_GROUPS, ERR_R_INTERNAL_ERROR); @@ -590,7 +589,6 @@ int tls_construct_ctos_key_share(SSL *s, WPACKET *pkt, unsigned int context, return 0; } - pcurves = s->ext.supportedgroups; if (!tls1_get_curvelist(s, 0, &pcurves, &num_curves)) { SSLerr(SSL_F_TLS_CONSTRUCT_CTOS_KEY_SHARE, ERR_R_INTERNAL_ERROR); return 0; @@ -771,6 +769,14 @@ int tls_construct_ctos_psk(SSL *s, WPACKET *pkt, unsigned int context, X509 *x, return 1; } + if (s->hello_retry_request && md != ssl_handshake_md(s)) { + /* + * Selected ciphersuite hash does not match the hash for the session so + * we can't use it. + */ + return 1; + } + /* * Technically the C standard just says time() returns a time_t and says * nothing about the encoding of that type. In practice most implementations @@ -933,24 +939,6 @@ int tls_parse_stoc_server_name(SSL *s, PACKET *pkt, unsigned int context, return 1; } -int tls_parse_stoc_early_data_info(SSL *s, PACKET *pkt, unsigned int context, - X509 *x, size_t chainidx, int *al) -{ - unsigned long max_early_data; - - if (!PACKET_get_net_4(pkt, &max_early_data) - || PACKET_remaining(pkt) != 0) { - SSLerr(SSL_F_TLS_PARSE_STOC_EARLY_DATA_INFO, - SSL_R_INVALID_MAX_EARLY_DATA); - *al = SSL_AD_DECODE_ERROR; - return 0; - } - - s->session->ext.max_early_data = max_early_data; - - return 1; -} - #ifndef OPENSSL_NO_EC int tls_parse_stoc_ec_pt_formats(SSL *s, PACKET *pkt, unsigned int context, X509 *x, size_t chainidx, int *al) @@ -1301,7 +1289,6 @@ int tls_parse_stoc_key_share(SSL *s, PACKET *pkt, unsigned int context, X509 *x, } /* Validate the selected group is one we support */ - pcurves = s->ext.supportedgroups; if (!tls1_get_curvelist(s, 0, &pcurves, &num_curves)) { SSLerr(SSL_F_TLS_PARSE_STOC_KEY_SHARE, ERR_R_INTERNAL_ERROR); return 0; @@ -1385,6 +1372,22 @@ int tls_parse_stoc_cookie(SSL *s, PACKET *pkt, unsigned int context, X509 *x, int tls_parse_stoc_early_data(SSL *s, PACKET *pkt, unsigned int context, X509 *x, size_t chainidx, int *al) { + if (context == EXT_TLS1_3_NEW_SESSION_TICKET) { + unsigned long max_early_data; + + if (!PACKET_get_net_4(pkt, &max_early_data) + || PACKET_remaining(pkt) != 0) { + SSLerr(SSL_F_TLS_PARSE_STOC_EARLY_DATA, + SSL_R_INVALID_MAX_EARLY_DATA); + *al = SSL_AD_DECODE_ERROR; + return 0; + } + + s->session->ext.max_early_data = max_early_data; + + return 1; + } + if (PACKET_remaining(pkt) != 0) { *al = SSL_AD_DECODE_ERROR; return 0;