diff options
author | jsing <> | 2021-01-19 18:57:09 +0000 |
---|---|---|
committer | jsing <> | 2021-01-19 18:57:09 +0000 |
commit | eb720c630d40660f4bf00d58faa6f6d59ba82ea2 (patch) | |
tree | 1cc6adc2f532c5f987be2b9a01b957de5960ebfa /src/lib/libssl/d1_pkt.c | |
parent | ac4995fa26f1a8ba3ff386c0caf843a423a4abc7 (diff) | |
download | openbsd-eb720c630d40660f4bf00d58faa6f6d59ba82ea2.tar.gz openbsd-eb720c630d40660f4bf00d58faa6f6d59ba82ea2.tar.bz2 openbsd-eb720c630d40660f4bf00d58faa6f6d59ba82ea2.zip |
Provide functions to determine if TLSv1.2 record protection is engaged.
Call these functions from code that needs to know if we've changed cipher
state and enabled record protection, rather than inconsistently checking
various pointers from other places in the code base. This also fixes a
minor bug where the wrong pointers are checked if we're operating with
AEAD.
ok inoguchi@ tb@
Diffstat (limited to 'src/lib/libssl/d1_pkt.c')
-rw-r--r-- | src/lib/libssl/d1_pkt.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/lib/libssl/d1_pkt.c b/src/lib/libssl/d1_pkt.c index 4f15015145..14ff8221be 100644 --- a/src/lib/libssl/d1_pkt.c +++ b/src/lib/libssl/d1_pkt.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: d1_pkt.c,v 1.88 2021/01/13 18:38:34 jsing Exp $ */ | 1 | /* $OpenBSD: d1_pkt.c,v 1.89 2021/01/19 18:57:09 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * DTLS implementation written by Nagendra Modadugu | 3 | * DTLS implementation written by Nagendra Modadugu |
4 | * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. | 4 | * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. |
@@ -642,13 +642,12 @@ dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek) | |||
642 | return (0); | 642 | return (0); |
643 | } | 643 | } |
644 | 644 | ||
645 | 645 | /* SSL3_RT_APPLICATION_DATA or SSL3_RT_HANDSHAKE */ | |
646 | if (type == rr->type) /* SSL3_RT_APPLICATION_DATA or SSL3_RT_HANDSHAKE */ | 646 | if (type == rr->type) { |
647 | { | ||
648 | /* make sure that we are not getting application data when we | 647 | /* make sure that we are not getting application data when we |
649 | * are doing a handshake for the first time */ | 648 | * are doing a handshake for the first time */ |
650 | if (SSL_in_init(s) && (type == SSL3_RT_APPLICATION_DATA) && | 649 | if (SSL_in_init(s) && type == SSL3_RT_APPLICATION_DATA && |
651 | (s->enc_read_ctx == NULL)) { | 650 | !tls12_record_layer_read_protected(s->internal->rl)) { |
652 | al = SSL_AD_UNEXPECTED_MESSAGE; | 651 | al = SSL_AD_UNEXPECTED_MESSAGE; |
653 | SSLerror(s, SSL_R_APP_DATA_IN_HANDSHAKE); | 652 | SSLerror(s, SSL_R_APP_DATA_IN_HANDSHAKE); |
654 | goto f_err; | 653 | goto f_err; |