Latest update and remove TLSv1.3 draft
This commit is contained in:
@@ -533,25 +533,8 @@ EXT_RETURN tls_construct_ctos_supported_versions(SSL *s, WPACKET *pkt,
|
||||
return EXT_RETURN_FAIL;
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO(TLS1.3): There is some discussion on the TLS list as to whether
|
||||
* we should include versions <TLS1.2. For the moment we do. To be
|
||||
* reviewed later.
|
||||
*/
|
||||
for (currv = max_version; currv >= min_version; currv--) {
|
||||
/* TODO(TLS1.3): Remove this first if clause prior to release!! */
|
||||
if (currv == TLS1_3_VERSION) {
|
||||
if (!WPACKET_put_bytes_u16(pkt, TLS1_3_VERSION)
|
||||
|| !WPACKET_put_bytes_u16(pkt, TLS1_3_VERSION_DRAFT)
|
||||
|| !WPACKET_put_bytes_u16(pkt, TLS1_3_VERSION_DRAFT_27)
|
||||
|| !WPACKET_put_bytes_u16(pkt, TLS1_3_VERSION_DRAFT_26)
|
||||
|| !WPACKET_put_bytes_u16(pkt, TLS1_3_VERSION_DRAFT_23)) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR,
|
||||
SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_VERSIONS,
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
return EXT_RETURN_FAIL;
|
||||
}
|
||||
} else if (!WPACKET_put_bytes_u16(pkt, currv)) {
|
||||
if (!WPACKET_put_bytes_u16(pkt, currv)) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR,
|
||||
SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_VERSIONS,
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
@@ -1780,15 +1763,6 @@ int tls_parse_stoc_supported_versions(SSL *s, PACKET *pkt, unsigned int context,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* TODO(TLS1.3): Remove this before release */
|
||||
if (version == TLS1_3_VERSION_DRAFT
|
||||
|| version == TLS1_3_VERSION_DRAFT_27
|
||||
|| version == TLS1_3_VERSION_DRAFT_26
|
||||
|| version == TLS1_3_VERSION_DRAFT_23) {
|
||||
s->version_draft = version;
|
||||
version = TLS1_3_VERSION;
|
||||
}
|
||||
|
||||
/*
|
||||
* The only protocol version we support which is valid in this extension in
|
||||
* a ServerHello is TLSv1.3 therefore we shouldn't be getting anything else.
|
||||
|
||||
@@ -897,8 +897,7 @@ int tls_parse_ctos_cookie(SSL *s, PACKET *pkt, unsigned int context, X509 *x,
|
||||
}
|
||||
if (!WPACKET_put_bytes_u16(&hrrpkt, TLSEXT_TYPE_supported_versions)
|
||||
|| !WPACKET_start_sub_packet_u16(&hrrpkt)
|
||||
/* TODO(TLS1.3): Fix this before release */
|
||||
|| !WPACKET_put_bytes_u16(&hrrpkt, s->version_draft)
|
||||
|| !WPACKET_put_bytes_u16(&hrrpkt, s->version)
|
||||
|| !WPACKET_close(&hrrpkt)) {
|
||||
WPACKET_cleanup(&hrrpkt);
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PARSE_CTOS_COOKIE,
|
||||
@@ -1653,8 +1652,7 @@ EXT_RETURN tls_construct_stoc_supported_versions(SSL *s, WPACKET *pkt,
|
||||
|
||||
if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_supported_versions)
|
||||
|| !WPACKET_start_sub_packet_u16(pkt)
|
||||
/* TODO(TLS1.3): Update to remove the TLSv1.3 draft indicator */
|
||||
|| !WPACKET_put_bytes_u16(pkt, s->version_draft)
|
||||
|| !WPACKET_put_bytes_u16(pkt, s->version)
|
||||
|| !WPACKET_close(pkt)) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR,
|
||||
SSL_F_TLS_CONSTRUCT_STOC_SUPPORTED_VERSIONS,
|
||||
|
||||
@@ -1707,6 +1707,7 @@ MSG_PROCESS_RETURN tls_process_server_hello(SSL *s, PACKET *pkt)
|
||||
if (SSL_IS_DTLS(s) && s->hit) {
|
||||
unsigned char sctpauthkey[64];
|
||||
char labelbuffer[sizeof(DTLS1_SCTP_AUTH_LABEL)];
|
||||
size_t labellen;
|
||||
|
||||
/*
|
||||
* Add new shared key for SCTP-Auth, will be ignored if
|
||||
@@ -1715,10 +1716,15 @@ MSG_PROCESS_RETURN tls_process_server_hello(SSL *s, PACKET *pkt)
|
||||
memcpy(labelbuffer, DTLS1_SCTP_AUTH_LABEL,
|
||||
sizeof(DTLS1_SCTP_AUTH_LABEL));
|
||||
|
||||
/* Don't include the terminating zero. */
|
||||
labellen = sizeof(labelbuffer) - 1;
|
||||
if (s->mode & SSL_MODE_DTLS_SCTP_LABEL_LENGTH_BUG)
|
||||
labellen += 1;
|
||||
|
||||
if (SSL_export_keying_material(s, sctpauthkey,
|
||||
sizeof(sctpauthkey),
|
||||
labelbuffer,
|
||||
sizeof(labelbuffer), NULL, 0, 0) <= 0) {
|
||||
labellen, NULL, 0, 0) <= 0) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_SERVER_HELLO,
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
goto err;
|
||||
@@ -3397,6 +3403,7 @@ int tls_client_key_exchange_post_work(SSL *s)
|
||||
if (SSL_IS_DTLS(s)) {
|
||||
unsigned char sctpauthkey[64];
|
||||
char labelbuffer[sizeof(DTLS1_SCTP_AUTH_LABEL)];
|
||||
size_t labellen;
|
||||
|
||||
/*
|
||||
* Add new shared key for SCTP-Auth, will be ignored if no SCTP
|
||||
@@ -3405,9 +3412,14 @@ int tls_client_key_exchange_post_work(SSL *s)
|
||||
memcpy(labelbuffer, DTLS1_SCTP_AUTH_LABEL,
|
||||
sizeof(DTLS1_SCTP_AUTH_LABEL));
|
||||
|
||||
/* Don't include the terminating zero. */
|
||||
labellen = sizeof(labelbuffer) - 1;
|
||||
if (s->mode & SSL_MODE_DTLS_SCTP_LABEL_LENGTH_BUG)
|
||||
labellen += 1;
|
||||
|
||||
if (SSL_export_keying_material(s, sctpauthkey,
|
||||
sizeof(sctpauthkey), labelbuffer,
|
||||
sizeof(labelbuffer), NULL, 0, 0) <= 0) {
|
||||
labellen, NULL, 0, 0) <= 0) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR,
|
||||
SSL_F_TLS_CLIENT_KEY_EXCHANGE_POST_WORK,
|
||||
ERR_R_INTERNAL_ERROR);
|
||||
|
||||
@@ -1770,8 +1770,6 @@ int ssl_choose_server_version(SSL *s, CLIENTHELLO_MSG *hello, DOWNGRADE *dgrd)
|
||||
unsigned int best_vers = 0;
|
||||
const SSL_METHOD *best_method = NULL;
|
||||
PACKET versionslist;
|
||||
/* TODO(TLS1.3): Remove this before release */
|
||||
unsigned int orig_candidate = 0;
|
||||
|
||||
suppversions->parsed = 1;
|
||||
|
||||
@@ -1793,23 +1791,6 @@ int ssl_choose_server_version(SSL *s, CLIENTHELLO_MSG *hello, DOWNGRADE *dgrd)
|
||||
return SSL_R_BAD_LEGACY_VERSION;
|
||||
|
||||
while (PACKET_get_net_2(&versionslist, &candidate_vers)) {
|
||||
/* TODO(TLS1.3): Remove this before release */
|
||||
if (candidate_vers == TLS1_3_VERSION
|
||||
|| candidate_vers == TLS1_3_VERSION_DRAFT
|
||||
|| candidate_vers == TLS1_3_VERSION_DRAFT_26
|
||||
|| candidate_vers == TLS1_3_VERSION_DRAFT_23) {
|
||||
if (best_vers == TLS1_3_VERSION
|
||||
&& (orig_candidate > candidate_vers
|
||||
|| orig_candidate == TLS1_3_VERSION))
|
||||
continue;
|
||||
orig_candidate = candidate_vers;
|
||||
candidate_vers = TLS1_3_VERSION;
|
||||
}
|
||||
/*
|
||||
* TODO(TLS1.3): There is some discussion on the TLS list about
|
||||
* whether to ignore versions <TLS1.2 in supported_versions. At the
|
||||
* moment we honour them if present. To be reviewed later
|
||||
*/
|
||||
if (version_cmp(s, candidate_vers, best_vers) <= 0)
|
||||
continue;
|
||||
if (ssl_version_supported(s, candidate_vers, &best_method))
|
||||
@@ -1832,9 +1813,6 @@ int ssl_choose_server_version(SSL *s, CLIENTHELLO_MSG *hello, DOWNGRADE *dgrd)
|
||||
}
|
||||
check_for_downgrade(s, best_vers, dgrd);
|
||||
s->version = best_vers;
|
||||
/* TODO(TLS1.3): Remove this before release */
|
||||
if (best_vers == TLS1_3_VERSION)
|
||||
s->version_draft = orig_candidate;
|
||||
s->method = best_method;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -830,6 +830,7 @@ WORK_STATE ossl_statem_server_post_work(SSL *s, WORK_STATE wst)
|
||||
if (SSL_IS_DTLS(s) && s->hit) {
|
||||
unsigned char sctpauthkey[64];
|
||||
char labelbuffer[sizeof(DTLS1_SCTP_AUTH_LABEL)];
|
||||
size_t labellen;
|
||||
|
||||
/*
|
||||
* Add new shared key for SCTP-Auth, will be ignored if no
|
||||
@@ -838,9 +839,14 @@ WORK_STATE ossl_statem_server_post_work(SSL *s, WORK_STATE wst)
|
||||
memcpy(labelbuffer, DTLS1_SCTP_AUTH_LABEL,
|
||||
sizeof(DTLS1_SCTP_AUTH_LABEL));
|
||||
|
||||
/* Don't include the terminating zero. */
|
||||
labellen = sizeof(labelbuffer) - 1;
|
||||
if (s->mode & SSL_MODE_DTLS_SCTP_LABEL_LENGTH_BUG)
|
||||
labellen += 1;
|
||||
|
||||
if (SSL_export_keying_material(s, sctpauthkey,
|
||||
sizeof(sctpauthkey), labelbuffer,
|
||||
sizeof(labelbuffer), NULL, 0,
|
||||
labellen, NULL, 0,
|
||||
0) <= 0) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR,
|
||||
SSL_F_OSSL_STATEM_SERVER_POST_WORK,
|
||||
@@ -3501,6 +3507,7 @@ WORK_STATE tls_post_process_client_key_exchange(SSL *s, WORK_STATE wst)
|
||||
if (SSL_IS_DTLS(s)) {
|
||||
unsigned char sctpauthkey[64];
|
||||
char labelbuffer[sizeof(DTLS1_SCTP_AUTH_LABEL)];
|
||||
size_t labellen;
|
||||
/*
|
||||
* Add new shared key for SCTP-Auth, will be ignored if no SCTP
|
||||
* used.
|
||||
@@ -3508,9 +3515,14 @@ WORK_STATE tls_post_process_client_key_exchange(SSL *s, WORK_STATE wst)
|
||||
memcpy(labelbuffer, DTLS1_SCTP_AUTH_LABEL,
|
||||
sizeof(DTLS1_SCTP_AUTH_LABEL));
|
||||
|
||||
/* Don't include the terminating zero. */
|
||||
labellen = sizeof(labelbuffer) - 1;
|
||||
if (s->mode & SSL_MODE_DTLS_SCTP_LABEL_LENGTH_BUG)
|
||||
labellen += 1;
|
||||
|
||||
if (SSL_export_keying_material(s, sctpauthkey,
|
||||
sizeof(sctpauthkey), labelbuffer,
|
||||
sizeof(labelbuffer), NULL, 0,
|
||||
labellen, NULL, 0,
|
||||
0) <= 0) {
|
||||
SSLfatal(s, SSL_AD_INTERNAL_ERROR,
|
||||
SSL_F_TLS_POST_PROCESS_CLIENT_KEY_EXCHANGE,
|
||||
|
||||
Reference in New Issue
Block a user