From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: pgcrypto: avoid name conflicts with OpenSSL in one more case.
Date: Wed, 23 Jun 2021 23:24:48 +0000
Message-ID: <E1lwCEi-00050H-2b@gemulon.postgresql.org> (raw)
pgcrypto: avoid name conflicts with OpenSSL in one more case.
I happened to notice that if compiled --with-gssapi, 9.6's
contrib/pgcrypto tests report memory stomps for some SHA operations.
Both MEMORY_CONTEXT_CHECKING and valgrind agree there's a problem,
though nothing crashes; it appears that the buffer overrun
only extends into alignment padding, at least on 64-bit hardware.
Investigation found that pgcrypto's references to SHA224_Init
et al were being captured by the system OpenSSL library, which
of course has slightly incompatible definitions of those functions.
We long ago noticed this problem with respect to the sibling
functions SHA256_Init and so on, and commit 56f44784f introduced
renaming macros to dodge the problem for those. However, it didn't
cover the SHA224 family because we didn't use that at the time.
When commit 1abf76e82 added those awhile later, it neglected to add
a similar renaming macro. Better late than never, so do so now.
This appears to affect all branches 8.2 - 9.6, so it's surprising
nobody noticed before now. Maybe the effect is somehow specific
to the way RHEL8 intertwines its GSS and SSL libraries? Anyway,
we refactored all this stuff in v10, so newer branches don't have
the problem.
Branch
------
REL9_6_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/c835be32cc9c3f685ae093a35d0368f175ed2a33
Modified Files
--------------
contrib/pgcrypto/sha2.h | 3 +++
1 file changed, 3 insertions(+)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: pgcrypto: avoid name conflicts with OpenSSL in one more case.
In-Reply-To: <E1lwCEi-00050H-2b@gemulon.postgresql.org>
References: <E1lwCEi-00050H-2b@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox