diff options
author | 2020-05-11 18:03:51 +0000 | |
---|---|---|
committer | 2020-05-11 18:03:51 +0000 | |
commit | 204f36c2801813e90c79fe8b14e633e73b4bb770 (patch) | |
tree | 93d42a200e665575a33d8b8bb0ad541663e5ddbd /lib/libssl/tls13_record_layer.c | |
parent | More accurate remaining power reporting with disparate batteries (diff) | |
download | wireguard-openbsd-204f36c2801813e90c79fe8b14e633e73b4bb770.tar.xz wireguard-openbsd-204f36c2801813e90c79fe8b14e633e73b4bb770.zip |
Add record version checks.
When legacy version is below TLSv1.2 ensure that the record version is
SSL3/TLS, however when the legacy version is set to TLSv1.2 require this
specifically.
ok beck@ tb@
Diffstat (limited to 'lib/libssl/tls13_record_layer.c')
-rw-r--r-- | lib/libssl/tls13_record_layer.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/libssl/tls13_record_layer.c b/lib/libssl/tls13_record_layer.c index e7650b1ecc5..8ca52d0b7fa 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.39 2020/05/11 17:46:46 jsing Exp $ */ +/* $OpenBSD: tls13_record_layer.c,v 1.40 2020/05/11 18:03:51 jsing Exp $ */ /* * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> * @@ -769,11 +769,18 @@ tls13_record_layer_read_record(struct tls13_record_layer *rl) goto err; } - if ((ret = tls13_record_recv(rl->rrec, rl->cb.wire_read, rl->cb_arg)) <= 0) + if ((ret = tls13_record_recv(rl->rrec, rl->cb.wire_read, rl->cb_arg)) <= 0) { + switch (ret) { + case TLS13_IO_RECORD_VERSION: + return tls13_send_alert(rl, SSL_AD_PROTOCOL_VERSION); + } return ret; - - /* XXX - record version checks. */ - + } + + if (rl->legacy_version == TLS1_2_VERSION && + tls13_record_version(rl->rrec) != TLS1_2_VERSION) + return tls13_send_alert(rl, SSL_AD_PROTOCOL_VERSION); + content_type = tls13_record_content_type(rl->rrec); /* |