Re: Replace current implementations in crypt() and gen_salt() to OpenSSL - Mailing list pgsql-hackers

From Daniel Gustafsson
Subject Re: Replace current implementations in crypt() and gen_salt() to OpenSSL
Date
Msg-id 764367AF-8A38-4763-BF8B-2469C9573998@yesql.se
Whole thread Raw
In response to RE: Replace current implementations in crypt() and gen_salt() to OpenSSL  ("Koshi Shibagaki (Fujitsu)" <shibagaki.koshi@fujitsu.com>)
Responses Re: Replace current implementations in crypt() and gen_salt() to OpenSSL
List pgsql-hackers
> On 20 Jan 2025, at 01:26, Koshi Shibagaki (Fujitsu) <shibagaki.koshi@fujitsu.com> wrote:
>
> Thank you for moving this discussion forward.
>
>> Maybe we could document that the test should fail if fips is enabled?
>>
>> FWIW I have not tested at all on a fips enabled machine. I will see about doing
>> that...
> I tested all on a fips enabled machine and test failed.

Did the patch as posted fail, or did it fail when you changed the GUC to follow
the fips mode?  I assume it's the latter since the code in question doesn't
care about FIPS at all (hence this patch).  Re-testing it again against OpenSSL
3.4 with FIPS enabled as well as disabled I can't reproduce any failure.

> Since all tests have been made to run even with FIPS enabled in PostgreSQL 17,
> it would be ideal for this test to follow suit.

The work which was done was to ensure that the tests passes regardless of if
FIPS is enabled or not, they were not designed to test FIPS.

After thinking about I don't think we need an alternative output file since it
won't add any testing:

> +SET pgcrypto.builtin_crypto_enabled = fips;
> +UPDATE ctest SET salt = gen_salt('des');
> +ERROR:  use of non-FIPS certified crypto not allowed when OpenSSL is in FIPS mode
> +UPDATE ctest SET res = crypt(data, salt);

If we add such an alternative output we also need the other case where FIPS is
disabled and the functions work, which means we add no test coverage at all as
both options are allowed to pass.

--
Daniel Gustafsson




pgsql-hackers by date:

Previous
From: Ritu Bhandari
Date:
Subject: Re: Purpose of wal_init_zero
Next
From: Roman Eskin
Date:
Subject: Re: Timeline issue if StartupXLOG() is interrupted right before end-of-recovery record is done