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 | |
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')
24 files changed, 63 insertions, 62 deletions
diff --git a/providers/fips/self_test_kats.c b/providers/fips/self_test_kats.c index 1b89cc82ae..d411767205 100644 --- a/providers/fips/self_test_kats.c +++ b/providers/fips/self_test_kats.c @@ -285,7 +285,7 @@ static int self_test_drbg(const ST_KAT_DRBG *t, OSSL_SELF_TEST *st, if (drbg == NULL) goto err; - strength = EVP_RAND_strength(drbg); + strength = EVP_RAND_get_strength(drbg); drbg_params[0] = OSSL_PARAM_construct_utf8_string(t->param_name, t->param_value, 0); diff --git a/providers/implementations/asymciphers/rsa_enc.c b/providers/implementations/asymciphers/rsa_enc.c index 354c234939..7b534e76ed 100644 --- a/providers/implementations/asymciphers/rsa_enc.c +++ b/providers/implementations/asymciphers/rsa_enc.c @@ -371,7 +371,7 @@ static int rsa_get_ctx_params(void *vprsactx, OSSL_PARAM *params) p = OSSL_PARAM_locate(params, OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST); if (p != NULL && !OSSL_PARAM_set_utf8_string(p, prsactx->oaep_md == NULL ? "" - : EVP_MD_name(prsactx->oaep_md))) + : EVP_MD_get0_name(prsactx->oaep_md))) return 0; p = OSSL_PARAM_locate(params, OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST); @@ -381,7 +381,7 @@ static int rsa_get_ctx_params(void *vprsactx, OSSL_PARAM *params) if (!OSSL_PARAM_set_utf8_string(p, mgf1_md == NULL ? "" - : EVP_MD_name(mgf1_md))) + : EVP_MD_get0_name(mgf1_md))) return 0; } diff --git a/providers/implementations/asymciphers/sm2_enc.c b/providers/implementations/asymciphers/sm2_enc.c index a855a36d20..c9dba32ffb 100644 --- a/providers/implementations/asymciphers/sm2_enc.c +++ b/providers/implementations/asymciphers/sm2_enc.c @@ -164,7 +164,7 @@ static int sm2_get_ctx_params(void *vpsm2ctx, OSSL_PARAM *params) const EVP_MD *md = ossl_prov_digest_md(&psm2ctx->md); if (!OSSL_PARAM_set_utf8_string(p, md == NULL ? "" - : EVP_MD_name(md))) + : EVP_MD_get0_name(md))) return 0; } diff --git a/providers/implementations/exchange/dh_exch.c b/providers/implementations/exchange/dh_exch.c index 67a73d36ef..1dffc8d112 100644 --- a/providers/implementations/exchange/dh_exch.c +++ b/providers/implementations/exchange/dh_exch.c @@ -461,7 +461,7 @@ static int dh_get_ctx_params(void *vpdhctx, OSSL_PARAM params[]) if (p != NULL && !OSSL_PARAM_set_utf8_string(p, pdhctx->kdf_md == NULL ? "" - : EVP_MD_name(pdhctx->kdf_md))){ + : EVP_MD_get0_name(pdhctx->kdf_md))){ return 0; } diff --git a/providers/implementations/exchange/ecdh_exch.c b/providers/implementations/exchange/ecdh_exch.c index 7748340248..35d665fb91 100644 --- a/providers/implementations/exchange/ecdh_exch.c +++ b/providers/implementations/exchange/ecdh_exch.c @@ -377,7 +377,7 @@ int ecdh_get_ctx_params(void *vpecdhctx, OSSL_PARAM params[]) if (p != NULL && !OSSL_PARAM_set_utf8_string(p, pectx->kdf_md == NULL ? "" - : EVP_MD_name(pectx->kdf_md))){ + : EVP_MD_get0_name(pectx->kdf_md))){ return 0; } 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; } diff --git a/providers/implementations/keymgmt/mac_legacy_kmgmt.c b/providers/implementations/keymgmt/mac_legacy_kmgmt.c index f11bcc560c..3b378d38ff 100644 --- a/providers/implementations/keymgmt/mac_legacy_kmgmt.c +++ b/providers/implementations/keymgmt/mac_legacy_kmgmt.c @@ -174,7 +174,7 @@ static int mac_match(const void *keydata1, const void *keydata2, int selection) key1->priv_key_len) == 0); if (key1->cipher.cipher != NULL) ok = ok && EVP_CIPHER_is_a(key1->cipher.cipher, - EVP_CIPHER_name(key2->cipher.cipher)); + EVP_CIPHER_get0_name(key2->cipher.cipher)); } return ok; } @@ -253,7 +253,7 @@ static int key_to_params(MAC_KEY *key, OSSL_PARAM_BLD *tmpl, if (key->cipher.cipher != NULL && !ossl_param_build_set_utf8_string(tmpl, params, OSSL_PKEY_PARAM_CIPHER, - EVP_CIPHER_name(key->cipher.cipher))) + EVP_CIPHER_get0_name(key->cipher.cipher))) return 0; #if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE) diff --git a/providers/implementations/macs/cmac_prov.c b/providers/implementations/macs/cmac_prov.c index 85625c8681..4f8450475c 100644 --- a/providers/implementations/macs/cmac_prov.c +++ b/providers/implementations/macs/cmac_prov.c @@ -99,7 +99,7 @@ static size_t cmac_size(void *vmacctx) { struct cmac_data_st *macctx = vmacctx; - return EVP_CIPHER_CTX_block_size(CMAC_CTX_get0_cipher_ctx(macctx->ctx)); + return EVP_CIPHER_CTX_get_block_size(CMAC_CTX_get0_cipher_ctx(macctx->ctx)); } static int cmac_setkey(struct cmac_data_st *macctx, diff --git a/providers/implementations/macs/gmac_prov.c b/providers/implementations/macs/gmac_prov.c index 1f4047ccd3..29fb9f87df 100644 --- a/providers/implementations/macs/gmac_prov.c +++ b/providers/implementations/macs/gmac_prov.c @@ -103,7 +103,7 @@ static int gmac_setkey(struct gmac_data_st *macctx, { EVP_CIPHER_CTX *ctx = macctx->ctx; - if (keylen != (size_t)EVP_CIPHER_CTX_key_length(ctx)) { + if (keylen != (size_t)EVP_CIPHER_CTX_get_key_length(ctx)) { ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY_LENGTH); return 0; } @@ -214,7 +214,7 @@ static int gmac_set_ctx_params(void *vmacctx, const OSSL_PARAM params[]) || !ossl_prov_cipher_load_from_params(&macctx->cipher, params, provctx)) return 0; - if (EVP_CIPHER_mode(ossl_prov_cipher_cipher(&macctx->cipher)) + if (EVP_CIPHER_get_mode(ossl_prov_cipher_cipher(&macctx->cipher)) != EVP_CIPH_GCM_MODE) { ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_MODE); return 0; diff --git a/providers/implementations/macs/kmac_prov.c b/providers/implementations/macs/kmac_prov.c index 4ee57ca1c2..123c40f54f 100644 --- a/providers/implementations/macs/kmac_prov.c +++ b/providers/implementations/macs/kmac_prov.c @@ -187,7 +187,7 @@ static void *kmac_fetch_new(void *provctx, const OSSL_PARAM *params) return 0; } - kctx->out_len = EVP_MD_size(ossl_prov_digest_md(&kctx->digest)); + kctx->out_len = EVP_MD_get_size(ossl_prov_digest_md(&kctx->digest)); return kctx; } @@ -243,7 +243,7 @@ static int kmac_setkey(struct kmac_data_st *kctx, const unsigned char *key, size_t keylen) { const EVP_MD *digest = ossl_prov_digest_md(&kctx->digest); - int w = EVP_MD_block_size(digest); + int w = EVP_MD_get_block_size(digest); if (keylen < KMAC_MIN_KEY || keylen > KMAC_MAX_KEY) { ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY_LENGTH); @@ -288,7 +288,7 @@ static int kmac_init(void *vmacctx, const unsigned char *key, NULL)) return 0; - t = EVP_MD_block_size(ossl_prov_digest_md(&kctx->digest)); + t = EVP_MD_get_block_size(ossl_prov_digest_md(&kctx->digest)); if (t < 0) { ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_DIGEST_LENGTH); return 0; diff --git a/providers/implementations/rands/drbg_ctr.c b/providers/implementations/rands/drbg_ctr.c index 48e8677ec8..458feca6a5 100644 --- a/providers/implementations/rands/drbg_ctr.c +++ b/providers/implementations/rands/drbg_ctr.c @@ -540,7 +540,7 @@ static int drbg_ctr_init(PROV_DRBG *drbg) ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_CIPHER); return 0; } - ctr->keylen = keylen = EVP_CIPHER_key_length(ctr->cipher_ctr); + ctr->keylen = keylen = EVP_CIPHER_get_key_length(ctr->cipher_ctr); if (ctr->ctx_ecb == NULL) ctr->ctx_ecb = EVP_CIPHER_CTX_new(); if (ctr->ctx_ctr == NULL) @@ -645,7 +645,8 @@ static int drbg_ctr_get_ctx_params(void *vdrbg, OSSL_PARAM params[]) p = OSSL_PARAM_locate(params, OSSL_DRBG_PARAM_CIPHER); if (p != NULL) { if (ctr->cipher_ctr == NULL - || !OSSL_PARAM_set_utf8_string(p, EVP_CIPHER_name(ctr->cipher_ctr))) + || !OSSL_PARAM_set_utf8_string(p, + EVP_CIPHER_get0_name(ctr->cipher_ctr))) return 0; } diff --git a/providers/implementations/rands/drbg_hash.c b/providers/implementations/rands/drbg_hash.c index 4db104c773..6deb0a2925 100644 --- a/providers/implementations/rands/drbg_hash.c +++ b/providers/implementations/rands/drbg_hash.c @@ -438,7 +438,7 @@ static int drbg_hash_get_ctx_params(void *vdrbg, OSSL_PARAM params[]) p = OSSL_PARAM_locate(params, OSSL_DRBG_PARAM_DIGEST); if (p != NULL) { md = ossl_prov_digest_md(&hash->digest); - if (md == NULL || !OSSL_PARAM_set_utf8_string(p, EVP_MD_name(md))) + if (md == NULL || !OSSL_PARAM_set_utf8_string(p, EVP_MD_get0_name(md))) return 0; } @@ -468,13 +468,13 @@ static int drbg_hash_set_ctx_params(void *vctx, const OSSL_PARAM params[]) md = ossl_prov_digest_md(&hash->digest); if (md != NULL) { - if ((EVP_MD_flags(md) & EVP_MD_FLAG_XOF) != 0) { + if ((EVP_MD_get_flags(md) & EVP_MD_FLAG_XOF) != 0) { ERR_raise(ERR_LIB_PROV, PROV_R_XOF_DIGESTS_NOT_ALLOWED); return 0; } /* These are taken from SP 800-90 10.1 Table 2 */ - hash->blocklen = EVP_MD_size(md); + hash->blocklen = EVP_MD_get_size(md); /* See SP800-57 Part1 Rev4 5.6.1 Table 3 */ ctx->strength = 64 * (hash->blocklen >> 3); if (ctx->strength > 256) diff --git a/providers/implementations/rands/drbg_hmac.c b/providers/implementations/rands/drbg_hmac.c index 67c0339801..e68465a78c 100644 --- a/providers/implementations/rands/drbg_hmac.c +++ b/providers/implementations/rands/drbg_hmac.c @@ -326,7 +326,7 @@ static int drbg_hmac_get_ctx_params(void *vdrbg, OSSL_PARAM params[]) if (p != NULL) { if (hmac->ctx == NULL) return 0; - name = EVP_MAC_name(EVP_MAC_CTX_mac(hmac->ctx)); + name = EVP_MAC_get0_name(EVP_MAC_CTX_get0_mac(hmac->ctx)); if (!OSSL_PARAM_set_utf8_string(p, name)) return 0; } @@ -334,7 +334,7 @@ static int drbg_hmac_get_ctx_params(void *vdrbg, OSSL_PARAM params[]) p = OSSL_PARAM_locate(params, OSSL_DRBG_PARAM_DIGEST); if (p != NULL) { md = ossl_prov_digest_md(&hmac->digest); - if (md == NULL || !OSSL_PARAM_set_utf8_string(p, EVP_MD_name(md))) + if (md == NULL || !OSSL_PARAM_set_utf8_string(p, EVP_MD_get0_name(md))) return 0; } @@ -369,7 +369,7 @@ static int drbg_hmac_set_ctx_params(void *vctx, const OSSL_PARAM params[]) * digests. */ md = ossl_prov_digest_md(&hmac->digest); - if (md != NULL && (EVP_MD_flags(md) & EVP_MD_FLAG_XOF) != 0) { + if (md != NULL && (EVP_MD_get_flags(md) & EVP_MD_FLAG_XOF) != 0) { ERR_raise(ERR_LIB_PROV, PROV_R_XOF_DIGESTS_NOT_ALLOWED); return 0; } @@ -380,7 +380,7 @@ static int drbg_hmac_set_ctx_params(void *vctx, const OSSL_PARAM params[]) if (hmac->ctx != NULL) { /* These are taken from SP 800-90 10.1 Table 2 */ - hmac->blocklen = EVP_MD_size(md); + hmac->blocklen = EVP_MD_get_size(md); /* See SP800-57 Part1 Rev4 5.6.1 Table 3 */ ctx->strength = 64 * (int)(hmac->blocklen >> 3); if (ctx->strength > 256) diff --git a/providers/implementations/signature/dsa_sig.c b/providers/implementations/signature/dsa_sig.c index 23e000db4c..138fbce5e9 100644 --- a/providers/implementations/signature/dsa_sig.c +++ b/providers/implementations/signature/dsa_sig.c @@ -92,7 +92,7 @@ typedef struct { static size_t dsa_get_md_size(const PROV_DSA_CTX *pdsactx) { if (pdsactx->md != NULL) - return EVP_MD_size(pdsactx->md); + return EVP_MD_get_size(pdsactx->md); return 0; } diff --git a/providers/implementations/signature/ecdsa_sig.c b/providers/implementations/signature/ecdsa_sig.c index a4297d1903..c32641f1eb 100644 --- a/providers/implementations/signature/ecdsa_sig.c +++ b/providers/implementations/signature/ecdsa_sig.c @@ -248,7 +248,7 @@ static int ecdsa_setup_md(PROV_ECDSA_CTX *ctx, const char *mdname, WPACKET_cleanup(&pkt); ctx->mdctx = NULL; ctx->md = md; - ctx->mdsize = EVP_MD_size(ctx->md); + ctx->mdsize = EVP_MD_get_size(ctx->md); OPENSSL_strlcpy(ctx->mdname, mdname, sizeof(ctx->mdname)); return 1; @@ -429,7 +429,7 @@ static int ecdsa_get_ctx_params(void *vctx, OSSL_PARAM *params) p = OSSL_PARAM_locate(params, OSSL_SIGNATURE_PARAM_DIGEST); if (p != NULL && !OSSL_PARAM_set_utf8_string(p, ctx->md == NULL ? ctx->mdname - : EVP_MD_name(ctx->md))) + : EVP_MD_get0_name(ctx->md))) return 0; return 1; diff --git a/providers/implementations/signature/mac_legacy_sig.c b/providers/implementations/signature/mac_legacy_sig.c index a8cc67b410..d9fd105289 100644 --- a/providers/implementations/signature/mac_legacy_sig.c +++ b/providers/implementations/signature/mac_legacy_sig.c @@ -107,7 +107,7 @@ static int mac_digest_sign_init(void *vpmacctx, const char *mdname, void *vkey, pmacctx->key = vkey; if (pmacctx->key->cipher.cipher != NULL) - ciphername = (char *)EVP_CIPHER_name(pmacctx->key->cipher.cipher); + ciphername = (char *)EVP_CIPHER_get0_name(pmacctx->key->cipher.cipher); #if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE) if (pmacctx->key->cipher.engine != NULL) engine = (char *)ENGINE_get_id(pmacctx->key->cipher.engine); diff --git a/providers/implementations/signature/rsa_sig.c b/providers/implementations/signature/rsa_sig.c index abd3b1a77b..30fd43e0e5 100644 --- a/providers/implementations/signature/rsa_sig.c +++ b/providers/implementations/signature/rsa_sig.c @@ -116,7 +116,7 @@ typedef struct { static size_t rsa_get_md_size(const PROV_RSA_CTX *prsactx) { if (prsactx->md != NULL) - return EVP_MD_size(prsactx->md); + return EVP_MD_get_size(prsactx->md); return 0; } @@ -156,7 +156,7 @@ static int rsa_check_parameters(PROV_RSA_CTX *prsactx, int min_saltlen) int max_saltlen; /* See if minimum salt length exceeds maximum possible */ - max_saltlen = RSA_size(prsactx->rsa) - EVP_MD_size(prsactx->md); + max_saltlen = RSA_size(prsactx->rsa) - EVP_MD_get_size(prsactx->md); if ((RSA_bits(prsactx->rsa) & 0x7) == 1) max_saltlen--; if (min_saltlen < 0 || min_saltlen > max_saltlen) { @@ -195,9 +195,9 @@ static int rsa_pss_compute_saltlen(PROV_RSA_CTX *ctx) int saltlen = ctx->saltlen; if (saltlen == RSA_PSS_SALTLEN_DIGEST) { - saltlen = EVP_MD_size(ctx->md); + saltlen = EVP_MD_get_size(ctx->md); } else if (saltlen == RSA_PSS_SALTLEN_AUTO || saltlen == RSA_PSS_SALTLEN_MAX) { - saltlen = RSA_size(ctx->rsa) - EVP_MD_size(ctx->md) - 2; + saltlen = RSA_size(ctx->rsa) - EVP_MD_get_size(ctx->md) - 2; if ((RSA_bits(ctx->rsa) & 0x7) == 1) saltlen--; } @@ -575,13 +575,13 @@ static int rsa_sign(void *vprsactx, unsigned char *sig, size_t *siglen, if (rsa_pss_restricted(prsactx)) { switch (prsactx->saltlen) { case RSA_PSS_SALTLEN_DIGEST: - if (prsactx->min_saltlen > EVP_MD_size(prsactx->md)) { + if (prsactx->min_saltlen > EVP_MD_get_size(prsactx->md)) { ERR_raise_data(ERR_LIB_PROV, PROV_R_PSS_SALTLEN_TOO_SMALL, "minimum salt length set to %d, " "but the digest only gives %d", prsactx->min_saltlen, - EVP_MD_size(prsactx->md)); + EVP_MD_get_size(prsactx->md)); return 0; } /* FALLTHRU */ @@ -678,10 +678,10 @@ static int rsa_verify_recover(void *vprsactx, ERR_raise(ERR_LIB_PROV, PROV_R_ALGORITHM_MISMATCH); return 0; } - if (ret != EVP_MD_size(prsactx->md)) { + if (ret != EVP_MD_get_size(prsactx->md)) { ERR_raise_data(ERR_LIB_PROV, PROV_R_INVALID_DIGEST_LENGTH, "Should be %d, but got %d", - EVP_MD_size(prsactx->md), ret); + EVP_MD_get_size(prsactx->md), ret); return 0; } @@ -1279,13 +1279,13 @@ static int rsa_set_ctx_params(void *vprsactx, const OSSL_PARAM params[]) } break; case RSA_PSS_SALTLEN_DIGEST: - if (prsactx->min_saltlen > EVP_MD_size(prsactx->md)) { + if (prsactx->min_saltlen > EVP_MD_get_size(prsactx->md)) { ERR_raise_data(ERR_LIB_PROV, PROV_R_PSS_SALTLEN_TOO_SMALL, "Should be more than %d, but would be " "set to match digest size (%d)", prsactx->min_saltlen, - EVP_MD_size(prsactx->md)); + EVP_MD_get_size(prsactx->md)); return 0; } break; diff --git a/providers/implementations/signature/sm2_sig.c b/providers/implementations/signature/sm2_sig.c index 8607a8b911..719e7a2eb2 100644 --- a/providers/implementations/signature/sm2_sig.c +++ b/providers/implementations/signature/sm2_sig.c @@ -198,7 +198,7 @@ static int sm2sig_digest_signverify_init(void *vpsm2ctx, const char *mdname, if (ctx->mdctx == NULL) goto error; - md_nid = EVP_MD_type(ctx->md); + md_nid = EVP_MD_get_type(ctx->md); /* * We |