-/* $OpenBSD: tls13_legacy.c,v 1.26 2021/07/01 17:53:39 jsing Exp $ */
+/* $OpenBSD: tls13_legacy.c,v 1.27 2021/08/30 16:50:23 tb Exp $ */
/*
* Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
*
ret = ssl_ctx->internal->tlsext_servername_callback(s, &legacy_alert,
ssl_ctx->internal->tlsext_servername_arg);
- if (ret == SSL_TLSEXT_ERR_ALERT_FATAL ||
- ret == SSL_TLSEXT_ERR_ALERT_WARNING) {
+ /*
+ * Ignore SSL_TLSEXT_ERR_ALERT_WARNING returns to match OpenSSL's
+ * behavior: the only warning alerts in TLSv1.3 are close_notify and
+ * user_canceled, neither of which should be returned by the callback.
+ */
+ if (ret == SSL_TLSEXT_ERR_ALERT_FATAL) {
if (legacy_alert >= 0 && legacy_alert <= 255)
*alert = legacy_alert;
return 0;