diff options
author | jsing <> | 2024-07-20 04:04:23 +0000 |
---|---|---|
committer | jsing <> | 2024-07-20 04:04:23 +0000 |
commit | b68193edfb3424eb0f993aec6089c9e057aa5d4d (patch) | |
tree | b04719de2f91b0f8d7c9c7acb93cef76a89b9948 /src/lib/libssl/ssl_pkt.c | |
parent | cc7dc6e9b7012526aa3797842d226b3a275a7e70 (diff) | |
download | openbsd-b68193edfb3424eb0f993aec6089c9e057aa5d4d.tar.gz openbsd-b68193edfb3424eb0f993aec6089c9e057aa5d4d.tar.bz2 openbsd-b68193edfb3424eb0f993aec6089c9e057aa5d4d.zip |
Remove cipher from SSL_SESSION.
For a long time SSL_SESSION has had both a cipher ID and a pointer to
an SSL_CIPHER (and not both are guaranteed to be populated). There is also
a pointer to an SSL_CIPHER in the SSL_HANDSHAKE that denotes the cipher
being used for this connection. Some code has been using the cipher from
SSL_SESSION and some code has been using the cipher from SSL_HANDSHAKE.
Remove cipher from SSL_SESSION and use the version in SSL_HANDSHAKE
everywhere. If resuming from a session then we need to use the SSL_SESSION
cipher ID to set the SSL_HANDSHAKE cipher. And we still need to ensure that
we update the cipher ID in the SSL_SESSION whenever the SSL_HANDSHAKE
cipher changes (this only occurs in a few places).
ok tb@
Diffstat (limited to 'src/lib/libssl/ssl_pkt.c')
-rw-r--r-- | src/lib/libssl/ssl_pkt.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/libssl/ssl_pkt.c b/src/lib/libssl/ssl_pkt.c index 2c33c45386..7d6785a3de 100644 --- a/src/lib/libssl/ssl_pkt.c +++ b/src/lib/libssl/ssl_pkt.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl_pkt.c,v 1.66 2023/07/11 17:02:47 tb Exp $ */ | 1 | /* $OpenBSD: ssl_pkt.c,v 1.67 2024/07/20 04:04:23 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 | * |
@@ -904,7 +904,7 @@ ssl3_read_handshake_unexpected(SSL *s) | |||
904 | * It should be impossible to hit this, but keep the safety | 904 | * It should be impossible to hit this, but keep the safety |
905 | * harness for now... | 905 | * harness for now... |
906 | */ | 906 | */ |
907 | if (s->session == NULL || s->session->cipher == NULL) | 907 | if (s->session == NULL || s->s3->hs.cipher == NULL) |
908 | return 1; | 908 | return 1; |
909 | 909 | ||
910 | /* | 910 | /* |
@@ -953,7 +953,7 @@ ssl3_read_handshake_unexpected(SSL *s) | |||
953 | return -1; | 953 | return -1; |
954 | } | 954 | } |
955 | 955 | ||
956 | if (s->session == NULL || s->session->cipher == NULL) { | 956 | if (s->session == NULL || s->s3->hs.cipher == NULL) { |
957 | SSLerror(s, ERR_R_INTERNAL_ERROR); | 957 | SSLerror(s, ERR_R_INTERNAL_ERROR); |
958 | return -1; | 958 | return -1; |
959 | } | 959 | } |
@@ -1235,7 +1235,8 @@ ssl3_do_change_cipher_spec(SSL *s) | |||
1235 | return (0); | 1235 | return (0); |
1236 | } | 1236 | } |
1237 | 1237 | ||
1238 | s->session->cipher = s->s3->hs.cipher; | 1238 | s->session->cipher_id = s->s3->hs.cipher->id; |
1239 | |||
1239 | if (!tls1_setup_key_block(s)) | 1240 | if (!tls1_setup_key_block(s)) |
1240 | return (0); | 1241 | return (0); |
1241 | } | 1242 | } |