diff options
author | tb <> | 2020-08-03 19:27:57 +0000 |
---|---|---|
committer | tb <> | 2020-08-03 19:27:57 +0000 |
commit | e9cd27a8fe1871d70e7986a755c746f3c3bfbca9 (patch) | |
tree | 962a3586c7058b6b794528e41f330336abdf1a07 /src | |
parent | 2bc9beff4e7e4404b48e98e8c4bccfe464a47b90 (diff) | |
download | openbsd-e9cd27a8fe1871d70e7986a755c746f3c3bfbca9.tar.gz openbsd-e9cd27a8fe1871d70e7986a755c746f3c3bfbca9.tar.bz2 openbsd-e9cd27a8fe1871d70e7986a755c746f3c3bfbca9.zip |
Correctly handle server requests for an OCSP response
According to RFC 8446, 4.4.2.1, a server may request that a client
present an OCSP response with its certificate by sending an empty
status_request extension as part of the certificate request. The
current code expects a full CertificateStatus structure, which is
only sent if the server sends an OCSP response with its certificate.
This causes interoperability issues with Go's TLS server and with
newer GnuTLS where we would abort the handshake with a decode_error
alert and length mismatch error.
Issue reported and diagnosed by Michael Forney
Problem also found by Mikolaj Kucharski and inoguchi.
ok inoguchi jsing
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libssl/ssl_tlsext.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/lib/libssl/ssl_tlsext.c b/src/lib/libssl/ssl_tlsext.c index 019b64f7e5..1dba9849a1 100644 --- a/src/lib/libssl/ssl_tlsext.c +++ b/src/lib/libssl/ssl_tlsext.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl_tlsext.c,v 1.78 2020/07/03 07:17:26 tb Exp $ */ | 1 | /* $OpenBSD: ssl_tlsext.c,v 1.79 2020/08/03 19:27:57 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2016, 2017, 2019 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2016, 2017, 2019 Joel Sing <jsing@openbsd.org> |
4 | * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> | 4 | * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> |
@@ -1018,6 +1018,17 @@ tlsext_ocsp_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert) | |||
1018 | uint8_t status_type; | 1018 | uint8_t status_type; |
1019 | 1019 | ||
1020 | if (version >= TLS1_3_VERSION) { | 1020 | if (version >= TLS1_3_VERSION) { |
1021 | if (msg_type == SSL_TLSEXT_MSG_CR) { | ||
1022 | /* | ||
1023 | * RFC 8446, 4.4.2.1 - the server may request an OCSP | ||
1024 | * response with an empty status_request. | ||
1025 | */ | ||
1026 | if (CBS_len(cbs) == 0) | ||
1027 | return 1; | ||
1028 | |||
1029 | SSLerror(s, SSL_R_LENGTH_MISMATCH); | ||
1030 | return 0; | ||
1031 | } | ||
1021 | if (!CBS_get_u8(cbs, &status_type)) { | 1032 | if (!CBS_get_u8(cbs, &status_type)) { |
1022 | SSLerror(s, SSL_R_LENGTH_MISMATCH); | 1033 | SSLerror(s, SSL_R_LENGTH_MISMATCH); |
1023 | return 0; | 1034 | return 0; |