diff options
author | Tomas Mraz <tomas@openssl.org> | 2021-05-21 16:58:08 +0200 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2021-06-01 12:40:00 +0200 |
commit | ed576acdf591d4164905ab98e89ca5a3b99d90ab (patch) | |
tree | c0f36ca1b3d42f34c0c502e700ad09b69b713d3c /providers/implementations/kdfs | |
parent | 5e2d22d53ed322a7124e26a4fbd116a8210eb77a (diff) |
Rename all getters to use get/get0 in name
For functions that exist in 1.1.1 provide a simple aliases via #define.
Fixes #15236
Functions with OSSL_DECODER_, OSSL_ENCODER_, OSSL_STORE_LOADER_,
EVP_KEYEXCH_, EVP_KEM_, EVP_ASYM_CIPHER_, EVP_SIGNATURE_,
EVP_KEYMGMT_, EVP_RAND_, EVP_MAC_, EVP_KDF_, EVP_PKEY_,
EVP_MD_, and EVP_CIPHER_ prefixes are renamed.
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15405)
Diffstat (limited to 'providers/implementations/kdfs')
-rw-r--r-- | providers/implementations/kdfs/hkdf.c | 12 | ||||
-rw-r--r-- | providers/implementations/kdfs/kbkdf.c | 4 | ||||
-rw-r--r-- | providers/implementations/kdfs/krb5kdf.c | 10 | ||||
-rw-r--r-- | providers/implementations/kdfs/pbkdf2.c | 2 | ||||
-rw-r--r-- | providers/implementations/kdfs/pkcs12kdf.c | 4 | ||||
-rw-r--r-- | providers/implementations/kdfs/sskdf.c | 8 | ||||
-rw-r--r-- | providers/implementations/kdfs/x942kdf.c | 4 |
7 files changed, 22 insertions, 22 deletions
diff --git a/providers/implementations/kdfs/hkdf.c b/providers/implementations/kdfs/hkdf.c index ce0c81c1d2..83d9d1ecce 100644 --- a/providers/implementations/kdfs/hkdf.c +++ b/providers/implementations/kdfs/hkdf.c @@ -116,7 +116,7 @@ static size_t kdf_hkdf_size(KDF_HKDF *ctx) ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_MESSAGE_DIGEST); return 0; } - sz = EVP_MD_size(md); + sz = EVP_MD_get_size(md); if (sz < 0) return 0; @@ -326,7 +326,7 @@ static int HKDF(OSSL_LIB_CTX *libctx, const EVP_MD *evp_md, int ret, sz; size_t prk_len; - sz = EVP_MD_size(evp_md); + sz = EVP_MD_get_size(evp_md); if (sz < 0) return 0; prk_len = (size_t)sz; @@ -372,7 +372,7 @@ static int HKDF_Extract(OSSL_LIB_CTX *libctx, const EVP_MD *evp_md, const unsigned char *ikm, size_t ikm_len, unsigned char *prk, size_t prk_len) { - int sz = EVP_MD_size(evp_md); + int sz = EVP_MD_get_size(evp_md); if (sz < 0) return 0; @@ -382,8 +382,8 @@ static int HKDF_Extract(OSSL_LIB_CTX *libctx, const EVP_MD *evp_md, } /* calc: PRK = HMAC-Hash(salt, IKM) */ return - EVP_Q_mac(libctx, "HMAC", NULL, EVP_MD_name(evp_md), NULL, salt, - salt_len, ikm, ikm_len, prk, EVP_MD_size(evp_md), NULL) + EVP_Q_mac(libctx, "HMAC", NULL, EVP_MD_get0_name(evp_md), NULL, salt, + salt_len, ikm, ikm_len, prk, EVP_MD_get_size(evp_md), NULL) != NULL; } @@ -437,7 +437,7 @@ static int HKDF_Expand(const EVP_MD *evp_md, unsigned char prev[EVP_MAX_MD_SIZE]; size_t done_len = 0, dig_len, n; - sz = EVP_MD_size(evp_md); + sz = EVP_MD_get_size(evp_md); if (sz <= 0) return 0; dig_len = (size_t)sz; diff --git a/providers/implementations/kdfs/kbkdf.c b/providers/implementations/kdfs/kbkdf.c index e22d54171f..01f7f0d4fd 100644 --- a/providers/implementations/kdfs/kbkdf.c +++ b/providers/implementations/kdfs/kbkdf.c @@ -289,9 +289,9 @@ static int kbkdf_set_ctx_params(void *vctx, const OSSL_PARAM params[]) NULL, NULL, libctx)) return 0; else if (ctx->ctx_init != NULL - && !EVP_MAC_is_a(EVP_MAC_CTX_mac(ctx->ctx_init), + && !EVP_MAC_is_a(EVP_MAC_CTX_get0_mac(ctx->ctx_init), OSSL_MAC_NAME_HMAC) - && !EVP_MAC_is_a(EVP_MAC_CTX_mac(ctx->ctx_init), + && !EVP_MAC_is_a(EVP_MAC_CTX_get0_mac(ctx->ctx_init), OSSL_MAC_NAME_CMAC)) { ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_MAC); return 0; diff --git a/providers/implementations/kdfs/krb5kdf.c b/providers/implementations/kdfs/krb5kdf.c index 4bf9ce7294..f8d4baa568 100644 --- a/providers/implementations/kdfs/krb5kdf.c +++ b/providers/implementations/kdfs/krb5kdf.c @@ -176,7 +176,7 @@ static int krb5kdf_get_ctx_params(void *vctx, OSSL_PARAM params[]) cipher = ossl_prov_cipher_cipher(&ctx->cipher); if (cipher) - len = EVP_CIPHER_key_length(cipher); + len = EVP_CIPHER_get_key_length(cipher); else len = EVP_MAX_KEY_LENGTH; @@ -332,7 +332,7 @@ static int cipher_init(EVP_CIPHER_CTX *ctx, if (!ret) goto out; /* set the key len for the odd variable key len cipher */ - klen = EVP_CIPHER_CTX_key_length(ctx); + klen = EVP_CIPHER_CTX_get_key_length(ctx); if (key_len != (size_t)klen) { ret = EVP_CIPHER_CTX_set_key_length(ctx, key_len); if (!ret) @@ -369,7 +369,7 @@ static int KRB5KDF(const EVP_CIPHER *cipher, ENGINE *engine, #ifndef OPENSSL_NO_DES /* special case for 3des, where the caller may be requesting * the random raw key, instead of the fixed up key */ - if (EVP_CIPHER_nid(cipher) == NID_des_ede3_cbc && + if (EVP_CIPHER_get_nid(cipher) == NID_des_ede3_cbc && key_len == 24 && okey_len == 21) { des3_no_fixup = 1; } else { @@ -390,7 +390,7 @@ static int KRB5KDF(const EVP_CIPHER *cipher, ENGINE *engine, goto out; /* Initialize input block */ - blocksize = EVP_CIPHER_CTX_block_size(ctx); + blocksize = EVP_CIPHER_CTX_get_block_size(ctx); if (constant_len > blocksize) { ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_CONSTANT_LENGTH); @@ -445,7 +445,7 @@ static int KRB5KDF(const EVP_CIPHER *cipher, ENGINE *engine, } #ifndef OPENSSL_NO_DES - if (EVP_CIPHER_nid(cipher) == NID_des_ede3_cbc && !des3_no_fixup) { + if (EVP_CIPHER_get_nid(cipher) == NID_des_ede3_cbc && !des3_no_fixup) { ret = fixup_des3_key(okey); if (!ret) { ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_GENERATE_KEY); diff --git a/providers/implementations/kdfs/pbkdf2.c b/providers/implementations/kdfs/pbkdf2.c index 14c78b518c..fe247028ea 100644 --- a/providers/implementations/kdfs/pbkdf2.c +++ b/providers/implementations/kdfs/pbkdf2.c @@ -281,7 +281,7 @@ static int pbkdf2_derive(const char *pass, size_t passlen, unsigned long i = 1; HMAC_CTX *hctx_tpl = NULL, *hctx = NULL; - mdlen = EVP_MD_size(digest); + mdlen = EVP_MD_get_size(digest); if (mdlen <= 0) return 0; diff --git a/providers/implementations/kdfs/pkcs12kdf.c b/providers/implementations/kdfs/pkcs12kdf.c index d0036441a3..0ca83dd243 100644 --- a/providers/implementations/kdfs/pkcs12kdf.c +++ b/providers/implementations/kdfs/pkcs12kdf.c @@ -62,8 +62,8 @@ static int pkcs12kdf_derive(const unsigned char *pass, size_t passlen, ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE); goto end; } - vi = EVP_MD_block_size(md_type); - ui = EVP_MD_size(md_type); + vi = EVP_MD_get_block_size(md_type); + ui = EVP_MD_get_size(md_type); if (ui < 0 || vi <= 0) { ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_DIGEST_SIZE); goto end; diff --git a/providers/implementations/kdfs/sskdf.c b/providers/implementations/kdfs/sskdf.c index c281997a25..56ac1e6334 100644 --- a/providers/implementations/kdfs/sskdf.c +++ b/providers/implementations/kdfs/sskdf.c @@ -108,7 +108,7 @@ static int SSKDF_hash_kdm(const EVP_MD *kdf_md, || derived_key_len == 0) return 0; - hlen = EVP_MD_size(kdf_md); + hlen = EVP_MD_get_size(kdf_md); if (hlen <= 0) return 0; out_len = (size_t)hlen; @@ -338,7 +338,7 @@ static size_t sskdf_size(KDF_SSKDF *ctx) ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_MESSAGE_DIGEST); return 0; } - len = EVP_MD_size(md); + len = EVP_MD_get_size(md); return (len <= 0) ? 0 : (size_t)len; } @@ -362,7 +362,7 @@ static int sskdf_derive(void *vctx, unsigned char *key, size_t keylen, const unsigned char *custom = NULL; size_t custom_len = 0; int default_salt_len; - EVP_MAC *mac = EVP_MAC_CTX_mac(ctx->macctx); + EVP_MAC *mac = EVP_MAC_CTX_get0_mac(ctx->macctx); if (EVP_MAC_is_a(mac, OSSL_MAC_NAME_HMAC)) { /* H(x) = HMAC(x, salt, hash) */ @@ -370,7 +370,7 @@ static int sskdf_derive(void *vctx, unsigned char *key, size_t keylen, ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_MESSAGE_DIGEST); return 0; } - default_salt_len = EVP_MD_size(md); + default_salt_len = EVP_MD_get_size(md); if (default_salt_len <= 0) return 0; } else if (EVP_MAC_is_a(mac, OSSL_MAC_NAME_KMAC128) diff --git a/providers/implementations/kdfs/x942kdf.c b/providers/implementations/kdfs/x942kdf.c index c469d48439..c2cc94a192 100644 --- a/providers/implementations/kdfs/x942kdf.c +++ b/providers/implementations/kdfs/x942kdf.c @@ -281,7 +281,7 @@ static int x942kdf_hash_kdm(const EVP_MD *kdf_md, return 0; } - hlen = EVP_MD_size(kdf_md); + hlen = EVP_MD_get_size(kdf_md); if (hlen <= 0) return 0; out_len = (size_t)hlen; @@ -388,7 +388,7 @@ static size_t x942kdf_size(KDF_X942 *ctx) ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_MESSAGE_DIGEST); return 0; } - len = EVP_MD_size(md); + len = EVP_MD_get_size(md); return (len <= 0) ? 0 : (size_t)len; } |