From 0e23bbf2265e6bc4d694249f110155810ed9a512 Mon Sep 17 00:00:00 2001
From: Andreas Karlsson <andreas.karlsson@percona.com>
Date: Wed, 25 Nov 2026 03:18:01 +0100
Subject: [PATCH v1] Remove backwards compatibility ifdef for
 SSL_AD_NO_APPLICATION_PROTOCOL

As our minimum supported OpenSSL version is 1.1.1 we can now rely on
that SSL_AD_NO_APPLICATION_PROTOCOL will always be defined so this ifdef
can be removed. And the same is also true for LibreSSL as this define
was actually introduced in 3.4.0, and not in 3.4.3 as the comment
implies and 3.4.0 happens to be our oldest supported version.
---
 src/interfaces/libpq/fe-secure-openssl.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/interfaces/libpq/fe-secure-openssl.c b/src/interfaces/libpq/fe-secure-openssl.c
index 243ed240087..16dcf4e36cc 100644
--- a/src/interfaces/libpq/fe-secure-openssl.c
+++ b/src/interfaces/libpq/fe-secure-openssl.c
@@ -1644,18 +1644,14 @@ SSLerrmessage(unsigned long ecode)
 	 * Server aborted the connection with TLS "no_application_protocol" alert.
 	 * The ERR_reason_error_string() function doesn't give any error string
 	 * for that for some reason, so do it ourselves.  See
-	 * https://github.com/openssl/openssl/issues/24300.  This is available in
-	 * OpenSSL 1.1.0 and later, as well as in LibreSSL 3.4.3 (OpenBSD 7.0) and
-	 * later.
+	 * https://github.com/openssl/openssl/issues/24300.
 	 */
-#ifdef SSL_AD_NO_APPLICATION_PROTOCOL
 	if (ERR_GET_LIB(ecode) == ERR_LIB_SSL &&
 		ERR_GET_REASON(ecode) == SSL_AD_REASON_OFFSET + SSL_AD_NO_APPLICATION_PROTOCOL)
 	{
 		snprintf(errbuf, SSL_ERR_LEN, "no application protocol");
 		return errbuf;
 	}
-#endif
 
 	/*
 	 * In OpenSSL 3.0.0 and later, ERR_reason_error_string does not map system
-- 
2.43.0

