openssl/providers
Clemens Lang 451cb23c41 fips: Use salt >= 16 bytes in PBKDF2 selftest
NIST SP 800-132 [1] section 5.1 says "[t]he length of the
randomly-generated portion of the salt shall be at least
128 bits", which implies that the salt for PBKDF2 must be at least 16
bytes long (see also Appendix A.2.1).

The FIPS 140-3 IG [2] section 10.3.A requires that "the lengths and the
properties of the Password and Salt parameters, as well as the desired
length of the Master Key used in a CAST shall be among those supported
by the module in the approved mode."

As a consequence, the salt length in the self test must be at least 16
bytes long for FIPS 140-3 compliance. Switch the self test to use the
only test vector from RFC 6070 that uses salt that is long enough to
fulfil this requirement. Since RFC 6070 does not provide expected
results for PBKDF2 with HMAC-SHA256, use the output from [3], which was
generated with python cryptography, which was tested against the RFC
6070 vectors with HMAC-SHA1.

 [1]: https://doi.org/10.6028/NIST.SP.800-132
 [2]: https://csrc.nist.gov/CSRC/media/Projects/cryptographic-module-validation-program/documents/fips%20140-3/FIPS%20140-3%20IG.pdf
 [3]: https://github.com/brycx/Test-Vector-Generation/blob/master/PBKDF2/pbkdf2-hmac-sha2-test-vectors.md

Signed-off-by: Clemens Lang <cllang@redhat.com>

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20429)
2023-03-07 18:28:54 +01:00
..
common Add option to FIPS module to enforce EMS check during KDF TLS1_PRF. 2023-03-07 18:24:45 +01:00
fips fips: Use salt >= 16 bytes in PBKDF2 selftest 2023-03-07 18:28:54 +01:00
implementations Add option to FIPS module to enforce EMS check during KDF TLS1_PRF. 2023-03-07 18:24:45 +01:00
baseprov.c Cleanup : directly include of internal/nelem.h when required. 2022-11-23 18:08:25 +01:00
build.info Add VERSIONINFO resource to legacy provider if it is not builtin 2022-06-02 11:09:10 -04:00
decoders.inc Support decode SM2 parameters 2022-08-23 11:08:11 +10:00
defltprov.c Implement deterministic ECDSA sign (RFC6979) 2022-11-30 07:31:53 +00:00
encoders.inc ENCODER PROV: Add encoders with EncryptedPrivateKeyInfo output 2021-09-05 21:34:51 +02:00
fips-sources.checksums Rationalize FIPS sources 2023-02-08 16:20:55 +01:00
fips.checksum Rationalize FIPS sources 2023-02-08 16:20:55 +01:00
fips.module.sources Rationalize FIPS sources 2023-02-08 16:20:55 +01:00
legacyprov.c Fix regression in default key length for Blowfish CFB and OFB ciphers 2022-05-23 08:50:42 +02:00
nullprov.c null prov: fix gettable param array type. 2020-10-16 10:33:38 +10:00
prov_running.c keygen: add FIPS error state management to conditional self tests 2020-09-12 16:46:51 +10:00
stores.inc Add support for loading root CAs from Windows crypto API 2022-09-14 14:10:18 +01:00