summaryrefslogtreecommitdiff
path: root/src/lib/libssl/tls13_record_layer.c
diff options
context:
space:
mode:
authorjsing <>2019-02-14 17:55:32 +0000
committerjsing <>2019-02-14 17:55:32 +0000
commit9507004da76db0b4a0cef78dcdb9e35596e20f68 (patch)
tree8d33d71ecb17eab8b569e6964abf8e5bd7fb0729 /src/lib/libssl/tls13_record_layer.c
parent5518a6b41f13c34882ea1415c4f1e65ba5678603 (diff)
downloadopenbsd-9507004da76db0b4a0cef78dcdb9e35596e20f68.tar.gz
openbsd-9507004da76db0b4a0cef78dcdb9e35596e20f68.tar.bz2
openbsd-9507004da76db0b4a0cef78dcdb9e35596e20f68.zip
Split tls13_record_layer_set_traffic_keys() into two separate functions.
This allows the read traffic key to be set independently of the write traffic key. This will become necessary for KeyUpdate handling, however also allows for switching to application traffic keys at more appropriate stages of the handshake. ok tb@
Diffstat (limited to 'src/lib/libssl/tls13_record_layer.c')
-rw-r--r--src/lib/libssl/tls13_record_layer.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/lib/libssl/tls13_record_layer.c b/src/lib/libssl/tls13_record_layer.c
index b70f9f174e..dbb5695d5e 100644
--- a/src/lib/libssl/tls13_record_layer.c
+++ b/src/lib/libssl/tls13_record_layer.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_record_layer.c,v 1.1 2019/01/20 10:31:54 jsing Exp $ */ 1/* $OpenBSD: tls13_record_layer.c,v 1.2 2019/02/14 17:55:32 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 *
@@ -260,21 +260,23 @@ tls13_record_layer_set_traffic_key(const EVP_AEAD *aead, EVP_AEAD_CTX *aead_ctx,
260} 260}
261 261
262int 262int
263tls13_record_layer_set_traffic_keys(struct tls13_record_layer *rl, 263tls13_record_layer_set_read_traffic_key(struct tls13_record_layer *rl,
264 struct tls13_secret *read_key, struct tls13_secret *write_key) 264 struct tls13_secret *read_key)
265{ 265{
266 memset(rl->read_seq_num, 0, TLS13_RECORD_SEQ_NUM_LEN); 266 memset(rl->read_seq_num, 0, TLS13_RECORD_SEQ_NUM_LEN);
267 memset(rl->write_seq_num, 0, TLS13_RECORD_SEQ_NUM_LEN);
268 267
269 if (!tls13_record_layer_set_traffic_key(rl->aead, &rl->read_aead_ctx, 268 return tls13_record_layer_set_traffic_key(rl->aead, &rl->read_aead_ctx,
270 rl->hash, &rl->read_iv, &rl->read_nonce, read_key)) 269 rl->hash, &rl->read_iv, &rl->read_nonce, read_key);
271 return 0; 270}
272 271
273 if (!tls13_record_layer_set_traffic_key(rl->aead, &rl->write_aead_ctx, 272int
274 rl->hash, &rl->write_iv, &rl->write_nonce, write_key)) 273tls13_record_layer_set_write_traffic_key(struct tls13_record_layer *rl,
275 return 0; 274 struct tls13_secret *write_key)
275{
276 memset(rl->write_seq_num, 0, TLS13_RECORD_SEQ_NUM_LEN);
276 277
277 return 1; 278 return tls13_record_layer_set_traffic_key(rl->aead, &rl->write_aead_ctx,
279 rl->hash, &rl->write_iv, &rl->write_nonce, write_key);
278} 280}
279 281
280static int 282static int