diff options
author | jsing <> | 2021-03-21 18:36:34 +0000 |
---|---|---|
committer | jsing <> | 2021-03-21 18:36:34 +0000 |
commit | b4267956efe26acca04e81248b224852ab3b48df (patch) | |
tree | 04368005066ac217cbc5ba4c6633356e81eb6d00 /src/lib/libssl/s3_lib.c | |
parent | 25064bbd608cffa42b7bf46d3ea7eeb88d693de4 (diff) | |
download | openbsd-b4267956efe26acca04e81248b224852ab3b48df.tar.gz openbsd-b4267956efe26acca04e81248b224852ab3b48df.tar.bz2 openbsd-b4267956efe26acca04e81248b224852ab3b48df.zip |
Move the TLSv1.3 handshake struct inside the shared handshake struct.
There are currently three different handshake structs that are in use -
the SSL_HANDSHAKE struct (as S3I(s)->hs), the SSL_HANDSHAKE_TLS13 struct
(as S3I(s)->hs_tls13 or ctx->hs in the TLSv1.3 code) and the infamous
'tmp' embedded in SSL3_STATE_INTERNAL (as S3I(s)->tmp)).
This is the first step towards cleaning up the handshake structs so that
shared data is in the SSL_HANDSHAKE struct, with sub-structs for TLSv1.2
and TLSv1.3 specific information. Place SSL_HANDSHAKE_TLS13 inside
SSL_HANDSHAKE and change ctx->hs to refer to the SSL_HANDSHAKE struct
instead of the SSL_HANDSHAKE_TLS13 struct. This allows the TLSv1.3 code
to access the shared handshake data without needing the SSL struct.
ok inoguchi@ tb@
Diffstat (limited to 'src/lib/libssl/s3_lib.c')
-rw-r--r-- | src/lib/libssl/s3_lib.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/lib/libssl/s3_lib.c b/src/lib/libssl/s3_lib.c index 75f71c4c7d..5e39907d9c 100644 --- a/src/lib/libssl/s3_lib.c +++ b/src/lib/libssl/s3_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: s3_lib.c,v 1.204 2021/02/07 15:26:32 jsing Exp $ */ | 1 | /* $OpenBSD: s3_lib.c,v 1.205 2021/03/21 18:36:34 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -1565,10 +1565,10 @@ ssl3_free(SSL *s) | |||
1565 | EC_KEY_free(S3I(s)->tmp.ecdh); | 1565 | EC_KEY_free(S3I(s)->tmp.ecdh); |
1566 | freezero(S3I(s)->tmp.x25519, X25519_KEY_LENGTH); | 1566 | freezero(S3I(s)->tmp.x25519, X25519_KEY_LENGTH); |
1567 | 1567 | ||
1568 | tls13_key_share_free(S3I(s)->hs_tls13.key_share); | 1568 | tls13_key_share_free(S3I(s)->hs.tls13.key_share); |
1569 | tls13_secrets_destroy(S3I(s)->hs_tls13.secrets); | 1569 | tls13_secrets_destroy(S3I(s)->hs.tls13.secrets); |
1570 | freezero(S3I(s)->hs_tls13.cookie, S3I(s)->hs_tls13.cookie_len); | 1570 | freezero(S3I(s)->hs.tls13.cookie, S3I(s)->hs.tls13.cookie_len); |
1571 | tls13_clienthello_hash_clear(&S3I(s)->hs_tls13); | 1571 | tls13_clienthello_hash_clear(&S3I(s)->hs.tls13); |
1572 | 1572 | ||
1573 | sk_X509_NAME_pop_free(S3I(s)->tmp.ca_names, X509_NAME_free); | 1573 | sk_X509_NAME_pop_free(S3I(s)->tmp.ca_names, X509_NAME_free); |
1574 | 1574 | ||
@@ -1605,15 +1605,15 @@ ssl3_clear(SSL *s) | |||
1605 | S3I(s)->hs.sigalgs = NULL; | 1605 | S3I(s)->hs.sigalgs = NULL; |
1606 | S3I(s)->hs.sigalgs_len = 0; | 1606 | S3I(s)->hs.sigalgs_len = 0; |
1607 | 1607 | ||
1608 | tls13_key_share_free(S3I(s)->hs_tls13.key_share); | 1608 | tls13_key_share_free(S3I(s)->hs.tls13.key_share); |
1609 | S3I(s)->hs_tls13.key_share = NULL; | 1609 | S3I(s)->hs.tls13.key_share = NULL; |
1610 | 1610 | ||
1611 | tls13_secrets_destroy(S3I(s)->hs_tls13.secrets); | 1611 | tls13_secrets_destroy(S3I(s)->hs.tls13.secrets); |
1612 | S3I(s)->hs_tls13.secrets = NULL; | 1612 | S3I(s)->hs.tls13.secrets = NULL; |
1613 | freezero(S3I(s)->hs_tls13.cookie, S3I(s)->hs_tls13.cookie_len); | 1613 | freezero(S3I(s)->hs.tls13.cookie, S3I(s)->hs.tls13.cookie_len); |
1614 | S3I(s)->hs_tls13.cookie = NULL; | 1614 | S3I(s)->hs.tls13.cookie = NULL; |
1615 | S3I(s)->hs_tls13.cookie_len = 0; | 1615 | S3I(s)->hs.tls13.cookie_len = 0; |
1616 | tls13_clienthello_hash_clear(&S3I(s)->hs_tls13); | 1616 | tls13_clienthello_hash_clear(&S3I(s)->hs.tls13); |
1617 | 1617 | ||
1618 | S3I(s)->hs.extensions_seen = 0; | 1618 | S3I(s)->hs.extensions_seen = 0; |
1619 | 1619 | ||
@@ -1678,8 +1678,8 @@ _SSL_get_peer_tmp_key(SSL *s, EVP_PKEY **key) | |||
1678 | } else if (sc->peer_x25519_tmp != NULL) { | 1678 | } else if (sc->peer_x25519_tmp != NULL) { |
1679 | if (!ssl_kex_dummy_ecdhe_x25519(pkey)) | 1679 | if (!ssl_kex_dummy_ecdhe_x25519(pkey)) |
1680 | goto err; | 1680 | goto err; |
1681 | } else if (S3I(s)->hs_tls13.key_share != NULL) { | 1681 | } else if (S3I(s)->hs.tls13.key_share != NULL) { |
1682 | if (!tls13_key_share_peer_pkey(S3I(s)->hs_tls13.key_share, | 1682 | if (!tls13_key_share_peer_pkey(S3I(s)->hs.tls13.key_share, |
1683 | pkey)) | 1683 | pkey)) |
1684 | goto err; | 1684 | goto err; |
1685 | } else { | 1685 | } else { |