summaryrefslogtreecommitdiffstats
path: root/lib/libssl/tls13_record_layer.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2019-11-17 18:27:16 +0000
committerjsing <jsing@openbsd.org>2019-11-17 18:27:16 +0000
commit09b7851cf2d37bc29d529e2a54a258cb36d815b5 (patch)
treed6d66055ebdf984815847ade60da5ff75df69120 /lib/libssl/tls13_record_layer.c
parentfail to usage if extra argv are present (diff)
downloadwireguard-openbsd-09b7851cf2d37bc29d529e2a54a258cb36d815b5.tar.xz
wireguard-openbsd-09b7851cf2d37bc29d529e2a54a258cb36d815b5.zip
Ensure that we are never operating in plaintext mode once the handshake
is complete, which should never occur. ok beck@
Diffstat (limited to 'lib/libssl/tls13_record_layer.c')
-rw-r--r--lib/libssl/tls13_record_layer.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/libssl/tls13_record_layer.c b/lib/libssl/tls13_record_layer.c
index 8208ae508c5..5487e005e47 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.11 2019/11/17 17:20:16 jsing Exp $ */
+/* $OpenBSD: tls13_record_layer.c,v 1.12 2019/11/17 18:27:16 jsing Exp $ */
/*
* Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
*
@@ -530,6 +530,9 @@ tls13_record_layer_open_record_protected(struct tls13_record_layer *rl)
static int
tls13_record_layer_open_record(struct tls13_record_layer *rl)
{
+ if (rl->handshake_completed && rl->aead == NULL)
+ return 0;
+
if (rl->aead == NULL)
return tls13_record_layer_open_record_plaintext(rl);
@@ -686,6 +689,9 @@ static int
tls13_record_layer_seal_record(struct tls13_record_layer *rl,
uint8_t content_type, const uint8_t *content, size_t content_len)
{
+ if (rl->handshake_completed && rl->aead == NULL)
+ return 0;
+
tls13_record_layer_wrec_free(rl);
if ((rl->wrec = tls13_record_new()) == NULL)