diff options
author | Richard Levitte <levitte@openssl.org> | 2019-08-15 12:39:20 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2019-08-19 08:10:16 +0200 |
commit | 81ff9eebbcf15ce04b52cc4257b265617ba412eb (patch) | |
tree | 41a8d094bed2e3bfaa2b5f323134ca63241ee72b /crypto/kdf | |
parent | doc: fix link in BN_new.pod (diff) | |
download | openssl-81ff9eebbcf15ce04b52cc4257b265617ba412eb.tar.xz openssl-81ff9eebbcf15ce04b52cc4257b265617ba412eb.zip |
Use macros internally for algorithm names
The macros are defined in include/openssl/core_names.h and follow the
naming standard OSSL_{OPNAME}_NAME_{ALGONAME}, where {OPNAME} is the
name of the operation (such as MAC) and {ALGONAME} is the name of the
algorithm. Example: OSSL_MAC_NAME_HMAC
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9635)
Diffstat (limited to 'crypto/kdf')
-rw-r--r-- | crypto/kdf/sskdf.c | 8 | ||||
-rw-r--r-- | crypto/kdf/tls1_prf.c | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/crypto/kdf/sskdf.c b/crypto/kdf/sskdf.c index 7e5a68be5e..a4a9abff5a 100644 --- a/crypto/kdf/sskdf.c +++ b/crypto/kdf/sskdf.c @@ -467,7 +467,7 @@ static int sskdf_derive(EVP_KDF_IMPL *impl, unsigned char *key, size_t keylen) * block size? */ macname = EVP_MAC_name(impl->mac); - if (strcmp(macname, "HMAC") == 0) { + if (strcmp(macname, OSSL_MAC_NAME_HMAC) == 0) { /* H(x) = HMAC(x, salt, hash) */ if (impl->md == NULL) { KDFerr(KDF_F_SSKDF_DERIVE, KDF_R_MISSING_MESSAGE_DIGEST); @@ -476,12 +476,12 @@ static int sskdf_derive(EVP_KDF_IMPL *impl, unsigned char *key, size_t keylen) default_salt_len = EVP_MD_block_size(impl->md); if (default_salt_len <= 0) return 0; - } else if (strcmp(macname, "KMAC128") == 0 - || strcmp(macname, "KMAC256") == 0) { + } else if (strcmp(macname, OSSL_MAC_NAME_KMAC128) == 0 + || strcmp(macname, OSSL_MAC_NAME_KMAC256) == 0) { /* H(x) = KMACzzz(x, salt, custom) */ custom = kmac_custom_str; custom_len = sizeof(kmac_custom_str); - if (strcmp(macname, "KMAC128") == 0) + if (strcmp(macname, OSSL_MAC_NAME_KMAC128) == 0) default_salt_len = SSKDF_KMAC128_DEFAULT_SALT_SIZE; else default_salt_len = SSKDF_KMAC256_DEFAULT_SALT_SIZE; diff --git a/crypto/kdf/tls1_prf.c b/crypto/kdf/tls1_prf.c index 1df201dd3f..b53c417737 100644 --- a/crypto/kdf/tls1_prf.c +++ b/crypto/kdf/tls1_prf.c @@ -243,7 +243,7 @@ static int tls1_prf_P_hash(const EVP_MD *md, int mac_flags; const char *mdname = EVP_MD_name(md); - mac = EVP_MAC_fetch(NULL, "HMAC", NULL); /* Implicit fetch */ + mac = EVP_MAC_fetch(NULL, OSSL_MAC_NAME_HMAC, NULL); /* Implicit fetch */ ctx_init = EVP_MAC_CTX_new(mac); if (ctx_init == NULL) goto err; |