Re: scram-sha-256 broken with FIPS and OpenSSL 1.0.2 - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: scram-sha-256 broken with FIPS and OpenSSL 1.0.2
Date
Msg-id X8maQe5Am7Q141f4@paquier.xyz
Whole thread Raw
In response to Re: scram-sha-256 broken with FIPS and OpenSSL 1.0.2  (Daniel Gustafsson <daniel@yesql.se>)
List pgsql-hackers
On Thu, Dec 03, 2020 at 10:58:39PM +0100, Daniel Gustafsson wrote:
> This version looks good to me, and builds/tests without any issues.  While I
> didn't try to adapt the libnss patch to the resowner machinery, I don't see any
> reasons off the cuff why it wouldn't work with the scaffolding provided here.

Based on my read of the code in lib/freebl/, SHA256ContextStr & co
hold the context data for SHA2, but are headers like sha256.h
installed?  I don't know enough of NSS to be able to answer to
that.  If, like OpenSSL, the context internals are not provided, I
think that you could use SHA256_NewContext() and track the allocation
with the resource owner callbacks, but doing a palloc() would be
much simpler if the context internals are available.

> My only question is:
>
> +#ifndef FRONTEND
> +               elog(ERROR, "out of memory");
> Shouldn't that be an ereport using ERRCODE_OUT_OF_MEMORY?

That makes sense, fixed.

I have done more testing across all versions of OpenSSL, and applied
this one, meaning that we are done for SHA2.  Thanks for the reviews!
Now, moving back to MD5..
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: Add Information during standby recovery conflicts
Next
From: Craig Ringer
Date:
Subject: Re: Single transaction in the tablesync worker?