summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libssl/tls13_record_layer.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/lib/libssl/tls13_record_layer.c b/src/lib/libssl/tls13_record_layer.c
index ff2a6884b6..6556547353 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.61 2021/05/16 14:19:04 jsing Exp $ */ 1/* $OpenBSD: tls13_record_layer.c,v 1.62 2021/06/08 18:05:47 tb 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 *
@@ -826,12 +826,18 @@ tls13_record_layer_read_record(struct tls13_record_layer *rl)
826 return ret; 826 return ret;
827 } 827 }
828 828
829 content_type = tls13_record_content_type(rl->rrec);
830
831 /*
832 * In response to a client hello we may receive an alert in a
833 * record with a legacy version. Otherwise enforce that the
834 * legacy record version is 0x0303 per RFC 8446, section 5.1.
835 */
829 if (rl->legacy_version == TLS1_2_VERSION && 836 if (rl->legacy_version == TLS1_2_VERSION &&
830 tls13_record_version(rl->rrec) != TLS1_2_VERSION) 837 tls13_record_version(rl->rrec) != TLS1_2_VERSION &&
838 (content_type != SSL3_RT_ALERT || !rl->legacy_alerts_allowed))
831 return tls13_send_alert(rl, TLS13_ALERT_PROTOCOL_VERSION); 839 return tls13_send_alert(rl, TLS13_ALERT_PROTOCOL_VERSION);
832 840
833 content_type = tls13_record_content_type(rl->rrec);
834
835 /* 841 /*
836 * Bag of hacks ahead... after the first ClientHello message has been 842 * Bag of hacks ahead... after the first ClientHello message has been
837 * sent or received and before the peer's Finished message has been 843 * sent or received and before the peer's Finished message has been