diff options
author | tb <> | 2018-12-03 17:16:12 +0000 |
---|---|---|
committer | tb <> | 2018-12-03 17:16:12 +0000 |
commit | 8deb8b4c92f2b13168ebf2fe28646d078632afe7 (patch) | |
tree | 17129a4f556acbb71df1bccef7008f5a049b5a59 /src/lib | |
parent | ce46eb83da6f0dd3fd9a3e951067930ee51d2abb (diff) | |
download | openbsd-8deb8b4c92f2b13168ebf2fe28646d078632afe7.tar.gz openbsd-8deb8b4c92f2b13168ebf2fe28646d078632afe7.tar.bz2 openbsd-8deb8b4c92f2b13168ebf2fe28646d078632afe7.zip |
Send SSL_AD_DECODE alerts in the case of a bad hello request or an
invalid change cipher spec. Found due to dead assignment warnings
by the Clang static analyzer.
ok inoguchi (previous version), jsing
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libssl/d1_pkt.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/libssl/d1_pkt.c b/src/lib/libssl/d1_pkt.c index 825c1838a1..b406b62536 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.65 2018/10/24 18:04:50 jsing Exp $ */ | 1 | /* $OpenBSD: d1_pkt.c,v 1.66 2018/12/03 17:16:12 tb 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. |
@@ -672,7 +672,7 @@ dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek) | |||
672 | } | 672 | } |
673 | } | 673 | } |
674 | 674 | ||
675 | start: | 675 | start: |
676 | s->internal->rwstate = SSL_NOTHING; | 676 | s->internal->rwstate = SSL_NOTHING; |
677 | 677 | ||
678 | /* S3I(s)->rrec.type - is the type of record | 678 | /* S3I(s)->rrec.type - is the type of record |
@@ -855,7 +855,7 @@ start: | |||
855 | (D1I(s)->handshake_fragment[3] != 0)) { | 855 | (D1I(s)->handshake_fragment[3] != 0)) { |
856 | al = SSL_AD_DECODE_ERROR; | 856 | al = SSL_AD_DECODE_ERROR; |
857 | SSLerror(s, SSL_R_BAD_HELLO_REQUEST); | 857 | SSLerror(s, SSL_R_BAD_HELLO_REQUEST); |
858 | goto err; | 858 | goto f_err; |
859 | } | 859 | } |
860 | 860 | ||
861 | /* no need to check sequence number on HELLO REQUEST messages */ | 861 | /* no need to check sequence number on HELLO REQUEST messages */ |
@@ -965,9 +965,9 @@ start: | |||
965 | /* XDTLS: check that epoch is consistent */ | 965 | /* XDTLS: check that epoch is consistent */ |
966 | if ((rr->length != ccs_hdr_len) || | 966 | if ((rr->length != ccs_hdr_len) || |
967 | (rr->off != 0) || (rr->data[0] != SSL3_MT_CCS)) { | 967 | (rr->off != 0) || (rr->data[0] != SSL3_MT_CCS)) { |
968 | i = SSL_AD_ILLEGAL_PARAMETER; | 968 | al = SSL_AD_DECODE_ERROR; |
969 | SSLerror(s, SSL_R_BAD_CHANGE_CIPHER_SPEC); | 969 | SSLerror(s, SSL_R_BAD_CHANGE_CIPHER_SPEC); |
970 | goto err; | 970 | goto f_err; |
971 | } | 971 | } |
972 | 972 | ||
973 | rr->length = 0; | 973 | rr->length = 0; |
@@ -1097,9 +1097,9 @@ start: | |||
1097 | } | 1097 | } |
1098 | /* not reached */ | 1098 | /* not reached */ |
1099 | 1099 | ||
1100 | f_err: | 1100 | f_err: |
1101 | ssl3_send_alert(s, SSL3_AL_FATAL, al); | 1101 | ssl3_send_alert(s, SSL3_AL_FATAL, al); |
1102 | err: | 1102 | err: |
1103 | return (-1); | 1103 | return (-1); |
1104 | } | 1104 | } |
1105 | 1105 | ||