pgsql: Use EVP_MAC for HMAC (OpenSSL >= 3.0)

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Use EVP_MAC for HMAC (OpenSSL >= 3.0)
Date: 2026-08-10 05:54:13
Message-ID: E1wtIxh-00000000v7G-3Wo8@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Use EVP_MAC for HMAC (OpenSSL >= 3.0)

The legacy HMAC_CTX interface (HMAC_CTX_new(), HMAC_Init_ex(), etc.) has
been deprecated since OpenSSL 3.0. The legacy routines do not dispatch
through the provider framework, so a loaded provider's HMAC
implementation could be bypassed.

This commit updates hmac_openssl.c to use EVP_MAC when building with
OpenSSL 3.0 or newer versions. OpenSSL 1.1.1 is the oldest version
supported on HEAD, so the legacy routines need to be kept. Note that
LibreSSL uses the legacy routines.

Like b91f79cd08ab, no backpatch is done.

Author: Mark Atwood <mark(at)reviewcommit(dot)com>
Co-authored-by: Michael Paquier <michael(at)paquier(dot)xyz>
Discussion: https://postgr.es/m/178596055149.1584250.13974609482797470185@reviewcommit.com

Branch
------
master

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

Modified Files
--------------
src/common/hmac_openssl.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 77 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Daniel Gustafsson 2026-08-10 06:50:12 pgsql: Fix errmsg grammar for publication membership
Previous Message Michael Paquier 2026-08-10 00:14:26 pgsql: Use explicit fetching for digests in cryptohash (OpenSSL >= 3.0)