pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Gustafsson <dgustafsson@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Clear the OpenSSL error queue before cryptohash operations
Date: Fri, 06 May 2022 13:04:45 +0000
Message-ID: <E1nmxdU-000Gdo-9M@gemulon.postgresql.org> (raw)

Clear the OpenSSL error queue before cryptohash operations

Setting up an EVP context for ciphers banned under FIPS generate
two OpenSSL errors in the queue, and as we only consume one from
the queue the other is at the head for the next invocation:

  postgres=# select md5('foo');
  ERROR:  could not compute MD5 hash: unsupported
  postgres=# select md5('foo');
  ERROR:  could not compute MD5 hash: initialization error

Clearing the error queue when creating the context ensures that
we don't pull in an error from an earlier operation.

Discussion: https://postgr.es/m/C89D932C-501E-4473-9750-638CFCD9095E@yesql.se

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/17ec5fa502d299b1919b1afacda839fb7d8206ad

Modified Files
--------------
src/common/cryptohash_openssl.c | 9 +++++++++
src/common/hmac_openssl.c       | 4 ++++
2 files changed, 13 insertions(+)



Message-ID: <E1nmxdU-000Gdo-9M@gemulon.postgresql.org>
Permalink:  ../E1nmxdU-000Gdo-9M@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1nmxdU-000Gdo-9M@gemulon.postgresql.org

 · 

reply

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: dgustafsson@postgresql.org
  Subject: Re: pgsql: Clear the OpenSSL error queue before cryptohash operations
  In-Reply-To: <E1nmxdU-000Gdo-9M@gemulon.postgresql.org>
  References: <E1nmxdU-000Gdo-9M@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