From: Matt Caswell Date: Fri, 4 Oct 2019 10:50:49 +0000 (+0100) Subject: Tweak some algorithm naming inconsistencies X-Git-Tag: openssl-3.0.0-alpha1~923 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=cc35c3ed8ffdc07bb53a2908b8a186fd866ac8d5;p=oweals%2Fopenssl.git Tweak some algorithm naming inconsistencies Make some algorithms names better match our "canonical" style. Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/10092) --- diff --git a/include/openssl/core_names.h b/include/openssl/core_names.h index cdc493bae1..1e8b764fb4 100644 --- a/include/openssl/core_names.h +++ b/include/openssl/core_names.h @@ -85,8 +85,8 @@ extern "C" { /* Known DIGEST names (not a complete list) */ #define OSSL_DIGEST_NAME_MD5 "MD5" -#define OSSL_DIGEST_NAME_KECCAK_KMAC128 "KECCAK_KMAC128" -#define OSSL_DIGEST_NAME_KECCAK_KMAC256 "KECCAK_KMAC256" +#define OSSL_DIGEST_NAME_KECCAK_KMAC128 "KECCAK-KMAC-128" +#define OSSL_DIGEST_NAME_KECCAK_KMAC256 "KECCAK-KMAC-256" /* MAC parameters */ #define OSSL_MAC_PARAM_KEY "key" /* octet string */ @@ -141,7 +141,7 @@ extern "C" { /* Known KDF names */ #define OSSL_KDF_NAME_HKDF "HKDF" #define OSSL_KDF_NAME_PBKDF2 "PBKDF2" -#define OSSL_KDF_NAME_SCRYPT "id-scrypt" +#define OSSL_KDF_NAME_SCRYPT "SCRYPT" #define OSSL_KDF_NAME_SSHKDF "SSHKDF" #define OSSL_KDF_NAME_SSKDF "SSKDF" #define OSSL_KDF_NAME_TLS1_PRF "TLS1-PRF" diff --git a/providers/defltprov.c b/providers/defltprov.c index ceb3fd0896..354c7a4a6d 100644 --- a/providers/defltprov.c +++ b/providers/defltprov.c @@ -73,6 +73,9 @@ static int deflt_get_params(const OSSL_PROVIDER *prov, OSSL_PARAM params[]) * We add diverse other names where applicable, such as the names that * NIST uses, or that are used for ASN.1 OBJECT IDENTIFIERs, or names * we have used historically. + * + * Algorithm names are case insensitive, but we use all caps in our "canonical" + * names for consistency. */ static const OSSL_ALGORITHM deflt_digests[] = { /* Our primary name:NIST name[:our older names] */ @@ -93,11 +96,11 @@ static const OSSL_ALGORITHM deflt_digests[] = { { "SHA3-512", "default=yes", sha3_512_functions }, /* - * KECCAK_KMAC128 and KECCAK_KMAC256 as hashes are mostly useful for - * the KMAC128 and KMAC256. + * KECCAK-KMAC-128 and KECCAK-KMAC-256 as hashes are mostly useful for + * the KMAC-128 and KMAC-256. */ - { "KECCAK_KMAC128", "default=yes", keccak_kmac_128_functions }, - { "KECCAK_KMAC256", "default=yes", keccak_kmac_256_functions }, + { "KECCAK-KMAC-128:KECCAK-KMAC128", "default=yes", keccak_kmac_128_functions }, + { "KECCAK-KMAC-256:KECCAK-KMAC256", "default=yes", keccak_kmac_256_functions }, /* Our primary name:NIST name */ { "SHAKE-128:SHAKE128", "default=yes", shake_128_functions }, @@ -111,8 +114,8 @@ static const OSSL_ALGORITHM deflt_digests[] = { * If we assume that "2b" and "2s" are versions, that pattern * fits with ours. We also add our historical names. */ - { "BLAKE2s-256:BLAKE2s256", "default=yes", blake2s256_functions }, - { "BLAKE2b-512:BLAKE2b512", "default=yes", blake2b512_functions }, + { "BLAKE2S-256:BLAKE2s256", "default=yes", blake2s256_functions }, + { "BLAKE2B-512:BLAKE2b512", "default=yes", blake2b512_functions }, #endif /* OPENSSL_NO_BLAKE2 */ #ifndef OPENSSL_NO_SM3 @@ -314,21 +317,21 @@ static const OSSL_ALGORITHM deflt_ciphers[] = { static const OSSL_ALGORITHM deflt_macs[] = { #ifndef OPENSSL_NO_BLAKE2 - { "BLAKE2bMAC", "default=yes", blake2bmac_functions }, - { "BLAKE2sMAC", "default=yes", blake2smac_functions }, + { "BLAKE2BMAC", "default=yes", blake2bmac_functions }, + { "BLAKE2SMAC", "default=yes", blake2smac_functions }, #endif #ifndef OPENSSL_NO_CMAC { "CMAC", "default=yes", cmac_functions }, #endif { "GMAC", "default=yes", gmac_functions }, { "HMAC", "default=yes", hmac_functions }, - { "KMAC128", "default=yes", kmac128_functions }, - { "KMAC256", "default=yes", kmac256_functions }, + { "KMAC-128:KMAC128", "default=yes", kmac128_functions }, + { "KMAC-256:KMAC256", "default=yes", kmac256_functions }, #ifndef OPENSSL_NO_SIPHASH - { "SipHash", "default=yes", siphash_functions }, + { "SIPHASH", "default=yes", siphash_functions }, #endif #ifndef OPENSSL_NO_POLY1305 - { "Poly1305", "default=yes", poly1305_functions }, + { "POLY1305", "default=yes", poly1305_functions }, #endif { NULL, NULL, NULL } }; diff --git a/providers/fips/fipsprov.c b/providers/fips/fipsprov.c index 05e5dd4a49..a12163fa97 100644 --- a/providers/fips/fipsprov.c +++ b/providers/fips/fipsprov.c @@ -349,11 +349,11 @@ static const OSSL_ALGORITHM fips_digests[] = { { "SHA3-384", "fips=yes", sha3_384_functions }, { "SHA3-512", "fips=yes", sha3_512_functions }, /* - * KECCAK_KMAC128 and KECCAK_KMAC256 as hashes are mostly useful for + * KECCAK-KMAC-128 and KECCAK-KMAC-256 as hashes are mostly useful for * KMAC128 and KMAC256. */ - { "KECCAK_KMAC128", "fips=yes", keccak_kmac_128_functions }, - { "KECCAK_KMAC256", "fips=yes", keccak_kmac_256_functions }, + { "KECCAK-KMAC-128:KECCAK-KMAC128", "fips=yes", keccak_kmac_128_functions }, + { "KECCAK-KMAC-256:KECCAK-KMAC256", "fips=yes", keccak_kmac_256_functions }, { NULL, NULL, NULL } }; @@ -402,8 +402,8 @@ static const OSSL_ALGORITHM fips_macs[] = { #endif { "GMAC", "fips=yes", gmac_functions }, { "HMAC", "fips=yes", hmac_functions }, - { "KMAC128", "fips=yes", kmac128_functions }, - { "KMAC256", "fips=yes", kmac256_functions }, + { "KMAC-128:KMAC128", "fips=yes", kmac128_functions }, + { "KMAC-256:KMAC256", "fips=yes", kmac256_functions }, { NULL, NULL, NULL } }; diff --git a/providers/legacyprov.c b/providers/legacyprov.c index 11a050e203..5937328638 100644 --- a/providers/legacyprov.c +++ b/providers/legacyprov.c @@ -68,11 +68,11 @@ static const OSSL_ALGORITHM legacy_digests[] = { #endif /* OPENSSL_NO_MDC2 */ #ifndef OPENSSL_NO_WHIRLPOOL - { "whirlpool", "legacy=yes", wp_functions }, + { "WHIRLPOOL", "legacy=yes", wp_functions }, #endif /* OPENSSL_NO_WHIRLPOOL */ #ifndef OPENSSL_NO_RMD160 - { "RIPEMD160:RIPEMD:RMD160", "legacy=yes", ripemd160_functions }, + { "RIPEMD-160:RIPEMD160:RIPEMD:RMD160", "legacy=yes", ripemd160_functions }, #endif /* OPENSSL_NO_RMD160 */ { NULL, NULL, NULL }