diff options
author | tb <> | 2021-08-30 16:50:23 +0000 |
---|---|---|
committer | tb <> | 2021-08-30 16:50:23 +0000 |
commit | 16d988bc2e4a08ee42706c3f39c9fd70bfa71cd4 (patch) | |
tree | 862224d45a5456bf7aa3d1dd02736b148e574b4d /src | |
parent | f67f6c5abc22f26c9c18cf14ee457c12b67479ab (diff) | |
download | openbsd-16d988bc2e4a08ee42706c3f39c9fd70bfa71cd4.tar.gz openbsd-16d988bc2e4a08ee42706c3f39c9fd70bfa71cd4.tar.bz2 openbsd-16d988bc2e4a08ee42706c3f39c9fd70bfa71cd4.zip |
Ignore warning alert returns from servername callback in TLSv1.3
If a servername callback returns SSL_TLSEXT_ERR_ALERT_WARNING, this
results in a fatal error in TLSv1.3 since alert levels are implicit
in the alert type and neither close_notify nor user_canceled make
sense in this context. OpenSSL chose to ignore this, so we need to
follow suit.
Found via a broken servername callback in p5-IO-Socket-SSL which
returns a Boolean instead of SSL_TLSEXT_ERR_*. This happened to
have worked before TLSv1.3 since warning alerts are often ignored.
This "fixes" sni.t and sni-verify.t in p5-IO-Socket-SSL.
ok beck jsing
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libssl/tls13_legacy.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/libssl/tls13_legacy.c b/src/lib/libssl/tls13_legacy.c index beb8952402..0360f8159c 100644 --- a/src/lib/libssl/tls13_legacy.c +++ b/src/lib/libssl/tls13_legacy.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls13_legacy.c,v 1.26 2021/07/01 17:53:39 jsing Exp $ */ | 1 | /* $OpenBSD: tls13_legacy.c,v 1.27 2021/08/30 16:50:23 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 | * |
@@ -515,8 +515,12 @@ tls13_legacy_servername_process(struct tls13_ctx *ctx, uint8_t *alert) | |||
515 | ret = ssl_ctx->internal->tlsext_servername_callback(s, &legacy_alert, | 515 | ret = ssl_ctx->internal->tlsext_servername_callback(s, &legacy_alert, |
516 | ssl_ctx->internal->tlsext_servername_arg); | 516 | ssl_ctx->internal->tlsext_servername_arg); |
517 | 517 | ||
518 | if (ret == SSL_TLSEXT_ERR_ALERT_FATAL || | 518 | /* |
519 | ret == SSL_TLSEXT_ERR_ALERT_WARNING) { | 519 | * Ignore SSL_TLSEXT_ERR_ALERT_WARNING returns to match OpenSSL's |
520 | * behavior: the only warning alerts in TLSv1.3 are close_notify and | ||
521 | * user_canceled, neither of which should be returned by the callback. | ||
522 | */ | ||
523 | if (ret == SSL_TLSEXT_ERR_ALERT_FATAL) { | ||
520 | if (legacy_alert >= 0 && legacy_alert <= 255) | 524 | if (legacy_alert >= 0 && legacy_alert <= 255) |
521 | *alert = legacy_alert; | 525 | *alert = legacy_alert; |
522 | return 0; | 526 | return 0; |