pgsql: ssl: Use the correct feature macros for TLS protocol support

From: Daniel Gustafsson <dgustafsson(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: ssl: Use the correct feature macros for TLS protocol support
Date: 2026-07-29 19:27:35
Message-ID: E1wp9wF-00000000qIx-1gZr@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

ssl: Use the correct feature macros for TLS protocol support

Our test for if the underlying TLS library supported a specific
version tested against the TLSX_Y_VERSION set of macros. These
are however always defined, regardless of if the library was
built without support for the specific protocol version. Fix
by using the feature test macros OPENSSL_NO_TLSX_Y which are
intended for this usecase.

The previous coding held no risk of protocol downgrade against
the underlying library, a library not supporting the protocol
version selected would simply error out as the feature isn't
available. This can be easily verified using a modern version
of LibreSSL, which in version 3.8 disabled TLS1 and 1.1 by
default. Once we bump our minimum supported version of LibreSSL
to 3.8+ we can add a test for this.

Author: Daniel Gustafsson <daniel(at)yesql(dot)se>
Reviewed-by: Tristan Partin <tristan(at)partin(dot)io>
Reviewed-by: Andreas Karlsson <andreas(at)proxel(dot)se>
Reviewed-by: Yilin Zhang <jiezhilove(at)126(dot)com>
Discussion: https://postgr.es/m/68B9881D-DAA8-467D-A251-C96E98E57BA0@yesql.se

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1ce49fab6026ba53dbe29576a53e67fe9e1557f7

Modified Files
--------------
src/backend/libpq/be-secure-openssl.c | 10 +++++++---
src/interfaces/libpq/fe-secure-openssl.c | 8 +++++---
2 files changed, 12 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Daniel Gustafsson 2026-07-29 19:55:53 pgsql: doc: Add a note that refint will be removed in v20
Previous Message Bruce Momjian 2026-07-29 18:20:56 pgsql: doc: remove added space within synopsis replaceable tags