summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsing <>2021-03-24 18:44:00 +0000
committerjsing <>2021-03-24 18:44:00 +0000
commitae1702cd90dfc51fd5483baea6488cd99ac9c26b (patch)
tree4ba7ed86321d6c92257c882bce631aa4a7f603b8
parent3ce9712d99b47c9a9db840f6cf8cc970a5f841dd (diff)
downloadopenbsd-ae1702cd90dfc51fd5483baea6488cd99ac9c26b.tar.gz
openbsd-ae1702cd90dfc51fd5483baea6488cd99ac9c26b.tar.bz2
openbsd-ae1702cd90dfc51fd5483baea6488cd99ac9c26b.zip
Rename new_cipher to cipher.
This is in the SSL_HANDSHAKE struct and is what we're currently negotiating, so there is really nothing more "new" about the cipher than there is the key block or other parts of the handshake data. ok inoguchi@ tb@
-rw-r--r--src/lib/libssl/s3_lib.c4
-rw-r--r--src/lib/libssl/ssl_both.c4
-rw-r--r--src/lib/libssl/ssl_ciph.c6
-rw-r--r--src/lib/libssl/ssl_clnt.c28
-rw-r--r--src/lib/libssl/ssl_lib.c16
-rw-r--r--src/lib/libssl/ssl_locl.h4
-rw-r--r--src/lib/libssl/ssl_pkt.c6
-rw-r--r--src/lib/libssl/ssl_srvr.c34
-rw-r--r--src/lib/libssl/t1_enc.c4
-rw-r--r--src/lib/libssl/tls13_client.c10
-rw-r--r--src/lib/libssl/tls13_server.c12
11 files changed, 64 insertions, 64 deletions
diff --git a/src/lib/libssl/s3_lib.c b/src/lib/libssl/s3_lib.c
index 5e39907d9c..9df06c51be 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.205 2021/03/21 18:36:34 jsing Exp $ */ 1/* $OpenBSD: s3_lib.c,v 1.206 2021/03/24 18:43:59 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 *
@@ -2548,7 +2548,7 @@ ssl3_get_req_cert_types(SSL *s, CBB *cbb)
2548{ 2548{
2549 unsigned long alg_k; 2549 unsigned long alg_k;
2550 2550
2551 alg_k = S3I(s)->hs.new_cipher->algorithm_mkey; 2551 alg_k = S3I(s)->hs.cipher->algorithm_mkey;
2552 2552
2553#ifndef OPENSSL_NO_GOST 2553#ifndef OPENSSL_NO_GOST
2554 if ((alg_k & SSL_kGOST) != 0) { 2554 if ((alg_k & SSL_kGOST) != 0) {
diff --git a/src/lib/libssl/ssl_both.c b/src/lib/libssl/ssl_both.c
index 6ce127fb0b..6625286daf 100644
--- a/src/lib/libssl/ssl_both.c
+++ b/src/lib/libssl/ssl_both.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_both.c,v 1.24 2021/02/20 14:14:16 tb Exp $ */ 1/* $OpenBSD: ssl_both.c,v 1.25 2021/03/24 18:44:00 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 *
@@ -224,7 +224,7 @@ ssl3_take_mac(SSL *s)
224 * If no new cipher setup return immediately: other functions will 224 * If no new cipher setup return immediately: other functions will
225 * set the appropriate error. 225 * set the appropriate error.
226 */ 226 */
227 if (S3I(s)->hs.new_cipher == NULL) 227 if (S3I(s)->hs.cipher == NULL)
228 return; 228 return;
229 229
230 if (S3I(s)->hs.state & SSL_ST_CONNECT) { 230 if (S3I(s)->hs.state & SSL_ST_CONNECT) {
diff --git a/src/lib/libssl/ssl_ciph.c b/src/lib/libssl/ssl_ciph.c
index 1ffd90dc16..ee627a8c1e 100644
--- a/src/lib/libssl/ssl_ciph.c
+++ b/src/lib/libssl/ssl_ciph.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_ciph.c,v 1.120 2021/02/07 15:26:32 jsing Exp $ */ 1/* $OpenBSD: ssl_ciph.c,v 1.121 2021/03/24 18:44:00 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 *
@@ -563,10 +563,10 @@ ssl_get_handshake_evp_md(SSL *s, const EVP_MD **md)
563 563
564 *md = NULL; 564 *md = NULL;
565 565
566 if (S3I(s)->hs.new_cipher == NULL) 566 if (S3I(s)->hs.cipher == NULL)
567 return 0; 567 return 0;
568 568
569 handshake_mac = S3I(s)->hs.new_cipher->algorithm2 & 569 handshake_mac = S3I(s)->hs.cipher->algorithm2 &
570 SSL_HANDSHAKE_MAC_MASK; 570 SSL_HANDSHAKE_MAC_MASK;
571 571
572 /* For TLSv1.2 we upgrade the default MD5+SHA1 MAC to SHA256. */ 572 /* For TLSv1.2 we upgrade the default MD5+SHA1 MAC to SHA256. */
diff --git a/src/lib/libssl/ssl_clnt.c b/src/lib/libssl/ssl_clnt.c
index 0f602bef7e..984ade0957 100644
--- a/src/lib/libssl/ssl_clnt.c
+++ b/src/lib/libssl/ssl_clnt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_clnt.c,v 1.87 2021/03/24 18:40:03 jsing Exp $ */ 1/* $OpenBSD: ssl_clnt.c,v 1.88 2021/03/24 18:44:00 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 *
@@ -343,7 +343,7 @@ ssl3_connect(SSL *s)
343 break; 343 break;
344 } 344 }
345 /* Check if it is anon DH/ECDH. */ 345 /* Check if it is anon DH/ECDH. */
346 if (!(S3I(s)->hs.new_cipher->algorithm_auth & 346 if (!(S3I(s)->hs.cipher->algorithm_auth &
347 SSL_aNULL)) { 347 SSL_aNULL)) {
348 ret = ssl3_get_server_certificate(s); 348 ret = ssl3_get_server_certificate(s);
349 if (ret <= 0) 349 if (ret <= 0)
@@ -477,7 +477,7 @@ ssl3_connect(SSL *s)
477 S3I(s)->hs.state = SSL3_ST_CW_FINISHED_A; 477 S3I(s)->hs.state = SSL3_ST_CW_FINISHED_A;
478 s->internal->init_num = 0; 478 s->internal->init_num = 0;
479 479
480 s->session->cipher = S3I(s)->hs.new_cipher; 480 s->session->cipher = S3I(s)->hs.cipher;
481 if (!tls1_setup_key_block(s)) { 481 if (!tls1_setup_key_block(s)) {
482 ret = -1; 482 ret = -1;
483 goto end; 483 goto end;
@@ -1054,7 +1054,7 @@ ssl3_get_server_hello(SSL *s)
1054 SSLerror(s, SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED); 1054 SSLerror(s, SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED);
1055 goto fatal_err; 1055 goto fatal_err;
1056 } 1056 }
1057 S3I(s)->hs.new_cipher = cipher; 1057 S3I(s)->hs.cipher = cipher;
1058 1058
1059 if (!tls1_transcript_hash_init(s)) 1059 if (!tls1_transcript_hash_init(s))
1060 goto err; 1060 goto err;
@@ -1063,7 +1063,7 @@ ssl3_get_server_hello(SSL *s)
1063 * Don't digest cached records if no sigalgs: we may need them for 1063 * Don't digest cached records if no sigalgs: we may need them for
1064 * client authentication. 1064 * client authentication.
1065 */ 1065 */
1066 alg_k = S3I(s)->hs.new_cipher->algorithm_mkey; 1066 alg_k = S3I(s)->hs.cipher->algorithm_mkey;
1067 if (!(SSL_USE_SIGALGS(s) || (alg_k & SSL_kGOST))) 1067 if (!(SSL_USE_SIGALGS(s) || (alg_k & SSL_kGOST)))
1068 tls1_transcript_free(s); 1068 tls1_transcript_free(s);
1069 1069
@@ -1276,7 +1276,7 @@ ssl3_get_server_kex_dhe(SSL *s, EVP_PKEY **pkey, CBS *cbs)
1276 long alg_a; 1276 long alg_a;
1277 int al; 1277 int al;
1278 1278
1279 alg_a = S3I(s)->hs.new_cipher->algorithm_auth; 1279 alg_a = S3I(s)->hs.cipher->algorithm_auth;
1280 sc = SSI(s)->sess_cert; 1280 sc = SSI(s)->sess_cert;
1281 1281
1282 if ((dh = DH_new()) == NULL) { 1282 if ((dh = DH_new()) == NULL) {
@@ -1404,7 +1404,7 @@ ssl3_get_server_kex_ecdhe(SSL *s, EVP_PKEY **pkey, CBS *cbs)
1404 int nid; 1404 int nid;
1405 int al; 1405 int al;
1406 1406
1407 alg_a = S3I(s)->hs.new_cipher->algorithm_auth; 1407 alg_a = S3I(s)->hs.cipher->algorithm_auth;
1408 sc = SSI(s)->sess_cert; 1408 sc = SSI(s)->sess_cert;
1409 1409
1410 /* Only named curves are supported. */ 1410 /* Only named curves are supported. */
@@ -1483,8 +1483,8 @@ ssl3_get_server_key_exchange(SSL *s)
1483 1483
1484 EVP_MD_CTX_init(&md_ctx); 1484 EVP_MD_CTX_init(&md_ctx);
1485 1485
1486 alg_k = S3I(s)->hs.new_cipher->algorithm_mkey; 1486 alg_k = S3I(s)->hs.cipher->algorithm_mkey;
1487 alg_a = S3I(s)->hs.new_cipher->algorithm_auth; 1487 alg_a = S3I(s)->hs.cipher->algorithm_auth;
1488 1488
1489 /* 1489 /*
1490 * Use same message size as in ssl3_get_certificate_request() 1490 * Use same message size as in ssl3_get_certificate_request()
@@ -1682,7 +1682,7 @@ ssl3_get_certificate_request(SSL *s)
1682 } 1682 }
1683 1683
1684 /* TLS does not like anon-DH with client cert */ 1684 /* TLS does not like anon-DH with client cert */
1685 if (S3I(s)->hs.new_cipher->algorithm_auth & SSL_aNULL) { 1685 if (S3I(s)->hs.cipher->algorithm_auth & SSL_aNULL) {
1686 ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_UNEXPECTED_MESSAGE); 1686 ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_UNEXPECTED_MESSAGE);
1687 SSLerror(s, SSL_R_TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER); 1687 SSLerror(s, SSL_R_TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER);
1688 goto err; 1688 goto err;
@@ -2251,7 +2251,7 @@ ssl3_send_client_kex_gost(SSL *s, SESS_CERT *sess_cert, CBB *cbb)
2251 } 2251 }
2252 2252
2253 /* XXX check handshake hash instead. */ 2253 /* XXX check handshake hash instead. */
2254 if (S3I(s)->hs.new_cipher->algorithm2 & SSL_HANDSHAKE_MAC_GOST94) 2254 if (S3I(s)->hs.cipher->algorithm2 & SSL_HANDSHAKE_MAC_GOST94)
2255 nid = NID_id_GostR3411_94; 2255 nid = NID_id_GostR3411_94;
2256 else 2256 else
2257 nid = NID_id_tc26_gost3411_2012_256; 2257 nid = NID_id_tc26_gost3411_2012_256;
@@ -2314,7 +2314,7 @@ ssl3_send_client_key_exchange(SSL *s)
2314 memset(&cbb, 0, sizeof(cbb)); 2314 memset(&cbb, 0, sizeof(cbb));
2315 2315
2316 if (S3I(s)->hs.state == SSL3_ST_CW_KEY_EXCH_A) { 2316 if (S3I(s)->hs.state == SSL3_ST_CW_KEY_EXCH_A) {
2317 alg_k = S3I(s)->hs.new_cipher->algorithm_mkey; 2317 alg_k = S3I(s)->hs.cipher->algorithm_mkey;
2318 2318
2319 if ((sess_cert = SSI(s)->sess_cert) == NULL) { 2319 if ((sess_cert = SSI(s)->sess_cert) == NULL) {
2320 ssl3_send_alert(s, SSL3_AL_FATAL, 2320 ssl3_send_alert(s, SSL3_AL_FATAL,
@@ -2726,8 +2726,8 @@ ssl3_check_cert_and_algorithm(SSL *s)
2726 SESS_CERT *sc; 2726 SESS_CERT *sc;
2727 DH *dh; 2727 DH *dh;
2728 2728
2729 alg_k = S3I(s)->hs.new_cipher->algorithm_mkey; 2729 alg_k = S3I(s)->hs.cipher->algorithm_mkey;
2730 alg_a = S3I(s)->hs.new_cipher->algorithm_auth; 2730 alg_a = S3I(s)->hs.cipher->algorithm_auth;
2731 2731
2732 /* We don't have a certificate. */ 2732 /* We don't have a certificate. */
2733 if (alg_a & SSL_aNULL) 2733 if (alg_a & SSL_aNULL)
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c
index 4b215a786d..e3e0c974af 100644
--- a/src/lib/libssl/ssl_lib.c
+++ b/src/lib/libssl/ssl_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_lib.c,v 1.251 2021/03/02 15:43:12 tb Exp $ */ 1/* $OpenBSD: ssl_lib.c,v 1.252 2021/03/24 18:44:00 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 *
@@ -2111,8 +2111,8 @@ ssl_using_ecc_cipher(SSL *s)
2111{ 2111{
2112 unsigned long alg_a, alg_k; 2112 unsigned long alg_a, alg_k;
2113 2113
2114 alg_a = S3I(s)->hs.new_cipher->algorithm_auth; 2114 alg_a = S3I(s)->hs.cipher->algorithm_auth;
2115 alg_k = S3I(s)->hs.new_cipher->algorithm_mkey; 2115 alg_k = S3I(s)->hs.cipher->algorithm_mkey;
2116 2116
2117 return SSI(s)->tlsext_ecpointformatlist != NULL && 2117 return SSI(s)->tlsext_ecpointformatlist != NULL &&
2118 SSI(s)->tlsext_ecpointformatlist_length > 0 && 2118 SSI(s)->tlsext_ecpointformatlist_length > 0 &&
@@ -2122,7 +2122,7 @@ ssl_using_ecc_cipher(SSL *s)
2122int 2122int
2123ssl_check_srvr_ecc_cert_and_alg(X509 *x, SSL *s) 2123ssl_check_srvr_ecc_cert_and_alg(X509 *x, SSL *s)
2124{ 2124{
2125 const SSL_CIPHER *cs = S3I(s)->hs.new_cipher; 2125 const SSL_CIPHER *cs = S3I(s)->hs.cipher;
2126 unsigned long alg_a; 2126 unsigned long alg_a;
2127 2127
2128 alg_a = cs->algorithm_auth; 2128 alg_a = cs->algorithm_auth;
@@ -2150,9 +2150,9 @@ ssl_get_server_send_pkey(const SSL *s)
2150 int i; 2150 int i;
2151 2151
2152 c = s->cert; 2152 c = s->cert;
2153 ssl_set_cert_masks(c, S3I(s)->hs.new_cipher); 2153 ssl_set_cert_masks(c, S3I(s)->hs.cipher);
2154 2154
2155 alg_a = S3I(s)->hs.new_cipher->algorithm_auth; 2155 alg_a = S3I(s)->hs.cipher->algorithm_auth;
2156 2156
2157 if (alg_a & SSL_aECDSA) { 2157 if (alg_a & SSL_aECDSA) {
2158 i = SSL_PKEY_ECC; 2158 i = SSL_PKEY_ECC;
@@ -2211,9 +2211,9 @@ ssl_get_auto_dh(SSL *s)
2211 2211
2212 if (s->cert->dh_tmp_auto == 2) { 2212 if (s->cert->dh_tmp_auto == 2) {
2213 keylen = 1024; 2213 keylen = 1024;
2214 } else if (S3I(s)->hs.new_cipher->algorithm_auth & SSL_aNULL) { 2214 } else if (S3I(s)->hs.cipher->algorithm_auth & SSL_aNULL) {
2215 keylen = 1024; 2215 keylen = 1024;
2216 if (S3I(s)->hs.new_cipher->strength_bits == 256) 2216 if (S3I(s)->hs.cipher->strength_bits == 256)
2217 keylen = 3072; 2217 keylen = 3072;
2218 } else { 2218 } else {
2219 if ((cpk = ssl_get_server_send_pkey(s)) == NULL) 2219 if ((cpk = ssl_get_server_send_pkey(s)) == NULL)
diff --git a/src/lib/libssl/ssl_locl.h b/src/lib/libssl/ssl_locl.h
index 5f953b8e64..c8c7ca5472 100644
--- a/src/lib/libssl/ssl_locl.h
+++ b/src/lib/libssl/ssl_locl.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_locl.h,v 1.329 2021/03/24 18:40:03 jsing Exp $ */ 1/* $OpenBSD: ssl_locl.h,v 1.330 2021/03/24 18:44:00 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 *
@@ -483,7 +483,7 @@ typedef struct ssl_handshake_st {
483 int state; 483 int state;
484 484
485 /* Cipher being negotiated in this handshake. */ 485 /* Cipher being negotiated in this handshake. */
486 const SSL_CIPHER *new_cipher; 486 const SSL_CIPHER *cipher;
487 487
488 /* Extensions seen in this handshake. */ 488 /* Extensions seen in this handshake. */
489 uint32_t extensions_seen; 489 uint32_t extensions_seen;
diff --git a/src/lib/libssl/ssl_pkt.c b/src/lib/libssl/ssl_pkt.c
index 37bee9e69f..a93acdfa7f 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.38 2021/03/24 18:40:03 jsing Exp $ */ 1/* $OpenBSD: ssl_pkt.c,v 1.39 2021/03/24 18:44:00 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 *
@@ -1038,7 +1038,7 @@ ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek)
1038 } 1038 }
1039 1039
1040 /* Check we have a cipher to change to */ 1040 /* Check we have a cipher to change to */
1041 if (S3I(s)->hs.new_cipher == NULL) { 1041 if (S3I(s)->hs.cipher == NULL) {
1042 al = SSL_AD_UNEXPECTED_MESSAGE; 1042 al = SSL_AD_UNEXPECTED_MESSAGE;
1043 SSLerror(s, SSL_R_CCS_RECEIVED_EARLY); 1043 SSLerror(s, SSL_R_CCS_RECEIVED_EARLY);
1044 goto fatal_err; 1044 goto fatal_err;
@@ -1170,7 +1170,7 @@ ssl3_do_change_cipher_spec(SSL *s)
1170 return (0); 1170 return (0);
1171 } 1171 }
1172 1172
1173 s->session->cipher = S3I(s)->hs.new_cipher; 1173 s->session->cipher = S3I(s)->hs.cipher;
1174 if (!tls1_setup_key_block(s)) 1174 if (!tls1_setup_key_block(s))
1175 return (0); 1175 return (0);
1176 } 1176 }
diff --git a/src/lib/libssl/ssl_srvr.c b/src/lib/libssl/ssl_srvr.c
index 3dc87a00c8..047087c1c9 100644
--- a/src/lib/libssl/ssl_srvr.c
+++ b/src/lib/libssl/ssl_srvr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_srvr.c,v 1.98 2021/03/24 18:40:03 jsing Exp $ */ 1/* $OpenBSD: ssl_srvr.c,v 1.99 2021/03/24 18:44:00 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 *
@@ -394,7 +394,7 @@ ssl3_accept(SSL *s)
394 case SSL3_ST_SW_CERT_A: 394 case SSL3_ST_SW_CERT_A:
395 case SSL3_ST_SW_CERT_B: 395 case SSL3_ST_SW_CERT_B:
396 /* Check if it is anon DH or anon ECDH. */ 396 /* Check if it is anon DH or anon ECDH. */
397 if (!(S3I(s)->hs.new_cipher->algorithm_auth & 397 if (!(S3I(s)->hs.cipher->algorithm_auth &
398 SSL_aNULL)) { 398 SSL_aNULL)) {
399 if (SSL_is_dtls(s)) 399 if (SSL_is_dtls(s))
400 dtls1_start_timer(s); 400 dtls1_start_timer(s);
@@ -414,7 +414,7 @@ ssl3_accept(SSL *s)
414 414
415 case SSL3_ST_SW_KEY_EXCH_A: 415 case SSL3_ST_SW_KEY_EXCH_A:
416 case SSL3_ST_SW_KEY_EXCH_B: 416 case SSL3_ST_SW_KEY_EXCH_B:
417 alg_k = S3I(s)->hs.new_cipher->algorithm_mkey; 417 alg_k = S3I(s)->hs.cipher->algorithm_mkey;
418 418
419 /* 419 /*
420 * Only send if using a DH key exchange. 420 * Only send if using a DH key exchange.
@@ -459,7 +459,7 @@ ssl3_accept(SSL *s)
459 if (!(s->verify_mode & SSL_VERIFY_PEER) || 459 if (!(s->verify_mode & SSL_VERIFY_PEER) ||
460 ((s->session->peer != NULL) && 460 ((s->session->peer != NULL) &&
461 (s->verify_mode & SSL_VERIFY_CLIENT_ONCE)) || 461 (s->verify_mode & SSL_VERIFY_CLIENT_ONCE)) ||
462 ((S3I(s)->hs.new_cipher->algorithm_auth & 462 ((S3I(s)->hs.cipher->algorithm_auth &
463 SSL_aNULL) && !(s->verify_mode & 463 SSL_aNULL) && !(s->verify_mode &
464 SSL_VERIFY_FAIL_IF_NO_PEER_CERT))) { 464 SSL_VERIFY_FAIL_IF_NO_PEER_CERT))) {
465 /* No cert request. */ 465 /* No cert request. */
@@ -542,7 +542,7 @@ ssl3_accept(SSL *s)
542 s->internal->init_num = 0; 542 s->internal->init_num = 0;
543 } 543 }
544 544
545 alg_k = S3I(s)->hs.new_cipher->algorithm_mkey; 545 alg_k = S3I(s)->hs.cipher->algorithm_mkey;
546 if (ret == 2) { 546 if (ret == 2) {
547 /* 547 /*
548 * For the ECDH ciphersuites when 548 * For the ECDH ciphersuites when
@@ -641,7 +641,7 @@ ssl3_accept(SSL *s)
641 641
642 case SSL3_ST_SW_CHANGE_A: 642 case SSL3_ST_SW_CHANGE_A:
643 case SSL3_ST_SW_CHANGE_B: 643 case SSL3_ST_SW_CHANGE_B:
644 s->session->cipher = S3I(s)->hs.new_cipher; 644 s->session->cipher = S3I(s)->hs.cipher;
645 if (!tls1_setup_key_block(s)) { 645 if (!tls1_setup_key_block(s)) {
646 ret = -1; 646 ret = -1;
647 goto end; 647 goto end;
@@ -1122,15 +1122,15 @@ ssl3_get_client_hello(SSL *s)
1122 SSLerror(s, SSL_R_NO_SHARED_CIPHER); 1122 SSLerror(s, SSL_R_NO_SHARED_CIPHER);
1123 goto fatal_err; 1123 goto fatal_err;
1124 } 1124 }
1125 S3I(s)->hs.new_cipher = c; 1125 S3I(s)->hs.cipher = c;
1126 } else { 1126 } else {
1127 S3I(s)->hs.new_cipher = s->session->cipher; 1127 S3I(s)->hs.cipher = s->session->cipher;
1128 } 1128 }
1129 1129
1130 if (!tls1_transcript_hash_init(s)) 1130 if (!tls1_transcript_hash_init(s))
1131 goto err; 1131 goto err;
1132 1132
1133 alg_k = S3I(s)->hs.new_cipher->algorithm_mkey; 1133 alg_k = S3I(s)->hs.cipher->algorithm_mkey;
1134 if (!(SSL_USE_SIGALGS(s) || (alg_k & SSL_kGOST)) || 1134 if (!(SSL_USE_SIGALGS(s) || (alg_k & SSL_kGOST)) ||
1135 !(s->verify_mode & SSL_VERIFY_PEER)) 1135 !(s->verify_mode & SSL_VERIFY_PEER))
1136 tls1_transcript_free(s); 1136 tls1_transcript_free(s);
@@ -1144,7 +1144,7 @@ ssl3_get_client_hello(SSL *s)
1144 * ssl version is set - sslv3 1144 * ssl version is set - sslv3
1145 * s->session - The ssl session has been setup. 1145 * s->session - The ssl session has been setup.
1146 * s->internal->hit - session reuse flag 1146 * s->internal->hit - session reuse flag
1147 * s->hs.new_cipher - the new cipher to use. 1147 * s->hs.cipher - the new cipher to use.
1148 */ 1148 */
1149 1149
1150 /* Handles TLS extensions that we couldn't check earlier */ 1150 /* Handles TLS extensions that we couldn't check earlier */
@@ -1265,7 +1265,7 @@ ssl3_send_server_hello(SSL *s)
1265 1265
1266 /* Cipher suite. */ 1266 /* Cipher suite. */
1267 if (!CBB_add_u16(&server_hello, 1267 if (!CBB_add_u16(&server_hello,
1268 ssl3_cipher_get_value(S3I(s)->hs.new_cipher))) 1268 ssl3_cipher_get_value(S3I(s)->hs.cipher)))
1269 goto err; 1269 goto err;
1270 1270
1271 /* Compression method (null). */ 1271 /* Compression method (null). */
@@ -1336,7 +1336,7 @@ ssl3_send_server_kex_dhe(SSL *s, CBB *cbb)
1336 1336
1337 if (dhp == NULL && s->cert->dh_tmp_cb != NULL) 1337 if (dhp == NULL && s->cert->dh_tmp_cb != NULL)
1338 dhp = s->cert->dh_tmp_cb(s, 0, 1338 dhp = s->cert->dh_tmp_cb(s, 0,
1339 SSL_C_PKEYLENGTH(S3I(s)->hs.new_cipher)); 1339 SSL_C_PKEYLENGTH(S3I(s)->hs.cipher));
1340 1340
1341 if (dhp == NULL) { 1341 if (dhp == NULL) {
1342 al = SSL_AD_HANDSHAKE_FAILURE; 1342 al = SSL_AD_HANDSHAKE_FAILURE;
@@ -1544,7 +1544,7 @@ ssl3_send_server_key_exchange(SSL *s)
1544 if (!CBB_init(&cbb_params, 0)) 1544 if (!CBB_init(&cbb_params, 0))
1545 goto err; 1545 goto err;
1546 1546
1547 type = S3I(s)->hs.new_cipher->algorithm_mkey; 1547 type = S3I(s)->hs.cipher->algorithm_mkey;
1548 if (type & SSL_kDHE) { 1548 if (type & SSL_kDHE) {
1549 if (ssl3_send_server_kex_dhe(s, &cbb_params) != 1) 1549 if (ssl3_send_server_kex_dhe(s, &cbb_params) != 1)
1550 goto err; 1550 goto err;
@@ -1564,8 +1564,8 @@ ssl3_send_server_key_exchange(SSL *s)
1564 goto err; 1564 goto err;
1565 1565
1566 /* Add signature unless anonymous. */ 1566 /* Add signature unless anonymous. */
1567 if (!(S3I(s)->hs.new_cipher->algorithm_auth & SSL_aNULL)) { 1567 if (!(S3I(s)->hs.cipher->algorithm_auth & SSL_aNULL)) {
1568 if ((pkey = ssl_get_sign_pkey(s, S3I(s)->hs.new_cipher, 1568 if ((pkey = ssl_get_sign_pkey(s, S3I(s)->hs.cipher,
1569 &md, &sigalg)) == NULL) { 1569 &md, &sigalg)) == NULL) {
1570 al = SSL_AD_DECODE_ERROR; 1570 al = SSL_AD_DECODE_ERROR;
1571 goto fatal_err; 1571 goto fatal_err;
@@ -2002,7 +2002,7 @@ ssl3_get_client_kex_gost(SSL *s, CBS *cbs)
2002 int ret = 0; 2002 int ret = 0;
2003 2003
2004 /* Get our certificate private key*/ 2004 /* Get our certificate private key*/
2005 alg_a = S3I(s)->hs.new_cipher->algorithm_auth; 2005 alg_a = S3I(s)->hs.cipher->algorithm_auth;
2006 if (alg_a & SSL_aGOST01) 2006 if (alg_a & SSL_aGOST01)
2007 pk = s->cert->pkeys[SSL_PKEY_GOST01].privatekey; 2007 pk = s->cert->pkeys[SSL_PKEY_GOST01].privatekey;
2008 2008
@@ -2081,7 +2081,7 @@ ssl3_get_client_key_exchange(SSL *s)
2081 2081
2082 CBS_init(&cbs, s->internal->init_msg, n); 2082 CBS_init(&cbs, s->internal->init_msg, n);
2083 2083
2084 alg_k = S3I(s)->hs.new_cipher->algorithm_mkey; 2084 alg_k = S3I(s)->hs.cipher->algorithm_mkey;
2085 2085
2086 if (alg_k & SSL_kRSA) { 2086 if (alg_k & SSL_kRSA) {
2087 if (ssl3_get_client_kex_rsa(s, &cbs) != 1) 2087 if (ssl3_get_client_kex_rsa(s, &cbs) != 1)
diff --git a/src/lib/libssl/t1_enc.c b/src/lib/libssl/t1_enc.c
index 5d889fa665..b9dcbac661 100644
--- a/src/lib/libssl/t1_enc.c
+++ b/src/lib/libssl/t1_enc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: t1_enc.c,v 1.134 2021/03/24 18:40:03 jsing Exp $ */ 1/* $OpenBSD: t1_enc.c,v 1.135 2021/03/24 18:44:00 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 *
@@ -343,7 +343,7 @@ tls1_change_cipher_state(SSL *s, int which)
343 343
344 if (aead != NULL) { 344 if (aead != NULL) {
345 key_len = EVP_AEAD_key_length(aead); 345 key_len = EVP_AEAD_key_length(aead);
346 iv_len = SSL_CIPHER_AEAD_FIXED_NONCE_LEN(S3I(s)->hs.new_cipher); 346 iv_len = SSL_CIPHER_AEAD_FIXED_NONCE_LEN(S3I(s)->hs.cipher);
347 } else { 347 } else {
348 key_len = EVP_CIPHER_key_length(cipher); 348 key_len = EVP_CIPHER_key_length(cipher);
349 iv_len = EVP_CIPHER_iv_length(cipher); 349 iv_len = EVP_CIPHER_iv_length(cipher);
diff --git a/src/lib/libssl/tls13_client.c b/src/lib/libssl/tls13_client.c
index 0f3d435c94..78bf15ec59 100644
--- a/src/lib/libssl/tls13_client.c
+++ b/src/lib/libssl/tls13_client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_client.c,v 1.75 2021/03/21 18:36:34 jsing Exp $ */ 1/* $OpenBSD: tls13_client.c,v 1.76 2021/03/24 18:44:00 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -304,7 +304,7 @@ tls13_server_hello_process(struct tls13_ctx *ctx, CBS *cbs)
304 goto err; 304 goto err;
305 } 305 }
306 /* XXX - move this to hs.tls13? */ 306 /* XXX - move this to hs.tls13? */
307 ctx->hs->new_cipher = cipher; 307 ctx->hs->cipher = cipher;
308 308
309 if (compression_method != 0) { 309 if (compression_method != 0) {
310 ctx->alert = TLS13_ALERT_ILLEGAL_PARAMETER; 310 ctx->alert = TLS13_ALERT_ILLEGAL_PARAMETER;
@@ -338,12 +338,12 @@ tls13_client_engage_record_protection(struct tls13_ctx *ctx)
338 &shared_key_len)) 338 &shared_key_len))
339 goto err; 339 goto err;
340 340
341 s->session->cipher = ctx->hs->new_cipher; 341 s->session->cipher = ctx->hs->cipher;
342 s->session->ssl_version = ctx->hs->tls13.server_version; 342 s->session->ssl_version = ctx->hs->tls13.server_version;
343 343
344 if ((ctx->aead = tls13_cipher_aead(ctx->hs->new_cipher)) == NULL) 344 if ((ctx->aead = tls13_cipher_aead(ctx->hs->cipher)) == NULL)
345 goto err; 345 goto err;
346 if ((ctx->hash = tls13_cipher_hash(ctx->hs->new_cipher)) == NULL) 346 if ((ctx->hash = tls13_cipher_hash(ctx->hs->cipher)) == NULL)
347 goto err; 347 goto err;
348 348
349 if ((secrets = tls13_secrets_create(ctx->hash, 0)) == NULL) 349 if ((secrets = tls13_secrets_create(ctx->hash, 0)) == NULL)
diff --git a/src/lib/libssl/tls13_server.c b/src/lib/libssl/tls13_server.c
index 658aef2cfe..bac9623a15 100644
--- a/src/lib/libssl/tls13_server.c
+++ b/src/lib/libssl/tls13_server.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_server.c,v 1.72 2021/03/21 18:36:34 jsing Exp $ */ 1/* $OpenBSD: tls13_server.c,v 1.73 2021/03/24 18:44:00 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2019, 2020 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2019, 2020 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2020 Bob Beck <beck@openbsd.org> 4 * Copyright (c) 2020 Bob Beck <beck@openbsd.org>
@@ -249,7 +249,7 @@ tls13_client_hello_process(struct tls13_ctx *ctx, CBS *cbs)
249 ctx->alert = TLS13_ALERT_HANDSHAKE_FAILURE; 249 ctx->alert = TLS13_ALERT_HANDSHAKE_FAILURE;
250 goto err; 250 goto err;
251 } 251 }
252 ctx->hs->new_cipher = cipher; 252 ctx->hs->cipher = cipher;
253 253
254 sk_SSL_CIPHER_free(s->session->ciphers); 254 sk_SSL_CIPHER_free(s->session->ciphers);
255 s->session->ciphers = ciphers; 255 s->session->ciphers = ciphers;
@@ -314,7 +314,7 @@ tls13_server_hello_build(struct tls13_ctx *ctx, CBB *cbb, int hrr)
314 SSL *s = ctx->ssl; 314 SSL *s = ctx->ssl;
315 uint16_t cipher; 315 uint16_t cipher;
316 316
317 cipher = SSL_CIPHER_get_value(ctx->hs->new_cipher); 317 cipher = SSL_CIPHER_get_value(ctx->hs->cipher);
318 server_random = s->s3->server_random; 318 server_random = s->s3->server_random;
319 319
320 if (hrr) { 320 if (hrr) {
@@ -362,11 +362,11 @@ tls13_server_engage_record_protection(struct tls13_ctx *ctx)
362 &shared_key, &shared_key_len)) 362 &shared_key, &shared_key_len))
363 goto err; 363 goto err;
364 364
365 s->session->cipher = ctx->hs->new_cipher; 365 s->session->cipher = ctx->hs->cipher;
366 366
367 if ((ctx->aead = tls13_cipher_aead(ctx->hs->new_cipher)) == NULL) 367 if ((ctx->aead = tls13_cipher_aead(ctx->hs->cipher)) == NULL)
368 goto err; 368 goto err;
369 if ((ctx->hash = tls13_cipher_hash(ctx->hs->new_cipher)) == NULL) 369 if ((ctx->hash = tls13_cipher_hash(ctx->hs->cipher)) == NULL)
370 goto err; 370 goto err;
371 371
372 if ((secrets = tls13_secrets_create(ctx->hash, 0)) == NULL) 372 if ((secrets = tls13_secrets_create(ctx->hash, 0)) == NULL)