From: Daniel Stenberg Date: Mon, 23 Dec 2024 08:59:33 +0000 (+0100) Subject: openssl: fix ECH logic X-Git-Tag: curl-8_12_0~283 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60900183058c7218d9f68f49c9b9f137598fac67;p=thirdparty%2Fcurl.git openssl: fix ECH logic - on error, bail out proper - remove unused #define Closes #15814 --- diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c index cd59254101..955f2bc743 100644 --- a/lib/vtls/openssl.c +++ b/lib/vtls/openssl.c @@ -4085,28 +4085,27 @@ static void ossl_trace_ech_retry_configs(struct Curl_easy *data, SSL* ssl, # endif if(rv && rcs) { -# define HEXSTR_MAX 800 char *b64str = NULL; size_t blen = 0; - result = Curl_base64_encode((const char *)rcs, rcl, - &b64str, &blen); - if(!result && b64str) + result = Curl_base64_encode((const char *)rcs, rcl, &b64str, &blen); + if(!result && b64str) { infof(data, "ECH: retry_configs %s", b64str); - free(b64str); -# if !defined(OPENSSL_IS_BORINGSSL) && !defined(OPENSSL_IS_AWSLC) - rv = SSL_ech_get_status(ssl, &inner, &outer); - infof(data, "ECH: retry_configs for %s from %s, %d %d", - inner ? inner : "NULL", outer ? outer : "NULL", reason, rv); -# else - rv = SSL_ech_accepted(ssl); - servername_type = SSL_get_servername_type(ssl); - inner = SSL_get_servername(ssl, servername_type); - SSL_get0_ech_name_override(ssl, &outer, &out_name_len); - /* TODO: get the inner from BoringSSL */ - infof(data, "ECH: retry_configs for %s from %s, %d %d", - inner ? inner : "NULL", outer ? outer : "NULL", reason, rv); -# endif + free(b64str); +#if !defined(OPENSSL_IS_BORINGSSL) && !defined(OPENSSL_IS_AWSLC) + rv = SSL_ech_get_status(ssl, &inner, &outer); + infof(data, "ECH: retry_configs for %s from %s, %d %d", + inner ? inner : "NULL", outer ? outer : "NULL", reason, rv); +#else + rv = SSL_ech_accepted(ssl); + servername_type = SSL_get_servername_type(ssl); + inner = SSL_get_servername(ssl, servername_type); + SSL_get0_ech_name_override(ssl, &outer, &out_name_len); + /* TODO: get the inner from BoringSSL */ + infof(data, "ECH: retry_configs for %s from %s, %d %d", + inner ? inner : "NULL", outer ? outer : "NULL", reason, rv); +#endif + } } else infof(data, "ECH: no retry_configs (rv = %d)", rv);