diff options
author | Tomas Mraz <tomas@openssl.org> | 2021-05-21 17:58:08 +0300 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2021-06-01 13:40:00 +0300 |
commit | ed576acdf591d4164905ab98e89ca5a3b99d90ab (patch) | |
tree | c0f36ca1b3d42f34c0c502e700ad09b69b713d3c /crypto | |
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 'crypto')
126 files changed, 765 insertions, 731 deletions
diff --git a/crypto/asn1/a_digest.c b/crypto/asn1/a_digest.c index 9d7efcdb70..72cc880779 100644 --- a/crypto/asn1/a_digest.c +++ b/crypto/asn1/a_digest.c @@ -65,15 +65,15 @@ int ossl_asn1_item_digest_ex(const ASN1_ITEM *it, const EVP_MD *md, void *asn, if (i < 0 || str == NULL) return 0; - if (EVP_MD_provider(md) == NULL) { + if (EVP_MD_get0_provider(md) == NULL) { #if !defined(OPENSSL_NO_ENGINE) - ENGINE *tmpeng = ENGINE_get_digest_engine(EVP_MD_type(md)); + ENGINE *tmpeng = ENGINE_get_digest_engine(EVP_MD_get_type(md)); if (tmpeng != NULL) ENGINE_finish(tmpeng); else #endif - fetched_md = EVP_MD_fetch(libctx, EVP_MD_name(md), propq); + fetched_md = EVP_MD_fetch(libctx, EVP_MD_get0_name(md), propq); } if (fetched_md == NULL) goto err; diff --git a/crypto/asn1/a_sign.c b/crypto/asn1/a_sign.c index 6ead2e2aca..302045cfcd 100644 --- a/crypto/asn1/a_sign.c +++ b/crypto/asn1/a_sign.c @@ -78,7 +78,7 @@ int ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1, X509_ALGOR *algor2, } inll = (size_t)inl; buf_in = OPENSSL_malloc(inll); - outll = outl = EVP_PKEY_size(pkey); + outll = outl = EVP_PKEY_get_size(pkey); buf_out = OPENSSL_malloc(outll); if (buf_in == NULL || buf_out == NULL) { outl = 0; @@ -143,7 +143,7 @@ int ASN1_item_sign_ex(const ASN1_ITEM *it, X509_ALGOR *algor1, rv = ASN1_item_sign_ctx(it, algor1, algor2, signature, data, ctx); err: - EVP_PKEY_CTX_free(EVP_MD_CTX_pkey_ctx(ctx)); + EVP_PKEY_CTX_free(EVP_MD_CTX_get_pkey_ctx(ctx)); EVP_MD_CTX_free(ctx); return rv; } @@ -160,7 +160,7 @@ int ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1, int rv, pkey_id; md = EVP_MD_CTX_get0_md(ctx); - pkey = EVP_PKEY_CTX_get0_pkey(EVP_MD_CTX_pkey_ctx(ctx)); + pkey = EVP_PKEY_CTX_get0_pkey(EVP_MD_CTX_get_pkey_ctx(ctx)); if (pkey == NULL) { ERR_raise(ERR_LIB_ASN1, ASN1_R_CONTEXT_NOT_INITIALISED); @@ -168,7 +168,7 @@ int ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1, } if (pkey->ameth == NULL) { - EVP_PKEY_CTX *pctx = EVP_MD_CTX_pkey_ctx(ctx); + EVP_PKEY_CTX *pctx = EVP_MD_CTX_get_pkey_ctx(ctx); OSSL_PARAM params[2]; unsigned char aid[128]; size_t aid_len = 0; @@ -238,7 +238,7 @@ int ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1, pkey_id = #ifndef OPENSSL_NO_SM2 - EVP_PKEY_id(pkey) == NID_sm2 ? NID_sm2 : + EVP_PKEY_get_id(pkey) == NID_sm2 ? NID_sm2 : #endif pkey->ameth->pkey_id; diff --git a/crypto/asn1/a_verify.c b/crypto/asn1/a_verify.c index b7eed914b0..b1adaf7a8f 100644 --- a/crypto/asn1/a_verify.c +++ b/crypto/asn1/a_verify.c @@ -102,7 +102,7 @@ int ASN1_item_verify_ex(const ASN1_ITEM *it, const X509_ALGOR *alg, if ((ctx = evp_md_ctx_new_ex(pkey, id, libctx, propq)) != NULL) { rv = ASN1_item_verify_ctx(it, alg, signature, data, ctx); - EVP_PKEY_CTX_free(EVP_MD_CTX_pkey_ctx(ctx)); + EVP_PKEY_CTX_free(EVP_MD_CTX_get_pkey_ctx(ctx)); EVP_MD_CTX_free(ctx); } return rv; @@ -118,7 +118,7 @@ int ASN1_item_verify_ctx(const ASN1_ITEM *it, const X509_ALGOR *alg, int mdnid, pknid; size_t inll = 0; - pkey = EVP_PKEY_CTX_get0_pkey(EVP_MD_CTX_pkey_ctx(ctx)); + pkey = EVP_PKEY_CTX_get0_pkey(EVP_MD_CTX_get_pkey_ctx(ctx)); if (pkey == NULL) { ERR_raise(ERR_LIB_ASN1, ERR_R_PASSED_NULL_PARAMETER); diff --git a/crypto/asn1/d2i_param.c b/crypto/asn1/d2i_param.c index adb394d04c..97f1022339 100644 --- a/crypto/asn1/d2i_param.c +++ b/crypto/asn1/d2i_param.c @@ -26,7 +26,7 @@ EVP_PKEY *d2i_KeyParams(int type, EVP_PKEY **a, const unsigned char **pp, } else ret = *a; - if (type != EVP_PKEY_id(ret) && !EVP_PKEY_set_type(ret, type)) + if (type != EVP_PKEY_get_id(ret) && !EVP_PKEY_set_type(ret, type)) goto err; if (ret->ameth == NULL || ret->ameth->param_decode == NULL) { diff --git a/crypto/asn1/d2i_pr.c b/crypto/asn1/d2i_pr.c index 94bd341d58..58b7646227 100644 --- a/crypto/asn1/d2i_pr.c +++ b/crypto/asn1/d2i_pr.c @@ -120,7 +120,7 @@ d2i_PrivateKey_legacy(int keytype, EVP_PKEY **a, const unsigned char **pp, EVP_PKEY_free(ret); ret = tmp; ERR_pop_to_mark(); - if (EVP_PKEY_type(keytype) != EVP_PKEY_base_id(ret)) + if (EVP_PKEY_type(keytype) != EVP_PKEY_get_base_id(ret)) goto err; } else { ERR_clear_last_mark(); diff --git a/crypto/asn1/d2i_pu.c b/crypto/asn1/d2i_pu.c index b6c7da772c..5f39ab0775 100644 --- a/crypto/asn1/d2i_pu.c +++ b/crypto/asn1/d2i_pu.c @@ -38,12 +38,12 @@ EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp, } else ret = *a; - if (type != EVP_PKEY_id(ret) && !EVP_PKEY_set_type(ret, type)) { + if (type != EVP_PKEY_get_id(ret) && !EVP_PKEY_set_type(ret, type)) { ERR_raise(ERR_LIB_ASN1, ERR_R_EVP_LIB); goto err; } - switch (EVP_PKEY_id(ret)) { + switch (EVP_PKEY_get_id(ret)) { case EVP_PKEY_RSA: if ((ret->pkey.rsa = d2i_RSAPublicKey(NULL, pp, length)) == NULL) { ERR_raise(ERR_LIB_ASN1, ERR_R_ASN1_LIB); diff --git a/crypto/asn1/i2d_evp.c b/crypto/asn1/i2d_evp.c index f03dcb2666..e1d5b7c7c4 100644 --- a/crypto/asn1/i2d_evp.c +++ b/crypto/asn1/i2d_evp.c @@ -131,7 +131,7 @@ int i2d_PublicKey(const EVP_PKEY *a, unsigned char **pp) return i2d_provided(a, EVP_PKEY_PUBLIC_KEY, output_info, pp); } - switch (EVP_PKEY_id(a)) { + switch (EVP_PKEY_get_id(a)) { case EVP_PKEY_RSA: return i2d_RSAPublicKey(EVP_PKEY_get0_RSA(a), pp); #ifndef OPENSSL_NO_DSA diff --git a/crypto/asn1/p5_pbev2.c b/crypto/asn1/p5_pbev2.c index 162e31d7ba..711743a77b 100644 --- a/crypto/asn1/p5_pbev2.c +++ b/crypto/asn1/p5_pbev2.c @@ -50,7 +50,7 @@ X509_ALGOR *PKCS5_pbe2_set_iv_ex(const EVP_CIPHER *cipher, int iter, unsigned char iv[EVP_MAX_IV_LENGTH]; PBE2PARAM *pbe2 = NULL; - alg_nid = EVP_CIPHER_type(cipher); + alg_nid = EVP_CIPHER_get_type(cipher); if (alg_nid == NID_undef) { ERR_raise(ERR_LIB_ASN1, ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER); goto err; @@ -66,7 +66,7 @@ X509_ALGOR *PKCS5_pbe2_set_iv_ex(const EVP_CIPHER *cipher, int iter, goto merr; /* Create random IV */ - ivlen = EVP_CIPHER_iv_length(cipher); + ivlen = EVP_CIPHER_get_iv_length(cipher); if (ivlen > 0) { if (aiv) memcpy(iv, aiv, ivlen); @@ -101,7 +101,7 @@ X509_ALGOR *PKCS5_pbe2_set_iv_ex(const EVP_CIPHER *cipher, int iter, /* If its RC2 then we'd better setup the key length */ if (alg_nid == NID_rc2_cbc) - keylen = EVP_CIPHER_key_length(cipher); + keylen = EVP_CIPHER_get_key_length(cipher); else keylen = -1; diff --git a/crypto/asn1/p5_scrypt.c b/crypto/asn1/p5_scrypt.c index e5a1ed59bc..a02190d0dc 100644 --- a/crypto/asn1/p5_scrypt.c +++ b/crypto/asn1/p5_scrypt.c @@ -60,7 +60,7 @@ X509_ALGOR *PKCS5_pbe2_set_scrypt(const EVP_CIPHER *cipher, goto err; } - alg_nid = EVP_CIPHER_type(cipher); + alg_nid = EVP_CIPHER_get_type(cipher); if (alg_nid == NID_undef) { ERR_raise(ERR_LIB_ASN1, ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER); goto err; @@ -79,10 +79,10 @@ X509_ALGOR *PKCS5_pbe2_set_scrypt(const EVP_CIPHER *cipher, goto merr; /* Create random IV */ - if (EVP_CIPHER_iv_length(cipher)) { + if (EVP_CIPHER_get_iv_length(cipher)) { if (aiv) - memcpy(iv, aiv, EVP_CIPHER_iv_length(cipher)); - else if (RAND_bytes(iv, EVP_CIPHER_iv_length(cipher)) <= 0) + memcpy(iv, aiv, EVP_CIPHER_get_iv_length(cipher)); + else if (RAND_bytes(iv, EVP_CIPHER_get_iv_length(cipher)) <= 0) goto err; } @@ -103,7 +103,7 @@ X509_ALGOR *PKCS5_pbe2_set_scrypt(const EVP_CIPHER *cipher, /* If its RC2 then we'd better setup the key length */ if (alg_nid == NID_rc2_cbc) - keylen = EVP_CIPHER_key_length(cipher); + keylen = EVP_CIPHER_get_key_length(cipher); /* Setup keyfunc */ @@ -234,7 +234,7 @@ int PKCS5_v2_scrypt_keyivgen_ex(EVP_CIPHER_CTX *ctx, const char *pass, goto err; } - t = EVP_CIPHER_CTX_key_length(ctx); + t = EVP_CIPHER_CTX_get_key_length(ctx); if (t < 0) { ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_KEY_LENGTH); goto err; diff --git a/crypto/asn1/x_algor.c b/crypto/asn1/x_algor.c index 7e7fd7301a..ff83ce4fef 100644 --- a/crypto/asn1/x_algor.c +++ b/crypto/asn1/x_algor.c @@ -80,7 +80,7 @@ void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md) else param_type = V_ASN1_NULL; - X509_ALGOR_set0(alg, OBJ_nid2obj(EVP_MD_type(md)), param_type, NULL); + X509_ALGOR_set0(alg, OBJ_nid2obj(EVP_MD_get_type(md)), param_type, NULL); } diff --git a/crypto/cmac/cmac.c b/crypto/cmac/cmac.c index 729d5a47c3..18c7fea3dd 100644 --- a/crypto/cmac/cmac.c +++ b/crypto/cmac/cmac.c @@ -96,7 +96,7 @@ int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in) if (in->nlast_block == -1) return 0; - if ((bl = EVP_CIPHER_CTX_block_size(in->cctx)) < 0) + if ((bl = EVP_CIPHER_CTX_get_block_size(in->cctx)) < 0) return 0; if (!EVP_CIPHER_CTX_copy(out->cctx, in->cctx)) return 0; @@ -120,7 +120,7 @@ int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, return 0; if (!EVP_EncryptInit_ex(ctx->cctx, NULL, NULL, NULL, zero_iv)) return 0; - memset(ctx->tbl, 0, EVP_CIPHER_CTX_block_size(ctx->cctx)); + memset(ctx->tbl, 0, EVP_CIPHER_CTX_get_block_size(ctx->cctx)); ctx->nlast_block = 0; return 1; } @@ -143,7 +143,7 @@ int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, return 0; if (!EVP_EncryptInit_ex(ctx->cctx, NULL, NULL, key, zero_iv)) return 0; - if ((bl = EVP_CIPHER_CTX_block_size(ctx->cctx)) < 0) + if ((bl = EVP_CIPHER_CTX_get_block_size(ctx->cctx)) < 0) return 0; if (EVP_Cipher(ctx->cctx, ctx->tbl, zero_iv, bl) <= 0) return 0; @@ -169,7 +169,7 @@ int CMAC_Update(CMAC_CTX *ctx, const void *in, size_t dlen) return 0; if (dlen == 0) return 1; - if ((bl = EVP_CIPHER_CTX_block_size(ctx->cctx)) < 0) + if ((bl = EVP_CIPHER_CTX_get_block_size(ctx->cctx)) < 0) return 0; /* Copy into partial block if we need to */ if (ctx->nlast_block > 0) { @@ -209,7 +209,7 @@ int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen) if (ctx->nlast_block == -1) return 0; - if ((bl = EVP_CIPHER_CTX_block_size(ctx->cctx)) < 0) + if ((bl = EVP_CIPHER_CTX_get_block_size(ctx->cctx)) < 0) return 0; if (poutlen != NULL) *poutlen = (size_t)bl; diff --git a/crypto/cmp/cmp_ctx.c b/crypto/cmp/cmp_ctx.c index d1f8f27e13..b0f676201e 100644 --- a/crypto/cmp/cmp_ctx.c +++ b/crypto/cmp/cmp_ctx.c @@ -1114,9 +1114,9 @@ int OSSL_CMP_CTX_get_option(const OSSL_CMP_CTX *ctx, int opt) case OSSL_CMP_OPT_POPO_METHOD: return ctx->popoMethod; case OSSL_CMP_OPT_DIGEST_ALGNID: - return EVP_MD_type(ctx->digest); + return EVP_MD_get_type(ctx->digest); case OSSL_CMP_OPT_OWF_ALGNID: - return EVP_MD_type(ctx->pbm_owf); + return EVP_MD_get_type(ctx->pbm_owf); case OSSL_CMP_OPT_MAC_ALGNID: return ctx->pbm_mac; case OSSL_CMP_OPT_KEEP_ALIVE: diff --git a/crypto/cmp/cmp_protect.c b/crypto/cmp/cmp_protect.c index 36a6597145..91a66f5d6e 100644 --- a/crypto/cmp/cmp_protect.c +++ b/crypto/cmp/cmp_protect.c @@ -195,7 +195,7 @@ static int set_pbmac_algor(const OSSL_CMP_CTX *ctx, X509_ALGOR **alg) return 0; pbm = OSSL_CRMF_pbmp_new(ctx->libctx, ctx->pbm_slen, - EVP_MD_type(ctx->pbm_owf), ctx->pbm_itercnt, + EVP_MD_get_type(ctx->pbm_owf), ctx->pbm_itercnt, ctx->pbm_mac); pbm_str = ASN1_STRING_new(); if (pbm == NULL || pbm_str == NULL) @@ -227,8 +227,8 @@ static int set_sig_algor(const OSSL_CMP_CTX *ctx, X509_ALGOR **alg) int nid = 0; ASN1_OBJECT *algo = NULL; - if (!OBJ_find_sigid_by_algs(&nid, EVP_MD_type(ctx->digest), - EVP_PKEY_id(ctx->pkey))) { + if (!OBJ_find_sigid_by_algs(&nid, EVP_MD_get_type(ctx->digest), + EVP_PKEY_get_id(ctx->pkey))) { ERR_raise(ERR_LIB_CMP, CMP_R_UNSUPPORTED_KEY_TYPE); return 0; } diff --git a/crypto/cms/cms_dh.c b/crypto/cms/cms_dh.c index 36714766d2..fe6289b205 100644 --- a/crypto/cms/cms_dh.c +++ b/crypto/cms/cms_dh.c @@ -53,7 +53,7 @@ static int dh_cms_set_peerkey(EVP_PKEY_CTX *pctx, * Pad to full p parameter size as that is checked by * EVP_PKEY_set1_encoded_public_key() */ - plen = EVP_PKEY_size(pk); + plen = EVP_PKEY_get_size(pk); if ((bnpub = ASN1_INTEGER_to_BN(public_key, NULL)) == NULL) goto err; if ((buf = OPENSSL_malloc(plen)) == NULL) @@ -122,19 +122,20 @@ static int dh_cms_set_shared_info(EVP_PKEY_CTX *pctx, CMS_RecipientInfo *ri) goto err; kekcipher = EVP_CIPHER_fetch(pctx->libctx, name, pctx->propquery); - if (kekcipher == NULL || EVP_CIPHER_mode(kekcipher) != EVP_CIPH_WRAP_MODE) + if (kekcipher == NULL + || EVP_CIPHER_get_mode(kekcipher) != EVP_CIPH_WRAP_MODE) goto err; if (!EVP_EncryptInit_ex(kekctx, kekcipher, NULL, NULL, NULL)) goto err; if (EVP_CIPHER_asn1_to_param(kekctx, kekalg->parameter) <= 0) goto err; - keylen = EVP_CIPHER_CTX_key_length(kekctx); + keylen = EVP_CIPHER_CTX_get_key_length(kekctx); if (EVP_PKEY_CTX_set_dh_kdf_outlen(pctx, keylen) <= 0) goto err; /* Use OBJ_nid2obj to ensure we use built in OID that isn't freed */ if (EVP_PKEY_CTX_set0_dh_kdf_oid(pctx, - OBJ_nid2obj(EVP_CIPHER_type(kekcipher))) + OBJ_nid2obj(EVP_CIPHER_get_type(kekcipher))) <= 0) goto err; @@ -258,7 +259,7 @@ static int dh_cms_encrypt(CMS_RecipientInfo *ri) kdf_md = EVP_sha1(); if (EVP_PKEY_CTX_set_dh_kdf_md(pctx, kdf_md) <= 0) goto err; - } else if (EVP_MD_type(kdf_md) != NID_sha1) + } else if (EVP_MD_get_type(kdf_md) != NID_sha1) /* Unsupported digest */ goto err; @@ -267,10 +268,10 @@ static int dh_cms_encrypt(CMS_RecipientInfo *ri) /* Get wrap NID */ ctx = CMS_RecipientInfo_kari_get0_ctx(ri); - wrap_nid = EVP_CIPHER_CTX_type(ctx); + wrap_nid = EVP_CIPHER_CTX_get_type(ctx); if (EVP_PKEY_CTX_set0_dh_kdf_oid(pctx, OBJ_nid2obj(wrap_nid)) <= 0) goto err; - keylen = EVP_CIPHER_CTX_key_length(ctx); + keylen = EVP_CIPHER_CTX_get_key_length(ctx); /* Package wrap algorithm in an AlgorithmIdentifier */ diff --git a/crypto/cms/cms_ec.c b/crypto/cms/cms_ec.c index 4994260af8..4cf208f5f2 100644 --- a/crypto/cms/cms_ec.c +++ b/crypto/cms/cms_ec.c @@ -182,14 +182,14 @@ static int ecdh_cms_set_shared_info(EVP_PKEY_CTX *pctx, CMS_RecipientInfo *ri) goto err; OBJ_obj2txt(name, sizeof(name), kekalg->algorithm, 0); kekcipher = EVP_CIPHER_fetch(pctx->libctx, name, pctx->propquery); - if (kekcipher == NULL || EVP_CIPHER_mode(kekcipher) != EVP_CIPH_WRAP_MODE) + if (kekcipher == NULL || EVP_CIPHER_get_mode(kekcipher) != EVP_CIPH_WRAP_MODE) goto err; if (!EVP_EncryptInit_ex(kekctx, kekcipher, NULL, NULL, NULL)) goto err; if (EVP_CIPHER_asn1_to_param(kekctx, kekalg->parameter) <= 0) goto err; - keylen = EVP_CIPHER_CTX_key_length(kekctx); + keylen = EVP_CIPHER_CTX_get_key_length(kekctx); if (EVP_PKEY_CTX_set_ecdh_kdf_outlen(pctx, keylen) <= 0) goto err; @@ -313,12 +313,12 @@ static int ecdh_cms_encrypt(CMS_RecipientInfo *ri) /* Lookup NID for KDF+cofactor+digest */ - if (!OBJ_find_sigid_by_algs(&kdf_nid, EVP_MD_type(kdf_md), ecdh_nid)) + if (!OBJ_find_sigid_by_algs(&kdf_nid, EVP_MD_get_type(kdf_md), ecdh_nid)) goto err; /* Get wrap NID */ ctx = CMS_RecipientInfo_kari_get0_ctx(ri); - wrap_nid = EVP_CIPHER_CTX_type(ctx); - keylen = EVP_CIPHER_CTX_key_length(ctx); + wrap_nid = EVP_CIPHER_CTX_get_type(ctx); + keylen = EVP_CIPHER_CTX_get_key_length(ctx); /* Package wrap algorithm in an AlgorithmIdentifier */ @@ -400,7 +400,7 @@ int ossl_cms_ecdsa_dsa_sign(CMS_SignerInfo *si, int verify) hnid = OBJ_obj2nid(alg1->algorithm); if (hnid == NID_undef) return -1; - if (!OBJ_find_sigid_by_algs(&snid, hnid, EVP_PKEY_id(pkey))) + if (!OBJ_find_sigid_by_algs(&snid, hnid, EVP_PKEY_get_id(pkey))) return -1; X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF, 0); } diff --git a/crypto/cms/cms_enc.c b/crypto/cms/cms_enc.c index 09dbb21275..a896148dd8 100644 --- a/crypto/cms/cms_enc.c +++ b/crypto/cms/cms_enc.c @@ -62,7 +62,8 @@ BIO *ossl_cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec, cipher = EVP_get_cipherbyobj(calg->algorithm); } if (cipher != NULL) { - fetched_ciph = EVP_CIPHER_fetch(libctx, EVP_CIPHER_name(cipher), propq); + fetched_ciph = EVP_CIPHER_fetch(libctx, EVP_CIPHER_get0_name(cipher), + propq); if (fetched_ciph != NULL) cipher = fetched_ciph; } @@ -79,9 +80,9 @@ BIO *ossl_cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec, } if (enc) { - calg->algorithm = OBJ_nid2obj(EVP_CIPHER_CTX_type(ctx)); + calg->algorithm = OBJ_nid2obj(EVP_CIPHER_CTX_get_type(ctx)); /* Generate a random IV if we need one */ - ivlen = EVP_CIPHER_CTX_iv_length(ctx); + ivlen = EVP_CIPHER_CTX_get_iv_length(ctx); if (ivlen > 0) { if (RAND_bytes_ex(libctx, iv, ivlen, 0) <= 0) goto err; @@ -92,7 +93,7 @@ BIO *ossl_cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec, ERR_raise(ERR_LIB_CMS, CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR); goto err; } - if ((EVP_CIPHER_flags(cipher) & EVP_CIPH_FLAG_AEAD_CIPHER)) { + if ((EVP_CIPHER_get_flags(cipher) & EVP_CIPH_FLAG_AEAD_CIPHER)) { piv = aparams.iv; if (ec->taglen > 0 && EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, @@ -102,7 +103,7 @@ BIO *ossl_cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec, } } } - len = EVP_CIPHER_CTX_key_length(ctx); + len = EVP_CIPHER_CTX_get_key_length(ctx); if (len <= 0) goto err; tkeylen = (size_t)len; @@ -160,10 +161,10 @@ BIO *ossl_cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec, ERR_raise(ERR_LIB_CMS, ERR_R_MALLOC_FAILURE); goto err; } - if ((EVP_CIPHER_flags(cipher) & EVP_CIPH_FLAG_AEAD_CIPHER)) { + if ((EVP_CIPHER_get_flags(cipher) & EVP_CIPH_FLAG_AEAD_CIPHER)) { memcpy(aparams.iv, piv, ivlen); aparams.iv_len = ivlen; - aparams.tag_len = EVP_CIPHER_CTX_tag_length(ctx); + aparams.tag_len = EVP_CIPHER_CTX_get_tag_length(ctx); if (aparams.tag_len <= 0) goto err; } diff --git a/crypto/cms/cms_env.c b/crypto/cms/cms_env.c index 29bbd0c36d..673880f6d9 100644 --- a/crypto/cms/cms_env.c +++ b/crypto/cms/cms_env.c @@ -557,7 +557,7 @@ static int cms_RecipientInfo_ktri_decrypt(CMS_ContentInfo *cms, } (void)ERR_pop_to_mark(); - fixlen = EVP_CIPHER_key_length(cipher); + fixlen = EVP_CIPHER_get_key_length(cipher); EVP_CIPHER_free(fetched_cipher); } @@ -1108,7 +1108,7 @@ static BIO *cms_EnvelopedData_Decryption_init_bio(CMS_ContentInfo *cms) * If the selected cipher supports unprotected attributes, * deal with it using special ctrl function */ - if ((EVP_CIPHER_flags(EVP_CIPHER_CTX_get0_cipher(ctx)) + if ((EVP_CIPHER_get_flags(EVP_CIPHER_CTX_get0_cipher(ctx)) & EVP_CIPH_FLAG_CIPHER_WITH_MAC) != 0 && EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_PROCESS_UNPROTECTED, 0, cms->d.envelopedData->unprotectedAttrs) <= 0) { @@ -1228,7 +1228,7 @@ int ossl_cms_EnvelopedData_final(CMS_ContentInfo *cms, BIO *chain) * If the selected cipher supports unprotected attributes, * deal with it using special ctrl function */ - if ((EVP_CIPHER_flags(EVP_CIPHER_CTX_get0_cipher(ctx)) + if ((EVP_CIPHER_get_flags(EVP_CIPHER_CTX_get0_cipher(ctx)) & EVP_CIPH_FLAG_CIPHER_WITH_MAC) != 0) { if (env->unprotectedAttrs == NULL) env->unprotectedAttrs = sk_X509_ATTRIBUTE_new_null(); @@ -1261,10 +1261,10 @@ int ossl_cms_AuthEnvelopedData_final(CMS_ContentInfo *cms, BIO *cmsbio) * The tag is set only for encryption. There is nothing to do for * decryption. */ - if (!EVP_CIPHER_CTX_encrypting(ctx)) + if (!EVP_CIPHER_CTX_is_encrypting(ctx)) return 1; - taglen = EVP_CIPHER_CTX_tag_length(ctx); + taglen = EVP_CIPHER_CTX_get_tag_length(ctx); if (taglen <= 0 || (tag = OPENSSL_malloc(taglen)) == NULL || EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, taglen, diff --git a/crypto/cms/cms_kari.c b/crypto/cms/cms_kari.c index 2fee4784da..47132fcbe8 100644 --- a/crypto/cms/cms_kari.c +++ b/crypto/cms/cms_kari.c @@ -218,7 +218,7 @@ static int cms_kek_cipher(unsigned char **pout, size_t *poutlen, unsigned char *out = NULL; int outlen; - keklen = EVP_CIPHER_CTX_key_length(kari->ctx); + keklen = EVP_CIPHER_CTX_get_key_length(kari->ctx); if (keklen > EVP_MAX_KEY_LENGTH) return 0; /* Derive KEK */ @@ -424,14 +424,14 @@ static int cms_wrap_init(CMS_KeyAgreeRecipientInfo *kari, /* If a suitable wrap algorithm is already set nothing to do */ kekcipher = EVP_CIPHER_CTX_get0_cipher(ctx); if (kekcipher != NULL) { - if (EVP_CIPHER_CTX_mode(ctx) != EVP_CIPH_WRAP_MODE) + if (EVP_CIPHER_CTX_get_mode(ctx) != EVP_CIPH_WRAP_MODE) return 0; return 1; } if (cipher == NULL) return 0; - keylen = EVP_CIPHER_key_length(cipher); - if ((EVP_CIPHER_flags(cipher) & EVP_CIPH_FLAG_GET_WRAP_CIPHER) != 0) { + keylen = EVP_CIPHER_get_key_length(cipher); + if ((EVP_CIPHER_get_flags(cipher) & EVP_CIPH_FLAG_GET_WRAP_CIPHER) != 0) { /* TODO: make this not get a method we can call directly */ ret = EVP_CIPHER_meth_get_ctrl(cipher)(NULL, EVP_CTRL_GET_WRAP_CIPHER, 0, &kekcipher); @@ -439,9 +439,9 @@ static int cms_wrap_init(CMS_KeyAgreeRecipientInfo *kari, return 0; if (kekcipher != NULL) { - if (EVP_CIPHER_mode(kekcipher) != EVP_CIPH_WRAP_MODE) + if (EVP_CIPHER_get_mode(kekcipher) != EVP_CIPH_WRAP_MODE) return 0; - kekcipher_name = EVP_CIPHER_name(kekcipher); + kekcipher_name = EVP_CIPHER_get0_name(kekcipher); goto enc; } } @@ -451,7 +451,7 @@ static int cms_wrap_init(CMS_KeyAgreeRecipientInfo *kari, * DES3 wrap otherwise use AES wrap similar to key size. */ #ifndef OPENSSL_NO_DES - if (EVP_CIPHER_type(cipher) == NID_des_ede3_cbc) + if (EVP_CIPHER_get_type(cipher) == NID_des_ede3_cbc) kekcipher_name = SN_id_smime_alg_CMS3DESwrap; else #endif diff --git a/crypto/cms/cms_lib.c b/crypto/cms/cms_lib.c index cfde2215bd..673a1f7ad5 100644 --- a/crypto/cms/cms_lib.c +++ b/crypto/cms/cms_lib.c @@ -455,12 +455,12 @@ int ossl_cms_DigestAlgorithm_find_ctx(EVP_MD_CTX *mctx, BIO *chain, return 0; } BIO_get_md_ctx(chain, &mtmp); - if (EVP_MD_CTX_type(mtmp) == nid + if (EVP_MD_CTX_get_type(mtmp) == nid /* * Workaround for broken implementations that use signature * algorithm OID instead of digest. */ - || EVP_MD_pkey_type(EVP_MD_CTX_get0_md(mtmp)) == nid) + || EVP_MD_get_pkey_type(EVP_MD_CTX_get0_md(mtmp)) == nid) return EVP_MD_CTX_copy_ex(mctx, mtmp); chain = BIO_next(chain); } diff --git a/crypto/cms/cms_pwri.c b/crypto/cms/cms_pwri.c index d521f8cc47..bc2b5179b7 100644 --- a/crypto/cms/cms_pwri.c +++ b/crypto/cms/cms_pwri.c @@ -91,7 +91,7 @@ CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms, goto err; } - ivlen = EVP_CIPHER_CTX_iv_length(ctx); + ivlen = EVP_CIPHER_CTX_get_iv_length(ctx); if (ivlen > 0) { if (RAND_bytes_ex(ossl_cms_ctx_get0_libctx(cms_ctx), iv, ivlen, 0) <= 0) @@ -111,7 +111,7 @@ CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms, } } - encalg->algorithm = OBJ_nid2obj(EVP_CIPHER_CTX_type(ctx)); + encalg->algorithm = OBJ_nid2obj(EVP_CIPHER_CTX_get_type(ctx)); EVP_CIPHER_CTX_free(ctx); ctx = NULL; @@ -182,7 +182,7 @@ static int kek_unwrap_key(unsigned char *out, size_t *outlen, const unsigned char *in, size_t inlen, EVP_CIPHER_CTX *ctx) { - size_t blocklen = EVP_CIPHER_CTX_block_size(ctx); + size_t blocklen = EVP_CIPHER_CTX_get_block_size(ctx); unsigned char *tmp; int outl, rv = 0; if (inlen < 2 * blocklen) { @@ -237,7 +237,7 @@ static int kek_wrap_key(unsigned char *out, size_t *outlen, const unsigned char *in, size_t inlen, EVP_CIPHER_CTX *ctx, const CMS_CTX *cms_ctx) { - size_t blocklen = EVP_CIPHER_CTX_block_size(ctx); + size_t blocklen = EVP_CIPHER_CTX_get_block_size(ctx); size_t olen; int dummy; /* diff --git a/crypto/cms/cms_sd.c b/crypto/cms/cms_sd.c index c0235b6962..4fbe09ca5f 100644 --- a/crypto/cms/cms_sd.c +++ b/crypto/cms/cms_sd.c @@ -469,7 +469,8 @@ CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms, goto err; if (EVP_PKEY_CTX_set_signature_md(si->pctx, md) <= 0) goto err; - } else if (EVP_DigestSignInit_ex(si->mctx, &si->pctx, EVP_MD_name(md), + } else if (EVP_DigestSignInit_ex(si->mctx, &si->pctx, + EVP_MD_get0_name(md), ossl_cms_ctx_get0_libctx(ctx), ossl_cms_ctx_get0_propq(ctx), pk, NULL) <= 0) { @@ -718,7 +719,7 @@ static int cms_SignerInfo_content_sign(CMS_ContentInfo *cms, pctx = si->pctx; if (!EVP_DigestFinal_ex(mctx, md, &mdlen)) goto err; - siglen = EVP_PKEY_size(si->pkey); + siglen = EVP_PKEY_get_size(si->pkey); sig = OPENSSL_malloc(siglen); if (sig == NULL) { ERR_raise(ERR_LIB_CMS, ERR_R_MALLOC_FAILURE); @@ -733,7 +734,7 @@ static int cms_SignerInfo_content_sign(CMS_ContentInfo *cms, unsigned char *sig; unsigned int siglen; - sig = OPENSSL_malloc(EVP_PKEY_size(si->pkey)); + sig = OPENSSL_malloc(EVP_PKEY_get_size(si->pkey)); if (sig == NULL) { ERR_raise(ERR_LIB_CMS, ERR_R_MALLOC_FAILURE); goto err; @@ -875,7 +876,7 @@ int CMS_SignerInfo_verify(CMS_SignerInfo *si) goto err; } mctx = si->mctx; - if (EVP_DigestVerifyInit_ex(mctx, &si->pctx, EVP_MD_name(md), libctx, + if (EVP_DigestVerifyInit_ex(mctx, &si->pctx, EVP_MD_get0_name(md), libctx, propq, si->pkey, NULL) <= 0) goto err; diff --git a/crypto/cms/cms_smime.c b/crypto/cms/cms_smime.c index d48bbcb6c7..0c3bbd03c3 100644 --- a/crypto/cms/cms_smime.c +++ b/crypto/cms/cms_smime.c @@ -630,7 +630,7 @@ CMS_ContentInfo *CMS_encrypt_ex(STACK_OF(X509) *certs, BIO *data, X509 *recip; - cms = (EVP_CIPHER_flags(cipher) & EVP_CIPH_FLAG_AEAD_CIPHER) + cms = (EVP_CIPHER_get_flags(cipher) & EVP_CIPH_FLAG_AEAD_CIPHER) ? CMS_AuthEnvelopedData_create_ex(cipher, libctx, propq) : CMS_EnvelopedData_create_ex(cipher, libctx, propq); if (cms == NULL) diff --git a/crypto/core_namemap.c b/crypto/core_namemap.c index 5bb0f09ec7..415df3d839 100644 --- a/crypto/core_namemap.c +++ b/crypto/core_namemap.c @@ -409,14 +409,14 @@ static void get_legacy_cipher_names(const OBJ_NAME *on, void *arg) { const EVP_CIPHER *cipher = (void *)OBJ_NAME_get(on->name, on->type); - get_legacy_evp_names(NID_undef, EVP_CIPHER_type(cipher), NULL, arg); + get_legacy_evp_names(NID_undef, EVP_CIPHER_get_type(cipher), NULL, arg); } static void get_legacy_md_names(const OBJ_NAME *on, void *arg) { const EVP_MD *md = (void *)OBJ_NAME_get(on->name, on->type); - get_legacy_evp_names(0, EVP_MD_type(md), NULL, arg); + get_legacy_evp_names(0, EVP_MD_get_type(md), NULL, arg); } static void get_legacy_pkey_meth_names(const EVP_PKEY_ASN1_METHOD *ameth, diff --git a/crypto/crmf/crmf_lib.c b/crypto/crmf/crmf_lib.c index e26637d0a4..f402086823 100644 --- a/crypto/crmf/crmf_lib.c +++ b/crypto/crmf/crmf_lib.c @@ -621,7 +621,7 @@ X509 } (void)ERR_pop_to_mark(); - cikeysize = EVP_CIPHER_key_length(cipher); + cikeysize = EVP_CIPHER_get_key_length(cipher); /* first the symmetric key needs to be decrypted */ pkctx = EVP_PKEY_CTX_new_from_pkey(libctx, pkey, propq); if (pkctx != NULL && EVP_PKEY_decrypt_init(pkctx)) { @@ -646,11 +646,11 @@ X509 } else { goto end; } - if ((iv = OPENSSL_malloc(EVP_CIPHER_iv_length(cipher))) == NULL) + if ((iv = OPENSSL_malloc(EVP_CIPHER_get_iv_length(cipher))) == NULL) goto end; if (ASN1_TYPE_get_octetstring(ecert->symmAlg->parameter, iv, - EVP_CIPHER_iv_length(cipher)) - != EVP_CIPHER_iv_length(cipher)) { + EVP_CIPHER_get_iv_length(cipher)) + != EVP_CIPHER_get_iv_length(cipher)) { ERR_raise(ERR_LIB_CRMF, CRMF_R_MALFORMED_IV); goto end; } @@ -660,7 +660,7 @@ X509 * keep the original pointer in outbuf so the memory can be freed later */ if ((p = outbuf = OPENSSL_malloc(ecert->encValue->length + - EVP_CIPHER_block_size(cipher))) == NULL + EVP_CIPHER_get_block_size(cipher))) == NULL || (evp_ctx = EVP_CIPHER_CTX_new()) == NULL) goto end; EVP_CIPHER_CTX_set_padding(evp_ctx, 0); diff --git a/crypto/dh/dh_kdf.c b/crypto/dh/dh_kdf.c index ecc37fa92a..7a234b8fb1 100644 --- a/crypto/dh/dh_kdf.c +++ b/crypto/dh/dh_kdf.c @@ -36,7 +36,7 @@ int ossl_dh_kdf_X9_42_asn1(unsigned char *out, size_t outlen, EVP_KDF_CTX *kctx = NULL; EVP_KDF *kdf = NULL; OSSL_PARAM params[5], *p = params; - const char *mdname = EVP_MD_name(md); + const char *mdname = EVP_MD_get0_name(md); kdf = EVP_KDF_fetch(libctx, OSSL_KDF_NAME_X942KDF_ASN1, propq); kctx = EVP_KDF_CTX_new(kdf); @@ -67,7 +67,7 @@ int DH_KDF_X9_42(unsigned char *out, size_t outlen, const unsigned char *ukm, size_t ukmlen, const EVP_MD *md) { char key_alg[OSSL_MAX_NAME_SIZE]; - const OSSL_PROVIDER *prov = EVP_MD_provider(md); + const OSSL_PROVIDER *prov = EVP_MD_get0_provider(md); OSSL_LIB_CTX *libctx = ossl_provider_libctx(prov); if (!OBJ_obj2txt(key_alg, sizeof(key_alg), key_oid, 0)) diff --git a/crypto/dh/dh_pmeth.c b/crypto/dh/dh_pmeth.c index 78d46aba22..f742bf75cf 100644 --- a/crypto/dh/dh_pmeth.c +++ b/crypto/dh/dh_pmeth.c @@ -296,7 +296,7 @@ static DH *ffc_params_generate(OSSL_LIB_CTX *libctx, DH_PKEY_CTX *dctx, } if (dctx->md != NULL) - ossl_ffc_set_digest(&ret->params, EVP_MD_name(dctx->md), NULL); + ossl_ffc_set_digest(&ret->params, EVP_MD_get0_name(dctx->md), NULL); # ifndef FIPS_MODULE if (dctx->paramgen_type == DH_PARAMGEN_TYPE_FIPS_186_2) diff --git a/crypto/dsa/dsa_pmeth.c b/crypto/dsa/dsa_pmeth.c index d9fdc90d25..ffb19da580 100644 --- a/crypto/dsa/dsa_pmeth.c +++ b/crypto/dsa/dsa_pmeth.c @@ -83,7 +83,7 @@ static int pkey_dsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, DSA_PKEY_CTX *dctx = ctx->data; DSA *dsa = ctx->pkey->pkey.dsa; - if (dctx->md != NULL && tbslen != (size_t)EVP_MD_size(dctx->md)) + if (dctx->md != NULL && tbslen != (size_t)EVP_MD_get_size(dctx->md)) return 0; ret = DSA_sign(0, tbs, tbslen, sig, &sltmp, dsa); @@ -102,7 +102,7 @@ static int pkey_dsa_verify(EVP_PKEY_CTX *ctx, DSA_PKEY_CTX *dctx = ctx->data; DSA *dsa = ctx->pkey->pkey.dsa; - if (dctx->md != NULL && tbslen != (size_t)EVP_MD_size(dctx->md)) + if (dctx->md != NULL && tbslen != (size_t)EVP_MD_get_size(dctx->md)) return 0; ret = DSA_verify(0, tbs, tbslen, sig, siglen, dsa); @@ -128,9 +128,9 @@ static int pkey_dsa_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) return 1; case EVP_PKEY_CTRL_DSA_PARAMGEN_MD: - if (EVP_MD_type((const EVP_MD *)p2) != NID_sha1 && - EVP_MD_type((const EVP_MD *)p2) != NID_sha224 && - EVP_MD_type((const EVP_MD *)p2) != NID_sha256) { + if (EVP_MD_get_type((const EVP_MD *)p2) != NID_sha1 && + EVP_MD_get_type((const EVP_MD *)p2) != NID_sha224 && + EVP_MD_get_type((const EVP_MD *)p2) != NID_sha256) { ERR_raise(ERR_LIB_DSA, DSA_R_INVALID_DIGEST_TYPE); return 0; } @@ -138,17 +138,17 @@ static int pkey_dsa_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) return 1; case EVP_PKEY_CTRL_MD: - if (EVP_MD_type((const EVP_MD *)p2) != NID_sha1 && - EVP_MD_type((const EVP_MD *)p2) != NID_dsa && - EVP_MD_type((const EVP_MD *)p2) != NID_dsaWithSHA && - EVP_MD_type((const EVP_MD *)p2) != NID_sha224 && - EVP_MD_type((const EVP_MD *)p2) != NID_sha256 && - EVP_MD_type((const EVP_MD *)p2) != NID_sha384 && - EVP_MD_type((const EVP_MD *)p2) != NID_sha512 && - EVP_MD_type((const EVP_MD *)p2) != NID_sha3_224 && - EVP_MD_type((const EVP_MD *)p2) != NID_sha3_256 && - EVP_MD_type((const EVP_MD *)p2) != NID_sha3_384 && - EVP_MD_type((const EVP_MD *)p2) != NID_sha3_512) { + if (EVP_MD_get_type((const EVP_MD *)p2) != NID_sha1 && + EVP_MD_get_type((const EVP_MD *)p2) != NID_dsa && + EVP_MD_get_type((const EVP_MD *)p2) != NID_dsaWithSHA && + EVP_MD_get_type((const EVP_MD *)p2) != NID_sha224 && + EVP_MD_get_type((const EVP_MD *)p2) != NID_sha256 && + EVP_MD_get_type((const EVP_MD *)p2) != NID_sha384 && + EVP_MD_get_type((const EVP_MD *)p2) != NID_sha512 && + EVP_MD_get_type((const EVP_MD *)p2) != NID_sha3_224 && + EVP_MD_get_type((const EVP_MD *)p2) != NID_sha3_256 && + EVP_MD_get_type((const EVP_MD *)p2) != NID_sha3_384 && + EVP_MD_get_type((const EVP_MD *)p2) != NID_sha3_512) { ERR_raise(ERR_LIB_DSA, DSA_R_INVALID_DIGEST_TYPE); return 0; } @@ -217,7 +217,7 @@ static int pkey_dsa_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) return 0; } if (dctx->md != NULL) - ossl_ffc_set_digest(&dsa->params, EVP_MD_name(dctx->md), NULL); + ossl_ffc_set_digest(&dsa->params, EVP_MD_get0_name(dctx->md), NULL); ret = ossl_ffc_params_FIPS186_4_generate(NULL, &dsa->params, FFC_PARAM_TYPE_DSA, dctx->nbits, diff --git a/crypto/ec/ec_ameth.c b/crypto/ec/ec_ameth.c index 574ad51581..c7fbaeab5e 100644 --- a/crypto/ec/ec_ameth.c +++ b/crypto/ec/ec_ameth.c @@ -405,7 +405,7 @@ static int ec_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) { switch (op) { case ASN1_PKEY_CTRL_DEFAULT_MD_NID: - if (EVP_PKEY_id(pkey) == EVP_PKEY_SM2) { + if (EVP_PKEY_get_id(pkey) == EVP_PKEY_SM2) { /* For SM2, the only valid digest-alg is SM3 */ *(int *)arg2 = NID_sm3; return 2; /* Make it mandatory */ diff --git a/crypto/ec/ec_pmeth.c b/crypto/ec/ec_pmeth.c index e4f3549d30..ce658e14ca 100644 --- a/crypto/ec/ec_pmeth.c +++ b/crypto/ec/ec_pmeth.c @@ -126,7 +126,7 @@ static int pkey_ec_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, return 0; } - type = (dctx->md != NULL) ? EVP_MD_type(dctx->md) : NID_sha1; + type = (dctx->md != NULL) ? EVP_MD_get_type(dctx->md) : NID_sha1; ret = ECDSA_sign(type, tbs, tbslen, sig, &sltmp, ec); @@ -145,7 +145,7 @@ static int pkey_ec_verify(EVP_PKEY_CTX *ctx, EC_KEY *ec = ctx->pkey->pkey.ec; if (dctx->md) - type = EVP_MD_type(dctx->md); + type = EVP_MD_get_type(dctx->md); else type = NID_sha1; @@ -335,17 +335,17 @@ static int pkey_ec_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) return dctx->kdf_ukmlen; case EVP_PKEY_CTRL_MD: - if (EVP_MD_type((const EVP_MD *)p2) != NID_sha1 && - EVP_MD_type((const EVP_MD *)p2) != NID_ecdsa_with_SHA1 && - EVP_MD_type((const EVP_MD *)p2) != NID_sha224 && - EVP_MD_type((const EVP_MD *)p2) != NID_sha256 && - EVP_MD_type((const EVP_MD *)p2) != NID_sha384 && - EVP_MD_type((const EVP_MD *)p2) != NID_sha512 && - EVP_MD_type((const EVP_MD *)p2) != NID_sha3_224 && - EVP_MD_type((const EVP_MD *)p2) != NID_sha3_256 && - EVP_MD_type((const EVP_MD *)p2) != NID_sha3_384 && - EVP_MD_type((const EVP_MD *)p2) != NID_sha3_512 && - EVP_MD_type((const EVP_MD *)p2) != NID_sm3) { + if (EVP_MD_get_type((const EVP_MD *)p2) != NID_sha1 && + EVP_MD_get_type((const EVP_MD *)p2) != NID_ecdsa_with_SHA1 && + EVP_MD_get_type((const EVP_MD *)p2) != NID_sha224 && + EVP_MD_get_type((const EVP_MD *)p2) != NID_sha256 && + EVP_MD_get_type((const EVP_MD *)p2) != NID_sha384 && + EVP_MD_get_type((const EVP_MD *)p2) != NID_sha512 && + EVP_MD_get_type((const EVP_MD *)p2) != NID_sha3_224 && + EVP_MD_get_type((const EVP_MD *)p2) != NID_sha3_256 && + EVP_MD_get_type((const EVP_MD *)p2) != NID_sha3_384 && + EVP_MD_get_type((const EVP_MD *)p2) != NID_sha3_512 && + EVP_MD_get_type((const EVP_MD *)p2) != NID_sm3) { ERR_raise(ERR_LIB_EC, EC_R_INVALID_DIGEST_TYPE); return 0; } diff --git a/crypto/ec/ecdh_kdf.c b/crypto/ec/ecdh_kdf.c index b8858cb3ef..de63bf8500 100644 --- a/crypto/ec/ecdh_kdf.c +++ b/crypto/ec/ecdh_kdf.c @@ -30,7 +30,7 @@ int ossl_ecdh_kdf_X9_63(unsigned char *out, size_t outlen, int ret = 0; EVP_KDF_CTX *kctx = NULL; OSSL_PARAM params[4], *p = params; - const char *mdname = EVP_MD_name(md); + const char *mdname = EVP_MD_get0_name(md); EVP_KDF *kdf = EVP_KDF_fetch(libctx, OSSL_KDF_NAME_X963KDF, propq); if ((kctx = EVP_KDF_CTX_new(kdf)) != NULL) { diff --git a/crypto/ec/ecx_meth.c b/crypto/ec/ecx_meth.c index 9dd347d670..c4bbb0a535 100644 --- a/crypto/ec/ecx_meth.c +++ b/crypto/ec/ecx_meth.c @@ -265,7 +265,7 @@ static int ecx_set_priv_key(EVP_PKEY *pkey, const unsigned char *priv, ECX_KEY *ecx = NULL; if (pkey->keymgmt != NULL) - libctx = ossl_provider_libctx(EVP_KEYMGMT_provider(pkey->keymgmt)); + libctx = ossl_provider_libctx(EVP_KEYMGMT_get0_provider(pkey->keymgmt)); ecx = ossl_ecx_key_op(NULL, priv, len, pkey->ameth->pkey_id, KEY_OP_PRIVATE, libctx, NULL); @@ -283,7 +283,7 @@ static int ecx_set_pub_key(EVP_PKEY *pkey, const unsigned char *pub, size_t len) ECX_KEY *ecx = NULL; if (pkey->keymgmt != NULL) - libctx = ossl_provider_libctx(EVP_KEYMGMT_provider(pkey->keymgmt)); + libctx = ossl_provider_libctx(EVP_KEYMGMT_get0_provider(pkey->keymgmt)); ecx = ossl_ecx_key_op(NULL, pub, len, pkey->ameth->pkey_id, KEY_OP_PUBLIC, libctx, NULL); @@ -806,7 +806,7 @@ static int pkey_ecd_digestsign25519(EVP_MD_CTX *ctx, unsigned char *sig, size_t *siglen, const unsigned char *tbs, size_t tbslen) { - const ECX_KEY *edkey = EVP_MD_CTX_pkey_ctx(ctx)->pkey->pkey.ecx; + const ECX_KEY *edkey = EVP_MD_CTX_get_pkey_ctx(ctx)->pkey->pkey.ecx; if (sig == NULL) { *siglen = ED25519_SIGSIZE; @@ -828,7 +828,7 @@ static int pkey_ecd_digestsign448(EVP_MD_CTX *ctx, unsigned char *sig, size_t *siglen, const unsigned char *tbs, size_t tbslen) { - const ECX_KEY *edkey = EVP_MD_CTX_pkey_ctx(ctx)->pkey->pkey.ecx; + const ECX_KEY *edkey = EVP_MD_CTX_get_pkey_ctx(ctx)->pkey->pkey.ecx; if (sig == NULL) { *siglen = ED448_SIGSIZE; @@ -850,7 +850,7 @@ static int pkey_ecd_digestverify25519(EVP_MD_CTX *ctx, const unsigned char *sig, size_t siglen, const unsigned char *tbs, size_t tbslen) { - const ECX_KEY *edkey = EVP_MD_CTX_pkey_ctx(ctx)->pkey->pkey.ecx; + const ECX_KEY *edkey = EVP_MD_CTX_get_pkey_ctx(ctx)->pkey->pkey.ecx; if (siglen != ED25519_SIGSIZE) return 0; @@ -863,7 +863,7 @@ static int pkey_ecd_digestverify448(EVP_MD_CTX *ctx, const unsigned char *sig, size_t siglen, const unsigned char *tbs, size_t tbslen) { - const ECX_KEY *edkey = EVP_MD_CTX_pkey_ctx(ctx)->pkey->pkey.ecx; + const ECX_KEY *edkey = EVP_MD_CTX_get_pkey_ctx(ctx)->pkey->pkey.ecx; if (siglen != ED448_SIGSIZE) return 0; @@ -1177,7 +1177,7 @@ static int s390x_pkey_ecd_digestsign25519(EVP_MD_CTX *ctx, } ed25519; unsigned long long buff[512]; } param; - const ECX_KEY *edkey = EVP_MD_CTX_pkey_ctx(ctx)->pkey->pkey.ecx; + const ECX_KEY *edkey = EVP_MD_CTX_get_pkey_ctx(ctx)->pkey->pkey.ecx; int rc; if (sig == NULL) { @@ -1217,7 +1217,7 @@ static int s390x_pkey_ecd_digestsign448(EVP_MD_CTX *ctx, } ed448; unsigned long long buff[512]; } param; - const ECX_KEY *edkey = EVP_MD_CTX_pkey_ctx(ctx)->pkey->pkey.ecx; + const ECX_KEY *edkey = EVP_MD_CTX_get_pkey_ctx(ctx)->pkey->pkey.ecx; int rc; if (sig == NULL) { @@ -1260,7 +1260,7 @@ static int s390x_pkey_ecd_digestverify25519(EVP_MD_CTX *ctx, } ed25519; unsigned long long buff[512]; } param; - const ECX_KEY *edkey = EVP_MD_CTX_pkey_ctx(ctx)->pkey->pkey.ecx; + const ECX_KEY *edkey = EVP_MD_CTX_get_pkey_ctx(ctx)->pkey->pkey.ecx; if (siglen != ED25519_SIGSIZE) return 0; @@ -1287,7 +1287,7 @@ static int s390x_pkey_ecd_digestverify448(EVP_MD_CTX *ctx, } ed448; unsigned long long buff[512]; } param; - const ECX_KEY *edkey = EVP_MD_CTX_pkey_ctx(ctx)->pkey->pkey.ecx; + const ECX_KEY *edkey = EVP_MD_CTX_get_pkey_ctx(ctx)->pkey->pkey.ecx; if (siglen != ED448_SIGSIZE) return 0; diff --git a/crypto/encode_decode/decoder_lib.c b/crypto/encode_decode/decoder_lib.c index 022c1d56e2..ddfd90aae5 100644 --- a/crypto/encode_decode/decoder_lib.c +++ b/crypto/encode_decode/decoder_lib.c @@ -300,7 +300,7 @@ int OSSL_DECODER_CTX_add_decoder(OSSL_DECODER_CTX *ctx, OSSL_DECODER *decoder) return 0; } - prov = OSSL_DECODER_provider(decoder); + prov = OSSL_DECODER_get0_provider(decoder); provctx = OSSL_PROVIDER_get0_provider_ctx(prov); if ((decoderctx = decoder->newctx(provctx)) == NULL diff --git a/crypto/encode_decode/decoder_meth.c b/crypto/encode_decode/decoder_meth.c index 48a52c9612..708b319314 100644 --- a/crypto/encode_decode/decoder_meth.c +++ b/crypto/encode_decode/decoder_meth.c @@ -401,7 +401,7 @@ OSSL_DECODER *ossl_decoder_fetch_by_number(OSSL_LIB_CTX *libctx, int id, * Library of basic method functions */ -const OSSL_PROVIDER *OSSL_DECODER_provider(const OSSL_DECODER *decoder) +const OSSL_PROVIDER *OSSL_DECODER_get0_provider(const OSSL_DECODER *decoder) { if (!ossl_assert(decoder != NULL)) { ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_PASSED_NULL_PARAMETER); @@ -411,7 +411,7 @@ const OSSL_PROVIDER *OSSL_DECODER_provider(const OSSL_DECODER *decoder) return decoder->base.prov; } -const char *OSSL_DECODER_properties(const OSSL_DECODER *decoder) +const char *OSSL_DECODER_get0_properties(const OSSL_DECODER *decoder) { if (!ossl_assert(decoder != NULL)) { ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_PASSED_NULL_PARAMETER); @@ -421,7 +421,7 @@ const char *OSSL_DECODER_properties(const OSSL_DECODER *decoder) return decoder->base.propdef; } -int OSSL_DECODER_number(const OSSL_DECODER *decoder) +int OSSL_DECODER_get_number(const OSSL_DECODER *decoder) { if (!ossl_assert(decoder != NULL)) { ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_PASSED_NULL_PARAMETER); @@ -431,12 +431,12 @@ int OSSL_DECODER_number(const OSSL_DECODER *decoder) return decoder->base.id; } -const char *OSSL_DECODER_name(const OSSL_DECODER *decoder) +const char *OSSL_DECODER_get0_name(const OSSL_DECODER *decoder) { return decoder->base.name; } -const char *OSSL_DECODER_description(const OSSL_DECODER *decoder) +const char *OSSL_DECODER_get0_description(const OSSL_DECODER *decoder) { return decoder->base.description; } @@ -511,7 +511,7 @@ const OSSL_PARAM * OSSL_DECODER_gettable_params(OSSL_DECODER *decoder) { if (decoder != NULL && decoder->gettable_params != NULL) { - void *provctx = ossl_provider_ctx(OSSL_DECODER_provider(decoder)); + void *provctx = ossl_provider_ctx(OSSL_DECODER_get0_provider(decoder)); return decoder->gettable_params(provctx); } @@ -529,7 +529,7 @@ const OSSL_PARAM * OSSL_DECODER_settable_ctx_params(OSSL_DECODER *decoder) { if (decoder != NULL && decoder->settable_ctx_params != NULL) { - void *provctx = ossl_provider_ctx(OSSL_DECODER_provider(decoder)); + void *provctx = ossl_provider_ctx(OSSL_DECODER_get0_provider(decoder)); return decoder->settable_ctx_params(provctx); } diff --git a/crypto/encode_decode/decoder_pkey.c b/crypto/encode_decode/decoder_pkey.c index 0bb068ae68..c9ccb2200a 100644 --- a/crypto/encode_decode/decoder_pkey.c +++ b/crypto/encode_decode/decoder_pkey.c @@ -108,8 +108,8 @@ static int decoder_construct_pkey(OSSL_DECODER_INSTANCE *decoder_inst, if (keymgmt != NULL) { EVP_PKEY *pkey = NULL; void *keydata = NULL; - const OSSL_PROVIDER *keymgmt_prov = EVP_KEYMGMT_provider(keymgmt); - const OSSL_PROVIDER *decoder_prov = OSSL_DECODER_provider(decoder); + const OSSL_PROVIDER *keymgmt_prov = EVP_KEYMGMT_get0_provider(keymgmt); + const OSSL_PROVIDER *decoder_prov = OSSL_DECODER_get0_provider(decoder); /* * If the EVP_KEYMGMT and the OSSL_DECODER are from the @@ -226,7 +226,7 @@ static void collect_decoder(OSSL_DECODER *decoder, void *arg) { struct collect_decoder_data_st *data = arg; size_t i, end_i; - const OSSL_PROVIDER *prov = OSSL_DECODER_provider(decoder); + const OSSL_PROVIDER *prov = OSSL_DECODER_get0_provider(decoder); void *provctx = OSSL_PROVIDER_get0_provider_ctx(prov); if (data->error_occurred) diff --git a/crypto/encode_decode/encoder_lib.c b/crypto/encode_decode/encoder_lib.c index f074c9fb60..4481773610 100644 --- a/crypto/encode_decode/encoder_lib.c +++ b/crypto/encode_decode/encoder_lib.c @@ -279,7 +279,7 @@ int OSSL_ENCODER_CTX_add_encoder(OSSL_ENCODER_CTX *ctx, OSSL_ENCODER *encoder) return 0; } - prov = OSSL_ENCODER_provider(encoder); + prov = OSSL_ENCODER_get0_provider(encoder); provctx = OSSL_PROVIDER_get0_provider_ctx(prov); if ((encoderctx = encoder->newctx(provctx)) == NULL diff --git a/crypto/encode_decode/encoder_meth.c b/crypto/encode_decode/encoder_meth.c index 3b2bc2d83e..33655c12a6 100644 --- a/crypto/encode_decode/encoder_meth.c +++ b/crypto/encode_decode/encoder_meth.c @@ -413,7 +413,7 @@ OSSL_ENCODER *ossl_encoder_fetch_by_number(OSSL_LIB_CTX *libctx, int id, * Library of basic method functions */ -const OSSL_PROVIDER *OSSL_ENCODER_provider(const OSSL_ENCODER *encoder) +const OSSL_PROVIDER *OSSL_ENCODER_get0_provider(const OSSL_ENCODER *encoder) { if (!ossl_assert(encoder != NULL)) { ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_PASSED_NULL_PARAMETER); @@ -423,7 +423,7 @@ const OSSL_PROVIDER *OSSL_ENCODER_provider(const OSSL_ENCODER *encoder) return encoder->base.prov; } -const char *OSSL_ENCODER_properties(const OSSL_ENCODER *encoder) +const char *OSSL_ENCODER_get0_properties(const OSSL_ENCODER *encoder) { if (!ossl_assert(encoder != NULL)) { ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_PASSED_NULL_PARAMETER); @@ -433,7 +433,7 @@ const char *OSSL_ENCODER_properties(const OSSL_ENCODER *encoder) return encoder->base.propdef; } -int OSSL_ENCODER_number(const OSSL_ENCODER *encoder) +int OSSL_ENCODER_get_number(const OSSL_ENCODER *encoder) { if (!ossl_assert(encoder != NULL)) { ERR_raise(ERR_LIB_OSSL_ENCODER, ERR_R_PASSED_NULL_PARAMETER); @@ -443,12 +443,12 @@ int OSSL_ENCODER_number(const OSSL_ENCODER *encoder) return encoder->base.id; } -const char *OSSL_ENCODER_name(const OSSL_ENCODER *encoder) +const char *OSSL_ENCODER_get0_name(const OSSL_ENCODER *encoder) { return encoder->base.name; } -const char *OSSL_ENCODER_description(const OSSL_ENCODER *encoder) +const char *OSSL_ENCODER_get0_description(const OSSL_ENCODER *encoder) { return encoder->base.description; } @@ -528,7 +528,7 @@ const OSSL_PARAM * OSSL_ENCODER_gettable_params(OSSL_ENCODER *encoder) { if (encoder != NULL && encoder->gettable_params != NULL) { - void *provctx = ossl_provider_ctx(OSSL_ENCODER_provider(encoder)); + void *provctx = ossl_provider_ctx(OSSL_ENCODER_get0_provider(encoder)); return encoder->gettable_params(provctx); } @@ -545,7 +545,7 @@ int OSSL_ENCODER_get_params(OSSL_ENCODER *encoder, OSSL_PARAM params[]) const OSSL_PARAM *OSSL_ENCODER_settable_ctx_params(OSSL_ENCODER *encoder) { if (encoder != NULL && encoder->settable_ctx_params != NULL) { - void *provctx = ossl_provider_ctx(OSSL_ENCODER_provider(encoder)); + void *provctx = ossl_provider_ctx(OSSL_ENCODER_get0_provider(encoder)); return encoder->settable_ctx_params(provctx); } diff --git a/crypto/encode_decode/encoder_pkey.c b/crypto/encode_decode/encoder_pkey.c index 3bb0702e43..4a1ffb3b3e 100644 --- a/crypto/encode_decode/encoder_pkey.c +++ b/crypto/encode_decode/encoder_pkey.c @@ -98,7 +98,7 @@ static void collect_encoder(OSSL_ENCODER *encoder, void *arg) end_i = sk_OPENSSL_CSTRING_num(data->names); for (i = 0; i < end_i; i++) { const char *name = sk_OPENSSL_CSTRING_value(data->names, i); - const OSSL_PROVIDER *prov = OSSL_ENCODER_provider(encoder); + const OSSL_PROVIDER *prov = OSSL_ENCODER_get0_provider(encoder); void *provctx = OSSL_PROVIDER_get0_provider_ctx(prov); if (!OSSL_ENCODER_is_a(encoder, name) @@ -173,8 +173,8 @@ encoder_construct_pkey(OSSL_ENCODER_INSTANCE *encoder_inst, void *arg) OSSL_ENCODER *encoder = OSSL_ENCODER_INSTANCE_get_encoder(encoder_inst); const EVP_PKEY *pk = data->pk; - const OSSL_PROVIDER *k_prov = EVP_KEYMGMT_provider(pk->keymgmt); - const OSSL_PROVIDER *e_prov = OSSL_ENCODER_provider(encoder); + const OSSL_PROVIDER *k_prov = EVP_KEYMGMT_get0_provider(pk->keymgmt); + const OSSL_PROVIDER *e_prov = OSSL_ENCODER_get0_provider(encoder); if (k_prov != e_prov) { data->encoder_inst = encoder_inst; @@ -226,7 +226,7 @@ static int ossl_encoder_ctx_setup_for_pkey(OSSL_ENCODER_CTX *ctx, } if (evp_pkey_is_provided(pkey)) { - prov = EVP_KEYMGMT_provider(pkey->keymgmt); + prov = EVP_KEYMGMT_get0_provider(pkey->keymgmt); libctx = ossl_provider_libctx(prov); } @@ -312,7 +312,7 @@ OSSL_ENCODER_CTX *OSSL_ENCODER_CTX_new_for_pkey(const EVP_PKEY *pkey, } if (evp_pkey_is_provided(pkey)) { - const OSSL_PROVIDER *prov = EVP_KEYMGMT_provider(pkey->keymgmt); + const OSSL_PROVIDER *prov = EVP_KEYMGMT_get0_provider(pkey->keymgmt); libctx = ossl_provider_libctx(prov); } diff --git a/crypto/engine/eng_openssl.c b/crypto/engine/eng_openssl.c index 3ca95abc13..648d333dbc 100644 --- a/crypto/engine/eng_openssl.c +++ b/crypto/engine/eng_openssl.c @@ -205,7 +205,7 @@ typedef struct { static int test_rc4_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc) { - const int n = EVP_CIPHER_CTX_key_length(ctx); + const int n = EVP_CIPHER_CTX_get_key_length(ctx); # ifdef TEST_ENG_OPENSSL_RC4_P_INIT fprintf(stderr, "(TEST_ENG_OPENSSL_RC4) test_init_key() called\n"); @@ -285,9 +285,9 @@ static int test_cipher_nids(const int **nids) if (!init) { const EVP_CIPHER *cipher; if ((cipher = test_r4_cipher()) != NULL) - cipher_nids[pos++] = EVP_CIPHER_nid(cipher); + cipher_nids[pos++] = EVP_CIPHER_get_nid(cipher); if ((cipher = test_r4_40_cipher()) != NULL) - cipher_nids[pos++] = EVP_CIPHER_nid(cipher); + cipher_nids[pos++] = EVP_CIPHER_get_nid(cipher); cipher_nids[pos] = 0; init = 1; } @@ -328,7 +328,7 @@ static int test_sha1_init(EVP_MD_CTX *ctx) # ifdef TEST_ENG_OPENSSL_SHA_P_INIT fprintf(stderr, "(TEST_ENG_OPENSSL_SHA) test_sha1_init() called\n"); # endif - return SHA1_Init(EVP_MD_CTX_md_data(ctx)); + return SHA1_Init(EVP_MD_CTX_get0_md_data(ctx)); } static int test_sha1_update(EVP_MD_CTX *ctx, const void *data, size_t count) @@ -336,7 +336,7 @@ static int test_sha1_update(EVP_MD_CTX *ctx, const void *data, size_t count) # ifdef TEST_ENG_OPENSSL_SHA_P_UPDATE fprintf(stderr, "(TEST_ENG_OPENSSL_SHA) test_sha1_update() called\n"); # endif - return SHA1_Update(EVP_MD_CTX_md_data(ctx), data, count); + return SHA1_Update(EVP_MD_CTX_get0_md_data(ctx), data, count); } static int test_sha1_final(EVP_MD_CTX *ctx, unsigned char *md) @@ -344,7 +344,7 @@ static int test_sha1_final(EVP_MD_CTX *ctx, unsigned char *md) # ifdef TEST_ENG_OPENSSL_SHA_P_FINAL fprintf(stderr, "(TEST_ENG_OPENSSL_SHA) test_sha1_final() called\n"); # endif - return SHA1_Final(md, EVP_MD_CTX_md_data(ctx)); + return SHA1_Final(md, EVP_MD_CTX_get0_md_data(ctx)); } static EVP_MD *sha1_md = NULL; @@ -383,7 +383,7 @@ static int test_digest_nids(const int **nids) if (!init) { const EVP_MD *md; if ((md = test_sha_md()) != NULL) - digest_nids[pos++] = EVP_MD_type(md); + digest_nids[pos++] = EVP_MD_get_type(md); digest_nids[pos] = 0; init = 1; } @@ -522,7 +522,7 @@ static int ossl_hmac_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) static int ossl_int_update(EVP_MD_CTX *ctx, const void *data, size_t count) { - OSSL_HMAC_PKEY_CTX *hctx = EVP_PKEY_CTX_get_data(EVP_MD_CTX_pkey_ctx(ctx)); + OSSL_HMAC_PKEY_CTX *hctx = EVP_PKEY_CTX_get_data(EVP_MD_CTX_get_pkey_ctx(ctx)); if (!HMAC_Update(hctx->ctx, data, count)) return 0; return 1; @@ -540,7 +540,7 @@ static int ossl_hmac_signctx(EVP_PKEY_CTX *ctx, unsigned char *sig, { unsigned int hlen; OSSL_HMAC_PKEY_CTX *hctx = EVP_PKEY_CTX_get_data(ctx); - int l = EVP_MD_CTX_size(mctx); + int l = EVP_MD_CTX_get_size(mctx); if (l < 0) return 0; diff --git a/crypto/evp/asymcipher.c b/crypto/evp/asymcipher.c index 513cb7e654..52be1c2d7c 100644 --- a/crypto/evp/asymcipher.c +++ b/crypto/evp/asymcipher.c @@ -79,8 +79,8 @@ static int evp_pkey_asym_cipher_init(EVP_PKEY_CTX *ctx, int operation, EVP_ASYM_CIPHER_fetch(ctx->libctx, supported_ciph, ctx->propquery); if (cipher == NULL - || (EVP_KEYMGMT_provider(ctx->keymgmt) - != EVP_ASYM_CIPHER_provider(cipher))) { + || (EVP_KEYMGMT_get0_provider(ctx->keymgmt) + != EVP_ASYM_CIPHER_get0_provider(cipher))) { /* * We don't need to free ctx->keymgmt here, as it's not necessarily * tied to this operation. It will be freed by EVP_PKEY_CTX_free(). @@ -415,7 +415,7 @@ int EVP_ASYM_CIPHER_up_ref(EVP_ASYM_CIPHER *cipher) return 1; } -OSSL_PROVIDER *EVP_ASYM_CIPHER_provider(const EVP_ASYM_CIPHER *cipher) +OSSL_PROVIDER *EVP_ASYM_CIPHER_get0_provider(const EVP_ASYM_CIPHER *cipher) { return cipher->prov; } @@ -434,17 +434,17 @@ int EVP_ASYM_CIPHER_is_a(const EVP_ASYM_CIPHER *cipher, const char *name) return evp_is_a(cipher->prov, cipher->name_id, NULL, name); } -int EVP_ASYM_CIPHER_number(const EVP_ASYM_CIPHER *cipher) +int EVP_ASYM_CIPHER_get_number(const EVP_ASYM_CIPHER *cipher) { return cipher->name_id; } -const char *EVP_ASYM_CIPHER_name(const EVP_ASYM_CIPHER *cipher) +const char *EVP_ASYM_CIPHER_get0_name(const EVP_ASYM_CIPHER *cipher) { return cipher->type_name; } -const char *EVP_ASYM_CIPHER_description(const EVP_ASYM_CIPHER *cipher) +const char *EVP_ASYM_CIPHER_get0_description(const EVP_ASYM_CIPHER *cipher) { return cipher->description; } @@ -478,7 +478,7 @@ const OSSL_PARAM *EVP_ASYM_CIPHER_gettable_ctx_params(const EVP_ASYM_CIPHER *cip if (cip == NULL || cip->gettable_ctx_params == NULL) return NULL; - provctx = ossl_provider_ctx(EVP_ASYM_CIPHER_provider(cip)); + provctx = ossl_provider_ctx(EVP_ASYM_CIPHER_get0_provider(cip)); return cip->gettable_ctx_params(NULL, provctx); } @@ -489,6 +489,6 @@ const OSSL_PARAM *EVP_ASYM_CIPHER_settable_ctx_params(const EVP_ASYM_CIPHER *cip if (cip == NULL || cip->settable_ctx_params == NULL) return NULL; - provctx = ossl_provider_ctx(EVP_ASYM_CIPHER_provider(cip)); + provctx = ossl_provider_ctx(EVP_ASYM_CIPHER_get0_provider(cip)); return cip->settable_ctx_params(NULL, provctx); } diff --git a/crypto/evp/bio_enc.c b/crypto/evp/bio_enc.c index 9d7a9eafef..0483c726d2 100644 --- a/crypto/evp/bio_enc.c +++ b/crypto/evp/bio_enc.c @@ -135,7 +135,7 @@ static int enc_read(BIO *b, char *out, int outl) } } - blocksize = EVP_CIPHER_CTX_block_size(ctx->cipher); + blocksize = EVP_CIPHER_CTX_get_block_size(ctx->cipher); if (blocksize == 1) blocksize = 0; @@ -312,7 +312,7 @@ static long enc_ctrl(BIO *b, int cmd, long num, void *ptr) ctx->ok = 1; ctx->finished = 0; if (!EVP_CipherInit_ex(ctx->cipher, NULL, NULL, NULL, NULL, - EVP_CIPHER_CTX_encrypting(ctx->cipher))) + EVP_CIPHER_CTX_is_encrypting(ctx->cipher))) return 0; ret = BIO_ctrl(next, cmd, num, ptr); break; diff --git a/crypto/evp/bio_md.c b/crypto/evp/bio_md.c index 8e5b3e6446..26a30c698b 100644 --- a/crypto/evp/bio_md.c +++ b/crypto/evp/bio_md.c @@ -214,7 +214,7 @@ static int md_gets(BIO *bp, char *buf, int size) ctx = BIO_get_data(bp); - if (size < EVP_MD_CTX_size(ctx)) + if (size < EVP_MD_CTX_get_size(ctx)) return 0; if (EVP_DigestFinal_ex(ctx, (unsigned char *)buf, &ret) <= 0) diff --git a/crypto/evp/bio_ok.c b/crypto/evp/bio_ok.c index c1256c7cbb..7e3d23f2dc 100644 --- a/crypto/evp/bio_ok.c +++ b/crypto/evp/bio_ok.c @@ -443,8 +443,8 @@ static int sig_out(BIO *b) ctx = BIO_get_data(b); md = ctx->md; digest = EVP_MD_CTX_get0_md(md); - md_size = EVP_MD_size(digest); - md_data = EVP_MD_CTX_md_data(md); + md_size = EVP_MD_get_size(digest); + md_data = EVP_MD_CTX_get0_md_data(md); if (ctx->buf_len + 2 * md_size > OK_BLOCK_SIZE) return 1; @@ -487,8 +487,8 @@ static int sig_in(BIO *b) ctx = BIO_get_data(b); md = ctx->md; digest = EVP_MD_CTX_get0_md(md); - md_size = EVP_MD_size(digest); - md_data = EVP_MD_CTX_md_data(md); + md_size = EVP_MD_get_size(digest); + md_data = EVP_MD_CTX_get0_md_data(md); if ((int)(ctx->buf_len - ctx->buf_off) < 2 * md_size) return 1; @@ -533,7 +533,7 @@ static int block_out(BIO *b) ctx = BIO_get_data(b); md = ctx->md; digest = EVP_MD_CTX_get0_md(md); - md_size = EVP_MD_size(digest); + md_size = EVP_MD_get_size(digest); tl = ctx->buf_len - OK_BLOCK_BLOCK; ctx->buf[0] = (unsigned char)(tl >> 24); @@ -563,7 +563,7 @@ static int block_in(BIO *b) ctx = BIO_get_data(b); md = ctx->md; - md_size = EVP_MD_size(EVP_MD_CTX_get0_md(md)); + md_size = EVP_MD_get_size(EVP_MD_CTX_get0_md(md)); assert(sizeof(tl) >= OK_BLOCK_BLOCK); /* always true */ tl = ctx->buf[0]; diff --git a/crypto/evp/ctrl_params_translate.c b/crypto/evp/ctrl_params_translate.c index 7e550f81a1..e289c7df7b 100644 --- a/crypto/evp/ctrl_params_translate.c +++ b/crypto/evp/ctrl_params_translate.c @@ -710,12 +710,12 @@ cleanup_translation_ctx(enum state state, */ static const char *get_cipher_name(void *cipher) { - return EVP_CIPHER_name(cipher); + return EVP_CIPHER_get0_name(cipher); } static const char *get_md_name(void *md) { - return EVP_MD_name(md); + return EVP_MD_get0_name(md); } static const void *get_cipher_by_name(OSSL_LIB_CTX *libctx, const char *name) @@ -1456,7 +1456,7 @@ static int get_payload_group_name(enum state state, EVP_PKEY *pkey = ctx->p2; ctx->p2 = NULL; - switch (EVP_PKEY_base_id(pkey)) { + switch (EVP_PKEY_get_base_id(pkey)) { #ifndef OPENSSL_NO_DH case EVP_PKEY_DH: { @@ -1512,7 +1512,7 @@ static int get_payload_private_key(enum state state, if (ctx->params->data_type != OSSL_PARAM_UNSIGNED_INTEGER) return 0; - switch (EVP_PKEY_base_id(pkey)) { + switch (EVP_PKEY_get_base_id(pkey)) { #ifndef OPENSSL_NO_DH case EVP_PKEY_DH: { @@ -1548,7 +1548,7 @@ static int get_payload_public_key(enum state state, int ret; ctx->p2 = NULL; - switch (EVP_PKEY_base_id(pkey)) { + switch (EVP_PKEY_get_base_id(pkey)) { #ifndef OPENSSL_NO_DH case EVP_PKEY_DH: switch (ctx->params->data_type) { @@ -1618,7 +1618,7 @@ static int get_dh_dsa_payload_p(enum state state, const BIGNUM *bn = NULL; EVP_PKEY *pkey = ctx->p2; - switch (EVP_PKEY_base_id(pkey)) { + switch (EVP_PKEY_get_base_id(pkey)) { #ifndef OPENSSL_NO_DH case EVP_PKEY_DH: bn = DH_get0_p(EVP_PKEY_get0_DH(pkey)); @@ -1642,7 +1642,7 @@ static int get_dh_dsa_payload_q(enum state state, { const BIGNUM *bn = NULL; - switch (EVP_PKEY_base_id(ctx->p2)) { + switch (EVP_PKEY_get_base_id(ctx->p2)) { #ifndef OPENSSL_NO_DH case EVP_PKEY_DH: bn = DH_get0_q(EVP_PKEY_get0_DH(ctx->p2)); @@ -1664,7 +1664,7 @@ static int get_dh_dsa_payload_g(enum state state, { const BIGNUM *bn = NULL; - switch (EVP_PKEY_base_id(ctx->p2)) { + switch (EVP_PKEY_get_base_id(ctx->p2)) { #ifndef OPENSSL_NO_DH case EVP_PKEY_DH: bn = DH_get0_g(EVP_PKEY_get0_DH(ctx->p2)); @@ -1720,7 +1720,7 @@ static int get_rsa_payload_n(enum state state, { const BIGNUM *bn = NULL; - if (EVP_PKEY_base_id(ctx->p2) != EVP_PKEY_RSA) + if (EVP_PKEY_get_base_id(ctx->p2) != EVP_PKEY_RSA) return 0; bn = RSA_get0_n(EVP_PKEY_get0_RSA(ctx->p2)); @@ -1733,7 +1733,7 @@ static int get_rsa_payload_e(enum state state, { const BIGNUM *bn = NULL; - if (EVP_PKEY_base_id(ctx->p2) != EVP_PKEY_RSA) + if (EVP_PKEY_get_base_id(ctx->p2) != EVP_PKEY_RSA) return 0; bn = RSA_get0_e(EVP_PKEY_get0_RSA(ctx->p2)); @@ -1746,7 +1746,7 @@ static int get_rsa_payload_d(enum state state, { const BIGNUM *bn = NULL; - if (EVP_PKEY_base_id(ctx->p2) != EVP_PKEY_RSA) + if (EVP_PKEY_get_base_id(ctx->p2) != EVP_PKEY_RSA) return 0; bn = RSA_get0_d(EVP_PKEY_get0_RSA(ctx->p2)); @@ -1846,7 +1846,7 @@ static int get_rsa_payload_coefficient(enum state state, const struct translation_st *translation, \ struct translation_ctx_st *ctx) \ { \ - if (EVP_PKEY_base_id(ctx->p2) != EVP_PKEY_RSA) \ + if (EVP_PKEY_get_base_id(ctx->p2) != EVP_PKEY_RSA) \ return 0; \ return get_rsa_payload_factor(state, translation, ctx, n - 1); \ } @@ -1857,7 +1857,7 @@ static int get_rsa_payload_coefficient(enum state state, const struct translation_st *translation, \ struct translation_ctx_st *ctx) \ { \ - if (EVP_PKEY_base_id(ctx->p2) != EVP_PKEY_RSA) \ + if (EVP_PKEY_get_base_id(ctx->p2) != EVP_PKEY_RSA) \ return 0; \ return get_rsa_payload_exponent(state, translation, ctx, \ n - 1); \ @@ -1869,7 +1869,7 @@ static int get_rsa_payload_coefficient(enum state state, const struct translation_st *translation, \ struct translation_ctx_st *ctx) \ { \ - if (EVP_PKEY_base_id(ctx->p2) != EVP_PKEY_RSA) \ + if (EVP_PKEY_get_base_id(ctx->p2) != EVP_PKEY_RSA) \ return 0; \ return get_rsa_payload_coefficient(state, translation, ctx, \ n - 1); \ diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c index b202d466e4..00806ae201 100644 --- a/crypto/evp/digest.c +++ b/crypto/evp/digest.c @@ -411,7 +411,7 @@ int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *isize) if (ctx->digest == NULL) return 0; - sz = EVP_MD_size(ctx->digest); + sz = EVP_MD_get_size(ctx->digest); if (sz < 0) return 0; mdsize = sz; @@ -654,7 +654,7 @@ const OSSL_PARAM *EVP_MD_gettable_params(const EVP_MD *digest) { if (digest != NULL && digest->gettable_params != NULL) return digest->gettable_params( - ossl_provider_ctx(EVP_MD_provider(digest))); + ossl_provider_ctx(EVP_MD_get0_provider(digest))); return NULL; } @@ -682,7 +682,7 @@ const OSSL_PARAM *EVP_MD_settable_ctx_params(const EVP_MD *md) void *provctx; if (md != NULL && md->settable_ctx_params != NULL) { - provctx = ossl_provider_ctx(EVP_MD_provider(md)); + provctx = ossl_provider_ctx(EVP_MD_get0_provider(md)); return md->settable_ctx_params(NULL, provctx); } return NULL; @@ -707,7 +707,7 @@ const OSSL_PARAM *EVP_MD_CTX_settable_params(EVP_MD_CTX *ctx) pctx->op.sig.algctx); if (ctx->digest != NULL && ctx->digest->settable_ctx_params != NULL) { - alg = ossl_provider_ctx(EVP_MD_provider(ctx->digest)); + alg = ossl_provider_ctx(EVP_MD_get0_provider(ctx->digest)); return ctx->digest->settable_ctx_params(ctx->algctx, alg); } @@ -738,7 +738,7 @@ const OSSL_PARAM *EVP_MD_gettable_ctx_params(const EVP_MD *md) void *provctx; if (md != NULL && md->gettable_ctx_params != NULL) { - provctx = ossl_provider_ctx(EVP_MD_provider(md)); + provctx = ossl_provider_ctx(EVP_MD_get0_provider(md)); return md->gettable_ctx_params(NULL, provctx); } return NULL; @@ -763,7 +763,7 @@ const OSSL_PARAM *EVP_MD_CTX_gettable_params(EVP_MD_CTX *ctx) pctx->op.sig.algctx); if (ctx->digest != NULL && ctx->digest->gettable_ctx_params != NULL) { - provctx = ossl_provider_ctx(EVP_MD_provider(ctx->digest)); + provctx = ossl_provider_ctx(EVP_MD_get0_provider(ctx->digest)); return ctx->digest->gettable_ctx_params(ctx->algctx, provctx); } return NULL; diff --git a/crypto/evp/e_aes.c b/crypto/evp/e_aes.c index 7e8f8ece72..2c2a4ba90c 100644 --- a/crypto/evp/e_aes.c +++ b/crypto/evp/e_aes.c @@ -147,16 +147,18 @@ static int aesni_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, int ret, mode; EVP_AES_KEY *dat = EVP_C_DATA(EVP_AES_KEY,ctx); - mode = EVP_CIPHER_CTX_mode(ctx); + mode = EVP_CIPHER_CTX_get_mode(ctx); if ((mode == EVP_CIPH_ECB_MODE || mode == EVP_CIPH_CBC_MODE) && !enc) { - ret = aesni_set_decrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + ret = aesni_set_decrypt_key(key, + EVP_CIPHER_CTX_get_key_length(ctx) * 8, &dat->ks.ks); dat->block = (block128_f) aesni_decrypt; dat->stream.cbc = mode == EVP_CIPH_CBC_MODE ? (cbc128_f) aesni_cbc_encrypt : NULL; } else { - ret = aesni_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + ret = aesni_set_encrypt_key(key, + EVP_CIPHER_CTX_get_key_length(ctx) * 8, &dat->ks.ks); dat->block = (block128_f) aesni_encrypt; if (mode == EVP_CIPH_CBC_MODE) @@ -179,7 +181,7 @@ static int aesni_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len) { aesni_cbc_encrypt(in, out, len, &EVP_C_DATA(EVP_AES_KEY,ctx)->ks.ks, - ctx->iv, EVP_CIPHER_CTX_encrypting(ctx)); + ctx->iv, EVP_CIPHER_CTX_is_encrypting(ctx)); return 1; } @@ -187,13 +189,13 @@ static int aesni_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, static int aesni_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len) { - size_t bl = EVP_CIPHER_CTX_block_size(ctx); + size_t bl = EVP_CIPHER_CTX_get_block_size(ctx); if (len < bl) return 1; aesni_ecb_encrypt(in, out, len, &EVP_C_DATA(EVP_AES_KEY,ctx)->ks.ks, - EVP_CIPHER_CTX_encrypting(ctx)); + EVP_CIPHER_CTX_is_encrypting(ctx)); return 1; } @@ -225,7 +227,7 @@ static int aesni_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, if (!iv && !key) return 1; if (key) { - aesni_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + aesni_set_encrypt_key(key, EVP_CIPHER_CTX_get_key_length(ctx) * 8, &gctx->ks.ks); CRYPTO_gcm128_init(&gctx->gcm, &gctx->ks, (block128_f) aesni_encrypt); gctx->ctr = (ctr128_f) aesni_ctr32_encrypt_blocks; @@ -265,7 +267,7 @@ static int aesni_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, if (key) { /* The key is two half length keys in reality */ - const int bytes = EVP_CIPHER_CTX_key_length(ctx) / 2; + const int bytes = EVP_CIPHER_CTX_get_key_length(ctx) / 2; const int bits = bytes * 8; /* @@ -316,7 +318,7 @@ static int aesni_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, if (!iv && !key) return 1; if (key) { - aesni_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + aesni_set_encrypt_key(key, EVP_CIPHER_CTX_get_key_length(ctx) * 8, &cctx->ks.ks); CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L, &cctx->ks, (block128_f) aesni_encrypt); @@ -349,9 +351,9 @@ static int aesni_ocb_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, * needs both. We could possibly optimise to remove setting the * decrypt for an encryption operation. */ - aesni_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + aesni_set_encrypt_key(key, EVP_CIPHER_CTX_get_key_length(ctx) * 8, &octx->ksenc.ks); - aesni_set_decrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + aesni_set_decrypt_key(key, EVP_CIPHER_CTX_get_key_length(ctx) * 8, &octx->ksdec.ks); if (!CRYPTO_ocb128_init(&octx->ocb, &octx->ksenc.ks, &octx->ksdec.ks, @@ -448,8 +450,8 @@ static int aes_t4_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, int ret, mode, bits; EVP_AES_KEY *dat = EVP_C_DATA(EVP_AES_KEY,ctx); - mode = EVP_CIPHER_CTX_mode(ctx); - bits = EVP_CIPHER_CTX_key_length(ctx) * 8; + mode = EVP_CIPHER_CTX_get_mode(ctx); + bits = EVP_CIPHER_CTX_get_key_length(ctx) * 8; if ((mode == EVP_CIPH_ECB_MODE || mode == EVP_CIPH_CBC_MODE) && !enc) { ret = 0; @@ -548,7 +550,7 @@ static int aes_t4_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, if (!iv && !key) return 1; if (key) { - int bits = EVP_CIPHER_CTX_key_length(ctx) * 8; + int bits = EVP_CIPHER_CTX_get_key_length(ctx) * 8; aes_t4_set_encrypt_key(key, bits, &gctx->ks.ks); CRYPTO_gcm128_init(&gctx->gcm, &gctx->ks, (block128_f) aes_t4_encrypt); @@ -601,7 +603,7 @@ static int aes_t4_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, if (key) { /* The key is two half length keys in reality */ - const int bytes = EVP_CIPHER_CTX_key_length(ctx) / 2; + const int bytes = EVP_CIPHER_CTX_get_key_length(ctx) / 2; const int bits = bytes * 8; /* @@ -671,7 +673,7 @@ static int aes_t4_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, if (!iv && !key) return 1; if (key) { - int bits = EVP_CIPHER_CTX_key_length(ctx) * 8; + int bits = EVP_CIPHER_CTX_get_key_length(ctx) * 8; aes_t4_set_encrypt_key(key, bits, &cctx->ks.ks); CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L, &cctx->ks, (block128_f) aes_t4_encrypt); @@ -703,9 +705,9 @@ static int aes_t4_ocb_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, * needs both. We could possibly optimise to remove setting the * decrypt for an encryption operation. */ - aes_t4_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + aes_t4_set_encrypt_key(key, EVP_CIPHER_CTX_get_key_length(ctx) * 8, &octx->ksenc.ks); - aes_t4_set_decrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + aes_t4_set_decrypt_key(key, EVP_CIPHER_CTX_get_key_length(ctx) * 8, &octx->ksdec.ks); if (!CRYPTO_ocb128_init(&octx->ocb, &octx->ksenc.ks, &octx->ksdec.ks, @@ -969,7 +971,7 @@ static int s390x_aes_ecb_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *iv, int enc) { S390X_AES_ECB_CTX *cctx = EVP_C_DATA(S390X_AES_ECB_CTX, ctx); - const int keylen = EVP_CIPHER_CTX_key_length(ctx); + const int keylen = EVP_CIPHER_CTX_get_key_length(ctx); cctx->fc = S390X_AES_FC(keylen); if (!enc) @@ -994,8 +996,8 @@ static int s390x_aes_ofb_init_key(EVP_CIPHER_CTX *ctx, { S390X_AES_OFB_CTX *cctx = EVP_C_DATA(S390X_AES_OFB_CTX, ctx); const unsigned char *iv = ctx->oiv; - const int keylen = EVP_CIPHER_CTX_key_length(ctx); - const int ivlen = EVP_CIPHER_CTX_iv_length(ctx); + const int keylen = EVP_CIPHER_CTX_get_key_length(ctx); + const int ivlen = EVP_CIPHER_CTX_get_iv_length(ctx); memcpy(cctx->kmo.param.cv, iv, ivlen); memcpy(cctx->kmo.param.k, key, keylen); @@ -1049,8 +1051,8 @@ static int s390x_aes_cfb_init_key(EVP_CIPHER_CTX *ctx, { S390X_AES_CFB_CTX *cctx = EVP_C_DATA(S390X_AES_CFB_CTX, ctx); const unsigned char *iv = ctx->oiv; - const int keylen = EVP_CIPHER_CTX_key_length(ctx); - const int ivlen = EVP_CIPHER_CTX_iv_length(ctx); + const int keylen = EVP_CIPHER_CTX_get_key_length(ctx); + const int ivlen = EVP_CIPHER_CTX_get_iv_length(ctx); cctx->fc = S390X_AES_FC(keylen); cctx->fc |= 16 << 24; /* 16 bytes cipher feedback */ @@ -1067,8 +1069,8 @@ static int s390x_aes_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len) { S390X_AES_CFB_CTX *cctx = EVP_C_DATA(S390X_AES_CFB_CTX, ctx); - const int keylen = EVP_CIPHER_CTX_key_length(ctx); - const int enc = EVP_CIPHER_CTX_encrypting(ctx); + const int keylen = EVP_CIPHER_CTX_get_key_length(ctx); + const int enc = EVP_CIPHER_CTX_is_encrypting(ctx); int n = cctx->res; int rem; unsigned char tmp; @@ -1115,8 +1117,8 @@ static int s390x_aes_cfb8_init_key(EVP_CIPHER_CTX *ctx, { S390X_AES_CFB_CTX *cctx = EVP_C_DATA(S390X_AES_CFB_CTX, ctx); const unsigned char *iv = ctx->oiv; - const int keylen = EVP_CIPHER_CTX_key_length(ctx); - const int ivlen = EVP_CIPHER_CTX_iv_length(ctx); + const int keylen = EVP_CIPHER_CTX_get_key_length(ctx); + const int ivlen = EVP_CIPHER_CTX_get_iv_length(ctx); cctx->fc = S390X_AES_FC(keylen); cctx->fc |= 1 << 24; /* 1 byte cipher feedback */ @@ -1345,7 +1347,7 @@ static int s390x_aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) switch (type) { case EVP_CTRL_INIT: - ivlen = EVP_CIPHER_iv_length(c->cipher); + ivlen = EVP_CIPHER_get_iv_length(c->cipher); gctx->key_set = 0; gctx->iv_set = 0; gctx->ivlen = ivlen; @@ -1385,7 +1387,7 @@ static int s390x_aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) case EVP_CTRL_AEAD_SET_TAG: buf = EVP_CIPHER_CTX_buf_noconst(c); - enc = EVP_CIPHER_CTX_encrypting(c); + enc = EVP_CIPHER_CTX_is_encrypting(c); if (arg <= 0 || arg > 16 || enc) return 0; @@ -1394,7 +1396,7 @@ static int s390x_aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) return 1; case EVP_CTRL_AEAD_GET_TAG: - enc = EVP_CIPHER_CTX_encrypting(c); + enc = EVP_CIPHER_CTX_is_encrypting(c); if (arg <= 0 || arg > 16 || !enc || gctx->taglen < 0) return 0; @@ -1418,7 +1420,7 @@ static int s390x_aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) if (arg) memcpy(gctx->iv, ptr, arg); - enc = EVP_CIPHER_CTX_encrypting(c); + enc = EVP_CIPHER_CTX_is_encrypting(c); if (enc && RAND_bytes(gctx->iv + arg, gctx->ivlen - arg) <= 0) return 0; @@ -1444,7 +1446,7 @@ static int s390x_aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) return 1; case EVP_CTRL_GCM_SET_IV_INV: - enc = EVP_CIPHER_CTX_encrypting(c); + enc = EVP_CIPHER_CTX_is_encrypting(c); if (gctx->iv_gen == 0 || gctx->key_set == 0 || enc) return 0; @@ -1470,7 +1472,7 @@ static int s390x_aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) len -= EVP_GCM_TLS_EXPLICIT_IV_LEN; /* If decrypting correct for tag too. */ - enc = EVP_CIPHER_CTX_encrypting(c); + enc = EVP_CIPHER_CTX_is_encrypting(c); if (!enc) { if (len < EVP_GCM_TLS_TAG_LEN) return 0; @@ -1518,7 +1520,7 @@ static int s390x_aes_gcm_init_key(EVP_CIPHER_CTX *ctx, return 1; if (key != NULL) { - keylen = EVP_CIPHER_CTX_key_length(ctx); + keylen = EVP_CIPHER_CTX_get_key_length(ctx); memcpy(&gctx->kma.param.k, key, keylen); gctx->fc = S390X_AES_FC(keylen); @@ -1554,7 +1556,7 @@ static int s390x_aes_gcm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, { S390X_AES_GCM_CTX *gctx = EVP_C_DATA(S390X_AES_GCM_CTX, ctx); const unsigned char *buf = EVP_CIPHER_CTX_buf_noconst(ctx); - const int enc = EVP_CIPHER_CTX_encrypting(ctx); + const int enc = EVP_CIPHER_CTX_is_encrypting(ctx); int rv = -1; if (out != in || len < (EVP_GCM_TLS_EXPLICIT_IV_LEN + EVP_GCM_TLS_TAG_LEN)) @@ -1643,7 +1645,7 @@ static int s390x_aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, OPENSSL_cleanse(tmp, gctx->mreslen); gctx->iv_set = 0; - enc = EVP_CIPHER_CTX_encrypting(ctx); + enc = EVP_CIPHER_CTX_is_encrypting(ctx); if (enc) { gctx->taglen = 16; } else { @@ -1866,7 +1868,7 @@ static int s390x_aes_ccm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, S390X_AES_CCM_CTX *cctx = EVP_C_DATA(S390X_AES_CCM_CTX, ctx); unsigned char *ivec = ctx->iv; unsigned char *buf = EVP_CIPHER_CTX_buf_noconst(ctx); - const int enc = EVP_CIPHER_CTX_encrypting(ctx); + const int enc = EVP_CIPHER_CTX_is_encrypting(ctx); if (out != in || len < (EVP_CCM_TLS_EXPLICIT_IV_LEN + (size_t)cctx->aes.ccm.m)) @@ -1924,7 +1926,7 @@ static int s390x_aes_ccm_init_key(EVP_CIPHER_CTX *ctx, return 1; if (key != NULL) { - keylen = EVP_CIPHER_CTX_key_length(ctx); + keylen = EVP_CIPHER_CTX_get_key_length(ctx); cctx->aes.ccm.fc = S390X_AES_FC(keylen); memcpy(cctx->aes.ccm.kmac_param.k, key, keylen); @@ -1957,7 +1959,7 @@ static int s390x_aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len) { S390X_AES_CCM_CTX *cctx = EVP_C_DATA(S390X_AES_CCM_CTX, ctx); - const int enc = EVP_CIPHER_CTX_encrypting(ctx); + const int enc = EVP_CIPHER_CTX_is_encrypting(ctx); int rv; unsigned char *buf; @@ -2079,7 +2081,7 @@ static int s390x_aes_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) /* Correct length for explicit iv. */ len -= EVP_CCM_TLS_EXPLICIT_IV_LEN; - enc = EVP_CIPHER_CTX_encrypting(c); + enc = EVP_CIPHER_CTX_is_encrypting(c); if (!enc) { if (len < cctx->aes.ccm.m) return 0; @@ -2117,7 +2119,7 @@ static int s390x_aes_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) if ((arg & 1) || arg < 4 || arg > 16) return 0; - enc = EVP_CIPHER_CTX_encrypting(c); + enc = EVP_CIPHER_CTX_is_encrypting(c); if (enc && ptr) return 0; @@ -2131,7 +2133,7 @@ static int s390x_aes_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) return 1; case EVP_CTRL_AEAD_GET_TAG: - enc = EVP_CIPHER_CTX_encrypting(c); + enc = EVP_CIPHER_CTX_is_encrypting(c); if (!enc || !cctx->aes.ccm.tag_set) return 0; @@ -2302,13 +2304,13 @@ static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, int ret, mode; EVP_AES_KEY *dat = EVP_C_DATA(EVP_AES_KEY,ctx); - mode = EVP_CIPHER_CTX_mode(ctx); + mode = EVP_CIPHER_CTX_get_mode(ctx); if ((mode == EVP_CIPH_ECB_MODE || mode == EVP_CIPH_CBC_MODE) && !enc) { #ifdef HWAES_CAPABLE if (HWAES_CAPABLE) { ret = HWAES_set_decrypt_key(key, - EVP_CIPHER_CTX_key_length(ctx) * 8, + EVP_CIPHER_CTX_get_key_length(ctx) * 8, &dat->ks.ks); dat->block = (block128_f) HWAES_decrypt; dat->stream.cbc = NULL; @@ -2320,7 +2322,8 @@ static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, #endif #ifdef BSAES_CAPABLE if (BSAES_CAPABLE && mode == EVP_CIPH_CBC_MODE) { - ret = AES_set_decrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + ret = AES_set_decrypt_key(key, + EVP_CIPHER_CTX_get_key_length(ctx) * 8, &dat->ks.ks); dat->block = (block128_f) AES_decrypt; dat->stream.cbc = (cbc128_f) ossl_bsaes_cbc_encrypt; @@ -2329,7 +2332,7 @@ static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, #ifdef VPAES_CAPABLE if (VPAES_CAPABLE) { ret = vpaes_set_decrypt_key(key, - EVP_CIPHER_CTX_key_length(ctx) * 8, + EVP_CIPHER_CTX_get_key_length(ctx) * 8, &dat->ks.ks); dat->block = (block128_f) vpaes_decrypt; dat->stream.cbc = mode == EVP_CIPH_CBC_MODE ? @@ -2338,7 +2341,7 @@ static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, #endif { ret = AES_set_decrypt_key(key, - EVP_CIPHER_CTX_key_length(ctx) * 8, + EVP_CIPHER_CTX_get_key_length(ctx) * 8, &dat->ks.ks); dat->block = (block128_f) AES_decrypt; dat->stream.cbc = mode == EVP_CIPH_CBC_MODE ? @@ -2347,7 +2350,8 @@ static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, } else #ifdef HWAES_CAPABLE if (HWAES_CAPABLE) { - ret = HWAES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + ret = HWAES_set_encrypt_key(key, + EVP_CIPHER_CTX_get_key_length(ctx) * 8, &dat->ks.ks); dat->block = (block128_f) HWAES_encrypt; dat->stream.cbc = NULL; @@ -2366,7 +2370,7 @@ static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, #endif #ifdef BSAES_CAPABLE if (BSAES_CAPABLE && mode == EVP_CIPH_CTR_MODE) { - ret = AES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + ret = AES_set_encrypt_key(key, EVP_CIPHER_CTX_get_key_length(ctx) * 8, &dat->ks.ks); dat->block = (block128_f) AES_encrypt; dat->stream.ctr = (ctr128_f) ossl_bsaes_ctr32_encrypt_blocks; @@ -2374,7 +2378,8 @@ static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, #endif #ifdef VPAES_CAPABLE if (VPAES_CAPABLE) { - ret = vpaes_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + ret = vpaes_set_encrypt_key(key, + EVP_CIPHER_CTX_get_key_length(ctx) * 8, &dat->ks.ks); dat->block = (block128_f) vpaes_encrypt; dat->stream.cbc = mode == EVP_CIPH_CBC_MODE ? @@ -2382,7 +2387,7 @@ static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, } else #endif { - ret = AES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + ret = AES_set_encrypt_key(key, EVP_CIPHER_CTX_get_key_length(ctx) * 8, &dat->ks.ks); dat->block = (block128_f) AES_encrypt; dat->stream.cbc = mode == EVP_CIPH_CBC_MODE ? @@ -2408,8 +2413,8 @@ static int aes_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, if (dat->stream.cbc) (*dat->stream.cbc) (in, out, len, &dat->ks, ctx->iv, - EVP_CIPHER_CTX_encrypting(ctx)); - else if (EVP_CIPHER_CTX_encrypting(ctx)) + EVP_CIPHER_CTX_is_encrypting(ctx)); + else if (EVP_CIPHER_CTX_is_encrypting(ctx)) CRYPTO_cbc128_encrypt(in, out, len, &dat->ks, ctx->iv, dat->block); else @@ -2422,7 +2427,7 @@ static int aes_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, static int aes_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len) { - size_t bl = EVP_CIPHER_CTX_block_size(ctx); + size_t bl = EVP_CIPHER_CTX_get_block_size(ctx); size_t i; EVP_AES_KEY *dat = EVP_C_DATA(EVP_AES_KEY,ctx); @@ -2440,7 +2445,7 @@ static int aes_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, { EVP_AES_KEY *dat = EVP_C_DATA(EVP_AES_KEY,ctx); - int num = EVP_CIPHER_CTX_num(ctx); + int num = EVP_CIPHER_CTX_get_num(ctx); CRYPTO_ofb128_encrypt(in, out, len, &dat->ks, ctx->iv, &num, dat->block); EVP_CIPHER_CTX_set_num(ctx, num); @@ -2452,10 +2457,10 @@ static int aes_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, { EVP_AES_KEY *dat = EVP_C_DATA(EVP_AES_KEY,ctx); - int num = EVP_CIPHER_CTX_num(ctx); + int num = EVP_CIPHER_CTX_get_num(ctx); CRYPTO_cfb128_encrypt(in, out, len, &dat->ks, ctx->iv, &num, - EVP_CIPHER_CTX_encrypting(ctx), dat->block); + EVP_CIPHER_CTX_is_encrypting(ctx), dat->block); EVP_CIPHER_CTX_set_num(ctx, num); return 1; } @@ -2465,10 +2470,10 @@ static int aes_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, { EVP_AES_KEY *dat = EVP_C_DATA(EVP_AES_KEY,ctx); - int num = EVP_CIPHER_CTX_num(ctx); + int num = EVP_CIPHER_CTX_get_num(ctx); CRYPTO_cfb128_8_encrypt(in, out, len, &dat->ks, ctx->iv, &num, - EVP_CIPHER_CTX_encrypting(ctx), dat->block); + EVP_CIPHER_CTX_is_encrypting(ctx), dat->block); EVP_CIPHER_CTX_set_num(ctx, num); return 1; } @@ -2479,29 +2484,29 @@ static int aes_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, EVP_AES_KEY *dat = EVP_C_DATA(EVP_AES_KEY,ctx); if (EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS)) { - int num = EVP_CIPHER_CTX_num(ctx); + int num = EVP_CIPHER_CTX_get_num(ctx); CRYPTO_cfb128_1_encrypt(in, out, len, &dat->ks, ctx->iv, &num, - EVP_CIPHER_CTX_encrypting(ctx), dat->block); + EVP_CIPHER_CTX_is_encrypting(ctx), dat->block); EVP_CIPHER_CTX_set_num(ctx, num); return 1; } while (len >= MAXBITCHUNK) { - int num = EVP_CIPHER_CTX_num(ctx); + int num = EVP_CIPHER_CTX_get_num(ctx); CRYPTO_cfb128_1_encrypt(in, out, MAXBITCHUNK * 8, &dat->ks, ctx->iv, &num, - EVP_CIPHER_CTX_encrypting(ctx), dat->block); + EVP_CIPHER_CTX_is_encrypting(ctx), dat->block); EVP_CIPHER_CTX_set_num(ctx, num); len -= MAXBITCHUNK; out += MAXBITCHUNK; in += MAXBITCHUNK; } if (len) { - int num = EVP_CIPHER_CTX_num(ctx); + int num = EVP_CIPHER_CTX_get_num(ctx); CRYPTO_cfb128_1_encrypt(in, out, len * 8, &dat->ks, ctx->iv, &num, - EVP_CIPHER_CTX_encrypting(ctx), dat->block); + EVP_CIPHER_CTX_is_encrypting(ctx), dat->block); EVP_CIPHER_CTX_set_num(ctx, num); } @@ -2511,7 +2516,7 @@ static int aes_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, static int aes_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len) { - unsigned int num = EVP_CIPHER_CTX_num(ctx); + unsigned int num = EVP_CIPHER_CTX_get_num(ctx); EVP_AES_KEY *dat = EVP_C_DATA(EVP_AES_KEY,ctx); if (dat->stream.ctr) @@ -2550,7 +2555,7 @@ static int aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) case EVP_CTRL_INIT: gctx->key_set = 0; gctx->iv_set = 0; - gctx->ivlen = EVP_CIPHER_iv_length(c->cipher); + gctx->ivlen = EVP_CIPHER_get_iv_length(c->cipher); gctx->iv = c->iv; gctx->taglen = -1; gctx->iv_gen = 0; @@ -3112,7 +3117,7 @@ static int aes_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, if (key) { do { /* The key is two half length keys in reality */ - const int bytes = EVP_CIPHER_CTX_key_length(ctx) / 2; + const int bytes = EVP_CIPHER_CTX_get_key_length(ctx) / 2; const int bits = bytes * 8; /* @@ -3241,7 +3246,7 @@ static int aes_xts_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, xctx->xts.key1, xctx->xts.key2, ctx->iv); else if (CRYPTO_xts128_encrypt(&xctx->xts, ctx->iv, in, out, len, - EVP_CIPHER_CTX_encrypting(ctx))) + EVP_CIPHER_CTX_is_encrypting(ctx))) return 0; return 1; } @@ -3288,7 +3293,7 @@ static int aes_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) return 0; len -= EVP_CCM_TLS_EXPLICIT_IV_LEN; /* If decrypting correct for tag too */ - if (!EVP_CIPHER_CTX_encrypting(c)) { + if (!EVP_CIPHER_CTX_is_encrypting(c)) { if (len < cctx->M) return 0; len -= cctx->M; @@ -3319,7 +3324,7 @@ static int aes_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) case EVP_CTRL_AEAD_SET_TAG: if ((arg & 1) || arg < 4 || arg > 16) return 0; - if (EVP_CIPHER_CTX_encrypting(c) && ptr) + if (EVP_CIPHER_CTX_is_encrypting(c) && ptr) return 0; if (ptr) { cctx->tag_set = 1; @@ -3329,7 +3334,7 @@ static int aes_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) return 1; case EVP_CTRL_AEAD_GET_TAG: - if (!EVP_CIPHER_CTX_encrypting(c) || !cctx->tag_set) + if (!EVP_CIPHER_CTX_is_encrypting(c) || !cctx->tag_set) return 0; if (!CRYPTO_ccm128_tag(&cctx->ccm, ptr, (size_t)arg)) return 0; @@ -3366,7 +3371,8 @@ static int aes_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, do { #ifdef HWAES_CAPABLE if (HWAES_CAPABLE) { - HWAES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + HWAES_set_encrypt_key(key, + EVP_CIPHER_CTX_get_key_length(ctx) * 8, &cctx->ks.ks); CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L, @@ -3378,7 +3384,8 @@ static int aes_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, #endif #ifdef VPAES_CAPABLE if (VPAES_CAPABLE) { - vpaes_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + vpaes_set_encrypt_key(key, + EVP_CIPHER_CTX_get_key_length(ctx) * 8, &cctx->ks.ks); CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L, &cctx->ks, (block128_f) vpaes_encrypt); @@ -3387,7 +3394,7 @@ static int aes_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, break; } #endif - AES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + AES_set_encrypt_key(key, EVP_CIPHER_CTX_get_key_length(ctx) * 8, &cctx->ks.ks); CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L, &cctx->ks, (block128_f) AES_encrypt); @@ -3410,7 +3417,7 @@ static int aes_ccm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, if (out != in || len < (EVP_CCM_TLS_EXPLICIT_IV_LEN + (size_t)cctx->M)) return -1; /* If encrypting set explicit IV from sequence number (start of AAD) */ - if (EVP_CIPHER_CTX_encrypting(ctx)) + if (EVP_CIPHER_CTX_is_encrypting(ctx)) memcpy(out, EVP_CIPHER_CTX_buf_noconst(ctx), EVP_CCM_TLS_EXPLICIT_IV_LEN); /* Get rest of IV from explicit IV */ @@ -3422,11 +3429,12 @@ static int aes_ccm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, len)) return -1; /* Use saved AAD */ - CRYPTO_ccm128_aad(ccm, EVP_CIPHER_CTX_buf_noconst(ctx), cctx->tls_aad_len); + CRYPTO_ccm128_aad(ccm, EVP_CIPHER_CTX_buf_noconst(ctx), + cctx->tls_aad_len); /* Fix buffer to point to payload */ in += EVP_CCM_TLS_EXPLICIT_IV_LEN; out += EVP_CCM_TLS_EXPLICIT_IV_LEN; - if (EVP_CIPHER_CTX_encrypting(ctx)) { + if (EVP_CIPHER_CTX_is_encrypting(ctx)) { if (cctx->str ? CRYPTO_ccm128_encrypt_ccm64(ccm, in, out, len, cctx->str) : CRYPTO_ccm128_encrypt(ccm, in, out, len)) @@ -3484,7 +3492,7 @@ static int aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, } /* The tag must be set before actually decrypting data */ - if (!EVP_CIPHER_CTX_encrypting(ctx) && !cctx->tag_set) + if (!EVP_CIPHER_CTX_is_encrypting(ctx) && !cctx->tag_set) return -1; /* If not set length yet do it */ @@ -3493,7 +3501,7 @@ static int aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, return -1; cctx->len_set = 1; } - if (EVP_CIPHER_CTX_encrypting(ctx)) { + if (EVP_CIPHER_CTX_is_encrypting(ctx)) { if (cctx->str ? CRYPTO_ccm128_encrypt_ccm64(ccm, in, out, len, cctx->str) : CRYPTO_ccm128_encrypt(ccm, in, out, len)) @@ -3546,17 +3554,17 @@ static int aes_wrap_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, if (!iv && !key) return 1; if (key) { - if (EVP_CIPHER_CTX_encrypting(ctx)) - AES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + if (EVP_CIPHER_CTX_is_encrypting(ctx)) + AES_set_encrypt_key(key, EVP_CIPHER_CTX_get_key_length(ctx) * 8, &wctx->ks.ks); else - AES_set_decrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + AES_set_decrypt_key(key, EVP_CIPHER_CTX_get_key_length(ctx) * 8, &wctx->ks.ks); if (!iv) wctx->iv = NULL; } if (iv) { - memcpy(ctx->iv, iv, EVP_CIPHER_CTX_iv_length(ctx)); + memcpy(ctx->iv, iv, EVP_CIPHER_CTX_get_iv_length(ctx)); wctx->iv = ctx->iv; } return 1; @@ -3568,7 +3576,7 @@ static int aes_wrap_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, EVP_AES_WRAP_CTX *wctx = EVP_C_DATA(EVP_AES_WRAP_CTX,ctx); size_t rv; /* AES wrap with padding has IV length of 4, without padding 8 */ - int pad = EVP_CIPHER_CTX_iv_length(ctx) == 4; + int pad = EVP_CIPHER_CTX_get_iv_length(ctx) == 4; /* No final operation so always return zero length */ if (!in) return 0; @@ -3576,7 +3584,7 @@ static int aes_wrap_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, if (!inlen) return -1; /* If decrypting need at least 16 bytes and multiple of 8 */ - if (!EVP_CIPHER_CTX_encrypting(ctx) && (inlen < 16 || inlen & 0x7)) + if (!EVP_CIPHER_CTX_is_encrypting(ctx) && (inlen < 16 || inlen & 0x7)) return -1; /* If not padding input must be multiple of 8 */ if (!pad && inlen & 0x7) @@ -3586,7 +3594,7 @@ static int aes_wrap_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, return 0; } if (!out) { - if (EVP_CIPHER_CTX_encrypting(ctx)) { + if (EVP_CIPHER_CTX_is_encrypting(ctx)) { /* If padding round up to multiple of 8 */ if (pad) inlen = (inlen + 7) / 8 * 8; @@ -3602,7 +3610,7 @@ static int aes_wrap_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, } } if (pad) { - if (EVP_CIPHER_CTX_encrypting(ctx)) + if (EVP_CIPHER_CTX_is_encrypting(ctx)) rv = CRYPTO_128_wrap_pad(&wctx->ks.ks, wctx->iv, out, in, inlen, (block128_f) AES_encrypt); @@ -3611,7 +3619,7 @@ static int aes_wrap_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, out, in, inlen, (block128_f) AES_decrypt); } else { - if (EVP_CIPHER_CTX_encrypting(ctx)) + if (EVP_CIPHER_CTX_is_encrypting(ctx)) rv = CRYPTO_128_wrap(&wctx->ks.ks, wctx->iv, out, in, inlen, (block128_f) AES_encrypt); else @@ -3720,7 +3728,7 @@ static int aes_ocb_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) case EVP_CTRL_INIT: octx->key_set = 0; octx->iv_set = 0; - octx->ivlen = EVP_CIPHER_iv_length(c->cipher); + octx->ivlen = EVP_CIPHER_get_iv_length(c->cipher); octx->iv = c->iv; octx->taglen = 16; octx->data_buf_len = 0; @@ -3748,13 +3756,13 @@ static int aes_ocb_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) octx->taglen = arg; return 1; } - if (arg != octx->taglen || EVP_CIPHER_CTX_encrypting(c)) + if (arg != octx->taglen || EVP_CIPHER_CTX_is_encrypting(c)) return 0; memcpy(octx->tag, ptr, arg); return 1; case EVP_CTRL_AEAD_GET_TAG: - if (arg != octx->taglen || !EVP_CIPHER_CTX_encrypting(c)) + if (arg != octx->taglen || !EVP_CIPHER_CTX_is_encrypting(c)) return 0; memcpy(ptr, octx->tag, arg); @@ -3788,9 +3796,9 @@ static int aes_ocb_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, */ # ifdef HWAES_CAPABLE if (HWAES_CAPABLE) { - HWAES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + HWAES_set_encrypt_key(key, EVP_CIPHER_CTX_get_key_length(ctx) * 8, &octx->ksenc.ks); - HWAES_set_decrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + HWAES_set_decrypt_key(key, EVP_CIPHER_CTX_get_key_length(ctx) * 8, &octx->ksdec.ks); if (!CRYPTO_ocb128_init(&octx->ocb, &octx->ksenc.ks, &octx->ksdec.ks, @@ -3804,9 +3812,11 @@ static int aes_ocb_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, # endif # ifdef VPAES_CAPABLE if (VPAES_CAPABLE) { - vpaes_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + vpaes_set_encrypt_key(key, + EVP_CIPHER_CTX_get_key_length(ctx) * 8, &octx->ksenc.ks); - vpaes_set_decrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + vpaes_set_decrypt_key(key, + EVP_CIPHER_CTX_get_key_length(ctx) * 8, &octx->ksdec.ks); if (!CRYPTO_ocb128_init(&octx->ocb, &octx->ksenc.ks, &octx->ksdec.ks, @@ -3817,9 +3827,9 @@ static int aes_ocb_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, break; } # endif - AES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + AES_set_encrypt_key(key, EVP_CIPHER_CTX_get_key_length(ctx) * 8, &octx->ksenc.ks); - AES_set_decrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + AES_set_decrypt_key(key, EVP_CIPHER_CTX_get_key_length(ctx) * 8, &octx->ksdec.ks); if (!CRYPTO_ocb128_init(&octx->ocb, &octx->ksenc.ks, &octx->ksdec.ks, @@ -3914,7 +3924,7 @@ static int aes_ocb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, if (out == NULL) { if (!CRYPTO_ocb128_aad(&octx->ocb, buf, AES_BLOCK_SIZE)) return -1; - } else if (EVP_CIPHER_CTX_encrypting(ctx)) { + } else if (EVP_CIPHER_CTX_is_encrypting(ctx)) { if (!CRYPTO_ocb128_encrypt(&octx->ocb, buf, out, AES_BLOCK_SIZE)) return -1; @@ -3939,7 +3949,7 @@ static int aes_ocb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, if (out == NULL) { if (!CRYPTO_ocb128_aad(&octx->ocb, in, len - trailing_len)) return -1; - } else if (EVP_CIPHER_CTX_encrypting(ctx)) { + } else if (EVP_CIPHER_CTX_is_encrypting(ctx)) { if (!CRYPTO_ocb128_encrypt (&octx->ocb, in, out, len - trailing_len)) return -1; @@ -3965,7 +3975,7 @@ static int aes_ocb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, * have been provided - both for data and AAD */ if (octx->data_buf_len > 0) { - if (EVP_CIPHER_CTX_encrypting(ctx)) { + if (EVP_CIPHER_CTX_is_encrypting(ctx)) { if (!CRYPTO_ocb128_encrypt(&octx->ocb, octx->data_buf, out, octx->data_buf_len)) return -1; @@ -3984,7 +3994,7 @@ static int aes_ocb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, octx->aad_buf_len = 0; } /* If decrypting then verify */ - if (!EVP_CIPHER_CTX_encrypting(ctx)) { + if (!EVP_CIPHER_CTX_is_encrypting(ctx)) { if (octx->taglen < 0) return -1; if (CRYPTO_ocb128_finish(&octx->ocb, diff --git a/crypto/evp/e_aes_cbc_hmac_sha1.c b/crypto/evp/e_aes_cbc_hmac_sha1.c index 91357f8b1a..4941f98e64 100644 --- a/crypto/evp/e_aes_cbc_hmac_sha1.c +++ b/crypto/evp/e_aes_cbc_hmac_sha1.c @@ -75,11 +75,11 @@ static int aesni_cbc_hmac_sha1_init_key(EVP_CIPHER_CTX *ctx, if (enc) ret = aesni_set_encrypt_key(inkey, - EVP_CIPHER_CTX_key_length(ctx) * 8, + EVP_CIPHER_CTX_get_key_length(ctx) * 8, &key->ks); else ret = aesni_set_decrypt_key(inkey, - EVP_CIPHER_CTX_key_length(ctx) * 8, + EVP_CIPHER_CTX_get_key_length(ctx) * 8, &key->ks); SHA1_Init(&key->head); /* handy when benchmarking */ @@ -424,7 +424,7 @@ static int aesni_cbc_hmac_sha1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, if (len % AES_BLOCK_SIZE) return 0; - if (EVP_CIPHER_CTX_encrypting(ctx)) { + if (EVP_CIPHER_CTX_is_encrypting(ctx)) { if (plen == NO_PAYLOAD_LENGTH) plen = len; else if (len != @@ -813,7 +813,7 @@ static int aesni_cbc_hmac_sha1_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, len = p[arg - 2] << 8 | p[arg - 1]; - if (EVP_CIPHER_CTX_encrypting(ctx)) { + if (EVP_CIPHER_CTX_is_encrypting(ctx)) { key->payload_length = len; if ((key->aux.tls_ver = p[arg - 4] << 8 | p[arg - 3]) >= TLS1_1_VERSION) { @@ -851,7 +851,7 @@ static int aesni_cbc_hmac_sha1_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, inp_len = param->inp[11] << 8 | param->inp[12]; - if (EVP_CIPHER_CTX_encrypting(ctx)) { + if (EVP_CIPHER_CTX_is_encrypting(ctx)) { if ((param->inp[9] << 8 | param->inp[10]) < TLS1_1_VERSION) return -1; diff --git a/crypto/evp/e_aes_cbc_hmac_sha256.c b/crypto/evp/e_aes_cbc_hmac_sha256.c index 82613cbff2..3a5f757dbf 100644 --- a/crypto/evp/e_aes_cbc_hmac_sha256.c +++ b/crypto/evp/e_aes_cbc_hmac_sha256.c @@ -71,11 +71,11 @@ static int aesni_cbc_hmac_sha256_init_key(EVP_CIPHER_CTX *ctx, if (enc) ret = aesni_set_encrypt_key(inkey, - EVP_CIPHER_CTX_key_length(ctx) * 8, + EVP_CIPHER_CTX_get_key_length(ctx) * 8, &key->ks); else ret = aesni_set_decrypt_key(inkey, - EVP_CIPHER_CTX_key_length(ctx) * 8, + EVP_CIPHER_CTX_get_key_length(ctx) * 8, &key->ks); SHA256_Init(&key->head); /* handy when benchmarking */ @@ -439,7 +439,7 @@ static int aesni_cbc_hmac_sha256_cipher(EVP_CIPHER_CTX *ctx, if (len % AES_BLOCK_SIZE) return 0; - if (EVP_CIPHER_CTX_encrypting(ctx)) { + if (EVP_CIPHER_CTX_is_encrypting(ctx)) { if (plen == NO_PAYLOAD_LENGTH) plen = len; else if (len != @@ -794,7 +794,7 @@ static int aesni_cbc_hmac_sha256_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, len = p[arg - 2] << 8 | p[arg - 1]; - if (EVP_CIPHER_CTX_encrypting(ctx)) { + if (EVP_CIPHER_CTX_is_encrypting(ctx)) { key->payload_length = len; if ((key->aux.tls_ver = p[arg - 4] << 8 | p[arg - 3]) >= TLS1_1_VERSION) { @@ -835,7 +835,7 @@ static int aesni_cbc_hmac_sha256_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, inp_len = param->inp[11] << 8 | param->inp[12]; - if (EVP_CIPHER_CTX_encrypting(ctx)) { + if (EVP_CIPHER_CTX_is_encrypting(ctx)) { if ((param->inp[9] << 8 | param->inp[10]) < TLS1_1_VERSION) return -1; diff --git a/crypto/evp/e_aria.c b/crypto/evp/e_aria.c index e7ba2df78f..b57661db58 100644 --- a/crypto/evp/e_aria.c +++ b/crypto/evp/e_aria.c @@ -60,13 +60,15 @@ static int aria_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc) { int ret; - int mode = EVP_CIPHER_CTX_mode(ctx); + int mode = EVP_CIPHER_CTX_get_mode(ctx); if (enc || (mode != EVP_CIPH_ECB_MODE && mode != EVP_CIPH_CBC_MODE)) - ret = ossl_aria_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + ret = ossl_aria_set_encrypt_key(key, + EVP_CIPHER_CTX_get_key_length(ctx) * 8, EVP_CIPHER_CTX_get_cipher_data(ctx)); else - ret = ossl_aria_set_decrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + ret = ossl_aria_set_decrypt_key(key, + EVP_CIPHER_CTX_get_key_length(ctx) * 8, EVP_CIPHER_CTX_get_cipher_data(ctx)); if (ret < 0) { ERR_raise(ERR_LIB_EVP,EVP_R_ARIA_KEY_SETUP_FAILED); @@ -171,7 +173,7 @@ const EVP_CIPHER *EVP_aria_##keylen##_##mode(void) \ static int aria_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len) { - unsigned int num = EVP_CIPHER_CTX_num(ctx); + unsigned int num = EVP_CIPHER_CTX_get_num(ctx); EVP_ARIA_KEY *dat = EVP_C_DATA(EVP_ARIA_KEY, ctx); CRYPTO_ctr128_encrypt(in, out, len, &dat->ks, ctx->iv, @@ -212,7 +214,8 @@ static int aria_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, if (!iv && !key) return 1; if (key) { - ret = ossl_aria_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + ret = ossl_aria_set_encrypt_key(key, + EVP_CIPHER_CTX_get_key_length(ctx) * 8, &gctx->ks.ks); CRYPTO_gcm128_init(&gctx->gcm, &gctx->ks, (block128_f) ossl_aria_encrypt); @@ -251,7 +254,7 @@ static int aria_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) case EVP_CTRL_INIT: gctx->key_set = 0; gctx->iv_set = 0; - gctx->ivlen = EVP_CIPHER_iv_length(c->cipher); + gctx->ivlen = EVP_CIPHER_get_iv_length(c->cipher); gctx->iv = c->iv; gctx->taglen = -1; gctx->iv_gen = 0; @@ -278,14 +281,14 @@ static int aria_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) return 1; case EVP_CTRL_AEAD_SET_TAG: - if (arg <= 0 || arg > 16 || EVP_CIPHER_CTX_encrypting(c)) + if (arg <= 0 || arg > 16 || EVP_CIPHER_CTX_is_encrypting(c)) return 0; memcpy(EVP_CIPHER_CTX_buf_noconst(c), ptr, arg); gctx->taglen = arg; return 1; case EVP_CTRL_AEAD_GET_TAG: - if (arg <= 0 || arg > 16 || !EVP_CIPHER_CTX_encrypting(c) + if (arg <= 0 || arg > 16 || !EVP_CIPHER_CTX_is_encrypting(c) || gctx->taglen < 0) return 0; memcpy(ptr, EVP_CIPHER_CTX_buf_noconst(c), arg); @@ -306,7 +309,7 @@ static int aria_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) return 0; if (arg) memcpy(gctx->iv, ptr, arg); - if (EVP_CIPHER_CTX_encrypting(c) + if (EVP_CIPHER_CTX_is_encrypting(c) && RAND_bytes(gctx->iv + arg, gctx->ivlen - arg) <= 0) return 0; gctx->iv_gen = 1; @@ -329,7 +332,7 @@ static int aria_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) case EVP_CTRL_GCM_SET_IV_INV: if (gctx->iv_gen == 0 || gctx->key_set == 0 - || EVP_CIPHER_CTX_encrypting(c)) + || EVP_CIPHER_CTX_is_encrypting(c)) return 0; memcpy(gctx->iv + gctx->ivlen - arg, ptr, arg); CRYPTO_gcm128_setiv(&gctx->gcm, gctx->iv, gctx->ivlen); @@ -351,7 +354,7 @@ static int aria_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) return 0; len -= EVP_GCM_TLS_EXPLICIT_IV_LEN; /* If decrypting correct for tag too */ - if (!EVP_CIPHER_CTX_encrypting(c)) { + if (!EVP_CIPHER_CTX_is_encrypting(c)) { if (len < EVP_GCM_TLS_TAG_LEN) return 0; len -= EVP_GCM_TLS_TAG_LEN; @@ -403,7 +406,7 @@ static int aria_gcm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, * Set IV from start of buffer or generate IV and write to start of * buffer. */ - if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CIPHER_CTX_encrypting(ctx) ? + if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CIPHER_CTX_is_encrypting(ctx) ? EVP_CTRL_GCM_IV_GEN : EVP_CTRL_GCM_SET_IV_INV, EVP_GCM_TLS_EXPLICIT_IV_LEN, out) <= 0) goto err; @@ -415,7 +418,7 @@ static int aria_gcm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, in += EVP_GCM_TLS_EXPLICIT_IV_LEN; out += EVP_GCM_TLS_EXPLICIT_IV_LEN; len -= EVP_GCM_TLS_EXPLICIT_IV_LEN + EVP_GCM_TLS_TAG_LEN; - if (EVP_CIPHER_CTX_encrypting(ctx)) { + if (EVP_CIPHER_CTX_is_encrypting(ctx)) { /* Encrypt payload */ if (CRYPTO_gcm128_encrypt(&gctx->gcm, in, out, len)) goto err; @@ -463,7 +466,7 @@ static int aria_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, if (out == NULL) { if (CRYPTO_gcm128_aad(&gctx->gcm, in, len)) return -1; - } else if (EVP_CIPHER_CTX_encrypting(ctx)) { + } else if (EVP_CIPHER_CTX_is_encrypting(ctx)) { if (CRYPTO_gcm128_encrypt(&gctx->gcm, in, out, len)) return -1; } else { @@ -472,7 +475,7 @@ static int aria_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, } return len; } - if (!EVP_CIPHER_CTX_encrypting(ctx)) { + if (!EVP_CIPHER_CTX_is_encrypting(ctx)) { if (gctx->taglen < 0) return -1; if (CRYPTO_gcm128_finish(&gctx->gcm, @@ -509,7 +512,8 @@ static int aria_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, return 1; if (key) { - ret = ossl_aria_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, + ret = ossl_aria_set_encrypt_key(key, + EVP_CIPHER_CTX_get_key_length(ctx) * 8, &cctx->ks.ks); CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L, &cctx->ks, (block128_f) ossl_aria_encrypt); @@ -561,7 +565,7 @@ static int aria_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) return 0; len -= EVP_CCM_TLS_EXPLICIT_IV_LEN; /* If decrypting correct for tag too */ - if (!EVP_CIPHER_CTX_encrypting(c)) { + if (!EVP_CIPHER_CTX_is_encrypting(c)) { if (len < cctx->M) return 0; len -= cctx->M; @@ -591,7 +595,7 @@ static int aria_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) case EVP_CTRL_AEAD_SET_TAG: if ((arg & 1) || arg < 4 || arg > 16) return 0; - if (EVP_CIPHER_CTX_encrypting(c) && ptr) + if (EVP_CIPHER_CTX_is_encrypting(c) && ptr) return 0; if (ptr) { cctx->tag_set = 1; @@ -601,7 +605,7 @@ static int aria_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) return 1; case EVP_CTRL_AEAD_GET_TAG: - if (!EVP_CIPHER_CTX_encrypting(c) || !cctx->tag_set) + if (!EVP_CIPHER_CTX_is_encrypting(c) || !cctx->tag_set) return 0; if (!CRYPTO_ccm128_tag(&cctx->ccm, ptr, (size_t)arg)) return 0; @@ -637,7 +641,7 @@ static int aria_ccm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, if (out != in || len < (EVP_CCM_TLS_EXPLICIT_IV_LEN + (size_t)cctx->M)) return -1; /* If encrypting set explicit IV from sequence number (start of AAD) */ - if (EVP_CIPHER_CTX_encrypting(ctx)) + if (EVP_CIPHER_CTX_is_encrypting(ctx)) memcpy(out, EVP_CIPHER_CTX_buf_noconst(ctx), EVP_CCM_TLS_EXPLICIT_IV_LEN); /* Get rest of IV from explicit IV */ @@ -649,11 +653,12 @@ static int aria_ccm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, len)) return -1; /* Use saved AAD */ - CRYPTO_ccm128_aad(ccm, EVP_CIPHER_CTX_buf_noconst(ctx), cctx->tls_aad_len); + CRYPTO_ccm128_aad(ccm, EVP_CIPHER_CTX_buf_noconst(ctx), + cctx->tls_aad_len); /* Fix buffer to point to payload */ in += EVP_CCM_TLS_EXPLICIT_IV_LEN; out += EVP_CCM_TLS_EXPLICIT_IV_LEN; - if (EVP_CIPHER_CTX_encrypting(ctx)) { + if (EVP_CIPHER_CTX_is_encrypting(ctx)) { if (cctx->str ? CRYPTO_ccm128_encrypt_ccm64(ccm, in, out, len, cctx->str) : CRYPTO_ccm128_encrypt(ccm, in, out, len)) return -1; @@ -709,7 +714,7 @@ static int aria_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, } /* The tag must be set before actually decrypting data */ - if (!EVP_CIPHER_CTX_encrypting(ctx) && !cctx->tag_set) + if (!EVP_CIPHER_CTX_is_encrypting(ctx) && !cctx->tag_set) return -1; /* If not set length yet do it */ @@ -718,7 +723,7 @@ static int aria_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, return -1; cctx->len_set = 1; } - if (EVP_CIPHER_CTX_encrypting(ctx)) { + if (EVP_CIPHER_CTX_is_encrypting(ctx)) { if (cctx->str ? CRYPTO_ccm128_encrypt_ccm64(ccm, in, out, len, cctx->str) : CRYPTO_ccm128_encrypt(ccm, in, out, len)) return -1; diff --git a/crypto/evp/e_bf.c b/crypto/evp/e_bf.c index 9e240d1124..734e77f0a9 100644 --- a/crypto/evp/e_bf.c +++ b/crypto/evp/e_bf.c @@ -38,7 +38,7 @@ IMPLEMENT_BLOCK_CIPHER(bf, ks, BF, EVP_BF_KEY, NID_bf, 8, 16, 8, 64, static int bf_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc) { - BF_set_key(&data(ctx)->ks, EVP_CIPHER_CTX_key_length(ctx), key); + BF_set_key(&data(ctx)->ks, EVP_CIPHER_CTX_get_key_length(ctx), key); return 1; } diff --git a/crypto/evp/e_camellia.c b/crypto/evp/e_camellia.c index db2057a660..b2f59847d4 100644 --- a/crypto/evp/e_camellia.c +++ b/crypto/evp/e_camellia.c @@ -56,8 +56,8 @@ static int cmll_t4_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, EVP_CAMELLIA_KEY *dat = (EVP_CAMELLIA_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx); - mode = EVP_CIPHER_CTX_mode(ctx); - bits = EVP_CIPHER_CTX_key_length(ctx) * 8; + mode = EVP_CIPHER_CTX_get_mode(ctx); + bits = EVP_CIPHER_CTX_get_key_length(ctx) * 8; cmll_t4_set_key(key, bits, &dat->ks); @@ -196,13 +196,14 @@ static int camellia_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, int ret, mode; EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY,ctx); - ret = Camellia_set_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, &dat->ks); + ret = Camellia_set_key(key, EVP_CIPHER_CTX_get_key_length(ctx) * 8, + &dat->ks); if (ret < 0) { ERR_raise(ERR_LIB_EVP, EVP_R_CAMELLIA_KEY_SETUP_FAILED); return 0; } - mode = EVP_CIPHER_CTX_mode(ctx); + mode = EVP_CIPHER_CTX_get_mode(ctx); if ((mode == EVP_CIPH_ECB_MODE || mode == EVP_CIPH_CBC_MODE) && !enc) { dat->block = (block128_f) Camellia_decrypt; @@ -224,8 +225,8 @@ static int camellia_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, if (dat->stream.cbc) (*dat->stream.cbc) (in, out, len, &dat->ks, ctx->iv, - EVP_CIPHER_CTX_encrypting(ctx)); - else if (EVP_CIPHER_CTX_encrypting(ctx)) + EVP_CIPHER_CTX_is_encrypting(ctx)); + else if (EVP_CIPHER_CTX_is_encrypting(ctx)) CRYPTO_cbc128_encrypt(in, out, len, &dat->ks, ctx->iv, dat->block); else CRYPTO_cbc128_decrypt(in, out, len, &dat->ks, ctx->iv, dat->block); @@ -236,7 +237,7 @@ static int camellia_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, static int camellia_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len) { - size_t bl = EVP_CIPHER_CTX_block_size(ctx); + size_t bl = EVP_CIPHER_CTX_get_block_size(ctx); size_t i; EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY,ctx); @@ -254,7 +255,7 @@ static int camellia_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, { EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY,ctx); - int num = EVP_CIPHER_CTX_num(ctx); + int num = EVP_CIPHER_CTX_get_num(ctx); CRYPTO_ofb128_encrypt(in, out, len, &dat->ks, ctx->iv, &num, dat->block); EVP_CIPHER_CTX_set_num(ctx, num); return 1; @@ -265,9 +266,9 @@ static int camellia_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, { EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY,ctx); - int num = EVP_CIPHER_CTX_num(ctx); + int num = EVP_CIPHER_CTX_get_num(ctx); CRYPTO_cfb128_encrypt(in, out, len, &dat->ks, ctx->iv, &num, - EVP_CIPHER_CTX_encrypting(ctx), dat->block); + EVP_CIPHER_CTX_is_encrypting(ctx), dat->block); EVP_CIPHER_CTX_set_num(ctx, num); return 1; } @@ -277,9 +278,9 @@ static int camellia_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, { EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY,ctx); - int num = EVP_CIPHER_CTX_num(ctx); + int num = EVP_CIPHER_CTX_get_num(ctx); CRYPTO_cfb128_8_encrypt(in, out, len, &dat->ks, ctx->iv, &num, - EVP_CIPHER_CTX_encrypting(ctx), dat->block); + EVP_CIPHER_CTX_is_encrypting(ctx), dat->block); EVP_CIPHER_CTX_set_num(ctx, num); return 1; } @@ -290,26 +291,31 @@ static int camellia_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY,ctx); if (EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS)) { - int num = EVP_CIPHER_CTX_num(ctx); + int num = EVP_CIPHER_CTX_get_num(ctx); CRYPTO_cfb128_1_encrypt(in, out, len, &dat->ks, ctx->iv, &num, - EVP_CIPHER_CTX_encrypting(ctx), dat->block); + EVP_CIPHER_CTX_is_encrypting(ctx), + dat->block); EVP_CIPHER_CTX_set_num(ctx, num); return 1; } while (len >= MAXBITCHUNK) { - int num = EVP_CIPHER_CTX_num(ctx); + int num = EVP_CIPHER_CTX_get_num(ctx); CRYPTO_cfb128_1_encrypt(in, out, MAXBITCHUNK * 8, &dat->ks, - ctx->iv, &num, EVP_CIPHER_CTX_encrypting(ctx), dat->block); + ctx->iv, &num, + EVP_CIPHER_CTX_is_encrypting(ctx), + dat->block); EVP_CIPHER_CTX_set_num(ctx, num); len -= MAXBITCHUNK; out += MAXBITCHUNK; in += MAXBITCHUNK; } if (len) { - int num = EVP_CIPHER_CTX_num(ctx); + int num = EVP_CIPHER_CTX_get_num(ctx); CRYPTO_cfb128_1_encrypt(in, out, len * 8, &dat->ks, - ctx->iv, &num, EVP_CIPHER_CTX_encrypting(ctx), dat->block); + ctx->iv, &num, + EVP_CIPHER_CTX_is_encrypting(ctx), + dat->block); EVP_CIPHER_CTX_set_num(ctx, num); } @@ -319,7 +325,7 @@ static int camellia_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, static int camellia_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len) { - int snum = EVP_CIPHER_CTX_num(ctx); + int snum = EVP_CIPHER_CTX_get_num(ctx); unsigned int num; EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY,ctx); @@ -328,7 +334,8 @@ static int camellia_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, num = snum; if (dat->stream.ctr) CRYPTO_ctr128_encrypt_ctr32(in, out, len, &dat->ks, ctx->iv, - EVP_CIPHER_CTX_buf_noconst(ctx), &num, + EVP_CIPHER_CTX_buf_noconst(ctx), + &num, dat->stream.ctr); else CRYPTO_ctr128_encrypt(in, out, len, &dat->ks, ctx->iv, diff --git a/crypto/evp/e_cast.c b/crypto/evp/e_cast.c index fd9dd0dc75..5e9be2dc7d 100644 --- a/crypto/evp/e_cast.c +++ b/crypto/evp/e_cast.c @@ -40,7 +40,7 @@ IMPLEMENT_BLOCK_CIPHER(cast5, ks, CAST, EVP_CAST_KEY, static int cast_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc) { - int keylen = EVP_CIPHER_CTX_key_length(ctx); + int keylen = EVP_CIPHER_CTX_get_key_length(ctx); if (keylen <= 0) return 0; diff --git a/crypto/evp/e_des.c b/crypto/evp/e_des.c index d3b2206bb7..491d4511d8 100644 --- a/crypto/evp/e_des.c +++ b/crypto/evp/e_des.c @@ -65,7 +65,7 @@ static int des_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, BLOCK_CIPHER_ecb_loop() DES_ecb_encrypt((DES_cblock *)(in + i), (DES_cblock *)(out + i), EVP_CIPHER_CTX_get_cipher_data(ctx), - EVP_CIPHER_CTX_encrypting(ctx)); + EVP_CIPHER_CTX_is_encrypting(ctx)); return 1; } @@ -73,7 +73,7 @@ static int des_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) { while (inl >= EVP_MAXCHUNK) { - int num = EVP_CIPHER_CTX_num(ctx); + int num = EVP_CIPHER_CTX_get_num(ctx); DES_ofb64_encrypt(in, out, (long)EVP_MAXCHUNK, EVP_CIPHER_CTX_get_cipher_data(ctx), (DES_cblock *)ctx->iv, &num); @@ -83,7 +83,7 @@ static int des_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, out += EVP_MAXCHUNK; } if (inl) { - int num = EVP_CIPHER_CTX_num(ctx); + int num = EVP_CIPHER_CTX_get_num(ctx); DES_ofb64_encrypt(in, out, (long)inl, EVP_CIPHER_CTX_get_cipher_data(ctx), (DES_cblock *)ctx->iv, &num); @@ -105,7 +105,7 @@ static int des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, DES_ncbc_encrypt(in, out, (long)EVP_MAXCHUNK, EVP_CIPHER_CTX_get_cipher_data(ctx), (DES_cblock *)ctx->iv, - EVP_CIPHER_CTX_encrypting(ctx)); + EVP_CIPHER_CTX_is_encrypting(ctx)); inl -= EVP_MAXCHUNK; in += EVP_MAXCHUNK; out += EVP_MAXCHUNK; @@ -114,7 +114,7 @@ static int des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, DES_ncbc_encrypt(in, out, (long)inl, EVP_CIPHER_CTX_get_cipher_data(ctx), (DES_cblock *)ctx->iv, - EVP_CIPHER_CTX_encrypting(ctx)); + EVP_CIPHER_CTX_is_encrypting(ctx)); return 1; } @@ -122,22 +122,22 @@ static int des_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) { while (inl >= EVP_MAXCHUNK) { - int num = EVP_CIPHER_CTX_num(ctx); + int num = EVP_CIPHER_CTX_get_num(ctx); DES_cfb64_encrypt(in, out, (long)EVP_MAXCHUNK, EVP_CIPHER_CTX_get_cipher_data(ctx), (DES_cblock *)ctx->iv, &num, - EVP_CIPHER_CTX_encrypting(ctx)); + EVP_CIPHER_CTX_is_encrypting(ctx)); EVP_CIPHER_CTX_set_num(ctx, num); inl -= EVP_MAXCHUNK; in += EVP_MAXCHUNK; out += EVP_MAXCHUNK; } if (inl) { - int num = EVP_CIPHER_CTX_num(ctx); + int num = EVP_CIPHER_CTX_get_num(ctx); DES_cfb64_encrypt(in, out, (long)inl, EVP_CIPHER_CTX_get_cipher_data(ctx), (DES_cblock *)ctx->iv, &num, - EVP_CIPHER_CTX_encrypting(ctx)); + EVP_CIPHER_CTX_is_encrypting(ctx)); EVP_CIPHER_CTX_set_num(ctx, num); } return 1; @@ -161,7 +161,7 @@ static int des_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, c[0] = (in[n / 8] & (1 << (7 - n % 8))) ? 0x80 : 0; DES_cfb_encrypt(c, d, 1, 1, EVP_CIPHER_CTX_get_cipher_data(ctx), (DES_cblock *)ctx->iv, - EVP_CIPHER_CTX_encrypting(ctx)); + EVP_CIPHER_CTX_is_encrypting(ctx)); out[n / 8] = (out[n / 8] & ~(0x80 >> (unsigned int)(n % 8))) | ((d[0] & 0x80) >> (unsigned int)(n % 8)); @@ -183,7 +183,7 @@ static int des_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, DES_cfb_encrypt(in, out, 8, (long)EVP_MAXCHUNK, EVP_CIPHER_CTX_get_cipher_data(ctx), (DES_cblock *)ctx->iv, - EVP_CIPHER_CTX_encrypting(ctx)); + EVP_CIPHER_CTX_is_encrypting(ctx)); inl -= EVP_MAXCHUNK; in += EVP_MAXCHUNK; out += EVP_MAXCHUNK; @@ -192,7 +192,7 @@ static int des_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, DES_cfb_encrypt(in, out, 8, (long)inl, EVP_CIPHER_CTX_get_cipher_data(ctx), (DES_cblock *)ctx->iv, - EVP_CIPHER_CTX_encrypting(ctx)); + EVP_CIPHER_CTX_is_encrypting(ctx)); return 1; } @@ -217,7 +217,7 @@ static int des_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, dat->stream.cbc = NULL; # if defined(SPARC_DES_CAPABLE) if (SPARC_DES_CAPABLE) { - int mode = EVP_CIPHER_CTX_mode(ctx); + int mode = EVP_CIPHER_CTX_get_mode(ctx); if (mode == EVP_CIPH_CBC_MODE) { des_t4_key_expand(key, &dat->ks.ks); diff --git a/crypto/evp/e_des3.c b/crypto/evp/e_des3.c index 9043f3fb1b..746709fa41 100644 --- a/crypto/evp/e_des3.c +++ b/crypto/evp/e_des3.c @@ -75,7 +75,7 @@ static int des_ede_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, DES_ecb3_encrypt((const_DES_cblock *)(in + i), (DES_cblock *)(out + i), &data(ctx)->ks1, &data(ctx)->ks2, - &data(ctx)->ks3, EVP_CIPHER_CTX_encrypting(ctx)); + &data(ctx)->ks3, EVP_CIPHER_CTX_is_encrypting(ctx)); return 1; } @@ -83,7 +83,7 @@ static int des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) { while (inl >= EVP_MAXCHUNK) { - int num = EVP_CIPHER_CTX_num(ctx); + int num = EVP_CIPHER_CTX_get_num(ctx); DES_ede3_ofb64_encrypt(in, out, (long)EVP_MAXCHUNK, &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, @@ -95,7 +95,7 @@ static int des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, out += EVP_MAXCHUNK; } if (inl) { - int num = EVP_CIPHER_CTX_num(ctx); + int num = EVP_CIPHER_CTX_get_num(ctx); DES_ede3_ofb64_encrypt(in, out, (long)inl, &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, @@ -121,7 +121,7 @@ static int des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, DES_ede3_cbc_encrypt(in, out, (long)EVP_MAXCHUNK, &dat->ks1, &dat->ks2, &dat->ks3, (DES_cblock *)ctx->iv, - EVP_CIPHER_CTX_encrypting(ctx)); + EVP_CIPHER_CTX_is_encrypting(ctx)); inl -= EVP_MAXCHUNK; in += EVP_MAXCHUNK; out += EVP_MAXCHUNK; @@ -130,7 +130,7 @@ static int des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, DES_ede3_cbc_encrypt(in, out, (long)inl, &dat->ks1, &dat->ks2, &dat->ks3, (DES_cblock *)ctx->iv, - EVP_CIPHER_CTX_encrypting(ctx)); + EVP_CIPHER_CTX_is_encrypting(ctx)); return 1; } @@ -138,22 +138,22 @@ static int des_ede_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) { while (inl >= EVP_MAXCHUNK) { - int num = EVP_CIPHER_CTX_num(ctx); + int num = EVP_CIPHER_CTX_get_num(ctx); DES_ede3_cfb64_encrypt(in, out, (long)EVP_MAXCHUNK, &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, (DES_cblock *)ctx->iv, - &num, EVP_CIPHER_CTX_encrypting(ctx)); + &num, EVP_CIPHER_CTX_is_encrypting(ctx)); EVP_CIPHER_CTX_set_num(ctx, num); inl -= EVP_MAXCHUNK; in += EVP_MAXCHUNK; out += EVP_MAXCHUNK; } if (inl) { - int num = EVP_CIPHER_CTX_num(ctx); + int num = EVP_CIPHER_CTX_get_num(ctx); DES_ede3_cfb64_encrypt(in, out, (long)inl, &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, (DES_cblock *)ctx->iv, - &num, EVP_CIPHER_CTX_encrypting(ctx)); + &num, EVP_CIPHER_CTX_is_encrypting(ctx)); EVP_CIPHER_CTX_set_num(ctx, num); } return 1; @@ -176,7 +176,7 @@ static int des_ede3_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, DES_ede3_cfb_encrypt(c, d, 1, 1, &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, (DES_cblock *)ctx->iv, - EVP_CIPHER_CTX_encrypting(ctx)); + EVP_CIPHER_CTX_is_encrypting(ctx)); out[n / 8] = (out[n / 8] & ~(0x80 >> (unsigned int)(n % 8))) | ((d[0] & 0x80) >> (unsigned int)(n % 8)); } @@ -191,7 +191,7 @@ static int des_ede3_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, DES_ede3_cfb_encrypt(in, out, 8, (long)EVP_MAXCHUNK, &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, (DES_cblock *)ctx->iv, - EVP_CIPHER_CTX_encrypting(ctx)); + EVP_CIPHER_CTX_is_encrypting(ctx)); inl -= EVP_MAXCHUNK; in += EVP_MAXCHUNK; out += EVP_MAXCHUNK; @@ -200,7 +200,7 @@ static int des_ede3_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, DES_ede3_cfb_encrypt(in, out, 8, (long)inl, &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, (DES_cblock *)ctx->iv, - EVP_CIPHER_CTX_encrypting(ctx)); + EVP_CIPHER_CTX_is_encrypting(ctx)); return 1; } @@ -232,7 +232,7 @@ static int des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, dat->stream.cbc = NULL; # if defined(SPARC_DES_CAPABLE) if (SPARC_DES_CAPABLE) { - int mode = EVP_CIPHER_CTX_mode(ctx); + int mode = EVP_CIPHER_CTX_get_mode(ctx); if (mode == EVP_CIPH_CBC_MODE) { des_t4_key_expand(&deskey[0], &dat->ks1); @@ -259,7 +259,7 @@ static int des_ede3_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, dat->stream.cbc = NULL; # if defined(SPARC_DES_CAPABLE) if (SPARC_DES_CAPABLE) { - int mode = EVP_CIPHER_CTX_mode(ctx); + int mode = EVP_CIPHER_CTX_get_mode(ctx); if (mode == EVP_CIPH_CBC_MODE) { des_t4_key_expand(&deskey[0], &dat->ks1); @@ -285,7 +285,7 @@ static int des3_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) switch (type) { case EVP_CTRL_RAND_KEY: - kl = EVP_CIPHER_CTX_key_length(ctx); + kl = EVP_CIPHER_CTX_get_key_length(ctx); if (kl < 0 || RAND_priv_bytes(ptr, kl) <= 0) return 0; DES_set_odd_parity(deskey); @@ -401,7 +401,7 @@ static int des_ede3_wrap_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, return 0; } - if (EVP_CIPHER_CTX_encrypting(ctx)) + if (EVP_CIPHER_CTX_is_encrypting(ctx)) return des_ede3_wrap(ctx, out, in, inl); else return des_ede3_unwrap(ctx, out, in, inl); diff --git a/crypto/evp/e_idea.c b/crypto/evp/e_idea.c index a4778a2c05..cf8746d357 100644 --- a/crypto/evp/e_idea.c +++ b/crypto/evp/e_idea.c @@ -58,9 +58,9 @@ static int idea_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc) { if (!enc) { - if (EVP_CIPHER_CTX_mode(ctx) == EVP_CIPH_OFB_MODE) + if (EVP_CIPHER_CTX_get_mode(ctx) == EVP_CIPH_OFB_MODE) enc = 1; - else if (EVP_CIPHER_CTX_mode(ctx) == EVP_CIPH_CFB_MODE) + else if (EVP_CIPHER_CTX_get_mode(ctx) == EVP_CIPH_CFB_MODE) enc = 1; } if (enc) diff --git a/crypto/evp/e_rc2.c b/crypto/evp/e_rc2.c index c935a49bbd..ffeb17fb1e 100644 --- a/crypto/evp/e_rc2.c +++ b/crypto/evp/e_rc2.c @@ -92,7 +92,7 @@ const EVP_CIPHER *EVP_rc2_40_cbc(void) static int rc2_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc) { - RC2_set_key(&data(ctx)->ks, EVP_CIPHER_CTX_key_length(ctx), + RC2_set_key(&data(ctx)->ks, EVP_CIPHER_CTX_get_key_length(ctx), key, data(ctx)->key_bits); return 1; } @@ -136,7 +136,7 @@ static int rc2_get_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type) unsigned char iv[EVP_MAX_IV_LENGTH]; if (type != NULL) { - l = EVP_CIPHER_CTX_iv_length(c); + l = EVP_CIPHER_CTX_get_iv_length(c); OPENSSL_assert(l <= sizeof(iv)); i = ASN1_TYPE_get_int_octetstring(type, &num, iv, l); if (i != (int)l) @@ -161,7 +161,7 @@ static int rc2_set_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type) if (type != NULL) { num = rc2_meth_to_magic(c); - j = EVP_CIPHER_CTX_iv_length(c); + j = EVP_CIPHER_CTX_get_iv_length(c); i = ASN1_TYPE_set_int_octetstring(type, num, c->oiv, j); } return i; @@ -171,7 +171,7 @@ static int rc2_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) { switch (type) { case EVP_CTRL_INIT: - data(c)->key_bits = EVP_CIPHER_CTX_key_length(c) * 8; + data(c)->key_bits = EVP_CIPHER_CTX_get_key_length(c) * 8; return 1; case EVP_CTRL_GET_RC2_KEY_BITS: diff --git a/crypto/evp/e_rc4.c b/crypto/evp/e_rc4.c index ec07f028c5..e22e81d467 100644 --- a/crypto/evp/e_rc4.c +++ b/crypto/evp/e_rc4.c @@ -79,7 +79,7 @@ static int rc4_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, { int keylen; - if ((keylen = EVP_CIPHER_CTX_key_length(ctx)) <= 0) + if ((keylen = EVP_CIPHER_CTX_get_key_length(ctx)) <= 0) return 0; RC4_set_key(&data(ctx)->ks, keylen, key); return 1; diff --git a/crypto/evp/e_rc4_hmac_md5.c b/crypto/evp/e_rc4_hmac_md5.c index c8b6da246f..183ecefcec 100644 --- a/crypto/evp/e_rc4_hmac_md5.c +++ b/crypto/evp/e_rc4_hmac_md5.c @@ -46,7 +46,7 @@ static int rc4_hmac_md5_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *iv, int enc) { EVP_RC4_HMAC_MD5 *key = data(ctx); - const int keylen = EVP_CIPHER_CTX_key_length(ctx); + const int keylen = EVP_CIPHER_CTX_get_key_length(ctx); if (keylen <= 0) return 0; @@ -88,7 +88,7 @@ static int rc4_hmac_md5_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, if (plen != NO_PAYLOAD_LENGTH && len != (plen + MD5_DIGEST_LENGTH)) return 0; - if (EVP_CIPHER_CTX_encrypting(ctx)) { + if (EVP_CIPHER_CTX_is_encrypting(ctx)) { if (plen == NO_PAYLOAD_LENGTH) plen = len; # if defined(STITCHED_CALL) @@ -228,7 +228,7 @@ static int rc4_hmac_md5_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, len = p[arg - 2] << 8 | p[arg - 1]; - if (!EVP_CIPHER_CTX_encrypting(ctx)) { + if (!EVP_CIPHER_CTX_is_encrypting(ctx)) { if (len < MD5_DIGEST_LENGTH) return -1; len -= MD5_DIGEST_LENGTH; diff --git a/crypto/evp/e_rc5.c b/crypto/evp/e_rc5.c index aa5e9020de..20098a9225 100644 --- a/crypto/evp/e_rc5.c +++ b/crypto/evp/e_rc5.c @@ -72,11 +72,11 @@ static int rc5_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) static int r_32_12_16_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc) { - if (EVP_CIPHER_CTX_key_length(ctx) > 255) { + if (EVP_CIPHER_CTX_get_key_length(ctx) > 255) { ERR_raise(ERR_LIB_EVP, EVP_R_BAD_KEY_LENGTH); return 0; } - return RC5_32_set_key(&data(ctx)->ks, EVP_CIPHER_CTX_key_length(ctx), + return RC5_32_set_key(&data(ctx)->ks, EVP_CIPHER_CTX_get_key_length(ctx), key, data(ctx)->rounds); } diff --git a/crypto/evp/e_sm4.c b/crypto/evp/e_sm4.c index a3767573ce..a3ccc49f7e 100644 --- a/crypto/evp/e_sm4.c +++ b/crypto/evp/e_sm4.c @@ -72,7 +72,7 @@ IMPLEMENT_BLOCK_CIPHER(sm4, ks, sm4, EVP_SM4_KEY, NID_sm4, static int sm4_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len) { - unsigned int num = EVP_CIPHER_CTX_num(ctx); + unsigned int num = EVP_CIPHER_CTX_get_num(ctx); EVP_SM4_KEY *dat = EVP_C_DATA(EVP_SM4_KEY, ctx); CRYPTO_ctr128_encrypt(in, out, len, &dat->ks, ctx->iv, diff --git a/crypto/evp/e_xcbc_d.c b/crypto/evp/e_xcbc_d.c index b1e6c2a168..f930941887 100644 --- a/crypto/evp/e_xcbc_d.c +++ b/crypto/evp/e_xcbc_d.c @@ -76,7 +76,7 @@ static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, DES_xcbc_encrypt(in, out, (long)EVP_MAXCHUNK, &data(ctx)->ks, (DES_cblock *)ctx->iv, &data(ctx)->inw, &data(ctx)->outw, - EVP_CIPHER_CTX_encrypting(ctx)); + EVP_CIPHER_CTX_is_encrypting(ctx)); inl -= EVP_MAXCHUNK; in += EVP_MAXCHUNK; out += EVP_MAXCHUNK; @@ -85,7 +85,7 @@ static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, DES_xcbc_encrypt(in, out, (long)inl, &data(ctx)->ks, (DES_cblock *)ctx->iv, &data(ctx)->inw, &data(ctx)->outw, - EVP_CIPHER_CTX_encrypting(ctx)); + EVP_CIPHER_CTX_is_encrypting(ctx)); return 1; } #endif diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c index 356951014b..f39e9b8c90 100644 --- a/crypto/evp/evp_enc.c +++ b/crypto/evp/evp_enc.c @@ -216,10 +216,10 @@ static int evp_cipher_init_internal(EVP_CIPHER_CTX *ctx, return ctx->cipher->einit(ctx->algctx, key, key == NULL ? 0 - : EVP_CIPHER_CTX_key_length(ctx), + : EVP_CIPHER_CTX_get_key_length(ctx), iv, iv == NULL ? 0 - : EVP_CIPHER_CTX_iv_length(ctx), + : EVP_CIPHER_CTX_get_iv_length(ctx), params); } @@ -231,10 +231,10 @@ static int evp_cipher_init_internal(EVP_CIPHER_CTX *ctx, return ctx->cipher->dinit(ctx->algctx, key, key == NULL ? 0 - : EVP_CIPHER_CTX_key_length(ctx), + : EVP_CIPHER_CTX_get_key_length(ctx), iv, iv == NULL ? 0 - : EVP_CIPHER_CTX_iv_length(ctx), + : EVP_CIPHER_CTX_get_iv_length(ctx), params); /* Code below to be removed when legacy support is dropped. */ @@ -321,14 +321,14 @@ static int evp_cipher_init_internal(EVP_CIPHER_CTX *ctx, || ctx->cipher->block_size == 16); if (!(ctx->flags & EVP_CIPHER_CTX_FLAG_WRAP_ALLOW) - && EVP_CIPHER_CTX_mode(ctx) == EVP_CIPH_WRAP_MODE) { + && EVP_CIPHER_CTX_get_mode(ctx) == EVP_CIPH_WRAP_MODE) { ERR_raise(ERR_LIB_EVP, EVP_R_WRAP_MODE_NOT_ALLOWED); return 0; } - if ((EVP_CIPHER_flags(EVP_CIPHER_CTX_get0_cipher(ctx)) + if ((EVP_CIPHER_get_flags(EVP_CIPHER_CTX_get0_cipher(ctx)) & EVP_CIPH_CUSTOM_IV) == 0) { - switch (EVP_CIPHER_CTX_mode(ctx)) { + switch (EVP_CIPHER_CTX_get_mode(ctx)) { case EVP_CIPH_STREAM_CIPHER: case EVP_CIPH_ECB_MODE: @@ -341,19 +341,19 @@ static int evp_cipher_init_internal(EVP_CIPHER_CTX *ctx, /* fall-through */ case EVP_CIPH_CBC_MODE: - n = EVP_CIPHER_CTX_iv_length(ctx); + n = EVP_CIPHER_CTX_get_iv_length(ctx); if (!ossl_assert(n >= 0 && n <= (int)sizeof(ctx->iv))) return 0; if (iv) - memcpy(ctx->oiv, iv, EVP_CIPHER_CTX_iv_length(ctx)); - memcpy(ctx->iv, ctx->oiv, EVP_CIPHER_CTX_iv_length(ctx)); + memcpy(ctx->oiv, iv, EVP_CIPHER_CTX_get_iv_length(ctx)); + memcpy(ctx->iv, ctx->oiv, EVP_CIPHER_CTX_get_iv_length(ctx)); break; case EVP_CIPH_CTR_MODE: ctx->num = 0; /* Don't reuse IV for CTR mode */ if (iv) - memcpy(ctx->iv, iv, EVP_CIPHER_CTX_iv_length(ctx)); + memcpy(ctx->iv, iv, EVP_CIPHER_CTX_get_iv_length(ctx)); break; default: @@ -674,7 +674,7 @@ int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) if (ctx->cipher->prov == NULL) goto legacy; - blocksize = EVP_CIPHER_CTX_block_size(ctx); + blocksize = EVP_CIPHER_CTX_get_block_size(ctx); if (blocksize < 1 || ctx->cipher->cfinal == NULL) { ERR_raise(ERR_LIB_EVP, EVP_R_FINAL_ERROR); @@ -761,7 +761,7 @@ int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, if (ctx->cipher->prov == NULL) goto legacy; - blocksize = EVP_CIPHER_CTX_block_size(ctx); + blocksize = EVP_CIPHER_CTX_get_block_size(ctx); if (ctx->cipher->cupdate == NULL || blocksize < 1) { ERR_raise(ERR_LIB_EVP, EVP_R_UPDATE_ERROR); @@ -896,7 +896,7 @@ int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) if (ctx->cipher->prov == NULL) goto legacy; - blocksize = EVP_CIPHER_CTX_block_size(ctx); + blocksize = EVP_CIPHER_CTX_get_block_size(ctx); if (blocksize < 1 || ctx->cipher->cfinal == NULL) { ERR_raise(ERR_LIB_EVP, EVP_R_FINAL_ERROR); @@ -976,7 +976,7 @@ int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *c, int keylen) OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END }; size_t len = keylen; - if (EVP_CIPHER_CTX_key_length(c) == keylen) + if (EVP_CIPHER_CTX_get_key_length(c) == keylen) return 1; /* Check the cipher actually understands this parameter */ @@ -998,7 +998,7 @@ int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *c, int keylen) */ if (c->cipher->flags & EVP_CIPH_CUSTOM_KEY_LENGTH) return EVP_CIPHER_CTX_ctrl(c, EVP_CTRL_SET_KEY_LENGTH, keylen, NULL); - if (EVP_CIPHER_CTX_key_length(c) == keylen) + if (EVP_CIPHER_CTX_get_key_length(c) == keylen) return 1; if ((keylen > 0) && (c->cipher->flags & EVP_CIPH_VARIABLE_LENGTH)) { c->key_len = keylen; @@ -1257,7 +1257,7 @@ const OSSL_PARAM *EVP_CIPHER_gettable_params(const EVP_CIPHER *cipher) { if (cipher != NULL && cipher->gettable_params != NULL) return cipher->gettable_params( - ossl_provider_ctx(EVP_CIPHER_provider(cipher))); + ossl_provider_ctx(EVP_CIPHER_get0_provider(cipher))); return NULL; } @@ -1266,7 +1266,7 @@ const OSSL_PARAM *EVP_CIPHER_settable_ctx_params(const EVP_CIPHER *cipher) void *provctx; if (cipher != NULL && cipher->settable_ctx_params != NULL) { - provctx = ossl_provider_ctx(EVP_CIPHER_provider(cipher)); + provctx = ossl_provider_ctx(EVP_CIPHER_get0_provider(cipher)); return cipher->settable_ctx_params(NULL, provctx); } return NULL; @@ -1277,7 +1277,7 @@ const OSSL_PARAM *EVP_CIPHER_gettable_ctx_params(const EVP_CIPHER *cipher) void *provctx; if (cipher != NULL && cipher->gettable_ctx_params != NULL) { - provctx = ossl_provider_ctx(EVP_CIPHER_provider(cipher)); + provctx = ossl_provider_ctx(EVP_CIPHER_get0_provider(cipher)); return cipher->gettable_ctx_params(NULL, provctx); } return NULL; @@ -1288,7 +1288,7 @@ const OSSL_PARAM *EVP_CIPHER_CTX_settable_params(EVP_CIPHER_CTX *cctx) void *alg; if (cctx != NULL && cctx->cipher->settable_ctx_params != NULL) { - alg = ossl_provider_ctx(EVP_CIPHER_provider(cctx->cipher)); + alg = ossl_provider_ctx(EVP_CIPHER_get0_provider(cctx->cipher)); return cctx->cipher->settable_ctx_params(cctx->algctx, alg); } return NULL; @@ -1299,7 +1299,7 @@ const OSSL_PARAM *EVP_CIPHER_CTX_gettable_params(EVP_CIPHER_CTX *cctx) void *provctx; if (cctx != NULL && cctx->cipher->gettable_ctx_params != NULL) { - provctx = ossl_provider_ctx(EVP_CIPHER_provider(cctx->cipher)); + provctx = ossl_provider_ctx(EVP_CIPHER_get0_provider(cctx->cipher)); return cctx->cipher->gettable_ctx_params(cctx->algctx, provctx); } return NULL; @@ -1314,7 +1314,7 @@ static OSSL_LIB_CTX *EVP_CIPHER_CTX_get_libctx(EVP_CIPHER_CTX *ctx) if (cipher == NULL) return NULL; - prov = EVP_CIPHER_provider(cipher); + prov = EVP_CIPHER_get0_provider(cipher); return ossl_provider_libctx(prov); } #endif @@ -1331,7 +1331,7 @@ int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key) int kl; OSSL_LIB_CTX *libctx = EVP_CIPHER_CTX_get_libctx(ctx); - kl = EVP_CIPHER_CTX_key_length(ctx); + kl = EVP_CIPHER_CTX_get_key_length(ctx); if (kl <= 0 || RAND_priv_bytes_ex(libctx, key, kl, 0) <= 0) return 0; return 1; @@ -1442,7 +1442,7 @@ static void set_legacy_nid(const char *name, void *vlegacy_nid) return; if (legacy_method == NULL) return; - nid = EVP_CIPHER_nid(legacy_method); + nid = EVP_CIPHER_get_nid(legacy_method); if (*legacy_nid != NID_undef && *legacy_nid != nid) { *legacy_nid = -1; return; diff --git a/crypto/evp/evp_key.c b/crypto/evp/evp_key.c index 3aa49aa47e..acbe92dac1 100644 --- a/crypto/evp/evp_key.c +++ b/crypto/evp/evp_key.c @@ -85,8 +85,8 @@ int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, int niv, nkey, addmd = 0; unsigned int mds = 0, i; int rv = 0; - nkey = EVP_CIPHER_key_length(type); - niv = EVP_CIPHER_iv_length(type); + nkey = EVP_CIPHER_get_key_length(type); + niv = EVP_CIPHER_get_iv_length(type); OPENSSL_assert(nkey <= EVP_MAX_KEY_LENGTH); OPENSSL_assert(niv <= EVP_MAX_IV_LENGTH); @@ -146,7 +146,7 @@ int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, if ((nkey == 0) && (niv == 0)) break; } - rv = EVP_CIPHER_key_length(type); + rv = EVP_CIPHER_get_key_length(type); err: EVP_MD_CTX_free(c); OPENSSL_cleanse(md_buf, sizeof(md_buf)); diff --git a/crypto/evp/evp_lib.c b/crypto/evp/evp_lib.c index bc872c0e79..8a03c4490b 100644 --- a/crypto/evp/evp_lib.c +++ b/crypto/evp/evp_lib.c @@ -49,7 +49,7 @@ int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) if (type != NULL) { unsigned char iv[EVP_MAX_IV_LENGTH]; - l = EVP_CIPHER_CTX_iv_length(ctx); + l = EVP_CIPHER_CTX_get_iv_length(ctx); if (!ossl_assert(l <= sizeof(iv))) return -1; i = ASN1_TYPE_get_octetstring(type, iv, l); @@ -70,7 +70,7 @@ int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type) if (type != NULL) { oiv = (unsigned char *)EVP_CIPHER_CTX_original_iv(c); - j = EVP_CIPHER_CTX_iv_length(c); + j = EVP_CIPHER_CTX_get_iv_length(c); OPENSSL_assert(j <= sizeof(c->iv)); i = ASN1_TYPE_set_octetstring(type, oiv, j); } @@ -101,8 +101,8 @@ int evp_cipher_param_to_asn1_ex(EVP_CIPHER_CTX *c, ASN1_TYPE *type, */ if (cipher->set_asn1_parameters != NULL) { ret = cipher->set_asn1_parameters(c, type); - } else if ((EVP_CIPHER_flags(cipher) & EVP_CIPH_FLAG_CUSTOM_ASN1) == 0) { - switch (EVP_CIPHER_mode(cipher)) { + } else if ((EVP_CIPHER_get_flags(cipher) & EVP_CIPH_FLAG_CUSTOM_ASN1) == 0) { + switch (EVP_CIPHER_get_mode(cipher)) { case EVP_CIPH_WRAP_MODE: if (EVP_CIPHER_is_a(cipher, SN_id_smime_alg_CMS3DESwrap)) ASN1_TYPE_set(type, V_ASN1_NULL, NULL); @@ -192,8 +192,8 @@ int evp_cipher_asn1_to_param_ex(EVP_CIPHER_CTX *c, ASN1_TYPE *type, */ if (cipher->get_asn1_parameters != NULL) { ret = cipher->get_asn1_parameters(c, type); - } else if ((EVP_CIPHER_flags(cipher) & EVP_CIPH_FLAG_CUSTOM_ASN1) == 0) { - switch (EVP_CIPHER_mode(cipher)) { + } else if ((EVP_CIPHER_get_flags(cipher) & EVP_CIPH_FLAG_CUSTOM_ASN1) == 0) { + switch (EVP_CIPHER_get_mode(cipher)) { case EVP_CIPH_WRAP_MODE: ret = 1; break; @@ -273,10 +273,10 @@ int evp_cipher_set_asn1_aead_params(EVP_CIPHER_CTX *c, ASN1_TYPE *type, #endif /* !defined(FIPS_MODULE) */ /* Convert the various cipher NIDs and dummies to a proper OID NID */ -int EVP_CIPHER_type(const EVP_CIPHER *cipher) +int EVP_CIPHER_get_type(const EVP_CIPHER *cipher) { int nid; - nid = EVP_CIPHER_nid(cipher); + nid = EVP_CIPHER_get_nid(cipher); switch (nid) { @@ -381,14 +381,14 @@ int evp_cipher_cache_constants(EVP_CIPHER *cipher) return ok; } -int EVP_CIPHER_block_size(const EVP_CIPHER *cipher) +int EVP_CIPHER_get_block_size(const EVP_CIPHER *cipher) { return cipher->block_size; } -int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx) +int EVP_CIPHER_CTX_get_block_size(const EVP_CIPHER_CTX *ctx) { - return EVP_CIPHER_block_size(ctx->cipher); + return EVP_CIPHER_get_block_size(ctx->cipher); } int EVP_CIPHER_impl_ctx_size(const EVP_CIPHER *e) @@ -409,7 +409,7 @@ int EVP_Cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, */ int ret = -1; size_t outl = 0; - size_t blocksize = EVP_CIPHER_CTX_block_size(ctx); + size_t blocksize = EVP_CIPHER_CTX_get_block_size(ctx); if (ctx->cipher->ccipher != NULL) ret = ctx->cipher->ccipher(ctx->algctx, out, &outl, @@ -458,12 +458,12 @@ EVP_CIPHER *EVP_CIPHER_CTX_get1_cipher(EVP_CIPHER_CTX *ctx) return cipher; } -int EVP_CIPHER_CTX_encrypting(const EVP_CIPHER_CTX *ctx) +int EVP_CIPHER_CTX_is_encrypting(const EVP_CIPHER_CTX *ctx) { return ctx->encrypt; } -unsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher) +unsigned long EVP_CIPHER_get_flags(const EVP_CIPHER *cipher) { return cipher->flags; } @@ -493,14 +493,14 @@ void *EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data) return old_cipher_data; } -int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher) +int EVP_CIPHER_get_iv_length(const EVP_CIPHER *cipher) { return cipher->iv_len; } -int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx) +int EVP_CIPHER_CTX_get_iv_length(const EVP_CIPHER_CTX *ctx) { - int rv, len = EVP_CIPHER_iv_length(ctx->cipher); + int rv, len = EVP_CIPHER_get_iv_length(ctx->cipher); size_t v = len; OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END }; @@ -511,7 +511,7 @@ int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx) return rv != 0 ? (int)v : -1; /* Code below to be removed when legacy support is dropped. */ legacy: - if ((EVP_CIPHER_flags(ctx->cipher) & EVP_CIPH_CUSTOM_IV_LENGTH) != 0) { + if ((EVP_CIPHER_get_flags(ctx->cipher) & EVP_CIPH_CUSTOM_IV_LENGTH) != 0) { rv = EVP_CIPHER_CTX_ctrl((EVP_CIPHER_CTX *)ctx, EVP_CTRL_GET_IVLEN, 0, &len); return (rv == 1) ? len : -1; @@ -519,7 +519,7 @@ legacy: return len; } -int EVP_CIPHER_CTX_tag_length(const EVP_CIPHER_CTX *ctx) +int EVP_CIPHER_CTX_get_tag_length(const EVP_CIPHER_CTX *ctx) { int ret; size_t v = 0; @@ -600,7 +600,7 @@ unsigned char *EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx) return ctx->buf; } -int EVP_CIPHER_CTX_num(const EVP_CIPHER_CTX *ctx) +int EVP_CIPHER_CTX_get_num(const EVP_CIPHER_CTX *ctx) { int ok; unsigned int v = (unsigned int)ctx->num; @@ -626,12 +626,12 @@ int EVP_CIPHER_CTX_set_num(EVP_CIPHER_CTX *ctx, int num) return ok != 0; } -int EVP_CIPHER_key_length(const EVP_CIPHER *cipher) +int EVP_CIPHER_get_key_length(const EVP_CIPHER *cipher) { return cipher->key_len; } -int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx) +int EVP_CIPHER_CTX_get_key_length(const EVP_CIPHER_CTX *ctx) { int ok; size_t v = ctx->key_len; @@ -643,12 +643,12 @@ int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx) return ok != 0 ? (int)v : EVP_CTRL_RET_UNSUPPORTED; } -int EVP_CIPHER_nid(const EVP_CIPHER *cipher) +int EVP_CIPHER_get_nid(const EVP_CIPHER *cipher) { return cipher->nid; } -int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx) +int EVP_CIPHER_CTX_get_nid(const EVP_CIPHER_CTX *ctx) { return ctx->cipher->nid; } @@ -657,31 +657,31 @@ int EVP_CIPHER_is_a(const EVP_CIPHER *cipher, const char *name) { if (cipher->prov != NULL) return evp_is_a(cipher->prov, cipher->name_id, NULL, name); - return evp_is_a(NULL, 0, EVP_CIPHER_name(cipher), name); + return evp_is_a(NULL, 0, EVP_CIPHER_get0_name(cipher), name); } -int EVP_CIPHER_number(const EVP_CIPHER *cipher) +int EVP_CIPHER_get_number(const EVP_CIPHER *cipher) { return cipher->name_id; } -const char *EVP_CIPHER_name(const EVP_CIPHER *cipher) +const char *EVP_CIPHER_get0_name(const EVP_CIPHER *cipher) { if (cipher->type_name != NULL) return cipher->type_name; #ifndef FIPS_MODULE - return OBJ_nid2sn(EVP_CIPHER_nid(cipher)); + return OBJ_nid2sn(EVP_CIPHER_get_nid(cipher)); #else return NULL; #endif } -const char *EVP_CIPHER_description(const EVP_CIPHER *cipher) +const char *EVP_CIPHER_get0_description(const EVP_CIPHER *cipher) { if (cipher->description != NULL) return cipher->description; #ifndef FIPS_MODULE - return OBJ_nid2ln(EVP_CIPHER_nid(cipher)); + return OBJ_nid2ln(EVP_CIPHER_get_nid(cipher)); #else return NULL; #endif @@ -697,29 +697,29 @@ int EVP_CIPHER_names_do_all(const EVP_CIPHER *cipher, return 1; } -const OSSL_PROVIDER *EVP_CIPHER_provider(const EVP_CIPHER *cipher) +const OSSL_PROVIDER *EVP_CIPHER_get0_provider(const EVP_CIPHER *cipher) { return cipher->prov; } -int EVP_CIPHER_mode(const EVP_CIPHER *cipher) +int EVP_CIPHER_get_mode(const EVP_CIPHER *cipher) { - return EVP_CIPHER_flags(cipher) & EVP_CIPH_MODE; + return EVP_CIPHER_get_flags(cipher) & EVP_CIPH_MODE; } int EVP_MD_is_a(const EVP_MD *md, const char *name) { if (md->prov != NULL) return evp_is_a(md->prov, md->name_id, NULL, name); - return evp_is_a(NULL, 0, EVP_MD_name(md), name); + return evp_is_a(NULL, 0, EVP_MD_get0_name(md), name); } -int EVP_MD_number(const EVP_MD *md) +int EVP_MD_get_number(const EVP_MD *md) { return md->name_id; } -const char *EVP_MD_description(const EVP_MD *md) +const char *EVP_MD_get0_description(const EVP_MD *md) { if (md->description != NULL) return md->description; @@ -730,7 +730,7 @@ const char *EVP_MD_description(const EVP_MD *md) #endif } -const char *EVP_MD_name(const EVP_MD *md) +const char *EVP_MD_get0_name(const EVP_MD *md) { if (md == NULL) return NULL; @@ -753,22 +753,22 @@ int EVP_MD_names_do_all(const EVP_MD *md, return 1; } -const OSSL_PROVIDER *EVP_MD_provider(const EVP_MD *md) +const OSSL_PROVIDER *EVP_MD_get0_provider(const EVP_MD *md) { return md->prov; } -int EVP_MD_type(const EVP_MD *md) +int EVP_MD_get_type(const EVP_MD *md) { return md->type; } -int EVP_MD_pkey_type(const EVP_MD *md) +int EVP_MD_get_pkey_type(const EVP_MD *md) { return md->pkey_type; } -int EVP_MD_block_size(const EVP_MD *md) +int EVP_MD_get_block_size(const EVP_MD *md) { if (md == NULL) { ERR_raise(ERR_LIB_EVP, EVP_R_MESSAGE_DIGEST_IS_NULL); @@ -777,7 +777,7 @@ int EVP_MD_block_size(const EVP_MD *md) return md->block_size; } -int EVP_MD_size(const EVP_MD *md) +int EVP_MD_get_size(const EVP_MD *md) { if (md == NULL) { ERR_raise(ERR_LIB_EVP, EVP_R_MESSAGE_DIGEST_IS_NULL); @@ -786,7 +786,7 @@ int EVP_MD_size(const EVP_MD *md) return md->md_size; } -unsigned long EVP_MD_flags(const EVP_MD *md) +unsigned long EVP_MD_get_flags(const EVP_MD *md) { return md->flags; } @@ -999,7 +999,7 @@ EVP_MD *EVP_MD_CTX_get1_md(EVP_MD_CTX *ctx) return md; } -EVP_PKEY_CTX *EVP_MD_CTX_pkey_ctx(const EVP_MD_CTX *ctx) +EVP_PKEY_CTX *EVP_MD_CTX_get_pkey_ctx(const EVP_MD_CTX *ctx) { return ctx->pctx; } @@ -1025,7 +1025,7 @@ void EVP_MD_CTX_set_pkey_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pctx) } #endif /* !defined(FIPS_MODULE) */ -void *EVP_MD_CTX_md_data(const EVP_MD_CTX *ctx) +void *EVP_MD_CTX_get0_md_data(const EVP_MD_CTX *ctx) { return ctx->md_data; } diff --git a/crypto/evp/evp_local.h b/crypto/evp/evp_local.h index a0f363805c..137e458f5a 100644 --- a/crypto/evp/evp_local.h +++ b/crypto/evp/evp_local.h @@ -325,7 +325,7 @@ OSSL_PARAM *evp_pkey_to_param(EVP_PKEY *pkey, size_t *sz); #define M_check_autoarg(ctx, arg, arglen, err) \ if (ctx->pmeth->flags & EVP_PKEY_FLAG_AUTOARGLEN) { \ - size_t pksize = (size_t)EVP_PKEY_size(ctx->pkey); \ + size_t pksize = (size_t)EVP_PKEY_get_size(ctx->pkey); \ \ if (pksize == 0) { \ ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_KEY); /*ckerr_ignore*/ \ diff --git a/crypto/evp/evp_pbe.c b/crypto/evp/evp_pbe.c index 129888f2f7..e19b781645 100644 --- a/crypto/evp/evp_pbe.c +++ b/crypto/evp/evp_pbe.c @@ -226,11 +226,11 @@ int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md, int cipher_nid, md_nid; if (cipher) - cipher_nid = EVP_CIPHER_nid(cipher); + cipher_nid = EVP_CIPHER_get_nid(cipher); else cipher_nid = -1; if (md) - md_nid = EVP_MD_type(md); + md_nid = EVP_MD_get_type(md); else md_nid = -1; diff --git a/crypto/evp/evp_pkey.c b/crypto/evp/evp_pkey.c index f82d6f8081..420b69399a 100644 --- a/crypto/evp/evp_pkey.c +++ b/crypto/evp/evp_pkey.c @@ -225,7 +225,7 @@ const char *EVP_PKEY_get0_type_name(const EVP_PKEY *key) const char *name = NULL; if (key->keymgmt != NULL) - return EVP_KEYMGMT_name(key->keymgmt); + return EVP_KEYMGMT_get0_name(key->keymgmt); /* Otherwise fallback to legacy */ ameth = EVP_PKEY_get0_asn1(key); diff --git a/crypto/evp/evp_rand.c b/crypto/evp/evp_rand.c index c886d9a563..1e41fe0765 100644 --- a/crypto/evp/evp_rand.c +++ b/crypto/evp/evp_rand.c @@ -293,17 +293,17 @@ void EVP_RAND_free(EVP_RAND *rand) evp_rand_free(rand); } -int EVP_RAND_number(const EVP_RAND *rand) +int EVP_RAND_get_number(const EVP_RAND *rand) { return rand->name_id; } -const char *EVP_RAND_name(const EVP_RAND *rand) +const char *EVP_RAND_get0_name(const EVP_RAND *rand) { return rand->type_name; } -const char *EVP_RAND_description(const EVP_RAND *rand) +const char *EVP_RAND_get0_description(const EVP_RAND *rand) { return rand->description; } @@ -313,7 +313,7 @@ int EVP_RAND_is_a(const EVP_RAND *rand, const char *name) return evp_is_a(rand->prov, rand->name_id, NULL, name); } -const OSSL_PROVIDER *EVP_RAND_provider(const EVP_RAND *rand) +const OSSL_PROVIDER *EVP_RAND_get0_provider(const EVP_RAND *rand) { return rand->prov; } @@ -395,7 +395,7 @@ void EVP_RAND_CTX_free(EVP_RAND_CTX *ctx) EVP_RAND_CTX_free(parent); } -EVP_RAND *EVP_RAND_CTX_rand(EVP_RAND_CTX *ctx) +EVP_RAND *EVP_RAND_CTX_get0_rand(EVP_RAND_CTX *ctx) { return ctx->meth; } @@ -440,7 +440,7 @@ const OSSL_PARAM *EVP_RAND_gettable_params(const EVP_RAND *rand) { if (rand->gettable_params == NULL) return NULL; - return rand->gettable_params(ossl_provider_ctx(EVP_RAND_provider(rand))); + return rand->gettable_params(ossl_provider_ctx(EVP_RAND_get0_provider(rand))); } const OSSL_PARAM *EVP_RAND_gettable_ctx_params(const EVP_RAND *rand) @@ -449,7 +449,7 @@ const OSSL_PARAM *EVP_RAND_gettable_ctx_params(const EVP_RAND *rand) if (rand->gettable_ctx_params == NULL) return NULL; - provctx = ossl_provider_ctx(EVP_RAND_provider(rand)); + provctx = ossl_provider_ctx(EVP_RAND_get0_provider(rand)); return rand->gettable_ctx_params(NULL, provctx); } @@ -459,7 +459,7 @@ const OSSL_PARAM *EVP_RAND_settable_ctx_params(const EVP_RAND *rand) if (rand->settable_ctx_params == NULL) return NULL; - provctx = ossl_provider_ctx(EVP_RAND_provider(rand)); + provctx = ossl_provider_ctx(EVP_RAND_get0_provider(rand)); return rand->settable_ctx_params(NULL, provctx); } @@ -469,7 +469,7 @@ const OSSL_PARAM *EVP_RAND_CTX_gettable_params(EVP_RAND_CTX *ctx) if (ctx->meth->gettable_ctx_params == NULL) return NULL; - provctx = ossl_provider_ctx(EVP_RAND_provider(ctx->meth)); + provctx = ossl_provider_ctx(EVP_RAND_get0_provider(ctx->meth)); return ctx->meth->gettable_ctx_params(ctx->algctx, provctx); } @@ -479,7 +479,7 @@ const OSSL_PARAM *EVP_RAND_CTX_settable_params(EVP_RAND_CTX *ctx) if (ctx->meth->settable_ctx_params == NULL) return NULL; - provctx = ossl_provider_ctx(EVP_RAND_provider(ctx->meth)); + provctx = ossl_provider_ctx(EVP_RAND_get0_provider(ctx->meth)); return ctx->meth->settable_ctx_params(ctx->algctx, provctx); } @@ -622,7 +622,7 @@ static unsigned int evp_rand_strength_locked(EVP_RAND_CTX *ctx) return strength; } -unsigned int EVP_RAND_strength(EVP_RAND_CTX *ctx) +unsigned int EVP_RAND_get_strength(EVP_RAND_CTX *ctx) { unsigned int res; @@ -656,7 +656,7 @@ int EVP_RAND_nonce(EVP_RAND_CTX *ctx, unsigned char *out, size_t outlen) return res; } -int EVP_RAND_state(EVP_RAND_CTX *ctx) +int EVP_RAND_get_state(EVP_RAND_CTX *ctx) { OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END }; int state; diff --git a/crypto/evp/exchange.c b/crypto/evp/exchange.c index fb5521681a..2a066082d7 100644 --- a/crypto/evp/exchange.c +++ b/crypto/evp/exchange.c @@ -166,7 +166,7 @@ int EVP_KEYEXCH_up_ref(EVP_KEYEXCH *exchange) return 1; } -OSSL_PROVIDER *EVP_KEYEXCH_provider(const EVP_KEYEXCH *exchange) +OSSL_PROVIDER *EVP_KEYEXCH_get0_provider(const EVP_KEYEXCH *exchange) { return exchange->prov; } @@ -264,8 +264,8 @@ int EVP_PKEY_derive_init_ex(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]) exchange = EVP_KEYEXCH_fetch(ctx->libctx, supported_exch, ctx->propquery); if (exchange == NULL - || (EVP_KEYMGMT_provider(ctx->keymgmt) - != EVP_KEYEXCH_provider(exchange))) { + || (EVP_KEYMGMT_get0_provider(ctx->keymgmt) + != EVP_KEYEXCH_get0_provider(exchange))) { /* * We don't need to free ctx->keymgmt here, as it's not necessarily * tied to this operation. It will be freed by EVP_PKEY_CTX_free(). @@ -464,17 +464,17 @@ int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *pkeylen) return ctx->pmeth->derive(ctx, key, pkeylen); } -int EVP_KEYEXCH_number(const EVP_KEYEXCH *keyexch) +int EVP_KEYEXCH_get_number(const EVP_KEYEXCH *keyexch) { return keyexch->name_id; } -const char *EVP_KEYEXCH_name(const EVP_KEYEXCH *keyexch) +const char *EVP_KEYEXCH_get0_name(const EVP_KEYEXCH *keyexch) { return keyexch->type_name; } -const char *EVP_KEYEXCH_description(const EVP_KEYEXCH *keyexch) +const char *EVP_KEYEXCH_get0_description(const EVP_KEYEXCH *keyexch) { return keyexch->description; } @@ -511,7 +511,7 @@ const OSSL_PARAM *EVP_KEYEXCH_gettable_ctx_params(const EVP_KEYEXCH *keyexch) if (keyexch == NULL || keyexch->gettable_ctx_params == NULL) return NULL; - provctx = ossl_provider_ctx(EVP_KEYEXCH_provider(keyexch)); + provctx = ossl_provider_ctx(EVP_KEYEXCH_get0_provider(keyexch)); return keyexch->gettable_ctx_params(NULL, provctx); } @@ -521,6 +521,6 @@ const OSSL_PARAM *EVP_KEYEXCH_settable_ctx_params(const EVP_KEYEXCH *keyexch) if (keyexch == NULL || keyexch->settable_ctx_params == NULL) return NULL; - provctx = ossl_provider_ctx(EVP_KEYEXCH_provider(keyexch)); + provctx = ossl_provider_ctx(EVP_KEYEXCH_get0_provider(keyexch)); return keyexch->settable_ctx_params(NULL, provctx); } diff --git a/crypto/evp/kdf_lib.c b/crypto/evp/kdf_lib.c index 55f5c50ab5..65b1617b81 100644 --- a/crypto/evp/kdf_lib.c +++ b/crypto/evp/kdf_lib.c @@ -83,17 +83,17 @@ EVP_KDF_CTX *EVP_KDF_CTX_dup(const EVP_KDF_CTX *src) return dst; } -int EVP_KDF_number(const EVP_KDF *kdf) +int EVP_KDF_get_number(const EVP_KDF *kdf) { return kdf->name_id; } -const char *EVP_KDF_name(const EVP_KDF *kdf) +const char *EVP_KDF_get0_name(const EVP_KDF *kdf) { return kdf->type_name; } -const char *EVP_KDF_description(const EVP_KDF *kdf) +const char *EVP_KDF_get0_description(const EVP_KDF *kdf) { return kdf->description; } @@ -103,7 +103,7 @@ int EVP_KDF_is_a(const EVP_KDF *kdf, const char *name) return evp_is_a(kdf->prov, kdf->name_id, NULL, name); } -const OSSL_PROVIDER *EVP_KDF_provider(const EVP_KDF *kdf) +const OSSL_PROVIDER *EVP_KDF_get0_provider(const EVP_KDF *kdf) { return kdf->prov; } diff --git a/crypto/evp/kdf_meth.c b/crypto/evp/kdf_meth.c index 9cf0ca125b..8759021afc 100644 --- a/crypto/evp/kdf_meth.c +++ b/crypto/evp/kdf_meth.c @@ -179,7 +179,7 @@ const OSSL_PARAM *EVP_KDF_gettable_params(const EVP_KDF *kdf) { if (kdf->gettable_params == NULL) return NULL; - return kdf->gettable_params(ossl_provider_ctx(EVP_KDF_provider(kdf))); + return kdf->gettable_params(ossl_provider_ctx(EVP_KDF_get0_provider(kdf))); } const OSSL_PARAM *EVP_KDF_gettable_ctx_params(const EVP_KDF *kdf) @@ -188,7 +188,7 @@ const OSSL_PARAM *EVP_KDF_gettable_ctx_params(const EVP_KDF *kdf) if (kdf->gettable_ctx_params == NULL) return NULL; - alg = ossl_provider_ctx(EVP_KDF_provider(kdf)); + alg = ossl_provider_ctx(EVP_KDF_get0_provider(kdf)); return kdf->gettable_ctx_params(NULL, alg); } @@ -198,7 +198,7 @@ const OSSL_PARAM *EVP_KDF_settable_ctx_params(const EVP_KDF *kdf) if (kdf->settable_ctx_params == NULL) return NULL; - alg = ossl_provider_ctx(EVP_KDF_provider(kdf)); + alg = ossl_provider_ctx(EVP_KDF_get0_provider(kdf)); return kdf->settable_ctx_params(NULL, alg); } @@ -208,7 +208,7 @@ const OSSL_PARAM *EVP_KDF_CTX_gettable_params(EVP_KDF_CTX *ctx) if (ctx->meth->gettable_ctx_params == NULL) return NULL; - alg = ossl_provider_ctx(EVP_KDF_provider(ctx->meth)); + alg = ossl_provider_ctx(EVP_KDF_get0_provider(ctx->meth)); return ctx->meth->gettable_ctx_params(ctx->algctx, alg); } @@ -218,7 +218,7 @@ const OSSL_PARAM *EVP_KDF_CTX_settable_params(EVP_KDF_CTX *ctx) if (ctx->meth->settable_ctx_params == NULL) return NULL; - alg = ossl_provider_ctx(EVP_KDF_provider(ctx->meth)); + alg = ossl_provider_ctx(EVP_KDF_get0_provider(ctx->meth)); return ctx->meth->settable_ctx_params(ctx->algctx, alg); } diff --git a/crypto/evp/kem.c b/crypto/evp/kem.c index 493eabf97b..594633cf92 100644 --- a/crypto/evp/kem.c +++ b/crypto/evp/kem.c @@ -60,7 +60,7 @@ static int evp_kem_init(EVP_PKEY_CTX *ctx, int operation, kem = EVP_KEM_fetch(ctx->libctx, supported_kem, ctx->propquery); if (kem == NULL - || (EVP_KEYMGMT_provider(ctx->keymgmt) != EVP_KEM_provider(kem))) { + || (EVP_KEYMGMT_get0_provider(ctx->keymgmt) != EVP_KEM_get0_provider(kem))) { ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE); ret = -2; goto err; @@ -324,7 +324,7 @@ int EVP_KEM_up_ref(EVP_KEM *kem) return 1; } -OSSL_PROVIDER *EVP_KEM_provider(const EVP_KEM *kem) +OSSL_PROVIDER *EVP_KEM_get0_provider(const EVP_KEM *kem) { return kem->prov; } @@ -343,17 +343,17 @@ int EVP_KEM_is_a(const EVP_KEM *kem, const char *name) return evp_is_a(kem->prov, kem->name_id, NULL, name); } -int EVP_KEM_number(const EVP_KEM *kem) +int EVP_KEM_get_number(const EVP_KEM *kem) { return kem->name_id; } -const char *EVP_KEM_name(const EVP_KEM *kem) +const char *EVP_KEM_get0_name(const EVP_KEM *kem) { return kem->type_name; } -const char *EVP_KEM_description(const EVP_KEM *kem) +const char *EVP_KEM_get0_description(const EVP_KEM *kem) { return kem->description; } @@ -384,7 +384,7 @@ const OSSL_PARAM *EVP_KEM_gettable_ctx_params(const EVP_KEM *kem) if (kem == NULL || kem->gettable_ctx_params == NULL) return NULL; - provctx = ossl_provider_ctx(EVP_KEM_provider(kem)); + provctx = ossl_provider_ctx(EVP_KEM_get0_provider(kem)); return kem->gettable_ctx_params(NULL, provctx); } @@ -395,6 +395,6 @@ const OSSL_PARAM *EVP_KEM_settable_ctx_params(const EVP_KEM *kem) if (kem == NULL || kem->settable_ctx_params == NULL) return NULL; - provctx = ossl_provider_ctx(EVP_KEM_provider(kem)); + provctx = ossl_provider_ctx(EVP_KEM_get0_provider(kem)); return kem->settable_ctx_params(NULL, provctx); } diff --git a/crypto/evp/keymgmt_lib.c b/crypto/evp/keymgmt_lib.c index d2d60fa953..bbca3ddef5 100644 --- a/crypto/evp/keymgmt_lib.c +++ b/crypto/evp/keymgmt_lib.c @@ -22,7 +22,7 @@ */ static int match_type(const EVP_KEYMGMT *keymgmt1, const EVP_KEYMGMT *keymgmt2) { - const char *name2 = EVP_KEYMGMT_name(keymgmt2); + const char *name2 = EVP_KEYMGMT_get0_name(keymgmt2); return EVP_KEYMGMT_is_a(keymgmt1, name2); } @@ -278,7 +278,7 @@ void evp_keymgmt_util_cache_keyinfo(EVP_PKEY *pk) /* * Cache information about the provider "origin" key. * - * This services functions like EVP_PKEY_size, EVP_PKEY_bits, etc + * This services functions like EVP_PKEY_get_size, EVP_PKEY_get_bits, etc */ if (pk->keydata != NULL) { int bits = 0; diff --git a/crypto/evp/keymgmt_meth.c b/crypto/evp/keymgmt_meth.c index 94f0133860..841eae1df8 100644 --- a/crypto/evp/keymgmt_meth.c +++ b/crypto/evp/keymgmt_meth.c @@ -246,22 +246,22 @@ void EVP_KEYMGMT_free(EVP_KEYMGMT *keymgmt) OPENSSL_free(keymgmt); } -const OSSL_PROVIDER *EVP_KEYMGMT_provider(const EVP_KEYMGMT *keymgmt) +const OSSL_PROVIDER *EVP_KEYMGMT_get0_provider(const EVP_KEYMGMT *keymgmt) { return keymgmt->prov; } -int EVP_KEYMGMT_number(const EVP_KEYMGMT *keymgmt) +int EVP_KEYMGMT_get_number(const EVP_KEYMGMT *keymgmt) { return keymgmt->name_id; } -const char *EVP_KEYMGMT_description(const EVP_KEYMGMT *keymgmt) +const char *EVP_KEYMGMT_get0_description(const EVP_KEYMGMT *keymgmt) { return keymgmt->description; } -const char *EVP_KEYMGMT_name(const EVP_KEYMGMT *keymgmt) +const char *EVP_KEYMGMT_get0_name(const EVP_KEYMGMT *keymgmt) { return keymgmt->type_name; } @@ -296,7 +296,7 @@ int EVP_KEYMGMT_names_do_all(const EVP_KEYMGMT *keymgmt, */ void *evp_keymgmt_newdata(const EVP_KEYMGMT *keymgmt) { - void *provctx = ossl_provider_ctx(EVP_KEYMGMT_provider(keymgmt)); + void *provctx = ossl_provider_ctx(EVP_KEYMGMT_get0_provider(keymgmt)); /* * 'new' is currently mandatory on its own, but when new @@ -317,7 +317,7 @@ void evp_keymgmt_freedata(const EVP_KEYMGMT *keymgmt, void *keydata) void *evp_keymgmt_gen_init(const EVP_KEYMGMT *keymgmt, int selection, const OSSL_PARAM params[]) { - void *provctx = ossl_provider_ctx(EVP_KEYMGMT_provider(keymgmt)); + void *provctx = ossl_provider_ctx(EVP_KEYMGMT_get0_provider(keymgmt)); if (keymgmt->gen_init == NULL) return NULL; @@ -348,7 +348,7 @@ int evp_keymgmt_gen_set_params(const EVP_KEYMGMT *keymgmt, void *genctx, const OSSL_PARAM *EVP_KEYMGMT_gen_settable_params(const EVP_KEYMGMT *keymgmt) { - void *provctx = ossl_provider_ctx(EVP_KEYMGMT_provider(keymgmt)); + void *provctx = ossl_provider_ctx(EVP_KEYMGMT_get0_provider(keymgmt)); if (keymgmt->gen_settable_params == NULL) return NULL; @@ -387,7 +387,7 @@ int evp_keymgmt_get_params(const EVP_KEYMGMT *keymgmt, void *keydata, const OSSL_PARAM *EVP_KEYMGMT_gettable_params(const EVP_KEYMGMT *keymgmt) { - void *provctx = ossl_provider_ctx(EVP_KEYMGMT_provider(keymgmt)); + void *provctx = ossl_provider_ctx(EVP_KEYMGMT_get0_provider(keymgmt)); if (keymgmt->gettable_params == NULL) return NULL; @@ -404,7 +404,7 @@ int evp_keymgmt_set_params(const EVP_KEYMGMT *keymgmt, void *keydata, const OSSL_PARAM *EVP_KEYMGMT_settable_params(const EVP_KEYMGMT *keymgmt) { - void *provctx = ossl_provider_ctx(EVP_KEYMGMT_provider(keymgmt)); + void *provctx = ossl_provider_ctx(EVP_KEYMGMT_get0_provider(keymgmt)); if (keymgmt->settable_params == NULL) return NULL; diff --git a/crypto/evp/legacy_md5_sha1.c b/crypto/evp/legacy_md5_sha1.c index f2d4c0ba22..b84bf3deaa 100644 --- a/crypto/evp/legacy_md5_sha1.c +++ b/crypto/evp/legacy_md5_sha1.c @@ -21,7 +21,7 @@ IMPLEMENT_LEGACY_EVP_MD_METH_LC(md5_sha1_int, ossl_md5_sha1) static int md5_sha1_int_ctrl(EVP_MD_CTX *ctx, int cmd, int mslen, void *ms) { - return ossl_md5_sha1_ctrl(EVP_MD_CTX_md_data(ctx), cmd, mslen, ms); + return ossl_md5_sha1_ctrl(EVP_MD_CTX_get0_md_data(ctx), cmd, mslen, ms); } static const EVP_MD md5_sha1_md = { diff --git a/crypto/evp/legacy_meth.h b/crypto/evp/legacy_meth.h index 0a23efd05a..d32f20aad3 100644 --- a/crypto/evp/legacy_meth.h +++ b/crypto/evp/legacy_meth.h @@ -10,29 +10,29 @@ #define IMPLEMENT_LEGACY_EVP_MD_METH(nm, fn) \ static int nm##_init(EVP_MD_CTX *ctx) \ { \ - return fn##_Init(EVP_MD_CTX_md_data(ctx)); \ + return fn##_Init(EVP_MD_CTX_get0_md_data(ctx)); \ } \ static int nm##_update(EVP_MD_CTX *ctx, const void *data, size_t count) \ { \ - return fn##_Update(EVP_MD_CTX_md_data(ctx), data, count); \ + return fn##_Update(EVP_MD_CTX_get0_md_data(ctx), data, count); \ } \ static int nm##_final(EVP_MD_CTX *ctx, unsigned char *md) \ { \ - return fn##_Final(md, EVP_MD_CTX_md_data(ctx)); \ + return fn##_Final(md, EVP_MD_CTX_get0_md_data(ctx)); \ } #define IMPLEMENT_LEGACY_EVP_MD_METH_LC(nm, fn) \ static int nm##_init(EVP_MD_CTX *ctx) \ { \ - return fn##_init(EVP_MD_CTX_md_data(ctx)); \ + return fn##_init(EVP_MD_CTX_get0_md_data(ctx)); \ } \ static int nm##_update(EVP_MD_CTX *ctx, const void *data, size_t count) \ { \ - return fn##_update(EVP_MD_CTX_md_data(ctx), data, count); \ + return fn##_update(EVP_MD_CTX_get0_md_data(ctx), data, count); \ } \ static int nm##_final(EVP_MD_CTX *ctx, unsigned char *md) \ { \ - return fn##_final(md, EVP_MD_CTX_md_data(ctx)); \ + return fn##_final(md, EVP_MD_CTX_get0_md_data(ctx)); \ } diff --git a/crypto/evp/legacy_sha.c b/crypto/evp/legacy_sha.c index 9ab839e7aa..3859286eeb 100644 --- a/crypto/evp/legacy_sha.c +++ b/crypto/evp/legacy_sha.c @@ -29,20 +29,20 @@ #define IMPLEMENT_LEGACY_EVP_MD_METH_SHA3(nm, fn, tag) \ static int nm##_init(EVP_MD_CTX *ctx) \ { \ - return fn##_init(EVP_MD_CTX_md_data(ctx), tag, ctx->digest->md_size * 8); \ + return fn##_init(EVP_MD_CTX_get0_md_data(ctx), tag, ctx->digest->md_size * 8); \ } \ static int nm##_update(EVP_MD_CTX *ctx, const void *data, size_t count) \ { \ - return fn##_update(EVP_MD_CTX_md_data(ctx), data, count); \ + return fn##_update(EVP_MD_CTX_get0_md_data(ctx), data, count); \ } \ static int nm##_final(EVP_MD_CTX *ctx, unsigned char *md) \ { \ - return fn##_final(md, EVP_MD_CTX_md_data(ctx)); \ + return fn##_final(md, EVP_MD_CTX_get0_md_data(ctx)); \ } #define IMPLEMENT_LEGACY_EVP_MD_METH_SHAKE(nm, fn, tag) \ static int nm##_init(EVP_MD_CTX *ctx) \ { \ - return fn##_init(EVP_MD_CTX_md_data(ctx), tag, ctx->digest->md_size * 8); \ + return fn##_init(EVP_MD_CTX_get0_md_data(ctx), tag, ctx->digest->md_size * 8); \ } \ #define sha512_224_Init sha512_224_init @@ -65,7 +65,7 @@ IMPLEMENT_LEGACY_EVP_MD_METH_SHAKE(shake, ossl_sha3, '\x1f') static int sha1_int_ctrl(EVP_MD_CTX *ctx, int cmd, int p1, void *p2) { - return ossl_sha1_ctrl(ctx != NULL ? EVP_MD_CTX_md_data(ctx) : NULL, + return ossl_sha1_ctrl(ctx != NULL ? EVP_MD_CTX_get0_md_data(ctx) : NULL, cmd, p1, p2); } diff --git a/crypto/evp/m_sigver.c b/crypto/evp/m_sigver.c index 296269a88e..dba549503d 100644 --- a/crypto/evp/m_sigver.c +++ b/crypto/evp/m_sigver.c @@ -122,8 +122,8 @@ static int do_sigver_init(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, locpctx->propquery); if (signature == NULL - || (EVP_KEYMGMT_provider(locpctx->keymgmt) - != EVP_SIGNATURE_provider(signature))) { + || (EVP_KEYMGMT_get0_provider(locpctx->keymgmt) + != EVP_SIGNATURE_get0_provider(signature))) { /* * We don't need to free ctx->keymgmt here, as it's not necessarily * tied to this operation. It will be freed by EVP_PKEY_CTX_free(). @@ -156,7 +156,7 @@ static int do_sigver_init(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, if (type != NULL) { ctx->reqdigest = type; if (mdname == NULL) - mdname = canon_mdname(EVP_MD_name(type)); + mdname = canon_mdname(EVP_MD_get0_name(type)); } else { if (mdname == NULL) { if (evp_keymgmt_util_get_deflt_digest_name(tmp_keymgmt, provkey, @@ -475,7 +475,7 @@ int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, if (pctx->pmeth->signctx(pctx, sigret, siglen, ctx) <= 0) return 0; } else { - int s = EVP_MD_size(ctx->digest); + int s = EVP_MD_get_size(ctx->digest); if (s < 0 || EVP_PKEY_sign(pctx, sigret, siglen, NULL, s) <= 0) return 0; diff --git a/crypto/evp/mac_lib.c b/crypto/evp/mac_lib.c index 9356595efd..bd8543b2c4 100644 --- a/crypto/evp/mac_lib.c +++ b/crypto/evp/mac_lib.c @@ -77,7 +77,7 @@ EVP_MAC_CTX *EVP_MAC_CTX_dup(const EVP_MAC_CTX *src) return dst; } -EVP_MAC *EVP_MAC_CTX_mac(EVP_MAC_CTX *ctx) +EVP_MAC *EVP_MAC_CTX_get0_mac(EVP_MAC_CTX *ctx) { return ctx->meth; } @@ -203,17 +203,17 @@ int EVP_MAC_CTX_set_params(EVP_MAC_CTX *ctx, const OSSL_PARAM params[]) return 1; } -int EVP_MAC_number(const EVP_MAC *mac) +int EVP_MAC_get_number(const EVP_MAC *mac) { return mac->name_id; } -const char *EVP_MAC_name(const EVP_MAC *mac) +const char *EVP_MAC_get0_name(const EVP_MAC *mac) { return mac->type_name; } -const char *EVP_MAC_description(const EVP_MAC *mac) +const char *EVP_MAC_get0_description(const EVP_MAC *mac) { return mac->description; } diff --git a/crypto/evp/mac_meth.c b/crypto/evp/mac_meth.c index 6396eb38fd..74cfecbcdf 100644 --- a/crypto/evp/mac_meth.c +++ b/crypto/evp/mac_meth.c @@ -175,7 +175,7 @@ void EVP_MAC_free(EVP_MAC *mac) evp_mac_free(mac); } -const OSSL_PROVIDER *EVP_MAC_provider(const EVP_MAC *mac) +const OSSL_PROVIDER *EVP_MAC_get0_provider(const EVP_MAC *mac) { return mac->prov; } @@ -184,7 +184,7 @@ const OSSL_PARAM *EVP_MAC_gettable_params(const EVP_MAC *mac) { if (mac->gettable_params == NULL) return NULL; - return mac->gettable_params(ossl_provider_ctx(EVP_MAC_provider(mac))); + return mac->gettable_params(ossl_provider_ctx(EVP_MAC_get0_provider(mac))); } const OSSL_PARAM *EVP_MAC_gettable_ctx_params(const EVP_MAC *mac) @@ -193,7 +193,7 @@ const OSSL_PARAM *EVP_MAC_gettable_ctx_params(const EVP_MAC *mac) if (mac->gettable_ctx_params == NULL) return NULL; - alg = ossl_provider_ctx(EVP_MAC_provider(mac)); + alg = ossl_provider_ctx(EVP_MAC_get0_provider(mac)); return mac->gettable_ctx_params(NULL, alg); } @@ -203,7 +203,7 @@ const OSSL_PARAM *EVP_MAC_settable_ctx_params(const EVP_MAC *mac) if (mac->settable_ctx_params == NULL) return NULL; - alg = ossl_provider_ctx(EVP_MAC_provider(mac)); + alg = ossl_provider_ctx(EVP_MAC_get0_provider(mac)); return mac->settable_ctx_params(NULL, alg); } @@ -213,7 +213,7 @@ const OSSL_PARAM *EVP_MAC_CTX_gettable_params(EVP_MAC_CTX *ctx) if (ctx->meth->gettable_ctx_params == NULL) return NULL; - alg = ossl_provider_ctx(EVP_MAC_provider(ctx->meth)); + alg = ossl_provider_ctx(EVP_MAC_get0_provider(ctx->meth)); return ctx->meth->gettable_ctx_params(ctx->algctx, alg); } @@ -223,7 +223,7 @@ const OSSL_PARAM *EVP_MAC_CTX_settable_params(EVP_MAC_CTX *ctx) if (ctx->meth->settable_ctx_params == NULL) return NULL; - alg = ossl_provider_ctx(EVP_MAC_provider(ctx->meth)); + alg = ossl_provider_ctx(EVP_MAC_get0_provider(ctx->meth)); return ctx->meth->settable_ctx_params(ctx->algctx, alg); } diff --git a/crypto/evp/p5_crpt.c b/crypto/evp/p5_crpt.c index abf153cb43..d8442a8d90 100644 --- a/crypto/evp/p5_crpt.c +++ b/crypto/evp/p5_crpt.c @@ -54,12 +54,12 @@ int PKCS5_PBE_keyivgen_ex(EVP_CIPHER_CTX *cctx, const char *pass, int passlen, return 0; } - ivl = EVP_CIPHER_iv_length(cipher); + ivl = EVP_CIPHER_get_iv_length(cipher); if (ivl < 0 || ivl > 16) { ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_IV_LENGTH); goto err; } - kl = EVP_CIPHER_key_length(cipher); + kl = EVP_CIPHER_get_key_length(cipher); if (kl < 0 || kl > (int)sizeof(md_tmp)) { ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_KEY_LENGTH); goto err; @@ -77,7 +77,7 @@ int PKCS5_PBE_keyivgen_ex(EVP_CIPHER_CTX *cctx, const char *pass, int passlen, else if (passlen == -1) passlen = strlen(pass); - mdsize = EVP_MD_size(md); + mdsize = EVP_MD_get_size(md); if (mdsize < 0) goto err; diff --git a/crypto/evp/p5_crpt2.c b/crypto/evp/p5_crpt2.c index 54773304fd..7088875fe1 100644 --- a/crypto/evp/p5_crpt2.c +++ b/crypto/evp/p5_crpt2.c @@ -28,7 +28,7 @@ int ossl_pkcs5_pbkdf2_hmac_ex(const char *pass, int passlen, int rv = 1, mode = 1; EVP_KDF *kdf; EVP_KDF_CTX *kctx; - const char *mdname = EVP_MD_name(digest); + const char *mdname = EVP_MD_get0_name(digest); OSSL_PARAM params[6], *p = params; /* Keep documented behaviour. */ @@ -193,7 +193,7 @@ int PKCS5_v2_PBKDF2_keyivgen_ex(EVP_CIPHER_CTX *ctx, const char *pass, ERR_raise(ERR_LIB_EVP, EVP_R_NO_CIPHER_SET); goto err; } - keylen = EVP_CIPHER_CTX_key_length(ctx); + keylen = EVP_CIPHER_CTX_get_key_length(ctx); OPENSSL_assert(keylen <= sizeof(key)); /* Decode parameter */ @@ -205,7 +205,7 @@ int PKCS5_v2_PBKDF2_keyivgen_ex(EVP_CIPHER_CTX *ctx, const char *pass, goto err; } - t = EVP_CIPHER_CTX_key_length(ctx); + t = EVP_CIPHER_CTX_get_key_length(ctx); if (t < 0) { ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_KEY_LENGTH); goto err; diff --git a/crypto/evp/p_dec.c b/crypto/evp/p_dec.c index 822c214e6b..7b33edecd5 100644 --- a/crypto/evp/p_dec.c +++ b/crypto/evp/p_dec.c @@ -23,7 +23,7 @@ int EVP_PKEY_decrypt_old(unsigned char *key, const unsigned char *ek, int ekl, { int ret = -1; - if (EVP_PKEY_id(priv) != EVP_PKEY_RSA) { + if (EVP_PKEY_get_id(priv) != EVP_PKEY_RSA) { ERR_raise(ERR_LIB_EVP, EVP_R_PUBLIC_KEY_NOT_RSA); goto err; } diff --git a/crypto/evp/p_enc.c b/crypto/evp/p_enc.c index f1a7a839f6..d4db595164 100644 --- a/crypto/evp/p_enc.c +++ b/crypto/evp/p_enc.c @@ -23,7 +23,7 @@ int EVP_PKEY_encrypt_old(unsigned char *ek, const unsigned char *key, { int ret = 0; - if (EVP_PKEY_id(pubk) != EVP_PKEY_RSA) { + if (EVP_PKEY_get_id(pubk) != EVP_PKEY_RSA) { ERR_raise(ERR_LIB_EVP, EVP_R_PUBLIC_KEY_NOT_RSA); goto err; } diff --git a/crypto/evp/p_legacy.c b/crypto/evp/p_legacy.c index c1d813f047..6c65e7e194 100644 --- a/crypto/evp/p_legacy.c +++ b/crypto/evp/p_legacy.c @@ -68,7 +68,7 @@ int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, EC_KEY *key) EC_KEY *evp_pkey_get0_EC_KEY_int(const EVP_PKEY *pkey) { - if (EVP_PKEY_base_id(pkey) != EVP_PKEY_EC) { + if (EVP_PKEY_get_base_id(pkey) != EVP_PKEY_EC) { ERR_raise(ERR_LIB_EVP, EVP_R_EXPECTING_A_EC_KEY); return NULL; } diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c index d2c871179e..07be8884fe 100644 --- a/crypto/evp/p_lib.c +++ b/crypto/evp/p_lib.c @@ -58,7 +58,7 @@ static void evp_pkey_free_it(EVP_PKEY *key); /* The type of parameters selected in key parameter functions */ # define SELECT_PARAMETERS OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS -int EVP_PKEY_bits(const EVP_PKEY *pkey) +int EVP_PKEY_get_bits(const EVP_PKEY *pkey) { int size = 0; @@ -70,7 +70,7 @@ int EVP_PKEY_bits(const EVP_PKEY *pkey) return size < 0 ? 0 : size; } -int EVP_PKEY_security_bits(const EVP_PKEY *pkey) +int EVP_PKEY_get_security_bits(const EVP_PKEY *pkey) { int size = 0; @@ -616,7 +616,7 @@ static EVP_PKEY *new_cmac_key_int(const unsigned char *priv, size_t len, EVP_PKEY_CTX *ctx; if (cipher != NULL) - cipher_name = EVP_CIPHER_name(cipher); + cipher_name = EVP_CIPHER_get0_name(cipher); if (cipher_name == NULL) { ERR_raise(ERR_LIB_EVP, EVP_R_KEY_SETUP_FAILED); @@ -865,7 +865,7 @@ DSA *EVP_PKEY_get1_DSA(EVP_PKEY *pkey) # ifndef OPENSSL_NO_EC static const ECX_KEY *evp_pkey_get0_ECX_KEY(const EVP_PKEY *pkey, int type) { - if (EVP_PKEY_base_id(pkey) != type) { + if (EVP_PKEY_get_base_id(pkey) != type) { ERR_raise(ERR_LIB_EVP, EVP_R_EXPECTING_A_ECX_KEY); return NULL; } @@ -970,12 +970,12 @@ int EVP_PKEY_type(int type) return ret; } -int EVP_PKEY_id(const EVP_PKEY *pkey) +int EVP_PKEY_get_id(const EVP_PKEY *pkey) { return pkey->type; } -int EVP_PKEY_base_id(const EVP_PKEY *pkey) +int EVP_PKEY_get_base_id(const EVP_PKEY *pkey) { return EVP_PKEY_type(pkey->type); } @@ -1052,7 +1052,7 @@ int EVP_PKEY_type_names_do_all(const EVP_PKEY *pkey, return 0; if (!evp_pkey_is_provided(pkey)) { - const char *name = OBJ_nid2sn(EVP_PKEY_id(pkey)); + const char *name = OBJ_nid2sn(EVP_PKEY_get_id(pkey)); fn(name, data); return 1; @@ -1063,7 +1063,7 @@ int EVP_PKEY_type_names_do_all(const EVP_PKEY *pkey, int EVP_PKEY_can_sign(const EVP_PKEY *pkey) { if (pkey->keymgmt == NULL) { - switch (EVP_PKEY_base_id(pkey)) { + switch (EVP_PKEY_get_base_id(pkey)) { case EVP_PKEY_RSA: return 1; # ifndef OPENSSL_NO_DSA @@ -1081,12 +1081,12 @@ int EVP_PKEY_can_sign(const EVP_PKEY *pkey) break; } } else { - const OSSL_PROVIDER *prov = EVP_KEYMGMT_provider(pkey->keymgmt); + const OSSL_PROVIDER *prov = EVP_KEYMGMT_get0_provider(pkey->keymgmt); OSSL_LIB_CTX *libctx = ossl_provider_libctx(prov); const char *supported_sig = pkey->keymgmt->query_operation_name != NULL ? pkey->keymgmt->query_operation_name(OSSL_OP_SIGNATURE) - : EVP_KEYMGMT_name(pkey->keymgmt); + : EVP_KEYMGMT_get0_name(pkey->keymgmt); EVP_SIGNATURE *signature = NULL; signature = EVP_SIGNATURE_fetch(libctx, supported_sig, NULL); @@ -1767,7 +1767,7 @@ void EVP_PKEY_free(EVP_PKEY *x) OPENSSL_free(x); } -int EVP_PKEY_size(const EVP_PKEY *pkey) +int EVP_PKEY_get_size(const EVP_PKEY *pkey) { int size = 0; @@ -1781,7 +1781,7 @@ int EVP_PKEY_size(const EVP_PKEY *pkey) return size < 0 ? 0 : size; } -const char *EVP_PKEY_description(const EVP_PKEY *pkey) +const char *EVP_PKEY_get0_description(const EVP_PKEY *pkey) { if (!evp_pkey_is_assigned(pkey)) return NULL; @@ -1971,7 +1971,7 @@ int evp_pkey_copy_downgraded(EVP_PKEY **dest, const EVP_PKEY *src) int type = src->type; const char *keytype = NULL; - keytype = EVP_KEYMGMT_name(keymgmt); + keytype = EVP_KEYMGMT_get0_name(keymgmt); /* * If the type is EVP_PKEY_NONE, then we have a problem somewhere diff --git a/crypto/evp/p_seal.c b/crypto/evp/p_seal.c index bafafd6244..475082d431 100644 --- a/crypto/evp/p_seal.c +++ b/crypto/evp/p_seal.c @@ -35,7 +35,7 @@ int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, return 0; } if ((cipher = EVP_CIPHER_CTX_get0_cipher(ctx)) != NULL - && (prov = EVP_CIPHER_provider(cipher)) != NULL) + && (prov = EVP_CIPHER_get0_provider(cipher)) != NULL) libctx = ossl_provider_libctx(prov); if ((npubk <= 0) || !pubk) return 1; @@ -43,11 +43,11 @@ int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, if (EVP_CIPHER_CTX_rand_key(ctx, key) <= 0) return 0; - len = EVP_CIPHER_CTX_iv_length(ctx); + len = EVP_CIPHER_CTX_get_iv_length(ctx); if (len < 0 || RAND_priv_bytes_ex(libctx, iv, len, 0) <= 0) goto err; - len = EVP_CIPHER_CTX_key_length(ctx); + len = EVP_CIPHER_CTX_get_key_length(ctx); if (len < 0) goto err; diff --git a/crypto/evp/p_sign.c b/crypto/evp/p_sign.c index fed9471311..8e430f4704 100644 --- a/crypto/evp/p_sign.c +++ b/crypto/evp/p_sign.c @@ -44,7 +44,7 @@ int EVP_SignFinal_ex(EVP_MD_CTX *ctx, unsigned char *sigret, return 0; } - sltmp = (size_t)EVP_PKEY_size(pkey); + sltmp = (size_t)EVP_PKEY_get_size(pkey); i = 0; pkctx = EVP_PKEY_CTX_new_from_pkey(libctx, pkey, propq); if (pkctx == NULL) diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c index 47062c02c1..bcc601ee59 100644 --- a/crypto/evp/pmeth_lib.c +++ b/crypto/evp/pmeth_lib.c @@ -192,7 +192,7 @@ static EVP_PKEY_CTX *int_ctx_new(OSSL_LIB_CTX *libctx, /* If we have an engine, something went wrong somewhere... */ if (!ossl_assert(e == NULL)) return NULL; - keytype = EVP_KEYMGMT_name(pkey->keymgmt); + keytype = EVP_KEYMGMT_get0_name(pkey->keymgmt); goto common; } @@ -742,7 +742,7 @@ const OSSL_PARAM *EVP_PKEY_CTX_gettable_params(const EVP_PKEY_CTX *ctx) if (EVP_PKEY_CTX_IS_DERIVE_OP(ctx) && ctx->op.kex.exchange != NULL && ctx->op.kex.exchange->gettable_ctx_params != NULL) { - provctx = ossl_provider_ctx(EVP_KEYEXCH_provider(ctx->op.kex.exchange)); + provctx = ossl_provider_ctx(EVP_KEYEXCH_get0_provider(ctx->op.kex.exchange)); return ctx->op.kex.exchange->gettable_ctx_params(ctx->op.kex.algctx, provctx); } @@ -750,7 +750,7 @@ const OSSL_PARAM *EVP_PKEY_CTX_gettable_params(const EVP_PKEY_CTX *ctx) && ctx->op.sig.signature != NULL && ctx->op.sig.signature->gettable_ctx_params != NULL) { provctx = ossl_provider_ctx( - EVP_SIGNATURE_provider(ctx->op.sig.signature)); + EVP_SIGNATURE_get0_provider(ctx->op.sig.signature)); return ctx->op.sig.signature->gettable_ctx_params(ctx->op.sig.algctx, provctx); } @@ -758,14 +758,14 @@ const OSSL_PARAM *EVP_PKEY_CTX_gettable_params(const EVP_PKEY_CTX *ctx) && ctx->op.ciph.cipher != NULL && ctx->op.ciph.cipher->gettable_ctx_params != NULL) { provctx = ossl_provider_ctx( - EVP_ASYM_CIPHER_provider(ctx->op.ciph.cipher)); + EVP_ASYM_CIPHER_get0_provider(ctx->op.ciph.cipher)); return ctx->op.ciph.cipher->gettable_ctx_params(ctx->op.ciph.algctx, provctx); } if (EVP_PKEY_CTX_IS_KEM_OP(ctx) && ctx->op.encap.kem != NULL && ctx->op.encap.kem->gettable_ctx_params != NULL) { - provctx = ossl_provider_ctx(EVP_KEM_provider(ctx->op.encap.kem)); + provctx = ossl_provider_ctx(EVP_KEM_get0_provider(ctx->op.encap.kem)); return ctx->op.encap.kem->gettable_ctx_params(ctx->op.encap.algctx, provctx); } @@ -779,7 +779,7 @@ const OSSL_PARAM *EVP_PKEY_CTX_settable_params(const EVP_PKEY_CTX *ctx) if (EVP_PKEY_CTX_IS_DERIVE_OP(ctx) && ctx->op.kex.exchange != NULL && ctx->op.kex.exchange->settable_ctx_params != NULL) { - provctx = ossl_provider_ctx(EVP_KEYEXCH_provider(ctx->op.kex.exchange)); + provctx = ossl_provider_ctx(EVP_KEYEXCH_get0_provider(ctx->op.kex.exchange)); return ctx->op.kex.exchange->settable_ctx_params(ctx->op.kex.algctx, provctx); } @@ -787,7 +787,7 @@ const OSSL_PARAM *EVP_PKEY_CTX_settable_params(const EVP_PKEY_CTX *ctx) && ctx->op.sig.signature != NULL && ctx->op.sig.signature->settable_ctx_params != NULL) { provctx = ossl_provider_ctx( - EVP_SIGNATURE_provider(ctx->op.sig.signature)); + EVP_SIGNATURE_get0_provider(ctx->op.sig.signature)); return ctx->op.sig.signature->settable_ctx_params(ctx->op.sig.algctx, provctx); } @@ -795,21 +795,21 @@ const OSSL_PARAM *EVP_PKEY_CTX_settable_params(const EVP_PKEY_CTX *ctx) && ctx->op.ciph.cipher != NULL && ctx->op.ciph.cipher->settable_ctx_params != NULL) { provctx = ossl_provider_ctx( - EVP_ASYM_CIPHER_provider(ctx->op.ciph.cipher)); + EVP_ASYM_CIPHER_get0_provider(ctx->op.ciph.cipher)); return ctx->op.ciph.cipher->settable_ctx_params(ctx->op.ciph.algctx, provctx); } if (EVP_PKEY_CTX_IS_GEN_OP(ctx) && ctx->keymgmt != NULL && ctx->keymgmt->gen_settable_params != NULL) { - provctx = ossl_provider_ctx(EVP_KEYMGMT_provider(ctx->keymgmt)); + provctx = ossl_provider_ctx(EVP_KEYMGMT_get0_provider(ctx->keymgmt)); return ctx->keymgmt->gen_settable_params(ctx->op.keymgmt.genctx, provctx); } if (EVP_PKEY_CTX_IS_KEM_OP(ctx) && ctx->op.encap.kem != NULL && ctx->op.encap.kem->settable_ctx_params != NULL) { - provctx = ossl_provider_ctx(EVP_KEM_provider(ctx->op.encap.kem)); + provctx = ossl_provider_ctx(EVP_KEM_get0_provider(ctx->op.encap.kem)); return ctx->op.encap.kem->settable_ctx_params(ctx->op.encap.algctx, provctx); } @@ -931,7 +931,7 @@ static int evp_pkey_ctx_set_md(EVP_PKEY_CTX *ctx, const EVP_MD *md, if (md == NULL) { name = ""; } else { - name = EVP_MD_name(md); + name = EVP_MD_get0_name(md); } *p++ = OSSL_PARAM_construct_utf8_string(param, @@ -1051,7 +1051,7 @@ int EVP_PKEY_CTX_add1_hkdf_info(EVP_PKEY_CTX *ctx, info, infolen); } -int EVP_PKEY_CTX_hkdf_mode(EVP_PKEY_CTX *ctx, int mode) +int EVP_PKEY_CTX_set_hkdf_mode(EVP_PKEY_CTX *ctx, int mode) { OSSL_PARAM int_params[2], *p = int_params; diff --git a/crypto/evp/signature.c b/crypto/evp/signature.c index b4e0ff2527..698adff088 100644 --- a/crypto/evp/signature.c +++ b/crypto/evp/signature.c @@ -300,7 +300,7 @@ int EVP_SIGNATURE_up_ref(EVP_SIGNATURE *signature) return 1; } -OSSL_PROVIDER *EVP_SIGNATURE_provider(const EVP_SIGNATURE *signature) +OSSL_PROVIDER *EVP_SIGNATURE_get0_provider(const EVP_SIGNATURE *signature) { return signature->prov; } @@ -319,17 +319,17 @@ int EVP_SIGNATURE_is_a(const EVP_SIGNATURE *signature, const char *name) return evp_is_a(signature->prov, signature->name_id, NULL, name); } -int EVP_SIGNATURE_number(const EVP_SIGNATURE *signature) +int EVP_SIGNATURE_get_number(const EVP_SIGNATURE *signature) { return signature->name_id; } -const char *EVP_SIGNATURE_name(const EVP_SIGNATURE *signature) +const char *EVP_SIGNATURE_get0_name(const EVP_SIGNATURE *signature) { return signature->type_name; } -const char *EVP_SIGNATURE_description(const EVP_SIGNATURE *signature) +const char *EVP_SIGNATURE_get0_description(const EVP_SIGNATURE *signature) { return signature->description; } @@ -363,7 +363,7 @@ const OSSL_PARAM *EVP_SIGNATURE_gettable_ctx_params(const EVP_SIGNATURE *sig) if (sig == NULL || sig->gettable_ctx_params == NULL) return NULL; - provctx = ossl_provider_ctx(EVP_SIGNATURE_provider(sig)); + provctx = ossl_provider_ctx(EVP_SIGNATURE_get0_provider(sig)); return sig->gettable_ctx_params(NULL, provctx); } @@ -374,7 +374,7 @@ const OSSL_PARAM *EVP_SIGNATURE_settable_ctx_params(const EVP_SIGNATURE *sig) if (sig == NULL || sig->settable_ctx_params == NULL) return NULL; - provctx = ossl_provider_ctx(EVP_SIGNATURE_provider(sig)); + provctx = ossl_provider_ctx(EVP_SIGNATURE_get0_provider(sig)); return sig->settable_ctx_params(NULL, provctx); } @@ -439,8 +439,8 @@ static int evp_pkey_signature_init(EVP_PKEY_CTX *ctx, int operation, EVP_SIGNATURE_fetch(ctx->libctx, supported_sig, ctx->propquery); if (signature == NULL - || (EVP_KEYMGMT_provider(ctx->keymgmt) - != EVP_SIGNATURE_provider(signature))) { + || (EVP_KEYMGMT_get0_provider(ctx->keymgmt) + != EVP_SIGNATURE_get0_provider(signature))) { /* * We don't need to free ctx->keymgmt here, as it's not necessarily * tied to this operation. It will be freed by EVP_PKEY_CTX_free(). diff --git a/crypto/ffc/ffc_params_generate.c b/crypto/ffc/ffc_params_generate.c index 85ae524015..36b5a873a7 100644 --- a/crypto/ffc/ffc_params_generate.c +++ b/crypto/ffc/ffc_params_generate.c @@ -140,7 +140,7 @@ static int generate_canonical_g(BN_CTX *ctx, BN_MONT_CTX *mont, EVP_MD_CTX *mctx = NULL; int mdsize; - mdsize = EVP_MD_size(evpmd); + mdsize = EVP_MD_get_size(evpmd); if (mdsize <= 0) return 0; @@ -211,7 +211,7 @@ static int generate_p(BN_CTX *ctx, const EVP_MD *evpmd, int max_counter, int n, if (!BN_lshift(test, BN_value_one(), L - 1)) goto err; - mdsize = EVP_MD_size(evpmd); + mdsize = EVP_MD_get_size(evpmd); if (mdsize <= 0) goto err; @@ -318,7 +318,7 @@ static int generate_q_fips186_4(BN_CTX *ctx, BIGNUM *q, const EVP_MD *evpmd, int ret = 0, r; int m = *retm; unsigned char md[EVP_MAX_MD_SIZE]; - int mdsize = EVP_MD_size(evpmd); + int mdsize = EVP_MD_get_size(evpmd); unsigned char *pmd; OSSL_LIB_CTX *libctx = ossl_bn_get_libctx(ctx); @@ -547,7 +547,7 @@ int ossl_ffc_params_FIPS186_4_gen_verify(OSSL_LIB_CTX *libctx, } if (md == NULL) goto err; - mdsize = EVP_MD_size(md); + mdsize = EVP_MD_get_size(md); if (mdsize <= 0) goto err; @@ -843,7 +843,7 @@ int ossl_ffc_params_FIPS186_2_gen_verify(OSSL_LIB_CTX *libctx, if (md == NULL) goto err; if (N == 0) - N = EVP_MD_size(md) * 8; + N = EVP_MD_get_size(md) * 8; qsize = N >> 3; /* diff --git a/crypto/hmac/hmac.c b/crypto/hmac/hmac.c index 86cdb7bde5..618b0a6196 100644 --- a/crypto/hmac/hmac.c +++ b/crypto/hmac/hmac.c @@ -46,13 +46,13 @@ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, * The HMAC construction is not allowed to be used with the * extendable-output functions (XOF) shake128 and shake256. */ - if ((EVP_MD_flags(md) & EVP_MD_FLAG_XOF) != 0) + if ((EVP_MD_get_flags(md) & EVP_MD_FLAG_XOF) != 0) return 0; if (key != NULL) { reset = 1; - j = EVP_MD_block_size(md); + j = EVP_MD_get_block_size(md); if (!ossl_assert(j <= (int)sizeof(keytmp))) return 0; if (j < 0) @@ -76,13 +76,15 @@ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, for (i = 0; i < HMAC_MAX_MD_CBLOCK_SIZE; i++) pad[i] = 0x36 ^ keytmp[i]; if (!EVP_DigestInit_ex(ctx->i_ctx, md, impl) - || !EVP_DigestUpdate(ctx->i_ctx, pad, EVP_MD_block_size(md))) + || !EVP_DigestUpdate(ctx->i_ctx, pad, + EVP_MD_get_block_size(md))) goto err; for (i = 0; i < HMAC_MAX_MD_CBLOCK_SIZE; i++) pad[i] = 0x5c ^ keytmp[i]; if (!EVP_DigestInit_ex(ctx->o_ctx, md, impl) - || !EVP_DigestUpdate(ctx->o_ctx, pad, EVP_MD_block_size(md))) + || !EVP_DigestUpdate(ctx->o_ctx, pad, + EVP_MD_get_block_size(md))) goto err; } if (!EVP_MD_CTX_copy_ex(ctx->md_ctx, ctx->i_ctx)) @@ -135,7 +137,7 @@ int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len) size_t HMAC_size(const HMAC_CTX *ctx) { - int size = EVP_MD_size((ctx)->md); + int size = EVP_MD_get_size((ctx)->md); return (size < 0) ? 0 : size; } @@ -221,11 +223,11 @@ unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, unsigned char *md, unsigned int *md_len) { static unsigned char static_md[EVP_MAX_MD_SIZE]; - int size = EVP_MD_size(evp_md); + int size = EVP_MD_get_size(evp_md); if (size < 0) return NULL; - return EVP_Q_mac(NULL, "HMAC", NULL, EVP_MD_name(evp_md), NULL, + return EVP_Q_mac(NULL, "HMAC", NULL, EVP_MD_get0_name(evp_md), NULL, key, key_len, data, data_len, md == NULL ? static_md : md, size, md_len); } diff --git a/crypto/modes/siv128.c b/crypto/modes/siv128.c index 07c3f4ac27..e6348a8d37 100644 --- a/crypto/modes/siv128.c +++ b/crypto/modes/siv128.c @@ -184,7 +184,7 @@ int ossl_siv128_init(SIV128_CONTEXT *ctx, const unsigned char *key, int klen, if (key == NULL || cbc == NULL || ctr == NULL) return 0; - cbc_name = EVP_CIPHER_name(cbc); + cbc_name = EVP_CIPHER_get0_name(cbc); params[0] = OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_CIPHER, (char *)cbc_name, 0); params[1] = OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY, diff --git a/crypto/ocsp/ocsp_lib.c b/crypto/ocsp/ocsp_lib.c index 336372f063..285634dec3 100644 --- a/crypto/ocsp/ocsp_lib.c +++ b/crypto/ocsp/ocsp_lib.c @@ -55,7 +55,7 @@ OCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst, alg = &cid->hashAlgorithm; ASN1_OBJECT_free(alg->algorithm); - if ((nid = EVP_MD_type(dgst)) == NID_undef) { + if ((nid = EVP_MD_get_type(dgst)) == NID_undef) { ERR_raise(ERR_LIB_OCSP, OCSP_R_UNKNOWN_NID); goto err; } diff --git a/crypto/ocsp/ocsp_srv.c b/crypto/ocsp/ocsp_srv.c index 1475bb0f7e..dbb6e760b2 100644 --- a/crypto/ocsp/ocsp_srv.c +++ b/crypto/ocsp/ocsp_srv.c @@ -171,12 +171,12 @@ int OCSP_basic_sign_ctx(OCSP_BASICRESP *brsp, OCSP_RESPID *rid; EVP_PKEY *pkey; - if (ctx == NULL || EVP_MD_CTX_pkey_ctx(ctx) == NULL) { + if (ctx == NULL || EVP_MD_CTX_get_pkey_ctx(ctx) == NULL) { ERR_raise(ERR_LIB_OCSP, OCSP_R_NO_SIGNER_KEY); goto err; } - pkey = EVP_PKEY_CTX_get0_pkey(EVP_MD_CTX_pkey_ctx(ctx)); + pkey = EVP_PKEY_CTX_get0_pkey(EVP_MD_CTX_get_pkey_ctx(ctx)); if (pkey == NULL || !X509_check_private_key(signer, pkey)) { ERR_raise(ERR_LIB_OCSP, OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE); goto err; @@ -223,7 +223,7 @@ int OCSP_basic_sign(OCSP_BASICRESP *brsp, if (ctx == NULL) return 0; - if (!EVP_DigestSignInit_ex(ctx, &pkctx, EVP_MD_name(dgst), + if (!EVP_DigestSignInit_ex(ctx, &pkctx, EVP_MD_get0_name(dgst), signer->libctx, signer->propq, key, NULL)) { EVP_MD_CTX_free(ctx); return 0; diff --git a/crypto/ocsp/ocsp_vfy.c b/crypto/ocsp/ocsp_vfy.c index 4231c3f2b2..5e829fa972 100644 --- a/crypto/ocsp/ocsp_vfy.c +++ b/crypto/ocsp/ocsp_vfy.c @@ -327,7 +327,7 @@ static int ocsp_match_issuerid(X509 *cert, OCSP_CERTID *cid, } (void)ERR_pop_to_mark(); - mdlen = EVP_MD_size(dgst); + mdlen = EVP_MD_get_size(dgst); if (mdlen < 0) { ERR_raise(ERR_LIB_OCSP, OCSP_R_DIGEST_SIZE_ERR); goto end; diff --git a/crypto/pem/pem_info.c b/crypto/pem/pem_info.c index cd75a95e2a..061c9b9f68 100644 --- a/crypto/pem/pem_info.c +++ b/crypto/pem/pem_info.c @@ -232,14 +232,14 @@ int PEM_X509_INFO_write_bio(BIO *bp, const X509_INFO *xi, EVP_CIPHER *enc, const unsigned char *iv = NULL; if (enc != NULL) { - objstr = EVP_CIPHER_name(enc); + objstr = EVP_CIPHER_get0_name(enc); if (objstr == NULL - /* - * Check "Proc-Type: 4,Encrypted\nDEK-Info: objstr,hex-iv\n" - * fits into buf - */ - || (strlen(objstr) + 23 + 2 * EVP_CIPHER_iv_length(enc) + 13) - > sizeof(buf)) { + /* + * Check "Proc-Type: 4,Encrypted\nDEK-Info: objstr,hex-iv\n" + * fits into buf + */ + || strlen(objstr) + 23 + 2 * EVP_CIPHER_get_iv_length(enc) + 13 + > sizeof(buf)) { ERR_raise(ERR_LIB_PEM, PEM_R_UNSUPPORTED_CIPHER); goto err; } @@ -267,7 +267,7 @@ int PEM_X509_INFO_write_bio(BIO *bp, const X509_INFO *xi, EVP_CIPHER *enc, * than what the user has passed us ... as we have to match * exactly for some strange reason */ - objstr = EVP_CIPHER_name(xi->enc_cipher.cipher); + objstr = EVP_CIPHER_get0_name(xi->enc_cipher.cipher); if (objstr == NULL) { ERR_raise(ERR_LIB_PEM, PEM_R_UNSUPPORTED_CIPHER); goto err; @@ -276,7 +276,7 @@ int PEM_X509_INFO_write_bio(BIO *bp, const X509_INFO *xi, EVP_CIPHER *enc, /* Create the right magic header stuff */ buf[0] = '\0'; PEM_proc_type(buf, PEM_TYPE_ENCRYPTED); - PEM_dek_info(buf, objstr, EVP_CIPHER_iv_length(enc), + PEM_dek_info(buf, objstr, EVP_CIPHER_get_iv_length(enc), (const char *)iv); /* use the normal code to write things out */ diff --git a/crypto/pem/pem_lib.c b/crypto/pem/pem_lib.c index d0516bc3fe..3948021702 100644 --- a/crypto/pem/pem_lib.c +++ b/crypto/pem/pem_lib.c @@ -323,14 +323,14 @@ int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, unsigned char iv[EVP_MAX_IV_LENGTH]; if (enc != NULL) { - objstr = EVP_CIPHER_name(enc); - if (objstr == NULL || EVP_CIPHER_iv_length(enc) == 0 - || EVP_CIPHER_iv_length(enc) > (int)sizeof(iv) + objstr = EVP_CIPHER_get0_name(enc); + if (objstr == NULL || EVP_CIPHER_get_iv_length(enc) == 0 + || EVP_CIPHER_get_iv_length(enc) > (int)sizeof(iv) /* * Check "Proc-Type: 4,Encrypted\nDEK-Info: objstr,hex-iv\n" * fits into buf */ - || (strlen(objstr) + 23 + 2 * EVP_CIPHER_iv_length(enc) + 13) + || strlen(objstr) + 23 + 2 * EVP_CIPHER_get_iv_length(enc) + 13 > sizeof(buf)) { ERR_raise(ERR_LIB_PEM, PEM_R_UNSUPPORTED_CIPHER); goto err; @@ -368,7 +368,8 @@ int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, #endif kstr = (unsigned char *)buf; } - if (RAND_bytes(iv, EVP_CIPHER_iv_length(enc)) <= 0) /* Generate a salt */ + /* Generate a salt */ + if (RAND_bytes(iv, EVP_CIPHER_get_iv_length(enc)) <= 0) goto err; /* * The 'iv' is used as the iv and as a salt. It is NOT taken from @@ -382,7 +383,7 @@ int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, buf[0] = '\0'; PEM_proc_type(buf, PEM_TYPE_ENCRYPTED); - PEM_dek_info(buf, objstr, EVP_CIPHER_iv_length(enc), (char *)iv); + PEM_dek_info(buf, objstr, EVP_CIPHER_get_iv_length(enc), (char *)iv); /* k=strlen(buf); */ ret = 1; @@ -548,7 +549,7 @@ int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher) ERR_raise(ERR_LIB_PEM, PEM_R_UNSUPPORTED_ENCRYPTION); return 0; } - ivlen = EVP_CIPHER_iv_length(enc); + ivlen = EVP_CIPHER_get_iv_length(enc); if (ivlen > 0 && *header++ != ',') { ERR_raise(ERR_LIB_PEM, PEM_R_MISSING_DEK_IV); return 0; @@ -557,7 +558,7 @@ int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher) return 0; } - if (!load_iv(&header, cipher->iv, EVP_CIPHER_iv_length(enc))) + if (!load_iv(&header, cipher->iv, EVP_CIPHER_get_iv_length(enc))) return 0; return 1; diff --git a/crypto/pem/pem_local.h b/crypto/pem/pem_local.h index 628a66912d..a84ca80be1 100644 --- a/crypto/pem/pem_local.h +++ b/crypto/pem/pem_local.h @@ -62,7 +62,7 @@ } \ if (enc != NULL) { \ ret = 0; \ - if (OSSL_ENCODER_CTX_set_cipher(ctx, EVP_CIPHER_name(enc), \ + if (OSSL_ENCODER_CTX_set_cipher(ctx, EVP_CIPHER_get0_name(enc), \ NULL)) { \ ret = 1; \ if (kstr != NULL \ diff --git a/crypto/pem/pem_pk8.c b/crypto/pem/pem_pk8.c index 5e28907be3..ab86448db9 100644 --- a/crypto/pem/pem_pk8.c +++ b/crypto/pem/pem_pk8.c @@ -103,7 +103,8 @@ static int do_pk8pkey(BIO *bp, const EVP_PKEY *x, int isder, int nid, ret = 1; if (enc != NULL) { ret = 0; - if (OSSL_ENCODER_CTX_set_cipher(ctx, EVP_CIPHER_name(enc), NULL)) { + if (OSSL_ENCODER_CTX_set_cipher(ctx, EVP_CIPHER_get0_name(enc), + NULL)) { const unsigned char *ukstr = (const unsigned char *)kstr; /* diff --git a/crypto/pem/pem_sign.c b/crypto/pem/pem_sign.c index b52764e0ac..8a147dbfc0 100644 --- a/crypto/pem/pem_sign.c +++ b/crypto/pem/pem_sign.c @@ -32,7 +32,7 @@ int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, int i, ret = 0; unsigned int m_len; - m = OPENSSL_malloc(EVP_PKEY_size(pkey)); + m = OPENSSL_malloc(EVP_PKEY_get_size(pkey)); if (m == NULL) { ERR_raise(ERR_LIB_PEM, ERR_R_MALLOC_FAILURE); goto err; diff --git a/crypto/pem/pvkfmt.c b/crypto/pem/pvkfmt.c index 1ff68e2158..11ac0a7c40 100644 --- a/crypto/pem/pvkfmt.c +++ b/crypto/pem/pvkfmt.c @@ -1027,7 +1027,7 @@ static int i2b_PVK(unsigned char **out, const EVP_PKEY *pk, int enclevel, write_ledword(&p, MS_PVKMAGIC); write_ledword(&p, 0); - if (EVP_PKEY_id(pk) == EVP_PKEY_RSA) + if (EVP_PKEY_get_id(pk) == EVP_PKEY_RSA) write_ledword(&p, MS_KEYTYPE_KEYX); #ifndef OPENSSL_NO_DSA else diff --git a/crypto/pkcs12/p12_crpt.c b/crypto/pkcs12/p12_crpt.c index 777bc93ac3..57d1caecfc 100644 --- a/crypto/pkcs12/p12_crpt.c +++ b/crypto/pkcs12/p12_crpt.c @@ -49,15 +49,17 @@ int PKCS12_PBE_keyivgen_ex(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, salt = pbe->salt->data; saltlen = pbe->salt->length; if (!PKCS12_key_gen_utf8_ex(pass, passlen, salt, saltlen, PKCS12_KEY_ID, - iter, EVP_CIPHER_key_length(cipher), key, md, + iter, EVP_CIPHER_get_key_length(cipher), + key, md, libctx, propq)) { ERR_raise(ERR_LIB_PKCS12, PKCS12_R_KEY_GEN_ERROR); PBEPARAM_free(pbe); return 0; } - if (EVP_CIPHER_iv_length(cipher) > 0) { + if (EVP_CIPHER_get_iv_length(cipher) > 0) { if (!PKCS12_key_gen_utf8_ex(pass, passlen, salt, saltlen, PKCS12_IV_ID, - iter, EVP_CIPHER_iv_length(cipher), iv, md, + iter, EVP_CIPHER_get_iv_length(cipher), + iv, md, libctx, propq)) { ERR_raise(ERR_LIB_PKCS12, PKCS12_R_IV_GEN_ERROR); PBEPARAM_free(pbe); diff --git a/crypto/pkcs12/p12_decr.c b/crypto/pkcs12/p12_decr.c index ef316d044b..87232e7737 100644 --- a/crypto/pkcs12/p12_decr.c +++ b/crypto/pkcs12/p12_decr.c @@ -43,15 +43,15 @@ unsigned char *PKCS12_pbe_crypt_ex(const X509_ALGOR *algor, * It's appended to encrypted text on encrypting * MAC should be processed on decrypting separately from plain text */ - max_out_len = inlen + EVP_CIPHER_CTX_block_size(ctx); - if ((EVP_CIPHER_flags(EVP_CIPHER_CTX_get0_cipher(ctx)) + max_out_len = inlen + EVP_CIPHER_CTX_get_block_size(ctx); + if ((EVP_CIPHER_get_flags(EVP_CIPHER_CTX_get0_cipher(ctx)) & EVP_CIPH_FLAG_CIPHER_WITH_MAC) != 0) { if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_TLS1_AAD, 0, &mac_len) < 0) { ERR_raise(ERR_LIB_PKCS12, ERR_R_INTERNAL_ERROR); goto err; } - if (EVP_CIPHER_CTX_encrypting(ctx)) { + if (EVP_CIPHER_CTX_is_encrypting(ctx)) { max_out_len += mac_len; } else { if (inlen < mac_len) { @@ -89,9 +89,9 @@ unsigned char *PKCS12_pbe_crypt_ex(const X509_ALGOR *algor, goto err; } outlen += i; - if ((EVP_CIPHER_flags(EVP_CIPHER_CTX_get0_cipher(ctx)) + if ((EVP_CIPHER_get_flags(EVP_CIPHER_CTX_get0_cipher(ctx)) & EVP_CIPH_FLAG_CIPHER_WITH_MAC) != 0) { - if (EVP_CIPHER_CTX_encrypting(ctx)) { + if (EVP_CIPHER_CTX_is_encrypting(ctx)) { if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, (int)mac_len, out+outlen) < 0) { ERR_raise(ERR_LIB_PKCS12, ERR_R_INTERNAL_ERROR); diff --git a/crypto/pkcs12/p12_key.c b/crypto/pkcs12/p12_key.c index a4ed0e516c..41a2d7293e 100644 --- a/crypto/pkcs12/p12_key.c +++ b/crypto/pkcs12/p12_key.c @@ -98,7 +98,8 @@ int PKCS12_key_gen_uni_ex(unsigned char *pass, int passlen, unsigned char *salt, return 0; *p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST, - (char *)EVP_MD_name(md_type), 0); + (char *)EVP_MD_get0_name(md_type), + 0); *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_PASSWORD, pass, passlen); *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SALT, diff --git a/crypto/pkcs12/p12_mutl.c b/crypto/pkcs12/p12_mutl.c index be4ed16ab7..88655651a0 100644 --- a/crypto/pkcs12/p12_mutl.c +++ b/crypto/pkcs12/p12_mutl.c @@ -117,8 +117,8 @@ static int pkcs12_gen_mac(PKCS12 *p12, const char *pass, int passlen, ERR_raise(ERR_LIB_PKCS12, PKCS12_R_UNKNOWN_DIGEST_ALGORITHM); return 0; } - md_size = EVP_MD_size(md); - md_nid = EVP_MD_type(md); + md_size = EVP_MD_get_size(md); + md_nid = EVP_MD_get_type(md); if (md_size < 0) goto err; if ((md_nid == NID_id_GostR3411_94 @@ -267,7 +267,7 @@ int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, int saltlen, } else memcpy(p12->mac->salt->data, salt, saltlen); X509_SIG_getm(p12->mac->dinfo, &macalg, NULL); - if (!X509_ALGOR_set0(macalg, OBJ_nid2obj(EVP_MD_type(md_type)), + if (!X509_ALGOR_set0(macalg, OBJ_nid2obj(EVP_MD_get_type(md_type)), V_ASN1_NULL, NULL)) { ERR_raise(ERR_LIB_PKCS12, ERR_R_MALLOC_FAILURE); return 0; diff --git a/crypto/pkcs7/pk7_doit.c b/crypto/pkcs7/pk7_doit.c index 8d4e95a3b4..441bf78bba 100644 --- a/crypto/pkcs7/pk7_doit.c +++ b/crypto/pkcs7/pk7_doit.c @@ -296,16 +296,16 @@ BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio) goto err; } BIO_get_cipher_ctx(btmp, &ctx); - keylen = EVP_CIPHER_key_length(evp_cipher); - ivlen = EVP_CIPHER_iv_length(evp_cipher); - xalg->algorithm = OBJ_nid2obj(EVP_CIPHER_type(evp_cipher)); + keylen = EVP_CIPHER_get_key_length(evp_cipher); + ivlen = EVP_CIPHER_get_iv_length(evp_cipher); + xalg->algorithm = OBJ_nid2obj(EVP_CIPHER_get_type(evp_cipher)); if (ivlen > 0) if (RAND_bytes_ex(libctx, iv, ivlen, 0) <= 0) goto err; (void)ERR_set_mark(); fetched_cipher = EVP_CIPHER_fetch(libctx, - EVP_CIPHER_name(evp_cipher), + EVP_CIPHER_get0_name(evp_cipher), propq); (void)ERR_pop_to_mark(); if (fetched_cipher != NULL) @@ -572,7 +572,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) ri = sk_PKCS7_RECIP_INFO_value(rsk, i); ri->ctx = p7_ctx; if (pkcs7_decrypt_rinfo(&ek, &eklen, ri, pkey, - EVP_CIPHER_key_length(cipher)) < 0) + EVP_CIPHER_get_key_length(cipher)) < 0) goto err; ERR_clear_error(); } @@ -591,7 +591,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) if (EVP_CIPHER_asn1_to_param(evp_ctx, enc_alg->parameter) < 0) goto err; /* Generate random key as MMA defence */ - len = EVP_CIPHER_CTX_key_length(evp_ctx); + len = EVP_CIPHER_CTX_get_key_length(evp_ctx); if (len <= 0) goto err; tkeylen = (size_t)len; @@ -606,7 +606,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) tkey = NULL; } - if (eklen != EVP_CIPHER_CTX_key_length(evp_ctx)) { + if (eklen != EVP_CIPHER_CTX_get_key_length(evp_ctx)) { /* * Some S/MIME clients don't use the same key and effective key * length. The key length is determined by the size of the @@ -679,7 +679,7 @@ static BIO *PKCS7_find_digest(EVP_MD_CTX **pmd, BIO *bio, int nid) ERR_raise(ERR_LIB_PKCS7, ERR_R_INTERNAL_ERROR); return NULL; } - if (EVP_MD_CTX_type(*pmd) == nid) + if (EVP_MD_CTX_get_type(*pmd) == nid) return bio; bio = BIO_next(bio); } @@ -837,7 +837,7 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) } else { unsigned char *abuf = NULL; unsigned int abuflen; - abuflen = EVP_PKEY_size(si->pkey); + abuflen = EVP_PKEY_get_size(si->pkey); abuf = OPENSSL_malloc(abuflen); if (abuf == NULL) goto err; @@ -915,7 +915,7 @@ int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si) goto err; } - if (EVP_DigestSignInit_ex(mctx, &pctx, EVP_MD_name(md), + if (EVP_DigestSignInit_ex(mctx, &pctx, EVP_MD_get0_name(md), ossl_pkcs7_ctx_get0_libctx(ctx), ossl_pkcs7_ctx_get0_propq(ctx), si->pkey, NULL) <= 0) @@ -1044,13 +1044,13 @@ int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si, ERR_raise(ERR_LIB_PKCS7, ERR_R_INTERNAL_ERROR); goto err; } - if (EVP_MD_CTX_type(mdc) == md_type) + if (EVP_MD_CTX_get_type(mdc) == md_type) break; /* * Workaround for some broken clients that put the signature OID * instead of the digest OID in digest_alg->algorithm */ - if (EVP_MD_pkey_type(EVP_MD_CTX_get0_md(mdc)) == md_type) + if (EVP_MD_get_pkey_type(EVP_MD_CTX_get0_md(mdc)) == md_type) break; btmp = BIO_next(btmp); } diff --git a/crypto/pkcs7/pk7_lib.c b/crypto/pkcs7/pk7_lib.c index a4b62f40dd..c32a666626 100644 --- a/crypto/pkcs7/pk7_lib.c +++ b/crypto/pkcs7/pk7_lib.c @@ -316,7 +316,7 @@ static int pkcs7_ecdsa_or_dsa_sign_verify_setup(PKCS7_SIGNER_INFO *si, hnid = OBJ_obj2nid(alg1->algorithm); if (hnid == NID_undef) return -1; - if (!OBJ_find_sigid_by_algs(&snid, hnid, EVP_PKEY_id(pkey))) + if (!OBJ_find_sigid_by_algs(&snid, hnid, EVP_PKEY_get_id(pkey))) return -1; X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF, 0); } @@ -362,7 +362,7 @@ int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey, /* Set the algorithms */ - X509_ALGOR_set0(p7i->digest_alg, OBJ_nid2obj(EVP_MD_type(dgst)), + X509_ALGOR_set0(p7i->digest_alg, OBJ_nid2obj(EVP_MD_get_type(dgst)), V_ASN1_NULL, NULL); if (EVP_PKEY_is_a(pkey, "EC") || EVP_PKEY_is_a(pkey, "DSA")) @@ -689,7 +689,7 @@ int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher) } /* Check cipher OID exists and has data in it */ - i = EVP_CIPHER_type(cipher); + i = EVP_CIPHER_get_type(cipher); if (i == NID_undef) { ERR_raise(ERR_LIB_PKCS7, PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER); return 0; diff --git a/crypto/rand/rand_lib.c b/crypto/rand/rand_lib.c index 56e615f6b9..a7a8c70523 100644 --- a/crypto/rand/rand_lib.c +++ b/crypto/rand/rand_lib.c @@ -298,7 +298,7 @@ int RAND_status(void) if ((rand = RAND_get0_primary(NULL)) == NULL) return 0; - return EVP_RAND_state(rand) == EVP_RAND_STATE_READY; + return EVP_RAND_get_state(rand) == EVP_RAND_STATE_READY; } # else /* !FIPS_MODULE */ diff --git a/crypto/rand/rand_meth.c b/crypto/rand/rand_meth.c index c0484823a2..49bf0acdf5 100644 --- a/crypto/rand/rand_meth.c +++ b/crypto/rand/rand_meth.c @@ -36,7 +36,7 @@ static int drbg_status(void) if (drbg == NULL) return 0; - return EVP_RAND_state(drbg) == EVP_RAND_STATE_READY ? 1 : 0; + return EVP_RAND_get_state(drbg) == EVP_RAND_STATE_READY ? 1 : 0; } /* Implements the default OpenSSL RAND_bytes() method */ diff --git a/crypto/rsa/rsa_ameth.c b/crypto/rsa/rsa_ameth.c index f2283d81bd..1d3b8685bd 100644 --- a/crypto/rsa/rsa_ameth.c +++ b/crypto/rsa/rsa_ameth.c @@ -427,7 +427,7 @@ static int rsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) ERR_raise(ERR_LIB_RSA, ERR_R_INTERNAL_ERROR); return 0; } - *(int *)arg2 = EVP_MD_type(md); + *(int *)arg2 = EVP_MD_get_type(md); /* Return of 2 indicates this MD is mandatory */ return 2; } @@ -457,10 +457,10 @@ static RSA_PSS_PARAMS *rsa_ctx_to_pss(EVP_PKEY_CTX *pkctx) if (!EVP_PKEY_CTX_get_rsa_pss_saltlen(pkctx, &saltlen)) return NULL; if (saltlen == -1) { - saltlen = EVP_MD_size(sigmd); + saltlen = EVP_MD_get_size(sigmd); } else if (saltlen == -2 || saltlen == -3) { - saltlen = EVP_PKEY_size(pk) - EVP_MD_size(sigmd) - 2; - if ((EVP_PKEY_bits(pk) & 0x7) == 1) + saltlen = EVP_PKEY_get_size(pk) - EVP_MD_get_size(sigmd) - 2; + if ((EVP_PKEY_get_bits(pk) & 0x7) == 1) saltlen--; if (saltlen < 0) return NULL; @@ -545,7 +545,7 @@ int ossl_rsa_pss_to_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pkctx, const EVP_MD *checkmd; if (EVP_PKEY_CTX_get_signature_md(pkctx, &checkmd) <= 0) goto err; - if (EVP_MD_type(md) != EVP_MD_type(checkmd)) { + if (EVP_MD_get_type(md) != EVP_MD_get_type(checkmd)) { ERR_raise(ERR_LIB_RSA, RSA_R_DIGEST_DOES_NOT_MATCH); goto err; } @@ -629,7 +629,7 @@ static int rsa_item_sign(EVP_MD_CTX *ctx, const ASN1_ITEM *it, const void *asn, ASN1_BIT_STRING *sig) { int pad_mode; - EVP_PKEY_CTX *pkctx = EVP_MD_CTX_pkey_ctx(ctx); + EVP_PKEY_CTX *pkctx = EVP_MD_CTX_get_pkey_ctx(ctx); if (EVP_PKEY_CTX_get_rsa_padding(pkctx, &pad_mode) <= 0) return 0; @@ -674,18 +674,19 @@ static int rsa_sig_info_set(X509_SIG_INFO *siginf, const X509_ALGOR *sigalg, pss = ossl_rsa_pss_decode(sigalg); if (!ossl_rsa_pss_get_param(pss, &md, &mgf1md, &saltlen)) goto err; - mdnid = EVP_MD_type(md); + mdnid = EVP_MD_get_type(md); /* * For TLS need SHA256, SHA384 or SHA512, digest and MGF1 digest must * match and salt length must equal digest size */ if ((mdnid == NID_sha256 || mdnid == NID_sha384 || mdnid == NID_sha512) - && mdnid == EVP_MD_type(mgf1md) && saltlen == EVP_MD_size(md)) + && mdnid == EVP_MD_get_type(mgf1md) + && saltlen == EVP_MD_get_size(md)) flags = X509_SIG_INFO_TLS; else flags = 0; /* Note: security bits half number of digest bits */ - secbits = EVP_MD_size(md) * 4; + secbits = EVP_MD_get_size(md) * 4; /* * SHA1 and MD5 are known to be broken. Reduce security bits so that * they're no longer accepted at security level 1. The real values don't @@ -763,8 +764,8 @@ static int rsa_int_export_to(const EVP_PKEY *from, int rsa_type, if (!ossl_rsa_pss_get_param_unverified(rsa->pss, &md, &mgf1md, &saltlen, &trailerfield)) goto err; - md_nid = EVP_MD_type(md); - mgf1md_nid = EVP_MD_type(mgf1md); + md_nid = EVP_MD_get_type(md); + mgf1md_nid = EVP_MD_get_type(mgf1md); if (!ossl_rsa_pss_params_30_set_defaults(&pss_params) || !ossl_rsa_pss_params_30_set_hashalg(&pss_params, md_nid) || !ossl_rsa_pss_params_30_set_maskgenhashalg(&pss_params, diff --git a/crypto/rsa/rsa_backend.c b/crypto/rsa/rsa_backend.c index 4a0ad2856b..5b7d60d6e1 100644 --- a/crypto/rsa/rsa_backend.c +++ b/crypto/rsa/rsa_backend.c @@ -480,8 +480,8 @@ static int ossl_rsa_sync_to_pss_params_30(RSA *rsa) if (!ossl_rsa_pss_get_param_unverified(legacy_pss, &md, &mgf1md, &saltlen, &trailerField)) return 0; - md_nid = EVP_MD_type(md); - mgf1md_nid = EVP_MD_type(mgf1md); + md_nid = EVP_MD_get_type(md); + mgf1md_nid = EVP_MD_get_type(mgf1md); if (!ossl_rsa_pss_params_30_set_defaults(&pss_params) || !ossl_rsa_pss_params_30_set_hashalg(&pss_params, md_nid) || !ossl_rsa_pss_params_30_set_maskgenhashalg(&pss_params, diff --git a/crypto/rsa/rsa_oaep.c b/crypto/rsa/rsa_oaep.c index 00646648c7..d9be1a4f98 100644 --- a/crypto/rsa/rsa_oaep.c +++ b/crypto/rsa/rsa_oaep.c @@ -76,7 +76,7 @@ int ossl_rsa_padding_add_PKCS1_OAEP_mgf1_ex(OSSL_LIB_CTX *libctx, if (mgf1md == NULL) mgf1md = md; - mdlen = EVP_MD_size(md); + mdlen = EVP_MD_get_size(md); if (mdlen <= 0) { ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_LENGTH); return 0; @@ -184,7 +184,7 @@ int RSA_padding_check_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, if (mgf1md == NULL) mgf1md = md; - mdlen = EVP_MD_size(md); + mdlen = EVP_MD_get_size(md); if (tlen <= 0 || flen <= 0) return -1; @@ -341,7 +341,7 @@ int PKCS1_MGF1(unsigned char *mask, long len, if (c == NULL) goto err; - mdlen = EVP_MD_size(dgst); + mdlen = EVP_MD_get_size(dgst); if (mdlen < 0) goto err; /* step 4 */ diff --git a/crypto/rsa/rsa_pmeth.c b/crypto/rsa/rsa_pmeth.c index 6e7e7a27e1..110d998ebd 100644 --- a/crypto/rsa/rsa_pmeth.c +++ b/crypto/rsa/rsa_pmeth.c @@ -138,12 +138,12 @@ static int pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, RSA *rsa = ctx->pkey->pkey.rsa; if (rctx->md) { - if (tbslen != (size_t)EVP_MD_size(rctx->md)) { + if (tbslen != (size_t)EVP_MD_get_size(rctx->md)) { ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_DIGEST_LENGTH); return -1; } - if (EVP_MD_type(rctx->md) == NID_mdc2) { + if (EVP_MD_get_type(rctx->md) == NID_mdc2) { unsigned int sltmp; if (rctx->pad_mode != RSA_PKCS1_PADDING) return -1; @@ -163,12 +163,12 @@ static int pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, return -1; } memcpy(rctx->tbuf, tbs, tbslen); - rctx->tbuf[tbslen] = RSA_X931_hash_id(EVP_MD_type(rctx->md)); + rctx->tbuf[tbslen] = RSA_X931_hash_id(EVP_MD_get_type(rctx->md)); ret = RSA_private_encrypt(tbslen + 1, rctx->tbuf, sig, rsa, RSA_X931_PADDING); } else if (rctx->pad_mode == RSA_PKCS1_PADDING) { unsigned int sltmp; - ret = RSA_sign(EVP_MD_type(rctx->md), + ret = RSA_sign(EVP_MD_get_type(rctx->md), tbs, tbslen, sig, &sltmp, rsa); if (ret <= 0) return ret; @@ -213,11 +213,11 @@ static int pkey_rsa_verifyrecover(EVP_PKEY_CTX *ctx, if (ret < 1) return 0; ret--; - if (rctx->tbuf[ret] != RSA_X931_hash_id(EVP_MD_type(rctx->md))) { + if (rctx->tbuf[ret] != RSA_X931_hash_id(EVP_MD_get_type(rctx->md))) { ERR_raise(ERR_LIB_RSA, RSA_R_ALGORITHM_MISMATCH); return 0; } - if (ret != EVP_MD_size(rctx->md)) { + if (ret != EVP_MD_get_size(rctx->md)) { ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_DIGEST_LENGTH); return 0; } @@ -225,7 +225,7 @@ static int pkey_rsa_verifyrecover(EVP_PKEY_CTX *ctx, memcpy(rout, rctx->tbuf, ret); } else if (rctx->pad_mode == RSA_PKCS1_PADDING) { size_t sltmp; - ret = ossl_rsa_verify(EVP_MD_type(rctx->md), + ret = ossl_rsa_verify(EVP_MD_get_type(rctx->md), NULL, 0, rout, &sltmp, sig, siglen, ctx->pkey->pkey.rsa); if (ret <= 0) @@ -254,9 +254,9 @@ static int pkey_rsa_verify(EVP_PKEY_CTX *ctx, if (rctx->md) { if (rctx->pad_mode == RSA_PKCS1_PADDING) - return RSA_verify(EVP_MD_type(rctx->md), tbs, tbslen, + return RSA_verify(EVP_MD_get_type(rctx->md), tbs, tbslen, sig, siglen, rsa); - if (tbslen != (size_t)EVP_MD_size(rctx->md)) { + if (tbslen != (size_t)EVP_MD_get_size(rctx->md)) { ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_DIGEST_LENGTH); return -1; } @@ -360,7 +360,7 @@ static int check_padding_md(const EVP_MD *md, int padding) if (!md) return 1; - mdnid = EVP_MD_type(md); + mdnid = EVP_MD_get_type(md); if (padding == RSA_NO_PADDING) { ERR_raise(ERR_LIB_RSA, RSA_R_INVALID_PADDING_MODE); @@ -457,7 +457,7 @@ static int pkey_rsa_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) return -2; } if ((p1 == RSA_PSS_SALTLEN_DIGEST - && rctx->min_saltlen > EVP_MD_size(rctx->md)) + && rctx->min_saltlen > EVP_MD_get_size(rctx->md)) || (p1 >= 0 && p1 < rctx->min_saltlen)) { ERR_raise(ERR_LIB_RSA, RSA_R_PSS_SALTLEN_TOO_SMALL); return 0; @@ -508,7 +508,7 @@ static int pkey_rsa_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) if (!check_padding_md(p2, rctx->pad_mode)) return 0; if (rsa_pss_restricted(rctx)) { - if (EVP_MD_type(rctx->md) == EVP_MD_type(p2)) + if (EVP_MD_get_type(rctx->md) == EVP_MD_get_type(p2)) return 1; ERR_raise(ERR_LIB_RSA, RSA_R_DIGEST_NOT_ALLOWED); return 0; @@ -534,7 +534,7 @@ static int pkey_rsa_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) *(const EVP_MD **)p2 = rctx->md; } else { if (rsa_pss_restricted(rctx)) { - if (EVP_MD_type(rctx->mgf1md) == EVP_MD_type(p2)) + if (EVP_MD_get_type(rctx->mgf1md) == EVP_MD_get_type(p2)) return 1; ERR_raise(ERR_LIB_RSA, RSA_R_MGF1_DIGEST_NOT_ALLOWED); return 0; @@ -823,7 +823,7 @@ static int pkey_pss_init(EVP_PKEY_CTX *ctx) return 0; /* See if minimum salt length exceeds maximum possible */ - max_saltlen = RSA_size(rsa) - EVP_MD_size(md); + max_saltlen = RSA_size(rsa) - EVP_MD_get_size(md); if ((RSA_bits(rsa) & 0x7) == 1) max_saltlen--; if (min_saltlen > max_saltlen) { diff --git a/crypto/rsa/rsa_pss.c b/crypto/rsa/rsa_pss.c index bca208340e..33874bfef8 100644 --- a/crypto/rsa/rsa_pss.c +++ b/crypto/rsa/rsa_pss.c @@ -53,7 +53,7 @@ int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, if (mgf1Hash == NULL) mgf1Hash = Hash; - hLen = EVP_MD_size(Hash); + hLen = EVP_MD_get_size(Hash); if (hLen < 0) goto err; /*- @@ -164,7 +164,7 @@ int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM, if (mgf1Hash == NULL) mgf1Hash = Hash; - hLen = EVP_MD_size(Hash); + hLen = EVP_MD_get_size(Hash); if (hLen < 0) goto err; /*- diff --git a/crypto/rsa/rsa_sp800_56b_gen.c b/crypto/rsa/rsa_sp800_56b_gen.c index d2052c5796..82b87cc5af 100644 --- a/crypto/rsa/rsa_sp800_56b_gen.c +++ b/crypto/rsa/rsa_sp800_56b_gen.c @@ -195,7 +195,7 @@ static int rsa_validate_rng_strength(EVP_RAND_CTX *rng, int nbits) { if (rng == NULL) return 0; - if (EVP_RAND_strength(rng) < ossl_ifc_ffc_compute_security_bits(nbits)) { + if (EVP_RAND_get_strength(rng) < ossl_ifc_ffc_compute_security_bits(nbits)) { ERR_raise(ERR_LIB_RSA, RSA_R_RANDOMNESS_SOURCE_STRENGTH_INSUFFICIENT); return 0; diff --git a/crypto/sm2/sm2_crypt.c b/crypto/sm2/sm2_crypt.c index f2771dbe73..105dd4ce70 100644 --- a/crypto/sm2/sm2_crypt.c +++ b/crypto/sm2/sm2_crypt.c @@ -71,7 +71,7 @@ int ossl_sm2_plaintext_size(const EC_KEY *key, const EVP_MD *digest, size_t msg_len, size_t *pt_size) { const size_t field_size = ec_field_size(EC_KEY_get0_group(key)); - const int md_size = EVP_MD_size(digest); + const int md_size = EVP_MD_get_size(digest); size_t overhead; if (md_size < 0) { @@ -97,7 +97,7 @@ int ossl_sm2_ciphertext_size(const EC_KEY *key, const EVP_MD *digest, size_t msg_len, size_t *ct_size) { const size_t field_size = ec_field_size(EC_KEY_get0_group(key)); - const int md_size = EVP_MD_size(digest); + const int md_size = EVP_MD_get_size(digest); size_t sz; if (field_size == 0 || md_size < 0) @@ -137,7 +137,7 @@ int ossl_sm2_encrypt(const EC_KEY *key, uint8_t *x2y2 = NULL; uint8_t *C3 = NULL; size_t field_size; - const int C3_size = EVP_MD_size(digest); + const int C3_size = EVP_MD_get_size(digest); EVP_MD *fetched_digest = NULL; OSSL_LIB_CTX *libctx = ossl_ec_key_get_libctx(key); const char *propq = ossl_ec_key_get0_propq(key); @@ -222,7 +222,7 @@ int ossl_sm2_encrypt(const EC_KEY *key, for (i = 0; i != msg_len; ++i) msg_mask[i] ^= msg[i]; - fetched_digest = EVP_MD_fetch(libctx, EVP_MD_name(digest), propq); + fetched_digest = EVP_MD_fetch(libctx, EVP_MD_get0_name(digest), propq); if (fetched_digest == NULL) { ERR_raise(ERR_LIB_SM2, ERR_R_INTERNAL_ERROR); goto done; @@ -291,7 +291,7 @@ int ossl_sm2_decrypt(const EC_KEY *key, uint8_t *x2y2 = NULL; uint8_t *computed_C3 = NULL; const size_t field_size = ec_field_size(group); - const int hash_size = EVP_MD_size(digest); + const int hash_size = EVP_MD_get_size(digest); uint8_t *msg_mask = NULL; const uint8_t *C2 = NULL; const uint8_t *C3 = NULL; diff --git a/crypto/sm2/sm2_sign.c b/crypto/sm2/sm2_sign.c index 907d6585ea..72be1c00b4 100644 --- a/crypto/sm2/sm2_sign.c +++ b/crypto/sm2/sm2_sign.c @@ -145,7 +145,7 @@ static BIGNUM *sm2_compute_msg_hash(const EVP_MD *digest, const uint8_t *msg, size_t msg_len) { EVP_MD_CTX *hash = EVP_MD_CTX_new(); - const int md_size = EVP_MD_size(digest); + const int md_size = EVP_MD_get_size(digest); uint8_t *z = NULL; BIGNUM *e = NULL; EVP_MD *fetched_digest = NULL; @@ -163,7 +163,7 @@ static BIGNUM *sm2_compute_msg_hash(const EVP_MD *digest, goto done; } - fetched_digest = EVP_MD_fetch(libctx, EVP_MD_name(digest), propq); + fetched_digest = EVP_MD_fetch(libctx, EVP_MD_get0_name(digest), propq); if (fetched_digest == NULL) { ERR_raise(ERR_LIB_SM2, ERR_R_INTERNAL_ERROR); goto done; diff --git a/crypto/store/store_lib.c b/crypto/store/store_lib.c index 1409f3aef4..f7939ea0dd 100644 --- a/crypto/store/store_lib.c +++ b/crypto/store/store_lib.c @@ -124,7 +124,7 @@ OSSL_STORE_open_ex(const char *uri, OSSL_LIB_CTX *libctx, const char *propq, && (fetched_loader = OSSL_STORE_LOADER_fetch(schemes[i], libctx, propq)) != NULL) { const OSSL_PROVIDER *provider = - OSSL_STORE_LOADER_provider(fetched_loader); + OSSL_STORE_LOADER_get0_provider(fetched_loader); void *provctx = OSSL_PROVIDER_get0_provider_ctx(provider); loader_ctx = fetched_loader->p_open(provctx, uri); @@ -351,7 +351,8 @@ int OSSL_STORE_find(OSSL_STORE_CTX *ctx, const OSSL_STORE_SEARCH *search) break; case OSSL_STORE_SEARCH_BY_KEY_FINGERPRINT: if (OSSL_PARAM_BLD_push_utf8_string(bld, OSSL_STORE_PARAM_DIGEST, - EVP_MD_name(search->digest), 0) + EVP_MD_get0_name(search->digest), + 0) && OSSL_PARAM_BLD_push_octet_string(bld, OSSL_STORE_PARAM_FINGERPRINT, search->string, @@ -790,7 +791,7 @@ int OSSL_STORE_supports_search(OSSL_STORE_CTX *ctx, int search_type) if (ctx->fetched_loader != NULL) { void *provctx = - ossl_provider_ctx(OSSL_STORE_LOADER_provider(ctx->fetched_loader)); + ossl_provider_ctx(OSSL_STORE_LOADER_get0_provider(ctx->fetched_loader)); const OSSL_PARAM *params; const OSSL_PARAM *p_subject = NULL; const OSSL_PARAM *p_issuer = NULL; @@ -879,11 +880,11 @@ OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_key_fingerprint(const EVP_MD *digest, return NULL; } - if (digest != NULL && len != (size_t)EVP_MD_size(digest)) { + if (digest != NULL && len != (size_t)EVP_MD_get_size(digest)) { ERR_raise_data(ERR_LIB_OSSL_STORE, OSSL_STORE_R_FINGERPRINT_SIZE_DOES_NOT_MATCH_DIGEST, "%s size is %d, fingerprint size is %zu", - EVP_MD_name(digest), EVP_MD_size(digest), len); + EVP_MD_get0_name(digest), EVP_MD_get_size(digest), len); OPENSSL_free(search); return NULL; } @@ -976,7 +977,7 @@ OSSL_STORE_CTX *OSSL_STORE_attach(BIO *bp, const char *scheme, && (fetched_loader = OSSL_STORE_LOADER_fetch(scheme, libctx, propq)) != NULL) { const OSSL_PROVIDER *provider = - OSSL_STORE_LOADER_provider(fetched_loader); + OSSL_STORE_LOADER_get0_provider(fetched_loader); void *provctx = OSSL_PROVIDER_get0_provider_ctx(provider); OSSL_CORE_BIO *cbio = ossl_core_bio_new_from_bio(bp); diff --git a/crypto/store/store_meth.c b/crypto/store/store_meth.c index 7bf0a329ce..7f11d4fbea 100644 --- a/crypto/store/store_meth.c +++ b/crypto/store/store_meth.c @@ -373,7 +373,7 @@ OSSL_STORE_LOADER *ossl_store_loader_fetch_by_number(OSSL_LIB_CTX *libctx, * Library of basic method functions */ -const OSSL_PROVIDER *OSSL_STORE_LOADER_provider(const OSSL_STORE_LOADER *loader) +const OSSL_PROVIDER *OSSL_STORE_LOADER_get0_provider(const OSSL_STORE_LOADER *loader) { if (!ossl_assert(loader != NULL)) { ERR_raise(ERR_LIB_OSSL_STORE, ERR_R_PASSED_NULL_PARAMETER); @@ -383,7 +383,7 @@ const OSSL_PROVIDER *OSSL_STORE_LOADER_provider(const OSSL_STORE_LOADER *loader) return loader->prov; } -const char *OSSL_STORE_LOADER_properties(const OSSL_STORE_LOADER *loader) +const char *OSSL_STORE_LOADER_get0_properties(const OSSL_STORE_LOADER *loader) { if (!ossl_assert(loader != NULL)) { ERR_raise(ERR_LIB_OSSL_STORE, ERR_R_PASSED_NULL_PARAMETER); @@ -393,7 +393,7 @@ const char *OSSL_STORE_LOADER_properties(const OSSL_STORE_LOADER *loader) return loader->propdef; } -int OSSL_STORE_LOADER_number(const OSSL_STORE_LOADER *loader) +int OSSL_STORE_LOADER_get_number(const OSSL_STORE_LOADER *loader) { if (!ossl_assert(loader != NULL)) { ERR_raise(ERR_LIB_OSSL_STORE, ERR_R_PASSED_NULL_PARAMETER); @@ -403,7 +403,7 @@ int OSSL_STORE_LOADER_number(const OSSL_STORE_LOADER *loader) return loader->scheme_id; } -const char *OSSL_STORE_LOADER_description(const OSSL_STORE_LOADER *loader) +const char *OSSL_STORE_LOADER_get0_description(const OSSL_STORE_LOADER *loader) { return loader->description; } diff --git a/crypto/store/store_result.c b/crypto/store/store_result.c index 7c48d182a8..c78d96d532 100644 --- a/crypto/store/store_result.c +++ b/crypto/store/store_result.c @@ -88,7 +88,7 @@ int ossl_store_handle_load_result(const OSSL_PARAM params[], void *arg) OSSL_STORE_INFO **v = &cbdata->v; OSSL_STORE_CTX *ctx = cbdata->ctx; const OSSL_PROVIDER *provider = - OSSL_STORE_LOADER_provider(ctx->fetched_loader); + OSSL_STORE_LOADER_get0_provider(ctx->fetched_loader); OSSL_LIB_CTX *libctx = ossl_provider_libctx(provider); const char *propq = ctx->properties; const OSSL_PARAM *p; @@ -206,7 +206,7 @@ static EVP_PKEY *try_key_ref(struct extracted_param_data_st *data, * 2. The keymgmt is from another provider, then we must * do the export/import dance. */ - if (EVP_KEYMGMT_provider(keymgmt) == provider) { + if (EVP_KEYMGMT_get0_provider(keymgmt) == provider) { keydata = evp_keymgmt_load(keymgmt, data->ref, data->ref_size); } else { struct evp_keymgmt_util_try_import_data_st import_data; diff --git a/crypto/ts/ts_rsp_sign.c b/crypto/ts/ts_rsp_sign.c index 172d444d09..8937bb2d66 100644 --- a/crypto/ts/ts_rsp_sign.c +++ b/crypto/ts/ts_rsp_sign.c @@ -484,7 +484,7 @@ static int ts_RESP_check_request(TS_RESP_CTX *ctx) return 0; } digest = msg_imprint->hashed_msg; - if (digest->length != EVP_MD_size(md)) { + if (digest->length != EVP_MD_get_size(md)) { TS_RESP_CTX_set_status_info(ctx, TS_STATUS_REJECTION, "Bad message digest."); TS_RESP_CTX_add_failure_info(ctx, TS_INFO_BAD_DATA_FORMAT); @@ -711,8 +711,8 @@ static int ts_RESP_sign(TS_RESP_CTX *ctx) if (ctx->signer_md == NULL) signer_md = EVP_MD_fetch(ctx->libctx, "SHA256", ctx->propq); - else if (EVP_MD_provider(ctx->signer_md) == NULL) - signer_md = EVP_MD_fetch(ctx->libctx, EVP_MD_name(ctx->signer_md), + else if (EVP_MD_get0_provider(ctx->signer_md) == NULL) + signer_md = EVP_MD_fetch(ctx->libctx, EVP_MD_get0_name(ctx->signer_md), ctx->propq); else signer_md = (EVP_MD *)ctx->signer_md; diff --git a/crypto/ts/ts_rsp_verify.c b/crypto/ts/ts_rsp_verify.c index 03e7312843..792a27ce57 100644 --- a/crypto/ts/ts_rsp_verify.c +++ b/crypto/ts/ts_rsp_verify.c @@ -447,7 +447,7 @@ static int ts_compute_imprint(BIO *data, TS_TST_INFO *tst_info, } (void)ERR_pop_to_mark(); - length = EVP_MD_size(md); + length = EVP_MD_get_size(md); if (length < 0) goto err; *imprint_len = length; diff --git a/crypto/x509/x509_set.c b/crypto/x509/x509_set.c index 8b2d8cc91d..d8ddde8aaa 100644 --- a/crypto/x509/x509_set.c +++ b/crypto/x509/x509_set.c @@ -255,7 +255,7 @@ static int x509_sig_info_init(X509_SIG_INFO *siginf, const X509_ALGOR *alg, ERR_raise(ERR_LIB_X509, X509_R_ERROR_GETTING_MD_BY_NID); return 0; } - siginf->secbits = EVP_MD_size(md) * 4; + siginf->secbits = EVP_MD_get_size(md) * 4; break; } switch (mdnid) { diff --git a/crypto/x509/x509_vfy.c b/crypto/x509/x509_vfy.c index edf3c51095..278b8b6765 100644 --- a/crypto/x509/x509_vfy.c +++ b/crypto/x509/x509_vfy.c @@ -3389,7 +3389,7 @@ static int check_key_level(X509_STORE_CTX *ctx, X509 *cert) if (level > NUM_AUTH_LEVELS) level = NUM_AUTH_LEVELS; - return EVP_PKEY_security_bits(pkey) >= minbits_table[level - 1]; + return EVP_PKEY_get_security_bits(pkey) >= minbits_table[level - 1]; } /*- @@ -3406,7 +3406,7 @@ static int check_curve(X509 *cert) if (pkey == NULL) return -1; - if (EVP_PKEY_id(pkey) == EVP_PKEY_EC) { + if (EVP_PKEY_get_id(pkey) == EVP_PKEY_EC) { int ret, val; ret = EVP_PKEY_get_int_param(pkey, diff --git a/crypto/x509/x509type.c b/crypto/x509/x509type.c index ca4310de1e..b0ed93cfbf 100644 --- a/crypto/x509/x509type.c +++ b/crypto/x509/x509type.c @@ -29,7 +29,7 @@ int X509_certificate_type(const X509 *x, const EVP_PKEY *pkey) if (pk == NULL) return 0; - switch (EVP_PKEY_id(pk)) { + switch (EVP_PKEY_get_id(pk)) { case EVP_PKEY_RSA: ret = EVP_PK_RSA | EVP_PKT_SIGN; /* if (!sign only extension) */ diff --git a/crypto/x509/x_pubkey.c b/crypto/x509/x_pubkey.c index 966a1a534b..7ae35f21fd 100644 --- a/crypto/x509/x_pubkey.c +++ b/crypto/x509/x_pubkey.c @@ -557,7 +557,7 @@ DH *ossl_d2i_DH_PUBKEY(DH **a, const unsigned char **pp, long length) pkey = d2i_PUBKEY_legacy(NULL, &q, length); if (pkey == NULL) return NULL; - if (EVP_PKEY_id(pkey) == EVP_PKEY_DH) + if (EVP_PKEY_get_id(pkey) == EVP_PKEY_DH) key = EVP_PKEY_get1_DH(pkey); EVP_PKEY_free(pkey); if (key == NULL) @@ -598,7 +598,7 @@ DH *ossl_d2i_DHx_PUBKEY(DH **a, const unsigned char **pp, long length) pkey = d2i_PUBKEY_legacy(NULL, &q, length); if (pkey == NULL) return NULL; - if (EVP_PKEY_id(pkey) == EVP_PKEY_DHX) + if (EVP_PKEY_get_id(pkey) == EVP_PKEY_DHX) key = EVP_PKEY_get1_DH(pkey); EVP_PKEY_free(pkey); if (key == NULL) @@ -684,7 +684,7 @@ EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, long length) pkey = d2i_PUBKEY_legacy(NULL, &q, length); if (pkey == NULL) return NULL; - type = EVP_PKEY_id(pkey); + type = EVP_PKEY_get_id(pkey); if (type == EVP_PKEY_EC || type == EVP_PKEY_SM2) key = EVP_PKEY_get1_EC_KEY(pkey); EVP_PKEY_free(pkey); @@ -768,7 +768,7 @@ ECX_KEY *ossl_d2i_ED448_PUBKEY(ECX_KEY **a, pkey = d2i_PUBKEY_legacy(NULL, &q, length); if (pkey == NULL) return NULL; - if (EVP_PKEY_id(pkey) == EVP_PKEY_ED448) + if (EVP_PKEY_get_id(pkey) == EVP_PKEY_ED448) key = ossl_evp_pkey_get1_ED448(pkey); EVP_PKEY_free(pkey); if (key == NULL) @@ -810,7 +810,7 @@ ECX_KEY *ossl_d2i_X25519_PUBKEY(ECX_KEY **a, pkey = d2i_PUBKEY_legacy(NULL, &q, length); if (pkey == NULL) return NULL; - if (EVP_PKEY_id(pkey) == EVP_PKEY_X25519) + if (EVP_PKEY_get_id(pkey) == EVP_PKEY_X25519) key = ossl_evp_pkey_get1_X25519(pkey); EVP_PKEY_free(pkey); if (key == NULL) @@ -852,7 +852,7 @@ ECX_KEY *ossl_d2i_X448_PUBKEY(ECX_KEY **a, pkey = d2i_PUBKEY_legacy(NULL, &q, length); if (pkey == NULL) return NULL; - if (EVP_PKEY_id(pkey) == EVP_PKEY_X448) + if (EVP_PKEY_get_id(pkey) == EVP_PKEY_X448) key = ossl_evp_pkey_get1_X448(pkey); EVP_PKEY_free(pkey); if (key == NULL) |