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 <[email protected]>
Co-authored-by: Michael Paquier <[email protected]>
Discussion: 
https://postgr.es/m/[email protected]

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(-)

Reply via email to