fips: change SLH-DSA key generation to use a fast algorithm flavour

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26837)
This commit is contained in:
Pauli 2025-02-20 10:34:36 +11:00
parent ca26db30a0
commit 26fc6da358

View file

@ -2857,31 +2857,34 @@ static const ST_KAT_PARAM ml_dsa_sig_init[] = {
* Deterministic SLH_DSA key generation supplies the private key elements and
* Half of the public key.
*/
static const uint8_t slh_dsa_sha2_128s_keygen_entropy[] = {
0xaa, 0x9c, 0xc7, 0xdc, 0xa4, 0x91, 0xfc, 0x86, 0xbc, 0xb1, 0x5a, 0x70, 0x9a, 0x15, 0xe9, 0xb3,
0x90, 0x5c, 0x80, 0x0b, 0x6e, 0x2f, 0xb9, 0xb5, 0x4b, 0x6b, 0x05, 0x0e, 0xe5, 0xe4, 0xde, 0x9a,
0xfa, 0x54, 0x64, 0xd1, 0xc6, 0x61, 0xfe, 0xd3, 0x8b, 0x2a, 0x51, 0xca, 0x3e, 0xae, 0x71, 0xba,
static const uint8_t slh_dsa_sha2_128f_keygen_entropy[] = {
0xae, 0xd6, 0xf6, 0xf5, 0xc5, 0x40, 0x8b, 0xbf, 0xfa, 0x11, 0x36, 0xbc, 0x90, 0x49, 0xa7, 0x01,
0x4d, 0x4c, 0xe0, 0x71, 0x1e, 0x17, 0x6a, 0x0c, 0x8a, 0x02, 0x35, 0x08, 0xa6, 0x92, 0xc2, 0x07,
0x74, 0xd9, 0x8d, 0x50, 0x00, 0xaf, 0x53, 0xb9, 0x8f, 0x36, 0x38, 0x9a, 0x12, 0x92, 0xbe, 0xd3
};
/* The expected outputs for the public and private key elements */
static const uint8_t slh_dsa_sha2_128s_keygen_priv[] = {
0xaa, 0x9c, 0xc7, 0xdc, 0xa4, 0x91, 0xfc, 0x86, 0xbc, 0xb1, 0x5a, 0x70, 0x9a, 0x15, 0xe9, 0xb3,
0x90, 0x5c, 0x80, 0x0b, 0x6e, 0x2f, 0xb9, 0xb5, 0x4b, 0x6b, 0x05, 0x0e, 0xe5, 0xe4, 0xde, 0x9a,
static const uint8_t slh_dsa_sha2_128f_keygen_priv[] = {
0xAE, 0xD6, 0xF6, 0xF5, 0xC5, 0x40, 0x8B, 0xBF, 0xFA, 0x11, 0x36, 0xBC, 0x90, 0x49, 0xA7, 0x01,
0x4D, 0x4C, 0xE0, 0x71, 0x1E, 0x17, 0x6A, 0x0C, 0x8A, 0x02, 0x35, 0x08, 0xA6, 0x92, 0xC2, 0x07
};
static const uint8_t slh_dsa_sha2_128s_keygen_pub[] = {
0xfa, 0x54, 0x64, 0xd1, 0xc6, 0x61, 0xfe, 0xd3, 0x8b, 0x2a, 0x51, 0xca, 0x3e, 0xae, 0x71, 0xba,
0xca, 0xe3, 0xd1, 0x86, 0x52, 0x15, 0xe3, 0xd3, 0x85, 0x0e, 0x8c, 0x1b, 0x82, 0x92, 0xbf, 0x42,
static const uint8_t slh_dsa_sha2_128f_keygen_pub[] = {
0x74, 0xD9, 0x8D, 0x50, 0x00, 0xAF, 0x53, 0xB9, 0x8F, 0x36, 0x38, 0x9A, 0x12, 0x92, 0xBE, 0xD3,
0xF4, 0xA6, 0x50, 0xC5, 0x6C, 0x42, 0x6F, 0xCF, 0xDB, 0x88, 0xE3, 0x35, 0x54, 0x59, 0x44, 0x0C
};
static const ST_KAT_PARAM slh_dsa_sha2_128s_keygen_init_params[] = {
static const ST_KAT_PARAM slh_dsa_sha2_128f_keygen_init_params[] = {
ST_KAT_PARAM_OCTET(OSSL_PKEY_PARAM_SLH_DSA_SEED,
slh_dsa_sha2_128s_keygen_entropy),
slh_dsa_sha2_128f_keygen_entropy),
ST_KAT_PARAM_END()
};
static const ST_KAT_PARAM slh_dsa_128s_keygen_expected_params[] = {
static const ST_KAT_PARAM slh_dsa_128f_keygen_expected_params[] = {
ST_KAT_PARAM_OCTET(OSSL_PKEY_PARAM_PRIV_KEY,
slh_dsa_sha2_128s_keygen_priv),
slh_dsa_sha2_128f_keygen_priv),
ST_KAT_PARAM_OCTET(OSSL_PKEY_PARAM_PUB_KEY,
slh_dsa_sha2_128s_keygen_pub),
slh_dsa_sha2_128f_keygen_pub),
ST_KAT_PARAM_END()
};
@ -3086,9 +3089,9 @@ static const ST_KAT_ASYM_KEYGEN st_kat_asym_keygen_tests[] = {
# if !defined(OPENSSL_NO_SLH_DSA)
{
OSSL_SELF_TEST_DESC_KEYGEN_SLH_DSA,
"SLH-DSA-SHA2-128s",
slh_dsa_sha2_128s_keygen_init_params,
slh_dsa_128s_keygen_expected_params
"SLH-DSA-SHA2-128f",
slh_dsa_sha2_128f_keygen_init_params,
slh_dsa_128f_keygen_expected_params
},
# endif
};