git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: 87f21d2) | patch
Fix handling of SCRAM-SHA-256's channel binding with RSA-PSS certificates
2023年2月15日 01:12:16 +0000 (10:12 +0900)
2023年2月15日 01:12:16 +0000 (10:12 +0900)
commit 9244c11afe23bce9358de3d36404151139e968d9
Fix handling of SCRAM-SHA-256's channel binding with RSA-PSS certificates

OpenSSL 1.1.1 and newer versions have added support for RSA-PSS
certificates, which requires the use of a specific routine in OpenSSL to
determine which hash function to use when compiling it when using
channel binding in SCRAM-SHA-256. X509_get_signature_nid(), that is the
original routine the channel binding code has relied on, is not able to
determine which hash algorithm to use for such certificates. However,
X509_get_signature_info(), new to OpenSSL 1.1.1, is able to do it. This
commit switches the channel binding logic to rely on
X509_get_signature_info() over X509_get_signature_nid(), which would be
the choice when building with 1.1.1 or newer.

The error could have been triggered on the client or the server, hence
libpq and the backend need to have their related code paths patched.
Note that attempting to load an RSA-PSS certificate with OpenSSL 1.1.0
or older leads to a failure due to an unsupported algorithm.

The discovery of relying on X509_get_signature_info() comes from Jacob,
the tests have been written by Heikki (with few tweaks from me), while I
have bundled the whole together while adding the bits needed for MSVC
and meson.

This issue exists since channel binding exists, so backpatch all the way
down. Some tests are added in 15~, triggered if compiling with OpenSSL
1.1.1 or newer, where the certificate and key files can easily be
generated for RSA-PSS.

Reported-by: Gunnar "Nick" Bluth
Author: Jacob Champion, Heikki Linnakangas
Discussion: https://postgr.es/m/17760-b6c61e752ec07060@postgresql.org
Backpatch-through: 11
15 files changed:
configure diff | blob | blame | history
configure.ac diff | blob | blame | history
meson.build diff | blob | blame | history
src/backend/libpq/be-secure-openssl.c diff | blob | blame | history
src/include/libpq/libpq-be.h diff | blob | blame | history
src/include/pg_config.h.in diff | blob | blame | history
src/interfaces/libpq/fe-secure-openssl.c diff | blob | blame | history
src/interfaces/libpq/libpq-int.h diff | blob | blame | history
src/test/ssl/README diff | blob | blame | history
src/test/ssl/conf/server-rsapss.config [new file with mode: 0644] blob
src/test/ssl/ssl/server-rsapss.crt [new file with mode: 0644] blob
src/test/ssl/ssl/server-rsapss.key [new file with mode: 0644] blob
src/test/ssl/sslfiles.mk diff | blob | blame | history
src/test/ssl/t/002_scram.pl diff | blob | blame | history
src/tools/msvc/Solution.pm diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /