summaryrefslogtreecommitdiffstats
path: root/lib/libssl/tls13_record_layer.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2019-02-14 17:55:31 +0000
committerjsing <jsing@openbsd.org>2019-02-14 17:55:31 +0000
commit46f83330140c87306f2ea23afad66ce0059467eb (patch)
treeb986cd159954eb4ba7a04006ce5b22d0807c8580 /lib/libssl/tls13_record_layer.c
parentmpw.h is no longer needed. (diff)
downloadwireguard-openbsd-46f83330140c87306f2ea23afad66ce0059467eb.tar.xz
wireguard-openbsd-46f83330140c87306f2ea23afad66ce0059467eb.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 'lib/libssl/tls13_record_layer.c')
-rw-r--r--lib/libssl/tls13_record_layer.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/libssl/tls13_record_layer.c b/lib/libssl/tls13_record_layer.c
index b70f9f174e1..dbb5695d5e1 100644
--- a/lib/libssl/tls13_record_layer.c
+++ b/lib/libssl/tls13_record_layer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tls13_record_layer.c,v 1.1 2019/01/20 10:31:54 jsing Exp $ */
+/* $OpenBSD: tls13_record_layer.c,v 1.2 2019/02/14 17:55:32 jsing Exp $ */
/*
* Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
*
@@ -260,21 +260,23 @@ tls13_record_layer_set_traffic_key(const EVP_AEAD *aead, EVP_AEAD_CTX *aead_ctx,
}
int
-tls13_record_layer_set_traffic_keys(struct tls13_record_layer *rl,
- struct tls13_secret *read_key, struct tls13_secret *write_key)
+tls13_record_layer_set_read_traffic_key(struct tls13_record_layer *rl,
+ struct tls13_secret *read_key)
{
memset(rl->read_seq_num, 0, TLS13_RECORD_SEQ_NUM_LEN);
- memset(rl->write_seq_num, 0, TLS13_RECORD_SEQ_NUM_LEN);
- if (!tls13_record_layer_set_traffic_key(rl->aead, &rl->read_aead_ctx,
- rl->hash, &rl->read_iv, &rl->read_nonce, read_key))
- return 0;
+ return tls13_record_layer_set_traffic_key(rl->aead, &rl->read_aead_ctx,
+ rl->hash, &rl->read_iv, &rl->read_nonce, read_key);
+}
- if (!tls13_record_layer_set_traffic_key(rl->aead, &rl->write_aead_ctx,
- rl->hash, &rl->write_iv, &rl->write_nonce, write_key))
- return 0;
+int
+tls13_record_layer_set_write_traffic_key(struct tls13_record_layer *rl,
+ struct tls13_secret *write_key)
+{
+ memset(rl->write_seq_num, 0, TLS13_RECORD_SEQ_NUM_LEN);
- return 1;
+ return tls13_record_layer_set_traffic_key(rl->aead, &rl->write_aead_ctx,
+ rl->hash, &rl->write_iv, &rl->write_nonce, write_key);
}
static int