Re: Grab bag of smaller OpenSSL fixups

From: "Yilin Zhang" <jiezhilove(at)126(dot)com>
To: "Daniel Gustafsson" <daniel(at)yesql(dot)se>
Cc: "Andreas Karlsson" <andreas(at)proxel(dot)se>, "Tristan Partin" <tristan(at)partin(dot)io>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Grab bag of smaller OpenSSL fixups
Date: 2026-07-28 07:47:29
Message-ID: 62555339.4fc8.19fa7b167fb.Coremail.jiezhilove@126.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At 2026-07-27 16:50:44, "Daniel Gustafsson" <daniel(at)yesql(dot)se> wrote:
>> On 26 Jul 2026, at 16:12, Andreas Karlsson <andreas(at)proxel(dot)se> wrote:
>>
>> On 7/15/26 16:20, Daniel Gustafsson wrote:
>>>> On 14 Jul 2026, at 22:50, Tristan Partin <tristan(at)partin(dot)io> wrote:
>>>> I wonder if it is worth leaving your justification in a comment. Other
>>>> than that, nothing to add.
>>> Not sure if it's all that interesting, I did however add a function comment on
>>> ssl_init_context which explains the hasWarned parameter as that was lacking.
>>> The attached v3 removes the openssl-owned comment and fixed the compiler
>>> warning, both mentioned upthread.
>>
>> The patches all look good now.
>
>Thanks everyone for review, I'll go ahead applying these.

Hi,
I have a minor comment on the v3 patch.

In v3-0004-ssl-Use-the-correct-feature-macros-for-TLS-protoc.patch:
diff --git a/src/backend/libpq/be-secure-openssl.c b/src/backend/libpq/be-secure-openssl.c
index 00d7519957d..aaea6bedfca 100644
--- a/src/backend/libpq/be-secure-openssl.c
+++ b/src/backend/libpq/be-secure-openssl.c
@@ -2421,21 +2421,25 @@ ssl_protocol_version_to_openssl(int v)
case PG_TLS_ANY:
return 0;
case PG_TLS1_VERSION:
+#ifndef OPENSSL_NO_TLS1
return TLS1_VERSION;
+#else
+ break;
+#endif
case PG_TLS1_1_VERSION:
-#ifdef TLS1_1_VERSION
+#ifndef OPENSSL_NO_TLS1_1
return TLS1_1_VERSION;
#else
break;
#endif
case PG_TLS1_2_VERSION:
-#ifdef TLS1_2_VERSION
+#ifndef OPENSSL_NO_TLS1_2
return TLS1_2_VERSION;
#else
break;
#endif
case PG_TLS1_3_VERSION:
-#ifdef TLS1_3_VERSION
+#ifdef OPENSSL_NO_TLS1_3
return TLS1_3_VERSION;
#else
break;

For all other protocol versions (TLS 1.0/1.1/1.2, both frontend and backend),
we uniformly use `#ifndef OPENSSL_NO_TLSx` — return if the library supports the protocol.
Only the backend TLS 1.3 path uses `#ifdef OPENSSL_NO_TLS1_3` — return when the library lacks support.
I believe this is a one-character mistake introduced during copy-paste: `ifdef` was not changed to `ifndef`.

Best regards,

--

Yilin Zhang

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrei Lepikhov 2026-07-28 08:13:19 Re: Do not scan index in right table if condition for left join evaluates to false using columns in left table
Previous Message Tender Wang 2026-07-28 07:41:01 Re: Partition pruning can incorrectly exclude a RANGE default partition