From: Hugo Landau Date: Wed, 9 Aug 2023 16:46:32 +0000 (+0100) Subject: QUIC TLS: Better error message when ALPN not used X-Git-Tag: openssl-3.2.0-alpha1~97 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=881e3299dcadd65cc4a2843ba47abc6548ced8f4;p=thirdparty%2Fopenssl.git QUIC TLS: Better error message when ALPN not used Reviewed-by: Tomas Mraz Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/21715) --- diff --git a/ssl/quic/quic_tls.c b/ssl/quic/quic_tls.c index 8b9f812253d..b0da216e377 100644 --- a/ssl/quic/quic_tls.c +++ b/ssl/quic/quic_tls.c @@ -672,8 +672,8 @@ static int raise_error(QUIC_TLS *qtls, uint64_t error_code, ERR_new(); ERR_set_debug(src_file, src_line, src_func); ERR_set_error(ERR_LIB_SSL, SSL_R_QUIC_HANDSHAKE_LAYER_ERROR, - "handshake layer error, error code %llu (\"%s\")", - (unsigned long long)error_code, error_msg); + "handshake layer error, error code %llu (0x%llx) (\"%s\")", + error_code, error_code, error_msg); OSSL_ERR_STATE_save_to_mark(qtls->error_state); /* @@ -743,7 +743,8 @@ int ossl_quic_tls_tick(QUIC_TLS *qtls) return RAISE_INTERNAL_ERROR(qtls); } else { if (sc->ext.alpn == NULL || sc->ext.alpn_len == 0) - return RAISE_INTERNAL_ERROR(qtls); + return RAISE_ERROR(qtls, QUIC_ERR_CRYPTO_NO_APP_PROTO, + "ALPN must be configured when using QUIC"); } if (!SSL_set_min_proto_version(qtls->args.s, TLS1_3_VERSION)) return RAISE_INTERNAL_ERROR(qtls);