summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsing <>2021-10-23 15:02:27 +0000
committerjsing <>2021-10-23 15:02:27 +0000
commit175c62fce31edd2a92d0fc71e7b74b2440fbe5cc (patch)
tree144ab5f7a9fa85a7b22cb87744d412ca7681fb8c
parent2e95ac2a54af81b1d4a20ccc90c6efc54570b0db (diff)
downloadopenbsd-175c62fce31edd2a92d0fc71e7b74b2440fbe5cc.tar.gz
openbsd-175c62fce31edd2a92d0fc71e7b74b2440fbe5cc.tar.bz2
openbsd-175c62fce31edd2a92d0fc71e7b74b2440fbe5cc.zip
Mop up enc_read_ctx and read_hash.
These are no longer public, so we can mop them up along with the machinery needed to set/clear them. ok beck@ tb@
-rw-r--r--src/lib/libssl/ssl_lib.c16
-rw-r--r--src/lib/libssl/ssl_locl.h14
-rw-r--r--src/lib/libssl/t1_enc.c4
-rw-r--r--src/lib/libssl/tls12_record_layer.c10
4 files changed, 4 insertions, 40 deletions
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c
index df02599739..c029b3716c 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.270 2021/10/23 13:36:03 jsing Exp $ */ 1/* $OpenBSD: ssl_lib.c,v 1.271 2021/10/23 15:02:27 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 *
@@ -2709,21 +2709,7 @@ SSL_dup(SSL *s)
2709void 2709void
2710ssl_clear_cipher_state(SSL *s) 2710ssl_clear_cipher_state(SSL *s)
2711{ 2711{
2712 ssl_clear_cipher_read_state(s);
2713 ssl_clear_cipher_write_state(s);
2714}
2715
2716void
2717ssl_clear_cipher_read_state(SSL *s)
2718{
2719 tls12_record_layer_clear_read_state(s->internal->rl); 2712 tls12_record_layer_clear_read_state(s->internal->rl);
2720 tls12_record_layer_read_cipher_hash(s->internal->rl,
2721 &s->enc_read_ctx, &s->read_hash);
2722}
2723
2724void
2725ssl_clear_cipher_write_state(SSL *s)
2726{
2727 tls12_record_layer_clear_write_state(s->internal->rl); 2713 tls12_record_layer_clear_write_state(s->internal->rl);
2728} 2714}
2729 2715
diff --git a/src/lib/libssl/ssl_locl.h b/src/lib/libssl/ssl_locl.h
index 3c58e5ac21..ea1ee084a0 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.363 2021/10/23 14:40:54 jsing Exp $ */ 1/* $OpenBSD: ssl_locl.h,v 1.364 2021/10/23 15:02:27 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 *
@@ -670,8 +670,6 @@ void tls12_record_layer_write_epoch_done(struct tls12_record_layer *rl,
670void tls12_record_layer_clear_read_state(struct tls12_record_layer *rl); 670void tls12_record_layer_clear_read_state(struct tls12_record_layer *rl);
671void tls12_record_layer_clear_write_state(struct tls12_record_layer *rl); 671void tls12_record_layer_clear_write_state(struct tls12_record_layer *rl);
672void tls12_record_layer_reflect_seq_num(struct tls12_record_layer *rl); 672void tls12_record_layer_reflect_seq_num(struct tls12_record_layer *rl);
673void tls12_record_layer_read_cipher_hash(struct tls12_record_layer *rl,
674 EVP_CIPHER_CTX **cipher, EVP_MD_CTX **hash);
675int tls12_record_layer_change_read_cipher_state(struct tls12_record_layer *rl, 673int tls12_record_layer_change_read_cipher_state(struct tls12_record_layer *rl,
676 CBS *mac_key, CBS *key, CBS *iv); 674 CBS *mac_key, CBS *key, CBS *iv);
677int tls12_record_layer_change_write_cipher_state(struct tls12_record_layer *rl, 675int tls12_record_layer_change_write_cipher_state(struct tls12_record_layer *rl,
@@ -1095,14 +1093,6 @@ struct ssl_st {
1095 SSL_CTX * initial_ctx; /* initial ctx, used to store sessions */ 1093 SSL_CTX * initial_ctx; /* initial ctx, used to store sessions */
1096#define session_ctx initial_ctx 1094#define session_ctx initial_ctx
1097 1095
1098 /*
1099 * XXX really should be internal, but is
1100 * touched unnaturally by wpa-supplicant
1101 * and freeradius and other perversions
1102 */
1103 EVP_CIPHER_CTX *enc_read_ctx; /* cryptographic state */
1104 EVP_MD_CTX *read_hash; /* used for mac generation */
1105
1106 struct ssl_internal_st *internal; 1096 struct ssl_internal_st *internal;
1107}; 1097};
1108 1098
@@ -1310,8 +1300,6 @@ const SSL_METHOD *tls_legacy_method(void);
1310const SSL_METHOD *ssl_get_method(uint16_t version); 1300const SSL_METHOD *ssl_get_method(uint16_t version);
1311 1301
1312void ssl_clear_cipher_state(SSL *s); 1302void ssl_clear_cipher_state(SSL *s);
1313void ssl_clear_cipher_read_state(SSL *s);
1314void ssl_clear_cipher_write_state(SSL *s);
1315int ssl_clear_bad_session(SSL *s); 1303int ssl_clear_bad_session(SSL *s);
1316 1304
1317void ssl_info_callback(const SSL *s, int type, int value); 1305void ssl_info_callback(const SSL *s, int type, int value);
diff --git a/src/lib/libssl/t1_enc.c b/src/lib/libssl/t1_enc.c
index 65e2063398..65abcbdcaf 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.151 2021/07/01 17:53:39 jsing Exp $ */ 1/* $OpenBSD: t1_enc.c,v 1.152 2021/10/23 15:02:27 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 *
@@ -315,8 +315,6 @@ tls1_change_cipher_state(SSL *s, int is_write)
315 goto err; 315 goto err;
316 if (SSL_is_dtls(s)) 316 if (SSL_is_dtls(s))
317 dtls1_reset_read_seq_numbers(s); 317 dtls1_reset_read_seq_numbers(s);
318 tls12_record_layer_read_cipher_hash(s->internal->rl,
319 &s->enc_read_ctx, &s->read_hash);
320 } else { 318 } else {
321 if (!tls12_record_layer_change_write_cipher_state(s->internal->rl, 319 if (!tls12_record_layer_change_write_cipher_state(s->internal->rl,
322 &mac_key, &key, &iv)) 320 &mac_key, &key, &iv))
diff --git a/src/lib/libssl/tls12_record_layer.c b/src/lib/libssl/tls12_record_layer.c
index 6d7d8696eb..f7264a17c5 100644
--- a/src/lib/libssl/tls12_record_layer.c
+++ b/src/lib/libssl/tls12_record_layer.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls12_record_layer.c,v 1.34 2021/08/30 19:12:25 jsing Exp $ */ 1/* $OpenBSD: tls12_record_layer.c,v 1.35 2021/10/23 15:02:27 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2020 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2020 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -356,14 +356,6 @@ tls12_record_layer_clear_write_state(struct tls12_record_layer *rl)
356} 356}
357 357
358void 358void
359tls12_record_layer_read_cipher_hash(struct tls12_record_layer *rl,
360 EVP_CIPHER_CTX **cipher, EVP_MD_CTX **hash)
361{
362 *cipher = rl->read->cipher_ctx;
363 *hash = rl->read->hash_ctx;
364}
365
366void
367tls12_record_layer_reflect_seq_num(struct tls12_record_layer *rl) 359tls12_record_layer_reflect_seq_num(struct tls12_record_layer *rl)
368{ 360{
369 memcpy(rl->write->seq_num, rl->read->seq_num, 361 memcpy(rl->write->seq_num, rl->read->seq_num,