diff options
author | Matt Caswell <matt@openssl.org> | 2020-09-24 10:42:23 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2020-10-01 09:25:20 +0100 |
commit | d8652be06e2778e8898453a391deb7253e1a35a2 (patch) | |
tree | fe40e22edb39642aa7ae633320c1900388f2e7ee /crypto | |
parent | aedac96c1172ca9a9efe72e027e935504b599e2f (diff) | |
download | openssl-new-d8652be06e2778e8898453a391deb7253e1a35a2.tar.gz |
Run the withlibctx.pl script
Automatically rename all instances of _with_libctx() to _ex() as per
our coding style.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12970)
Diffstat (limited to 'crypto')
66 files changed, 381 insertions, 452 deletions
diff --git a/crypto/asn1/a_digest.c b/crypto/asn1/a_digest.c index 9211d7a968..66c99862e5 100644 --- a/crypto/asn1/a_digest.c +++ b/crypto/asn1/a_digest.c @@ -53,10 +53,9 @@ int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data, #endif -int asn1_item_digest_with_libctx(const ASN1_ITEM *it, const EVP_MD *md, - void *asn, unsigned char *data, - unsigned int *len, OPENSSL_CTX *libctx, - const char *propq) +int asn1_item_digest_ex(const ASN1_ITEM *it, const EVP_MD *md, void *asn, + unsigned char *data, unsigned int *len, + OPENSSL_CTX *libctx, const char *propq) { int i, ret = 0; unsigned char *str = NULL; @@ -90,6 +89,6 @@ err: int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *md, void *asn, unsigned char *data, unsigned int *len) { - return asn1_item_digest_with_libctx(it, md, asn, data, len, NULL, NULL); + return asn1_item_digest_ex(it, md, asn, data, len, NULL, NULL); } diff --git a/crypto/asn1/a_sign.c b/crypto/asn1/a_sign.c index 04edd1b28c..4242e9a70e 100644 --- a/crypto/asn1/a_sign.c +++ b/crypto/asn1/a_sign.c @@ -119,18 +119,18 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2, ASN1_BIT_STRING *signature, const void *data, EVP_PKEY *pkey, const EVP_MD *md) { - return ASN1_item_sign_with_libctx(it, algor1, algor2, signature, data, NULL, - pkey, md, NULL, NULL); + return ASN1_item_sign_ex(it, algor1, algor2, signature, data, NULL, pkey, + md, NULL, NULL); } -int ASN1_item_sign_with_libctx(const ASN1_ITEM *it, X509_ALGOR *algor1, - X509_ALGOR *algor2, ASN1_BIT_STRING *signature, - const void *data, const ASN1_OCTET_STRING *id, - EVP_PKEY *pkey, const EVP_MD *md, - OPENSSL_CTX *libctx, const char *propq) +int ASN1_item_sign_ex(const ASN1_ITEM *it, X509_ALGOR *algor1, + X509_ALGOR *algor2, ASN1_BIT_STRING *signature, + const void *data, const ASN1_OCTET_STRING *id, + EVP_PKEY *pkey, const EVP_MD *md, OPENSSL_CTX *libctx, + const char *propq) { int rv = 0; - EVP_MD_CTX *ctx = evp_md_ctx_new_with_libctx(pkey, id, libctx, propq); + EVP_MD_CTX *ctx = evp_md_ctx_new_ex(pkey, id, libctx, propq); if (ctx == NULL) { ASN1err(0, ERR_R_MALLOC_FAILURE); diff --git a/crypto/asn1/a_verify.c b/crypto/asn1/a_verify.c index e3471c8141..d8cea688d5 100644 --- a/crypto/asn1/a_verify.c +++ b/crypto/asn1/a_verify.c @@ -89,20 +89,18 @@ int ASN1_item_verify(const ASN1_ITEM *it, const X509_ALGOR *alg, const ASN1_BIT_STRING *signature, const void *data, EVP_PKEY *pkey) { - return ASN1_item_verify_with_libctx(it, alg, signature, data, NULL, pkey, - NULL, NULL); + return ASN1_item_verify_ex(it, alg, signature, data, NULL, pkey, NULL, NULL); } -int ASN1_item_verify_with_libctx(const ASN1_ITEM *it, const X509_ALGOR *alg, - const ASN1_BIT_STRING *signature, - const void *data, - const ASN1_OCTET_STRING *id, EVP_PKEY *pkey, - OPENSSL_CTX *libctx, const char *propq) +int ASN1_item_verify_ex(const ASN1_ITEM *it, const X509_ALGOR *alg, + const ASN1_BIT_STRING *signature, const void *data, + const ASN1_OCTET_STRING *id, EVP_PKEY *pkey, + OPENSSL_CTX *libctx, const char *propq) { EVP_MD_CTX *ctx; int rv = -1; - if ((ctx = evp_md_ctx_new_with_libctx(pkey, id, libctx, propq)) != NULL) { + 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_MD_CTX_free(ctx); diff --git a/crypto/asn1/asn_mime.c b/crypto/asn1/asn_mime.c index 596b32a57e..adf368f72f 100644 --- a/crypto/asn1/asn_mime.c +++ b/crypto/asn1/asn_mime.c @@ -229,11 +229,10 @@ static int asn1_write_micalg(BIO *out, STACK_OF(X509_ALGOR) *mdalgs) /* SMIME sender */ -int SMIME_write_ASN1_with_libctx(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, - int ctype_nid, int econt_nid, - STACK_OF(X509_ALGOR) *mdalgs, - const ASN1_ITEM *it, - OPENSSL_CTX *libctx, const char *propq) +int SMIME_write_ASN1_ex(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, + int ctype_nid, int econt_nid, + STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it, + OPENSSL_CTX *libctx, const char *propq) { char bound[33], c; int i; @@ -326,8 +325,8 @@ int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, int ctype_nid, int econt_nid, STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it) { - return SMIME_write_ASN1_with_libctx(bio, val, data, flags, ctype_nid, - econt_nid, mdalgs, it, NULL, NULL); + return SMIME_write_ASN1_ex(bio, val, data, flags, ctype_nid, econt_nid, + mdalgs, it, NULL, NULL); } /* Handle output of ASN1 data */ diff --git a/crypto/asn1/d2i_pr.c b/crypto/asn1/d2i_pr.c index fcf8d2f8d0..838ce25b90 100644 --- a/crypto/asn1/d2i_pr.c +++ b/crypto/asn1/d2i_pr.c @@ -48,13 +48,13 @@ EVP_PKEY *d2i_PrivateKey_ex(int type, EVP_PKEY **a, const unsigned char **pp, if (!ret->ameth->old_priv_decode || !ret->ameth->old_priv_decode(ret, &p, length)) { if (ret->ameth->priv_decode != NULL - || ret->ameth->priv_decode_with_libctx != NULL) { + || ret->ameth->priv_decode_ex != NULL) { EVP_PKEY *tmp; PKCS8_PRIV_KEY_INFO *p8 = NULL; p8 = d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, length); if (p8 == NULL) goto err; - tmp = EVP_PKCS82PKEY_with_libctx(p8, libctx, propq); + tmp = EVP_PKCS82PKEY_ex(p8, libctx, propq); PKCS8_PRIV_KEY_INFO_free(p8); if (tmp == NULL) goto err; @@ -121,7 +121,7 @@ EVP_PKEY *d2i_AutoPrivateKey_ex(EVP_PKEY **a, const unsigned char **pp, ASN1err(0, ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE); return NULL; } - ret = EVP_PKCS82PKEY_with_libctx(p8, libctx, propq); + ret = EVP_PKCS82PKEY_ex(p8, libctx, propq); PKCS8_PRIV_KEY_INFO_free(p8); if (ret == NULL) return NULL; diff --git a/crypto/cmp/cmp_protect.c b/crypto/cmp/cmp_protect.c index eb162e382d..9b28f1b09b 100644 --- a/crypto/cmp/cmp_protect.c +++ b/crypto/cmp/cmp_protect.c @@ -119,9 +119,9 @@ ASN1_BIT_STRING *ossl_cmp_calc_protection(const OSSL_CMP_CTX *ctx, if ((prot = ASN1_BIT_STRING_new()) == NULL) return NULL; - if (ASN1_item_sign_with_libctx(ASN1_ITEM_rptr(OSSL_CMP_PROTECTEDPART), - NULL, NULL, prot, &prot_part, NULL, - ctx->pkey, md, ctx->libctx, ctx->propq)) + if (ASN1_item_sign_ex(ASN1_ITEM_rptr(OSSL_CMP_PROTECTEDPART), NULL, + NULL, prot, &prot_part, NULL, ctx->pkey, md, + ctx->libctx, ctx->propq)) return prot; ASN1_BIT_STRING_free(prot); return NULL; diff --git a/crypto/cmp/cmp_util.c b/crypto/cmp/cmp_util.c index 12afe57028..2eb58da21c 100644 --- a/crypto/cmp/cmp_util.c +++ b/crypto/cmp/cmp_util.c @@ -230,7 +230,7 @@ STACK_OF(X509) goto err; } - if ((csc = X509_STORE_CTX_new_with_libctx(libctx, propq)) == NULL) + if ((csc = X509_STORE_CTX_new_ex(libctx, propq)) == NULL) goto err; if (store == NULL && certs != NULL && !ossl_cmp_X509_STORE_add1_certs(ts, certs, 0)) diff --git a/crypto/cmp/cmp_vfy.c b/crypto/cmp/cmp_vfy.c index 00757c11ae..f9981c2330 100644 --- a/crypto/cmp/cmp_vfy.c +++ b/crypto/cmp/cmp_vfy.c @@ -50,10 +50,10 @@ static int verify_signature(const OSSL_CMP_CTX *cmp_ctx, prot_part.header = msg->header; prot_part.body = msg->body; - if (ASN1_item_verify_with_libctx(ASN1_ITEM_rptr(OSSL_CMP_PROTECTEDPART), - msg->header->protectionAlg, - msg->protection, &prot_part, NULL, pubkey, - cmp_ctx->libctx, cmp_ctx->propq) > 0) { + if (ASN1_item_verify_ex(ASN1_ITEM_rptr(OSSL_CMP_PROTECTEDPART), + msg->header->protectionAlg, msg->protection, + &prot_part, NULL, pubkey, cmp_ctx->libctx, + cmp_ctx->propq) > 0) { res = 1; goto end; } @@ -118,7 +118,7 @@ int OSSL_CMP_validate_cert_path(const OSSL_CMP_CTX *ctx, return 0; } - if ((csc = X509_STORE_CTX_new_with_libctx(ctx->libctx, ctx->propq)) == NULL + if ((csc = X509_STORE_CTX_new_ex(ctx->libctx, ctx->propq)) == NULL || !X509_STORE_CTX_init(csc, trusted_store, cert, ctx->untrusted)) goto err; @@ -825,8 +825,8 @@ int ossl_cmp_verify_popo(const OSSL_CMP_CTX *ctx, { X509_REQ *req = msg->body->value.p10cr; - if (X509_REQ_verify_with_libctx(req, X509_REQ_get0_pubkey(req), - ctx->libctx, ctx->propq) <= 0) { + if (X509_REQ_verify_ex(req, X509_REQ_get0_pubkey(req), ctx->libctx, + ctx->propq) <= 0) { #ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION CMPerr(0, CMP_R_REQUEST_NOT_ACCEPTED); return 0; diff --git a/crypto/cms/cms_cd.c b/crypto/cms/cms_cd.c index c596eab2c2..2abc867a59 100644 --- a/crypto/cms/cms_cd.c +++ b/crypto/cms/cms_cd.c @@ -36,7 +36,7 @@ CMS_ContentInfo *cms_CompressedData_create(int comp_nid, OPENSSL_CTX *libctx, CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM); return NULL; } - cms = CMS_ContentInfo_new_with_libctx(libctx, propq); + cms = CMS_ContentInfo_new_ex(libctx, propq); if (cms == NULL) return NULL; diff --git a/crypto/cms/cms_dd.c b/crypto/cms/cms_dd.c index 2b2d970acd..6b3796e7c0 100644 --- a/crypto/cms/cms_dd.c +++ b/crypto/cms/cms_dd.c @@ -23,7 +23,7 @@ CMS_ContentInfo *cms_DigestedData_create(const EVP_MD *md, CMS_ContentInfo *cms; CMS_DigestedData *dd; - cms = CMS_ContentInfo_new_with_libctx(libctx, propq); + cms = CMS_ContentInfo_new_ex(libctx, propq); if (cms == NULL) return NULL; diff --git a/crypto/cms/cms_env.c b/crypto/cms/cms_env.c index 068696586e..b1bba4c2d6 100644 --- a/crypto/cms/cms_env.c +++ b/crypto/cms/cms_env.c @@ -203,14 +203,14 @@ EVP_PKEY_CTX *CMS_RecipientInfo_get0_pkey_ctx(CMS_RecipientInfo *ri) return NULL; } -CMS_ContentInfo *CMS_EnvelopedData_create_with_libctx(const EVP_CIPHER *cipher, - OPENSSL_CTX *libctx, - const char *propq) +CMS_ContentInfo *CMS_EnvelopedData_create_ex(const EVP_CIPHER *cipher, + OPENSSL_CTX *libctx, + const char *propq) { CMS_ContentInfo *cms; CMS_EnvelopedData *env; - cms = CMS_ContentInfo_new_with_libctx(libctx, propq); + cms = CMS_ContentInfo_new_ex(libctx, propq); if (cms == NULL) goto merr; env = cms_enveloped_data_init(cms); @@ -229,18 +229,17 @@ CMS_ContentInfo *CMS_EnvelopedData_create_with_libctx(const EVP_CIPHER *cipher, CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher) { - return CMS_EnvelopedData_create_with_libctx(cipher, NULL, NULL); + return CMS_EnvelopedData_create_ex(cipher, NULL, NULL); } CMS_ContentInfo * -CMS_AuthEnvelopedData_create_with_libctx(const EVP_CIPHER *cipher, - OPENSSL_CTX *libctx, - const char *propq) +CMS_AuthEnvelopedData_create_ex(const EVP_CIPHER *cipher, OPENSSL_CTX *libctx, + const char *propq) { CMS_ContentInfo *cms; CMS_AuthEnvelopedData *aenv; - cms = CMS_ContentInfo_new_with_libctx(libctx, propq); + cms = CMS_ContentInfo_new_ex(libctx, propq); if (cms == NULL) goto merr; aenv = cms_auth_enveloped_data_init(cms); @@ -259,7 +258,7 @@ CMS_AuthEnvelopedData_create_with_libctx(const EVP_CIPHER *cipher, CMS_ContentInfo *CMS_AuthEnvelopedData_create(const EVP_CIPHER *cipher) { - return CMS_AuthEnvelopedData_create_with_libctx(cipher, NULL, NULL); + return CMS_AuthEnvelopedData_create_ex(cipher, NULL, NULL); } /* Key Transport Recipient Info (KTRI) routines */ diff --git a/crypto/cms/cms_ess.c b/crypto/cms/cms_ess.c index fa81b65c7b..7a617c3419 100644 --- a/crypto/cms/cms_ess.c +++ b/crypto/cms/cms_ess.c @@ -114,7 +114,7 @@ int ess_check_signing_certs(CMS_SignerInfo *si, STACK_OF(X509) *chain) return ret; } -CMS_ReceiptRequest *CMS_ReceiptRequest_create0_with_libctx( +CMS_ReceiptRequest *CMS_ReceiptRequest_create0_ex( unsigned char *id, int idlen, int allorfirst, STACK_OF(GENERAL_NAMES) *receiptList, STACK_OF(GENERAL_NAMES) *receiptsTo, OPENSSL_CTX *libctx, const char *propq) @@ -159,9 +159,8 @@ CMS_ReceiptRequest *CMS_ReceiptRequest_create0( unsigned char *id, int idlen, int allorfirst, STACK_OF(GENERAL_NAMES) *receiptList, STACK_OF(GENERAL_NAMES) *receiptsTo) { - return CMS_ReceiptRequest_create0_with_libctx(id, idlen, allorfirst, - receiptList, receiptsTo, - NULL, NULL); + return CMS_ReceiptRequest_create0_ex(id, idlen, allorfirst, receiptList, + receiptsTo, NULL, NULL); } int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr) @@ -221,9 +220,9 @@ static int cms_msgSigDigest(CMS_SignerInfo *si, if (md == NULL) return 0; - if (!asn1_item_digest_with_libctx(ASN1_ITEM_rptr(CMS_Attributes_Verify), md, - si->signedAttrs, dig, diglen, - si->cms_ctx->libctx, si->cms_ctx->propq)) + if (!asn1_item_digest_ex(ASN1_ITEM_rptr(CMS_Attributes_Verify), md, + si->signedAttrs, dig, diglen, si->cms_ctx->libctx, + si->cms_ctx->propq)) return 0; return 1; } diff --git a/crypto/cms/cms_io.c b/crypto/cms/cms_io.c index 70a7c652e9..55a2510ad6 100644 --- a/crypto/cms/cms_io.c +++ b/crypto/cms/cms_io.c @@ -83,11 +83,11 @@ int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags) else mdalgs = NULL; - return SMIME_write_ASN1_with_libctx(bio, (ASN1_VALUE *)cms, data, flags, - ctype_nid, econt_nid, mdalgs, - ASN1_ITEM_rptr(CMS_ContentInfo), - cms_ctx_get0_libctx(ctx), - cms_ctx_get0_propq(ctx)); + return SMIME_write_ASN1_ex(bio, (ASN1_VALUE *)cms, data, flags, ctype_nid, + econt_nid, mdalgs, + ASN1_ITEM_rptr(CMS_ContentInfo), + cms_ctx_get0_libctx(ctx), + cms_ctx_get0_propq(ctx)); } CMS_ContentInfo *SMIME_read_CMS_ex(BIO *bio, BIO **bcont, CMS_ContentInfo **cms) diff --git a/crypto/cms/cms_lib.c b/crypto/cms/cms_lib.c index bc7da7ff94..f35e503308 100644 --- a/crypto/cms/cms_lib.c +++ b/crypto/cms/cms_lib.c @@ -40,8 +40,7 @@ int i2d_CMS_ContentInfo(const CMS_ContentInfo *a, unsigned char **out) return ASN1_item_i2d((const ASN1_VALUE *)a, out, (CMS_ContentInfo_it())); } -CMS_ContentInfo *CMS_ContentInfo_new_with_libctx(OPENSSL_CTX *libctx, - const char *propq) +CMS_ContentInfo *CMS_ContentInfo_new_ex(OPENSSL_CTX *libctx, const char *propq) { CMS_ContentInfo *ci; @@ -63,7 +62,7 @@ CMS_ContentInfo *CMS_ContentInfo_new_with_libctx(OPENSSL_CTX *libctx, CMS_ContentInfo *CMS_ContentInfo_new(void) { - return CMS_ContentInfo_new_with_libctx(NULL, NULL); + return CMS_ContentInfo_new_ex(NULL, NULL); } void CMS_ContentInfo_free(CMS_ContentInfo *cms) @@ -120,7 +119,7 @@ const ASN1_OBJECT *CMS_get0_type(const CMS_ContentInfo *cms) CMS_ContentInfo *cms_Data_create(OPENSSL_CTX *libctx, const char *propq) { - CMS_ContentInfo *cms = CMS_ContentInfo_new_with_libctx(libctx, propq); + CMS_ContentInfo *cms = CMS_ContentInfo_new_ex(libctx, propq); if (cms != NULL) { cms->contentType = OBJ_nid2obj(NID_pkcs7_data); diff --git a/crypto/cms/cms_sd.c b/crypto/cms/cms_sd.c index 121390a8d5..1338211072 100644 --- a/crypto/cms/cms_sd.c +++ b/crypto/cms/cms_sd.c @@ -411,10 +411,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_with_libctx(si->mctx, &si->pctx, - EVP_MD_name(md), - ctx->libctx, ctx->propq, - pk) <= 0) { + } else if (EVP_DigestSignInit_ex(si->mctx, &si->pctx, EVP_MD_name(md), + ctx->libctx, ctx->propq, pk) <= 0) { goto err; } } @@ -676,8 +674,8 @@ static int cms_SignerInfo_content_sign(CMS_ContentInfo *cms, CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN, ERR_R_MALLOC_FAILURE); goto err; } - if (!EVP_SignFinal_with_libctx(mctx, sig, &siglen, si->pkey, - ctx->libctx, ctx->propq)) { + if (!EVP_SignFinal_ex(mctx, sig, &siglen, si->pkey, ctx->libctx, + ctx->propq)) { CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN, CMS_R_SIGNFINAL_ERROR); OPENSSL_free(sig); goto err; @@ -735,9 +733,8 @@ int CMS_SignerInfo_sign(CMS_SignerInfo *si) pctx = si->pctx; else { EVP_MD_CTX_reset(mctx); - if (EVP_DigestSignInit_with_libctx(mctx, &pctx, - md_name, ctx->libctx, ctx->propq, - si->pkey) <= 0) + if (EVP_DigestSignInit_ex(mctx, &pctx, md_name, ctx->libctx, ctx->propq, + si->pkey) <= 0) goto err; si->pctx = pctx; } @@ -844,9 +841,8 @@ int CMS_SignerInfo_verify(CMS_SignerInfo *si) goto err; } mctx = si->mctx; - if (EVP_DigestVerifyInit_with_libctx(mctx, &si->pctx, - EVP_MD_name(md), ctx->libctx, NULL, - si->pkey) <= 0) + if (EVP_DigestVerifyInit_ex(mctx, &si->pctx, EVP_MD_name(md), ctx->libctx, + NULL, si->pkey) <= 0) goto err; if (!cms_sd_asn1_ctrl(si, 1)) diff --git a/crypto/cms/cms_smime.c b/crypto/cms/cms_smime.c index a50eee9fa9..f9a851950f 100644 --- a/crypto/cms/cms_smime.c +++ b/crypto/cms/cms_smime.c @@ -118,9 +118,8 @@ int CMS_data(CMS_ContentInfo *cms, BIO *out, unsigned int flags) return r; } -CMS_ContentInfo *CMS_data_create_with_libctx(BIO *in, unsigned int flags, - OPENSSL_CTX *libctx, - const char *propq) +CMS_ContentInfo *CMS_data_create_ex(BIO *in, unsigned int flags, + OPENSSL_CTX *libctx, const char *propq) { CMS_ContentInfo *cms = cms_Data_create(libctx, propq); @@ -136,7 +135,7 @@ CMS_ContentInfo *CMS_data_create_with_libctx(BIO *in, unsigned int flags, CMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags) { - return CMS_data_create_with_libctx(in, flags, NULL, NULL); + return CMS_data_create_ex(in, flags, NULL, NULL); } int CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out, @@ -164,11 +163,9 @@ int CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out, return r; } -CMS_ContentInfo *CMS_digest_create_with_libctx(BIO *in, - const EVP_MD *md, - unsigned int flags, - OPENSSL_CTX *ctx, - const char *propq) +CMS_ContentInfo *CMS_digest_create_ex(BIO *in, const EVP_MD *md, + unsigned int flags, OPENSSL_CTX *ctx, + const char *propq) { CMS_ContentInfo *cms; @@ -191,7 +188,7 @@ CMS_ContentInfo *CMS_digest_create_with_libctx(BIO *in, CMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md, unsigned int flags) { - return CMS_digest_create_with_libctx(in, md, flags, NULL, NULL); + return CMS_digest_create_ex(in, md, flags, NULL, NULL); } int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms, @@ -220,13 +217,11 @@ int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms, return r; } -CMS_ContentInfo *CMS_EncryptedData_encrypt_with_libctx(BIO *in, - const EVP_CIPHER *cipher, - const unsigned char *key, - size_t keylen, - unsigned int flags, - OPENSSL_CTX *libctx, - const char *propq) +CMS_ContentInfo *CMS_EncryptedData_encrypt_ex(BIO *in, const EVP_CIPHER *cipher, + const unsigned char *key, + size_t keylen, unsigned int flags, + OPENSSL_CTX *libctx, + const char *propq) { CMS_ContentInfo *cms; @@ -234,7 +229,7 @@ CMS_ContentInfo *CMS_EncryptedData_encrypt_with_libctx(BIO *in, CMSerr(0, CMS_R_NO_CIPHER); return NULL; } - cms = CMS_ContentInfo_new_with_libctx(libctx, propq); + cms = CMS_ContentInfo_new_ex(libctx, propq); if (cms == NULL) return NULL; if (!CMS_EncryptedData_set1_key(cms, cipher, key, keylen)) @@ -255,8 +250,8 @@ CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher, const unsigned char *key, size_t keylen, unsigned int flags) { - return CMS_EncryptedData_encrypt_with_libctx(in, cipher, key, keylen, flags, - NULL, NULL); + return CMS_EncryptedData_encrypt_ex(in, cipher, key, keylen, flags, NULL, + NULL); } static int cms_signerinfo_verify_cert(CMS_SignerInfo *si, @@ -270,7 +265,7 @@ static int cms_signerinfo_verify_cert(CMS_SignerInfo *si, X509 *signer; int i, j, r = 0; - ctx = X509_STORE_CTX_new_with_libctx(cms_ctx->libctx, cms_ctx->propq); + ctx = X509_STORE_CTX_new_ex(cms_ctx->libctx, cms_ctx->propq); if (ctx == NULL) { CMSerr(CMS_F_CMS_SIGNERINFO_VERIFY_CERT, ERR_R_MALLOC_FAILURE); goto err; @@ -503,15 +498,15 @@ int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms, return cms_Receipt_verify(rcms, ocms); } -CMS_ContentInfo *CMS_sign_with_libctx(X509 *signcert, EVP_PKEY *pkey, - STACK_OF(X509) *certs, BIO *data, - unsigned int flags, - OPENSSL_CTX *libctx, const char *propq) +CMS_ContentInfo *CMS_sign_ex(X509 *signcert, EVP_PKEY *pkey, + STACK_OF(X509) *certs, BIO *data, + unsigned int flags, OPENSSL_CTX *libctx, + const char *propq) { CMS_ContentInfo *cms; int i; - cms = CMS_ContentInfo_new_with_libctx(libctx, propq); + cms = CMS_ContentInfo_new_ex(libctx, propq); if (cms == NULL || !CMS_SignedData_init(cms)) goto merr; if (flags & CMS_ASCIICRLF @@ -551,7 +546,7 @@ CMS_ContentInfo *CMS_sign_with_libctx(X509 *signcert, EVP_PKEY *pkey, CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, BIO *data, unsigned int flags) { - return CMS_sign_with_libctx(signcert, pkey, certs, data, flags, NULL, NULL); + return CMS_sign_ex(signcert, pkey, certs, data, flags, NULL, NULL); } CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si, @@ -575,8 +570,7 @@ CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si, /* Initialize signed data */ - cms = CMS_sign_with_libctx(NULL, NULL, certs, NULL, flags, - ctx->libctx, ctx->propq); + cms = CMS_sign_ex(NULL, NULL, certs, NULL, flags, ctx->libctx, ctx->propq); if (cms == NULL) goto err; @@ -623,10 +617,9 @@ CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si, } -CMS_ContentInfo *CMS_encrypt_with_libctx(STACK_OF(X509) *certs, - BIO *data, const EVP_CIPHER *cipher, - unsigned int flags, - OPENSSL_CTX *libctx, const char *propq) +CMS_ContentInfo *CMS_encrypt_ex(STACK_OF(X509) *certs, BIO *data, + const EVP_CIPHER *cipher, unsigned int flags, + OPENSSL_CTX *libctx, const char *propq) { CMS_ContentInfo *cms; int i; @@ -634,8 +627,8 @@ CMS_ContentInfo *CMS_encrypt_with_libctx(STACK_OF(X509) *certs, cms = (EVP_CIPHER_flags(cipher) & EVP_CIPH_FLAG_AEAD_CIPHER) - ? CMS_AuthEnvelopedData_create_with_libctx(cipher, libctx, propq) - : CMS_EnvelopedData_create_with_libctx(cipher, libctx, propq); + ? CMS_AuthEnvelopedData_create_ex(cipher, libctx, propq) + : CMS_EnvelopedData_create_ex(cipher, libctx, propq); if (cms == NULL) goto merr; for (i = 0; i < sk_X509_num(certs); i++) { @@ -665,7 +658,7 @@ CMS_ContentInfo *CMS_encrypt_with_libctx(STACK_OF(X509) *certs, CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *data, const EVP_CIPHER *cipher, unsigned int flags) { - return CMS_encrypt_with_libctx(certs, data, cipher, flags, NULL, NULL); + return CMS_encrypt_ex(certs, data, cipher, flags, NULL, NULL); } static int cms_kari_set1_pkey_and_peer(CMS_ContentInfo *cms, diff --git a/crypto/conf/conf_lib.c b/crypto/conf/conf_lib.c index a9d960b721..4cc698400c 100644 --- a/crypto/conf/conf_lib.c +++ b/crypto/conf/conf_lib.c @@ -174,7 +174,7 @@ int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out) * the "CONF classic" functions, for consistency. */ -CONF *NCONF_new_with_libctx(OPENSSL_CTX *libctx, CONF_METHOD *meth) +CONF *NCONF_new_ex(OPENSSL_CTX *libctx, CONF_METHOD *meth) { CONF *ret; @@ -193,7 +193,7 @@ CONF *NCONF_new_with_libctx(OPENSSL_CTX *libctx, CONF_METHOD *meth) CONF *NCONF_new(CONF_METHOD *meth) { - return NCONF_new_with_libctx(NULL, meth); + return NCONF_new_ex(NULL, meth); } void NCONF_free(CONF *conf) diff --git a/crypto/conf/conf_mod.c b/crypto/conf/conf_mod.c index fa7f6b9d9f..5359a7e06d 100644 --- a/crypto/conf/conf_mod.c +++ b/crypto/conf/conf_mod.c @@ -145,15 +145,14 @@ int CONF_modules_load(const CONF *cnf, const char *appname, } -int CONF_modules_load_file_with_libctx(OPENSSL_CTX *libctx, - const char *filename, - const char *appname, unsigned long flags) +int CONF_modules_load_file_ex(OPENSSL_CTX *libctx, const char *filename, + const char *appname, unsigned long flags) { char *file = NULL; CONF *conf = NULL; int ret = 0, diagnostics = 0; - conf = NCONF_new_with_libctx(libctx, NULL); + conf = NCONF_new_ex(libctx, NULL); if (conf == NULL) goto err; @@ -191,7 +190,7 @@ int CONF_modules_load_file_with_libctx(OPENSSL_CTX *libctx, int CONF_modules_load_file(const char *filename, const char *appname, unsigned long flags) { - return CONF_modules_load_file_with_libctx(NULL, filename, appname, flags); + return CONF_modules_load_file_ex(NULL, filename, appname, flags); } DEFINE_RUN_ONCE_STATIC(do_load_builtin_modules) diff --git a/crypto/context.c b/crypto/context.c index de289fcb68..1bc4bee290 100644 --- a/crypto/context.c +++ b/crypto/context.c @@ -170,7 +170,7 @@ OPENSSL_CTX *OPENSSL_CTX_new(void) #ifndef FIPS_MODULE int OPENSSL_CTX_load_config(OPENSSL_CTX *ctx, const char *config_file) { - return CONF_modules_load_file_with_libctx(ctx, config_file, NULL, 0) > 0; + return CONF_modules_load_file_ex(ctx, config_file, NULL, 0) > 0; } #endif diff --git a/crypto/crmf/crmf_lib.c b/crypto/crmf/crmf_lib.c index 5a6cdb7e82..3e971c7769 100644 --- a/crypto/crmf/crmf_lib.c +++ b/crypto/crmf/crmf_lib.c @@ -365,10 +365,9 @@ static int create_popo_signature(OSSL_CRMF_POPOSIGNINGKEY *ps, return 0; } - return ASN1_item_sign_with_libctx(ASN1_ITEM_rptr(OSSL_CRMF_CERTREQUEST), - ps->algorithmIdentifier, NULL, - ps->signature, cr, NULL, pkey, digest, - libctx, propq); + return ASN1_item_sign_ex(ASN1_ITEM_rptr(OSSL_CRMF_CERTREQUEST), + ps->algorithmIdentifier, NULL, ps->signature, cr, + NULL, pkey, digest, libctx, propq); } @@ -502,10 +501,9 @@ int OSSL_CRMF_MSGS_verify_popo(const OSSL_CRMF_MSGS *reqs, it = ASN1_ITEM_rptr(OSSL_CRMF_CERTREQUEST); asn = req->certReq; } - if (ASN1_item_verify_with_libctx(it, sig->algorithmIdentifier, - sig->signature, asn, NULL, - X509_PUBKEY_get0(pubkey), - libctx, propq) < 1) + if (ASN1_item_verify_ex(it, sig->algorithmIdentifier, sig->signature, + asn, NULL, X509_PUBKEY_get0(pubkey), libctx, + propq) < 1) return 0; break; case OSSL_CRMF_POPO_KEYENC: @@ -680,7 +678,7 @@ X509 outlen += n; /* convert decrypted certificate from DER to internal ASN.1 structure */ - if ((cert = X509_new_with_libctx(libctx, propq)) == NULL) + if ((cert = X509_new_ex(libctx, propq)) == NULL) goto end; if (d2i_X509(&cert, &p, outlen) == NULL) CRMFerr(CRMF_F_OSSL_CRMF_ENCRYPTEDVALUE_GET1_ENCCERT, diff --git a/crypto/ct/ct_b64.c b/crypto/ct/ct_b64.c index ab4aaf82c1..575524e1db 100644 --- a/crypto/ct/ct_b64.c +++ b/crypto/ct/ct_b64.c @@ -132,9 +132,9 @@ SCT *SCT_new_from_base64(unsigned char version, const char *logid_base64, * 0 on decoding failure, or invalid parameter if any * -1 on internal (malloc) failure */ -int CTLOG_new_from_base64_with_libctx(CTLOG **ct_log, const char *pkey_base64, - const char *name, OPENSSL_CTX *libctx, - const char *propq) +int CTLOG_new_from_base64_ex(CTLOG **ct_log, const char *pkey_base64, + const char *name, OPENSSL_CTX *libctx, + const char *propq) { unsigned char *pkey_der = NULL; int pkey_der_len; @@ -160,7 +160,7 @@ int CTLOG_new_from_base64_with_libctx(CTLOG **ct_log, const char *pkey_base64, return 0; } - *ct_log = CTLOG_new_with_libctx(pkey, name, libctx, propq); + *ct_log = CTLOG_new_ex(pkey, name, libctx, propq); if (*ct_log == NULL) { EVP_PKEY_free(pkey); return 0; @@ -172,6 +172,5 @@ int CTLOG_new_from_base64_with_libctx(CTLOG **ct_log, const char *pkey_base64, int CTLOG_new_from_base64(CTLOG **ct_log, const char *pkey_base64, const char *name) { - return CTLOG_new_from_base64_with_libctx(ct_log, pkey_base64, name, NULL, - NULL); + return CTLOG_new_from_base64_ex(ct_log, pkey_base64, name, NULL, NULL); } diff --git a/crypto/ct/ct_log.c b/crypto/ct/ct_log.c index 32a29ed699..9a32054c41 100644 --- a/crypto/ct/ct_log.c +++ b/crypto/ct/ct_log.c @@ -100,7 +100,7 @@ err: return ret; } -CTLOG_STORE *CTLOG_STORE_new_with_libctx(OPENSSL_CTX *libctx, const char *propq) +CTLOG_STORE *CTLOG_STORE_new_ex(OPENSSL_CTX *libctx, const char *propq) { CTLOG_STORE *ret = OPENSSL_zalloc(sizeof(*ret)); @@ -132,7 +132,7 @@ err: CTLOG_STORE *CTLOG_STORE_new(void) { - return CTLOG_STORE_new_with_libctx(NULL, NULL); + return CTLOG_STORE_new_ex(NULL, NULL); } void CTLOG_STORE_free(CTLOG_STORE *store) @@ -161,8 +161,8 @@ static int ctlog_new_from_conf(CTLOG_STORE *store, CTLOG **ct_log, return 0; } - return CTLOG_new_from_base64_with_libctx(ct_log, pkey_base64, description, - store->libctx, store->propq); + return CTLOG_new_from_base64_ex(ct_log, pkey_base64, description, + store->libctx, store->propq); } int CTLOG_STORE_load_default_file(CTLOG_STORE *store) @@ -264,8 +264,8 @@ end: * Takes ownership of the public key. * Copies the name. */ -CTLOG *CTLOG_new_with_libctx(EVP_PKEY *public_key, const char *name, - OPENSSL_CTX *libctx, const char *propq) +CTLOG *CTLOG_new_ex(EVP_PKEY *public_key, const char *name, OPENSSL_CTX *libctx, + const char *propq) { CTLOG *ret = OPENSSL_zalloc(sizeof(*ret)); @@ -301,7 +301,7 @@ err: CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name) { - return CTLOG_new_with_libctx(public_key, name, NULL, NULL); + return CTLOG_new_ex(public_key, name, NULL, NULL); } /* Frees CT log and associated structures */ diff --git a/crypto/ct/ct_policy.c b/crypto/ct/ct_policy.c index e067fd8ea5..268ef22b58 100644 --- a/crypto/ct/ct_policy.c +++ b/crypto/ct/ct_policy.c @@ -25,8 +25,8 @@ */ static const time_t SCT_CLOCK_DRIFT_TOLERANCE = 300; -CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new_with_libctx(OPENSSL_CTX *libctx, - const char *propq) +CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new_ex(OPENSSL_CTX *libctx, + const char *propq) { CT_POLICY_EVAL_CTX *ctx = OPENSSL_zalloc(sizeof(CT_POLICY_EVAL_CTX)); @@ -54,7 +54,7 @@ CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new_with_libctx(OPENSSL_CTX *libctx, CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new(void) { - return CT_POLICY_EVAL_CTX_new_with_libctx(NULL, NULL); + return CT_POLICY_EVAL_CTX_new_ex(NULL, NULL); } void CT_POLICY_EVAL_CTX_free(CT_POLICY_EVAL_CTX *ctx) diff --git a/crypto/ct/ct_vfy.c b/crypto/ct/ct_vfy.c index b05e77b8a1..db0a3d83bd 100644 --- a/crypto/ct/ct_vfy.c +++ b/crypto/ct/ct_vfy.c @@ -122,9 +122,8 @@ int SCT_CTX_verify(const SCT_CTX *sctx, const SCT *sct) if (ctx == NULL) goto end; - if (!EVP_DigestVerifyInit_with_libctx(ctx, NULL, - "SHA2-256", sctx->libctx, sctx->propq, - sctx->pkey)) + if (!EVP_DigestVerifyInit_ex(ctx, NULL, "SHA2-256", sctx->libctx, + sctx->propq, sctx->pkey)) goto end; if (!sct_ctx_update(ctx, sctx, sct)) diff --git a/crypto/dh/dh_ameth.c b/crypto/dh/dh_ameth.c index f89dd44ffd..cd318654cf 100644 --- a/crypto/dh/dh_ameth.c +++ b/crypto/dh/dh_ameth.c @@ -560,7 +560,7 @@ static int dh_pkey_import_from_type(const OSSL_PARAM params[], void *vpctx, { EVP_PKEY_CTX *pctx = vpctx; EVP_PKEY *pkey = EVP_PKEY_CTX_get0_pkey(pctx); - DH *dh = dh_new_with_libctx(pctx->libctx); + DH *dh = dh_new_ex(pctx->libctx); if (dh == NULL) { ERR_raise(ERR_LIB_DH, ERR_R_MALLOC_FAILURE); diff --git a/crypto/dh/dh_gen.c b/crypto/dh/dh_gen.c index 52f3151bc8..096cf12886 100644 --- a/crypto/dh/dh_gen.c +++ b/crypto/dh/dh_gen.c @@ -100,7 +100,7 @@ static int dh_gen_named_group(OPENSSL_CTX *libctx, DH *ret, int prime_len) if (nid == NID_undef) return 0; - dh = dh_new_by_nid_with_libctx(libctx, nid); + dh = dh_new_by_nid_ex(libctx, nid); if (dh != NULL && ffc_params_copy(&ret->params, &dh->params)) { ok = 1; diff --git a/crypto/dh/dh_group_params.c b/crypto/dh/dh_group_params.c index e0daa6ebc4..7a19f71b4d 100644 --- a/crypto/dh/dh_group_params.c +++ b/crypto/dh/dh_group_params.c @@ -103,7 +103,7 @@ const char *ffc_named_group_from_uid(int uid) static DH *dh_param_init(OPENSSL_CTX *libctx, int uid, const BIGNUM *p, const BIGNUM *q, const BIGNUM *g) { - DH *dh = dh_new_with_libctx(libctx); + DH *dh = dh_new_ex(libctx); if (dh == NULL) return NULL; @@ -136,7 +136,7 @@ static DH *dh_new_by_group_name(OPENSSL_CTX *libctx, const char *name) return NULL; } -DH *dh_new_by_nid_with_libctx(OPENSSL_CTX *libctx, int nid) +DH *dh_new_by_nid_ex(OPENSSL_CTX *libctx, int nid) { const char *name = ffc_named_group_from_uid(nid); @@ -145,7 +145,7 @@ DH *dh_new_by_nid_with_libctx(OPENSSL_CTX *libctx, int nid) DH *DH_new_by_nid(int nid) { - return dh_new_by_nid_with_libctx(NULL, nid); + return dh_new_by_nid_ex(NULL, nid); } int ffc_set_group_pqg(FFC_PARAMS *ffc, const char *group_name) diff --git a/crypto/dh/dh_lib.c b/crypto/dh/dh_lib.c index a6f4e64137..6c6eda27a2 100644 --- a/crypto/dh/dh_lib.c +++ b/crypto/dh/dh_lib.c @@ -63,7 +63,7 @@ DH *DH_new_method(ENGINE *engine) } #endif /* !FIPS_MODULE */ -DH *dh_new_with_libctx(OPENSSL_CTX *libctx) +DH *dh_new_ex(OPENSSL_CTX *libctx) { return dh_new_intern(NULL, libctx); } diff --git a/crypto/ec/ec_ameth.c b/crypto/ec/ec_ameth.c index 3312faa336..4bbbabff07 100644 --- a/crypto/ec/ec_ameth.c +++ b/crypto/ec/ec_ameth.c @@ -112,7 +112,7 @@ static EC_KEY *eckey_type2param(int ptype, const void *pval, EC_KEY *eckey = NULL; EC_GROUP *group = NULL; - if ((eckey = EC_KEY_new_with_libctx(libctx, propq)) == NULL) { + if ((eckey = EC_KEY_new_ex(libctx, propq)) == NULL) { ECerr(EC_F_ECKEY_TYPE2PARAM, ERR_R_MALLOC_FAILURE); goto ecerr; } @@ -134,8 +134,7 @@ static EC_KEY *eckey_type2param(int ptype, const void *pval, * type == V_ASN1_OBJECT => the parameters are given by an asn1 OID */ - group = EC_GROUP_new_by_curve_name_with_libctx(libctx, propq, - OBJ_obj2nid(poid)); + group = EC_GROUP_new_by_curve_name_ex(libctx, propq, OBJ_obj2nid(poid)); if (group == NULL) goto ecerr; EC_GROUP_set_asn1_flag(group, OPENSSL_EC_NAMED_CURVE); @@ -206,10 +205,8 @@ static int eckey_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b) return -2; } -static int eckey_priv_decode_with_libctx(EVP_PKEY *pkey, - const PKCS8_PRIV_KEY_INFO *p8, - OPENSSL_CTX *libctx, - const char *propq) +static int eckey_priv_decode_ex(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8, + OPENSSL_CTX *libctx, const char *propq) { const unsigned char *p = NULL; const void *pval; @@ -744,7 +741,7 @@ static int ec_pkey_import_from(const OSSL_PARAM params[], void *vpctx) { EVP_PKEY_CTX *pctx = vpctx; EVP_PKEY *pkey = EVP_PKEY_CTX_get0_pkey(pctx); - EC_KEY *ec = EC_KEY_new_with_libctx(pctx->libctx, pctx->propquery); + EC_KEY *ec = EC_KEY_new_ex(pctx->libctx, pctx->propquery); if (ec == NULL) { ERR_raise(ERR_LIB_DH, ERR_R_MALLOC_FAILURE); @@ -808,7 +805,7 @@ const EVP_PKEY_ASN1_METHOD eckey_asn1_meth = { ec_pkey_dirty_cnt, ec_pkey_export_to, ec_pkey_import_from, - eckey_priv_decode_with_libctx + eckey_priv_decode_ex }; #if !defined(OPENSSL_NO_SM2) diff --git a/crypto/ec/ec_curve.c b/crypto/ec/ec_curve.c index a63a8535c3..d8f46f4849 100644 --- a/crypto/ec/ec_curve.c +++ b/crypto/ec/ec_curve.c @@ -3197,8 +3197,8 @@ static EC_GROUP *ec_group_new_from_data(OPENSSL_CTX *libctx, /* If no curve data curve method must handle everything */ if (curve.data == NULL) - return ec_group_new_with_libctx(libctx, propq, - curve.meth != NULL ? curve.meth() : NULL); + return ec_group_new_ex(libctx, propq, + curve.meth != NULL ? curve.meth() : NULL); if ((ctx = BN_CTX_new_ex(libctx)) == NULL) { ECerr(EC_F_EC_GROUP_NEW_FROM_DATA, ERR_R_MALLOC_FAILURE); @@ -3220,7 +3220,7 @@ static EC_GROUP *ec_group_new_from_data(OPENSSL_CTX *libctx, if (curve.meth != 0) { meth = curve.meth(); - if (((group = ec_group_new_with_libctx(libctx, propq, meth)) == NULL) || + if (((group = ec_group_new_ex(libctx, propq, meth)) == NULL) || (!(group->meth->group_set_curve(group, p, a, b, ctx)))) { ECerr(EC_F_EC_GROUP_NEW_FROM_DATA, ERR_R_EC_LIB); goto err; @@ -3290,8 +3290,8 @@ static EC_GROUP *ec_group_new_from_data(OPENSSL_CTX *libctx, return group; } -EC_GROUP *EC_GROUP_new_by_curve_name_with_libctx(OPENSSL_CTX *libctx, - const char *propq, int nid) +EC_GROUP *EC_GROUP_new_by_curve_name_ex(OPENSSL_CTX *libctx, const char *propq, + int nid) { EC_GROUP *ret = NULL; const ec_list_element *curve; @@ -3311,7 +3311,7 @@ EC_GROUP *EC_GROUP_new_by_curve_name_with_libctx(OPENSSL_CTX *libctx, #ifndef FIPS_MODULE EC_GROUP *EC_GROUP_new_by_curve_name(int nid) { - return EC_GROUP_new_by_curve_name_with_libctx(NULL, NULL, nid); + return EC_GROUP_new_by_curve_name_ex(NULL, NULL, nid); } #endif diff --git a/crypto/ec/ec_cvt.c b/crypto/ec/ec_cvt.c index e5e6f10ce4..57e53d752e 100644 --- a/crypto/ec/ec_cvt.c +++ b/crypto/ec/ec_cvt.c @@ -54,7 +54,7 @@ EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, meth = EC_GFp_mont_method(); #endif - ret = ec_group_new_with_libctx(bn_get_lib_ctx(ctx), NULL, meth); + ret = ec_group_new_ex(bn_get_lib_ctx(ctx), NULL, meth); if (ret == NULL) return NULL; @@ -75,7 +75,7 @@ EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, meth = EC_GF2m_simple_method(); - ret = ec_group_new_with_libctx(bn_get_lib_ctx(ctx), NULL, meth); + ret = ec_group_new_ex(bn_get_lib_ctx(ctx), NULL, meth); if (ret == NULL) return NULL; diff --git a/crypto/ec/ec_key.c b/crypto/ec/ec_key.c index 89a28622bb..807b5e670a 100644 --- a/crypto/ec/ec_key.c +++ b/crypto/ec/ec_key.c @@ -34,18 +34,18 @@ EC_KEY *EC_KEY_new(void) } #endif -EC_KEY *EC_KEY_new_with_libctx(OPENSSL_CTX *ctx, const char *propq) +EC_KEY *EC_KEY_new_ex(OPENSSL_CTX *ctx, const char *propq) { return ec_key_new_method_int(ctx, propq, NULL); } -EC_KEY *EC_KEY_new_by_curve_name_with_libctx(OPENSSL_CTX *ctx, - const char *propq, int nid) +EC_KEY *EC_KEY_new_by_curve_name_ex(OPENSSL_CTX *ctx, const char *propq, + int nid) { - EC_KEY *ret = EC_KEY_new_with_libctx(ctx, propq); + EC_KEY *ret = EC_KEY_new_ex(ctx, propq); if (ret == NULL) return NULL; - ret->group = EC_GROUP_new_by_curve_name_with_libctx(ctx, propq, nid); + ret->group = EC_GROUP_new_by_curve_name_ex(ctx, propq, nid); if (ret->group == NULL) { EC_KEY_free(ret); return NULL; @@ -61,7 +61,7 @@ EC_KEY *EC_KEY_new_by_curve_name_with_libctx(OPENSSL_CTX *ctx, #ifndef FIPS_MODULE EC_KEY *EC_KEY_new_by_curve_name(int nid) { - return EC_KEY_new_by_curve_name_with_libctx(NULL, NULL, nid); + return EC_KEY_new_by_curve_name_ex(NULL, NULL, nid); } #endif @@ -122,8 +122,7 @@ EC_KEY *EC_KEY_copy(EC_KEY *dest, const EC_KEY *src) if (src->group != NULL) { /* clear the old group */ EC_GROUP_free(dest->group); - dest->group = ec_group_new_with_libctx(src->libctx, src->propq, - src->group->meth); + dest->group = ec_group_new_ex(src->libctx, src->propq, src->group->meth); if (dest->group == NULL) return NULL; if (!EC_GROUP_copy(dest->group, src->group)) diff --git a/crypto/ec/ec_lib.c b/crypto/ec/ec_lib.c index 222df55632..72ada1f723 100644 --- a/crypto/ec/ec_lib.c +++ b/crypto/ec/ec_lib.c @@ -26,8 +26,8 @@ /* functions for EC_GROUP objects */ -EC_GROUP *ec_group_new_with_libctx(OPENSSL_CTX *libctx, const char *propq, - const EC_METHOD *meth) +EC_GROUP *ec_group_new_ex(OPENSSL_CTX *libctx, const char *propq, + const EC_METHOD *meth) { EC_GROUP *ret; @@ -81,7 +81,7 @@ EC_GROUP *ec_group_new_with_libctx(OPENSSL_CTX *libctx, const char *propq, # ifndef FIPS_MODULE EC_GROUP *EC_GROUP_new(const EC_METHOD *meth) { - return ec_group_new_with_libctx(NULL, NULL, meth); + return ec_group_new_ex(NULL, NULL, meth); } # endif #endif @@ -271,7 +271,7 @@ EC_GROUP *EC_GROUP_dup(const EC_GROUP *a) if (a == NULL) return NULL; - if ((t = ec_group_new_with_libctx(a->libctx, a->propq, a->meth)) == NULL) + if ((t = ec_group_new_ex(a->libctx, a->propq, a->meth)) == NULL) return NULL; if (!EC_GROUP_copy(t, a)) goto err; @@ -1438,8 +1438,7 @@ static EC_GROUP *ec_group_explicit_to_named(const EC_GROUP *group, curve_name_nid = NID_secp224r1; #endif /* !def(OPENSSL_NO_EC_NISTP_64_GCC_128) */ - ret_group = EC_GROUP_new_by_curve_name_with_libctx(libctx, propq, - curve_name_nid); + ret_group = EC_GROUP_new_by_curve_name_ex(libctx, propq, curve_name_nid); if (ret_group == NULL) goto err; @@ -1522,7 +1521,7 @@ static EC_GROUP *group_new_from_name(const OSSL_PARAM *p, ECerr(0, EC_R_INVALID_CURVE); return NULL; } else { - return EC_GROUP_new_by_curve_name_with_libctx(libctx, propq, nid); + return EC_GROUP_new_by_curve_name_ex(libctx, propq, nid); } } return NULL; diff --git a/crypto/ec/ec_local.h b/crypto/ec/ec_local.h index 11fab6b985..33f40167aa 100644 --- a/crypto/ec/ec_local.h +++ b/crypto/ec/ec_local.h @@ -601,8 +601,8 @@ int ec_group_simple_order_bits(const EC_GROUP *group); * \param meth EC_METHOD to use * \return newly created EC_GROUP object or NULL in case of an error. */ -EC_GROUP *ec_group_new_with_libctx(OPENSSL_CTX *libctx, const char *propq, - const EC_METHOD *meth); +EC_GROUP *ec_group_new_ex(OPENSSL_CTX *libctx, const char *propq, + const EC_METHOD *meth); #ifdef ECP_NISTZ256_ASM /** Returns GFp methods using montgomery multiplication, with x86-64 optimized diff --git a/crypto/ec/ecx_meth.c b/crypto/ec/ecx_meth.c index 99f1e480c1..9aab96a050 100644 --- a/crypto/ec/ecx_meth.c +++ b/crypto/ec/ecx_meth.c @@ -149,9 +149,8 @@ static int ecx_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b) return CRYPTO_memcmp(akey->pubkey, bkey->pubkey, KEYLEN(a)) == 0; } -static int ecx_priv_decode_with_libctx(EVP_PKEY *pkey, - const PKCS8_PRIV_KEY_INFO *p8, - OPENSSL_CTX *libctx, const char *propq) +static int ecx_priv_decode_ex(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8, + OPENSSL_CTX *libctx, const char *propq) { const unsigned char *p; int plen; @@ -505,7 +504,7 @@ const EVP_PKEY_ASN1_METHOD ecx25519_asn1_meth = { ecx_pkey_export_to, x25519_import_from, - ecx_priv_decode_with_libctx + ecx_priv_decode_ex }; static int x448_import_from(const OSSL_PARAM params[], void *vpctx) @@ -558,7 +557,7 @@ const EVP_PKEY_ASN1_METHOD ecx448_asn1_meth = { ecx_pkey_export_to, x448_import_from, - ecx_priv_decode_with_libctx + ecx_priv_decode_ex }; static int ecd_size25519(const EVP_PKEY *pkey) @@ -684,7 +683,7 @@ const EVP_PKEY_ASN1_METHOD ed25519_asn1_meth = { ecx_pkey_export_to, ed25519_import_from, - ecx_priv_decode_with_libctx + ecx_priv_decode_ex }; static int ed448_import_from(const OSSL_PARAM params[], void *vpctx) @@ -736,7 +735,7 @@ const EVP_PKEY_ASN1_METHOD ed448_asn1_meth = { ecx_pkey_export_to, ed448_import_from, - ecx_priv_decode_with_libctx + ecx_priv_decode_ex }; static int pkey_ecx_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c index fb29ab5f08..524d3ede8d 100644 --- a/crypto/evp/digest.c +++ b/crypto/evp/digest.c @@ -82,9 +82,8 @@ int EVP_MD_CTX_reset(EVP_MD_CTX *ctx) } #ifndef FIPS_MODULE -EVP_MD_CTX *evp_md_ctx_new_with_libctx(EVP_PKEY *pkey, - const ASN1_OCTET_STRING *id, - OPENSSL_CTX *libctx, const char *propq) +EVP_MD_CTX *evp_md_ctx_new_ex(EVP_PKEY *pkey, const ASN1_OCTET_STRING *id, + OPENSSL_CTX *libctx, const char *propq) { EVP_MD_CTX *ctx; EVP_PKEY_CTX *pctx = NULL; @@ -351,8 +350,8 @@ int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data, size_t count) * Prior to OpenSSL 3.0 EVP_DigestSignUpdate() and * EVP_DigestVerifyUpdate() were just macros for EVP_DigestUpdate(). * Some code calls EVP_DigestUpdate() directly even when initialised - * with EVP_DigestSignInit_with_libctx() or - * EVP_DigestVerifyInit_with_libctx(), so we detect that and redirect to + * with EVP_DigestSignInit_ex() or + * EVP_DigestVerifyInit_ex(), so we detect that and redirect to * the correct EVP_Digest*Update() function */ if (ctx->pctx->operation == EVP_PKEY_OP_SIGNCTX) diff --git a/crypto/evp/evp_pkey.c b/crypto/evp/evp_pkey.c index 45666a2c42..b9fabf29f0 100644 --- a/crypto/evp/evp_pkey.c +++ b/crypto/evp/evp_pkey.c @@ -18,8 +18,8 @@ /* Extract a private key from a PKCS8 structure */ -EVP_PKEY *EVP_PKCS82PKEY_with_libctx(const PKCS8_PRIV_KEY_INFO *p8, - OPENSSL_CTX *libctx, const char *propq) +EVP_PKEY *EVP_PKCS82PKEY_ex(const PKCS8_PRIV_KEY_INFO *p8, OPENSSL_CTX *libctx, + const char *propq) { EVP_PKEY *pkey = NULL; const ASN1_OBJECT *algoid; @@ -40,8 +40,8 @@ EVP_PKEY *EVP_PKCS82PKEY_with_libctx(const PKCS8_PRIV_KEY_INFO *p8, goto error; } - if (pkey->ameth->priv_decode_with_libctx != NULL) { - if (!pkey->ameth->priv_decode_with_libctx(pkey, p8, libctx, propq)) + if (pkey->ameth->priv_decode_ex != NULL) { + if (!pkey->ameth->priv_decode_ex(pkey, p8, libctx, propq)) goto error; } else if (pkey->ameth->priv_decode != NULL) { if (!pkey->ameth->priv_decode(pkey, p8)) { @@ -62,7 +62,7 @@ EVP_PKEY *EVP_PKCS82PKEY_with_libctx(const PKCS8_PRIV_KEY_INFO *p8, EVP_PKEY *EVP_PKCS82PKEY(const PKCS8_PRIV_KEY_INFO *p8) { - return EVP_PKCS82PKEY_with_libctx(p8, NULL, NULL); + return EVP_PKCS82PKEY_ex(p8, NULL, NULL); } /* Turn a private key into a PKCS8 structure */ diff --git a/crypto/evp/m_sigver.c b/crypto/evp/m_sigver.c index e83a7e654a..faf5191234 100644 --- a/crypto/evp/m_sigver.c +++ b/crypto/evp/m_sigver.c @@ -310,10 +310,9 @@ static int do_sigver_init(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, return ret > 0 ? 1 : 0; } -int EVP_DigestSignInit_with_libctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, - const char *mdname, - OPENSSL_CTX *libctx, const char *props, - EVP_PKEY *pkey) +int EVP_DigestSignInit_ex(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, + const char *mdname, OPENSSL_CTX *libctx, + const char *props, EVP_PKEY *pkey) { return do_sigver_init(ctx, pctx, NULL, mdname, libctx, props, NULL, pkey, 0); } @@ -324,10 +323,9 @@ int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, return do_sigver_init(ctx, pctx, type, NULL, NULL, NULL, e, pkey, 0); } -int EVP_DigestVerifyInit_with_libctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, - const char *mdname, - OPENSSL_CTX *libctx, const char *props, - EVP_PKEY *pkey) +int EVP_DigestVerifyInit_ex(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, + const char *mdname, OPENSSL_CTX *libctx, + const char *props, EVP_PKEY *pkey) { return do_sigver_init(ctx, pctx, NULL, mdname, libctx, props, NULL, pkey, 1); } diff --git a/crypto/evp/p5_crpt2.c b/crypto/evp/p5_crpt2.c index 7b8f99d511..b827899445 100644 --- a/crypto/evp/p5_crpt2.c +++ b/crypto/evp/p5_crpt2.c @@ -19,11 +19,10 @@ #include "crypto/evp.h" #include "evp_local.h" -int pkcs5_pbkdf2_hmac_with_libctx(const char *pass, int passlen, - const unsigned char *salt, int saltlen, - int iter, const EVP_MD *digest, int keylen, - unsigned char *out, - OPENSSL_CTX *libctx, const char *propq) +int pkcs5_pbkdf2_hmac_ex(const char *pass, int passlen, + const unsigned char *salt, int saltlen, int iter, + const EVP_MD *digest, int keylen, unsigned char *out, + OPENSSL_CTX *libctx, const char *propq) { const char *empty = ""; int rv = 1, mode = 1; @@ -84,8 +83,8 @@ int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, const unsigned char *salt, int saltlen, int iter, const EVP_MD *digest, int keylen, unsigned char *out) { - return pkcs5_pbkdf2_hmac_with_libctx(pass, passlen, salt, saltlen, iter, - digest, keylen, out, NULL, NULL); + return pkcs5_pbkdf2_hmac_ex(pass, passlen, salt, saltlen, iter, digest, + keylen, out, NULL, NULL); } diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c index f3ada343fc..e3a885cd7a 100644 --- a/crypto/evp/p_lib.c +++ b/crypto/evp/p_lib.c @@ -450,11 +450,10 @@ static EVP_PKEY *new_raw_key_int(OPENSSL_CTX *libctx, return pkey; } -EVP_PKEY *EVP_PKEY_new_raw_private_key_with_libctx(OPENSSL_CTX *libctx, - const char *keytype, - const char *propq, - const unsigned char *priv, - size_t len) +EVP_PKEY *EVP_PKEY_new_raw_private_key_ex(OPENSSL_CTX *libctx, + const char *keytype, + const char *propq, + const unsigned char *priv, size_t len) { return new_raw_key_int(libctx, keytype, propq, EVP_PKEY_NONE, NULL, priv, len, 1); @@ -467,11 +466,9 @@ EVP_PKEY *EVP_PKEY_new_raw_private_key(int type, ENGINE *e, return new_raw_key_int(NULL, NULL, NULL, type, e, priv, len, 1); } -EVP_PKEY *EVP_PKEY_new_raw_public_key_with_libctx(OPENSSL_CTX *libctx, - const char *keytype, - const char *propq, - const unsigned char *pub, - size_t len) +EVP_PKEY *EVP_PKEY_new_raw_public_key_ex(OPENSSL_CTX *libctx, + const char *keytype, const char *propq, + const unsigned char *pub, size_t len) { return new_raw_key_int(libctx, keytype, propq, EVP_PKEY_NONE, NULL, pub, len, 0); @@ -636,11 +633,9 @@ static EVP_PKEY *new_cmac_key_int(const unsigned char *priv, size_t len, # endif } -EVP_PKEY *EVP_PKEY_new_CMAC_key_with_libctx(const unsigned char *priv, - size_t len, - const char *cipher_name, - OPENSSL_CTX *libctx, - const char *propq) +EVP_PKEY *EVP_PKEY_new_CMAC_key_ex(const unsigned char *priv, size_t len, + const char *cipher_name, OPENSSL_CTX *libctx, + const char *propq) { return new_cmac_key_int(priv, len, cipher_name, NULL, libctx, propq, NULL); } diff --git a/crypto/evp/p_sign.c b/crypto/evp/p_sign.c index 2c4f49a528..f530091a3e 100644 --- a/crypto/evp/p_sign.c +++ b/crypto/evp/p_sign.c @@ -14,9 +14,9 @@ #include <openssl/x509.h> #include "crypto/evp.h" -int EVP_SignFinal_with_libctx(EVP_MD_CTX *ctx, unsigned char *sigret, - unsigned int *siglen, EVP_PKEY *pkey, - OPENSSL_CTX *libctx, const char *propq) +int EVP_SignFinal_ex(EVP_MD_CTX *ctx, unsigned char *sigret, + unsigned int *siglen, EVP_PKEY *pkey, OPENSSL_CTX *libctx, + const char *propq) { unsigned char m[EVP_MAX_MD_SIZE]; unsigned int m_len = 0; @@ -65,5 +65,5 @@ int EVP_SignFinal_with_libctx(EVP_MD_CTX *ctx, unsigned char *sigret, int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen, EVP_PKEY *pkey) { - return EVP_SignFinal_with_libctx(ctx, sigret, siglen, pkey, NULL, NULL); + return EVP_SignFinal_ex(ctx, sigret, siglen, pkey, NULL, NULL); } diff --git a/crypto/evp/p_verify.c b/crypto/evp/p_verify.c index db14866af0..dc1ee84c15 100644 --- a/crypto/evp/p_verify.c +++ b/crypto/evp/p_verify.c @@ -14,9 +14,9 @@ #include <openssl/x509.h> #include "crypto/evp.h" -int EVP_VerifyFinal_with_libctx(EVP_MD_CTX *ctx, const unsigned char *sigbuf, - unsigned int siglen, EVP_PKEY *pkey, - OPENSSL_CTX *libctx, const char *propq) +int EVP_VerifyFinal_ex(EVP_MD_CTX *ctx, const unsigned char *sigbuf, + unsigned int siglen, EVP_PKEY *pkey, OPENSSL_CTX *libctx, + const char *propq) { unsigned char m[EVP_MAX_MD_SIZE]; unsigned int m_len = 0; @@ -59,5 +59,5 @@ int EVP_VerifyFinal_with_libctx(EVP_MD_CTX *ctx, const unsigned char *sigbuf, int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, unsigned int siglen, EVP_PKEY *pkey) { - return EVP_VerifyFinal_with_libctx(ctx, sigbuf, siglen, pkey, NULL, NULL); + return EVP_VerifyFinal_ex(ctx, sigbuf, siglen, pkey, NULL, NULL); } diff --git a/crypto/pem/pem_info.c b/crypto/pem/pem_info.c index ef023205c0..57e02e9db3 100644 --- a/crypto/pem/pem_info.c +++ b/crypto/pem/pem_info.c @@ -25,9 +25,8 @@ #ifndef OPENSSL_NO_STDIO STACK_OF(X509_INFO) -*PEM_X509_INFO_read_with_libctx(FILE *fp, STACK_OF(X509_INFO) *sk, - pem_password_cb *cb, void *u, - OPENSSL_CTX *libctx, const char *propq) +*PEM_X509_INFO_read_ex(FILE *fp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, + void *u, OPENSSL_CTX *libctx, const char *propq) { BIO *b; STACK_OF(X509_INFO) *ret; @@ -37,7 +36,7 @@ STACK_OF(X509_INFO) return 0; } BIO_set_fp(b, fp, BIO_NOCLOSE); - ret = PEM_X509_INFO_read_bio_with_libctx(b, sk, cb, u, libctx, propq); + ret = PEM_X509_INFO_read_bio_ex(b, sk, cb, u, libctx, propq); BIO_free(b); return ret; } @@ -45,14 +44,14 @@ STACK_OF(X509_INFO) STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u) { - return PEM_X509_INFO_read_with_libctx(fp, sk, cb, u, NULL, NULL); + return PEM_X509_INFO_read_ex(fp, sk, cb, u, NULL, NULL); } #endif STACK_OF(X509_INFO) -*PEM_X509_INFO_read_bio_with_libctx(BIO *bp, STACK_OF(X509_INFO) *sk, - pem_password_cb *cb, void *u, - OPENSSL_CTX *libctx, const char *propq) +*PEM_X509_INFO_read_bio_ex(BIO *bp, STACK_OF(X509_INFO) *sk, + pem_password_cb *cb, void *u, OPENSSL_CTX *libctx, + const char *propq) { X509_INFO *xi = NULL; char *name = NULL, *header = NULL; @@ -98,7 +97,7 @@ STACK_OF(X509_INFO) goto err; goto start; } - xi->x509 = X509_new_with_libctx(libctx, propq); + xi->x509 = X509_new_ex(libctx, propq); if (xi->x509 == NULL) goto err; pp = &(xi->x509); @@ -111,7 +110,7 @@ STACK_OF(X509_INFO) goto err; goto start; } - xi->x509 = X509_new_with_libctx(libctx, propq); + xi->x509 = X509_new_ex(libctx, propq); if (xi->x509 == NULL) goto err; pp = &(xi->x509); @@ -268,7 +267,7 @@ STACK_OF(X509_INFO) STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u) { - return PEM_X509_INFO_read_bio_with_libctx(bp, sk, cb, u, NULL, NULL); + return PEM_X509_INFO_read_bio_ex(bp, sk, cb, u, NULL, NULL); } /* A TJH addition */ diff --git a/crypto/pkcs7/pk7_asn1.c b/crypto/pkcs7/pk7_asn1.c index f04e4b34ce..b0027cec2d 100644 --- a/crypto/pkcs7/pk7_asn1.c +++ b/crypto/pkcs7/pk7_asn1.c @@ -83,7 +83,7 @@ PKCS7 *PKCS7_new(void) return (PKCS7 *)ASN1_item_new(ASN1_ITEM_rptr(PKCS7)); } -PKCS7 *PKCS7_new_with_libctx(OPENSSL_CTX *libctx, const char *propq) +PKCS7 *PKCS7_new_ex(OPENSSL_CTX *libctx, const char *propq) { PKCS7 *pkcs7 = PKCS7_new(); diff --git a/crypto/pkcs7/pk7_doit.c b/crypto/pkcs7/pk7_doit.c index bc9bfd8589..cde158d56a 100644 --- a/crypto/pkcs7/pk7_doit.c +++ b/crypto/pkcs7/pk7_doit.c @@ -847,8 +847,8 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) if (abuf == NULL) goto err; - if (!EVP_SignFinal_with_libctx(ctx_tmp, abuf, &abuflen, si->pkey, - p7_ctx->libctx, p7_ctx->propq)) { + if (!EVP_SignFinal_ex(ctx_tmp, abuf, &abuflen, si->pkey, + p7_ctx->libctx, p7_ctx->propq)) { OPENSSL_free(abuf); PKCS7err(PKCS7_F_PKCS7_DATAFINAL, ERR_R_EVP_LIB); goto err; @@ -919,9 +919,8 @@ int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si) goto err; } - if (EVP_DigestSignInit_with_libctx(mctx, &pctx, - EVP_MD_name(md), ctx->libctx, ctx->propq, - si->pkey) <= 0) + if (EVP_DigestSignInit_ex(mctx, &pctx, EVP_MD_name(md), ctx->libctx, + ctx->propq, si->pkey) <= 0) goto err; /* @@ -1171,8 +1170,8 @@ int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si, goto err; } - i = EVP_VerifyFinal_with_libctx(mdc_tmp, os->data, os->length, pkey, - ctx->libctx, ctx->propq); + i = EVP_VerifyFinal_ex(mdc_tmp, os->data, os->length, pkey, ctx->libctx, + ctx->propq); if (i <= 0) { PKCS7err(PKCS7_F_PKCS7_SIGNATUREVERIFY, PKCS7_R_SIGNATURE_FAILURE); ret = -1; diff --git a/crypto/pkcs7/pk7_mime.c b/crypto/pkcs7/pk7_mime.c index 2099e8d9ef..c505b23648 100644 --- a/crypto/pkcs7/pk7_mime.c +++ b/crypto/pkcs7/pk7_mime.c @@ -40,11 +40,10 @@ int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags) flags ^= SMIME_OLDMIME; - return SMIME_write_ASN1_with_libctx(bio, (ASN1_VALUE *)p7, data, flags, - ctype_nid, NID_undef, mdalgs, - ASN1_ITEM_rptr(PKCS7), - pkcs7_ctx_get0_libctx(ctx), - pkcs7_ctx_get0_propq(ctx)); + return SMIME_write_ASN1_ex(bio, (ASN1_VALUE *)p7, data, flags, ctype_nid, + NID_undef, mdalgs, ASN1_ITEM_rptr(PKCS7), + pkcs7_ctx_get0_libctx(ctx), + pkcs7_ctx_get0_propq(ctx)); } PKCS7 *SMIME_read_PKCS7_ex(BIO *bio, BIO **bcont, PKCS7 **p7) diff --git a/crypto/pkcs7/pk7_smime.c b/crypto/pkcs7/pk7_smime.c index 3347544bb8..5cbc18c63e 100644 --- a/crypto/pkcs7/pk7_smime.c +++ b/crypto/pkcs7/pk7_smime.c @@ -20,14 +20,14 @@ static int pkcs7_copy_existing_digest(PKCS7 *p7, PKCS7_SIGNER_INFO *si); -PKCS7 *PKCS7_sign_with_libctx(X509 *signcert, EVP_PKEY *pkey, - STACK_OF(X509) *certs, BIO *data, int flags, - OPENSSL_CTX *libctx, const char *propq) +PKCS7 *PKCS7_sign_ex(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, + BIO *data, int flags, OPENSSL_CTX *libctx, + const char *propq) { PKCS7 *p7; int i; - if ((p7 = PKCS7_new_with_libctx(libctx, propq)) == NULL) { + if ((p7 = PKCS7_new_ex(libctx, propq)) == NULL) { PKCS7err(0, ERR_R_MALLOC_FAILURE); return NULL; } @@ -67,7 +67,7 @@ PKCS7 *PKCS7_sign_with_libctx(X509 *signcert, EVP_PKEY *pkey, PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, BIO *data, int flags) { - return PKCS7_sign_with_libctx(signcert, pkey, certs, data, flags, NULL, NULL); + return PKCS7_sign_ex(signcert, pkey, certs, data, flags, NULL, NULL); } @@ -268,7 +268,7 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, /* Now verify the certificates */ p7_ctx = pkcs7_get0_ctx(p7); - cert_ctx = X509_STORE_CTX_new_with_libctx(p7_ctx->libctx, p7_ctx->propq); + cert_ctx = X509_STORE_CTX_new_ex(p7_ctx->libctx, p7_ctx->propq); if (cert_ctx == NULL) goto err; if (!(flags & PKCS7_NOVERIFY)) @@ -443,16 +443,16 @@ STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, /* Build a complete PKCS#7 enveloped data */ -PKCS7 *PKCS7_encrypt_with_libctx(STACK_OF(X509) *certs, BIO *in, - const EVP_CIPHER *cipher, int flags, - OPENSSL_CTX *libctx, const char *propq) +PKCS7 *PKCS7_encrypt_ex(STACK_OF(X509) *certs, BIO *in, + const EVP_CIPHER *cipher, int flags, + OPENSSL_CTX *libctx, const char *propq) { PKCS7 *p7; BIO *p7bio = NULL; int i; X509 *x509; - if ((p7 = PKCS7_new_with_libctx(libctx, propq)) == NULL) { + if ((p7 = PKCS7_new_ex(libctx, propq)) == NULL) { PKCS7err(0, ERR_R_MALLOC_FAILURE); return NULL; } @@ -489,7 +489,7 @@ PKCS7 *PKCS7_encrypt_with_libctx(STACK_OF(X509) *certs, BIO *in, PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher, int flags) { - return PKCS7_encrypt_with_libctx(certs, in, cipher, flags, NULL, NULL); + return PKCS7_encrypt_ex(certs, in, cipher, flags, NULL, NULL); } diff --git a/crypto/rsa/rsa_local.h b/crypto/rsa/rsa_local.h index 666e18ec65..cc03132d17 100644 --- a/crypto/rsa/rsa_local.h +++ b/crypto/rsa/rsa_local.h @@ -196,12 +196,10 @@ int rsa_fips186_4_gen_prob_primes(RSA *rsa, RSA_ACVP_TEST *test, int nbits, const BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb); -int rsa_padding_add_SSLv23_with_libctx(OPENSSL_CTX *libctx, unsigned char *to, - int tlen, const unsigned char *from, - int flen); -int rsa_padding_add_PKCS1_type_2_with_libctx(OPENSSL_CTX *libctx, - unsigned char *to, int tlen, - const unsigned char *from, - int flen); +int rsa_padding_add_SSLv23_ex(OPENSSL_CTX *libctx, unsigned char *to, int tlen, + const unsigned char *from, int flen); +int rsa_padding_add_PKCS1_type_2_ex(OPENSSL_CTX *libctx, unsigned char *to, + int tlen, const unsigned char *from, + int flen); #endif /* OSSL_CRYPTO_RSA_LOCAL_H */ diff --git a/crypto/rsa/rsa_oaep.c b/crypto/rsa/rsa_oaep.c index ce98802070..ea9ce0dee4 100644 --- a/crypto/rsa/rsa_oaep.c +++ b/crypto/rsa/rsa_oaep.c @@ -40,9 +40,8 @@ int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, const unsigned char *from, int flen, const unsigned char *param, int plen) { - return rsa_padding_add_PKCS1_OAEP_mgf1_with_libctx(NULL, to, tlen, from, - flen, param, plen, NULL, - NULL); + return rsa_padding_add_PKCS1_OAEP_mgf1_ex(NULL, to, tlen, from, flen, param, + plen, NULL, NULL); } /* @@ -52,13 +51,11 @@ int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, * Step numbers are included here but not in the constant time inverse below * to avoid complicating an already difficult enough function. */ -int rsa_padding_add_PKCS1_OAEP_mgf1_with_libctx(OPENSSL_CTX *libctx, - unsigned char *to, int tlen, - const unsigned char *from, - int flen, - const unsigned char *param, - int plen, const EVP_MD *md, - const EVP_MD *mgf1md) +int rsa_padding_add_PKCS1_OAEP_mgf1_ex(OPENSSL_CTX *libctx, unsigned char *to, + int tlen, const unsigned char *from, + int flen, const unsigned char *param, + int plen, const EVP_MD *md, + const EVP_MD *mgf1md) { int rv = 0; int i, emlen = tlen - 1; @@ -141,9 +138,8 @@ int RSA_padding_add_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, const unsigned char *param, int plen, const EVP_MD *md, const EVP_MD *mgf1md) { - return rsa_padding_add_PKCS1_OAEP_mgf1_with_libctx(NULL, to, tlen, from, - flen, param, plen, md, - mgf1md); + return rsa_padding_add_PKCS1_OAEP_mgf1_ex(NULL, to, tlen, from, flen, param, + plen, md, mgf1md); } int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, diff --git a/crypto/rsa/rsa_ossl.c b/crypto/rsa/rsa_ossl.c index b996e4d05e..d1e8535226 100644 --- a/crypto/rsa/rsa_ossl.c +++ b/crypto/rsa/rsa_ossl.c @@ -111,18 +111,15 @@ static int rsa_ossl_public_encrypt(int flen, const unsigned char *from, switch (padding) { case RSA_PKCS1_PADDING: - i = rsa_padding_add_PKCS1_type_2_with_libctx(rsa->libctx, buf, num, - from, flen); + i = rsa_padding_add_PKCS1_type_2_ex(rsa->libctx, buf, num, from, flen); break; case RSA_PKCS1_OAEP_PADDING: - i = rsa_padding_add_PKCS1_OAEP_mgf1_with_libctx(rsa->libctx, buf, num, - from, flen, NULL, 0, - NULL, NULL); + i = rsa_padding_add_PKCS1_OAEP_mgf1_ex(rsa->libctx, buf, num, from, + flen, NULL, 0, NULL, NULL); break; #ifndef FIPS_MODULE case RSA_SSLV23_PADDING: - i = rsa_padding_add_SSLv23_with_libctx(rsa->libctx, buf, num, from, - flen); + i = rsa_padding_add_SSLv23_ex(rsa->libctx, buf, num, from, flen); break; #endif case RSA_NO_PADDING: diff --git a/crypto/rsa/rsa_pk1.c b/crypto/rsa/rsa_pk1.c index b594534563..05c2933407 100644 --- a/crypto/rsa/rsa_pk1.c +++ b/crypto/rsa/rsa_pk1.c @@ -124,10 +124,9 @@ int RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen, return j; } -int rsa_padding_add_PKCS1_type_2_with_libctx(OPENSSL_CTX *libctx, - unsigned char *to, int tlen, - const unsigned char *from, - int flen) +int rsa_padding_add_PKCS1_type_2_ex(OPENSSL_CTX *libctx, unsigned char *to, + int tlen, const unsigned char *from, + int flen) { int i, j; unsigned char *p; @@ -165,7 +164,7 @@ int rsa_padding_add_PKCS1_type_2_with_libctx(OPENSSL_CTX *libctx, int RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen, const unsigned char *from, int flen) { - return rsa_padding_add_PKCS1_type_2_with_libctx(NULL, to, tlen, from, flen); + return rsa_padding_add_PKCS1_type_2_ex(NULL, to, tlen, from, flen); } int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen, diff --git a/crypto/rsa/rsa_ssl.c b/crypto/rsa/rsa_ssl.c index 1cca8d0b09..3565b8c8d6 100644 --- a/crypto/rsa/rsa_ssl.c +++ b/crypto/rsa/rsa_ssl.c @@ -21,9 +21,8 @@ #include "internal/constant_time.h" #include "rsa_local.h" -int rsa_padding_add_SSLv23_with_libctx(OPENSSL_CTX *libctx, unsigned char *to, - int tlen, const unsigned char *from, - int flen) +int rsa_padding_add_SSLv23_ex(OPENSSL_CTX *libctx, unsigned char *to, int tlen, + const unsigned char *from, int flen) { int i, j; unsigned char *p; @@ -63,7 +62,7 @@ int rsa_padding_add_SSLv23_with_libctx(OPENSSL_CTX *libctx, unsigned char *to, int RSA_padding_add_SSLv23(unsigned char *to, int tlen, const unsigned char *from, int flen) { - return rsa_padding_add_SSLv23_with_libctx(NULL, to, tlen, from, flen); + return rsa_padding_add_SSLv23_ex(NULL, to, tlen, from, flen); } /* diff --git a/crypto/store/store_lib.c b/crypto/store/store_lib.c index 0f686fb119..94f47d0394 100644 --- a/crypto/store/store_lib.c +++ b/crypto/store/store_lib.c @@ -32,11 +32,10 @@ static int ossl_store_close_it(OSSL_STORE_CTX *ctx); OSSL_STORE_CTX * -OSSL_STORE_open_with_libctx(const char *uri, - OPENSSL_CTX *libctx, const char *propq, - const UI_METHOD *ui_method, void *ui_data, - OSSL_STORE_post_process_info_fn post_process, - void *post_process_data) +OSSL_STORE_open_ex(const char *uri, OPENSSL_CTX *libctx, const char *propq, + const UI_METHOD *ui_method, void *ui_data, + OSSL_STORE_post_process_info_fn post_process, + void *post_process_data) { const OSSL_STORE_LOADER *loader = NULL; OSSL_STORE_LOADER *fetched_loader = NULL; @@ -85,9 +84,9 @@ OSSL_STORE_open_with_libctx(const char *uri, OSSL_TRACE1(STORE, "Looking up scheme %s\n", schemes[i]); #ifndef OPENSSL_NO_DEPRECATED_3_0 if ((loader = ossl_store_get0_loader_int(schemes[i])) != NULL) { - if (loader->open_with_libctx != NULL) - loader_ctx = loader->open_with_libctx(loader, uri, libctx, propq, - ui_method, ui_data); + if (loader->open_ex != NULL) + loader_ctx = loader->open_ex(loader, uri, libctx, propq, + ui_method, ui_data); else loader_ctx = loader->open(loader, uri, ui_method, ui_data); } @@ -187,8 +186,8 @@ OSSL_STORE_CTX *OSSL_STORE_open(const char *uri, OSSL_STORE_post_process_info_fn post_process, void *post_process_data) { - return OSSL_STORE_open_with_libctx(uri, NULL, NULL, ui_method, ui_data, - post_process, post_process_data); + return OSSL_STORE_open_ex(uri, NULL, NULL, ui_method, ui_data, post_process, + post_process_data); } #ifndef OPENSSL_NO_DEPRECATED_3_0 diff --git a/crypto/store/store_local.h b/crypto/store/store_local.h index ef9815fa69..e5488606e4 100644 --- a/crypto/store/store_local.h +++ b/crypto/store/store_local.h @@ -93,7 +93,7 @@ struct ossl_store_loader_st { OSSL_STORE_eof_fn eof; OSSL_STORE_error_fn error; OSSL_STORE_close_fn close; - OSSL_STORE_open_with_libctx_fn open_with_libctx; + OSSL_STORE_open_ex_fn open_ex; #endif /* Provider stuff */ diff --git a/crypto/store/store_register.c b/crypto/store/store_register.c index 7bc233ca9d..f426a82ecc 100644 --- a/crypto/store/store_register.c +++ b/crypto/store/store_register.c @@ -70,11 +70,11 @@ int OSSL_STORE_LOADER_set_open(OSSL_STORE_LOADER *loader, return 1; } -int OSSL_STORE_LOADER_set_open_with_libctx +int OSSL_STORE_LOADER_set_open_ex (OSSL_STORE_LOADER *loader, - OSSL_STORE_open_with_libctx_fn open_with_libctx_function) + OSSL_STORE_open_ex_fn open_ex_function) { - loader->open_with_libctx = open_with_libctx_function; + loader->open_ex = open_ex_function; return 1; } @@ -222,7 +222,7 @@ const OSSL_STORE_LOADER *ossl_store_get0_loader_int(const char *scheme) template.load = NULL; template.eof = NULL; template.close = NULL; - template.open_with_libctx = NULL; + template.open_ex = NULL; if (!ossl_store_init_once()) return NULL; diff --git a/crypto/store/store_result.c b/crypto/store/store_result.c index 363d25adbf..a591ef23ec 100644 --- a/crypto/store/store_result.c +++ b/crypto/store/store_result.c @@ -335,7 +335,7 @@ static EVP_PKEY *try_key_value_legacy(struct extracted_param_data_st *data, p8info = d2i_PKCS8_PRIV_KEY_INFO(NULL, &derp, der_len); RESET_ERR_MARK(); if (p8info != NULL) { - pk = EVP_PKCS82PKEY_with_libctx(p8info, libctx, propq); + pk = EVP_PKCS82PKEY_ex(p8info, libctx, propq); PKCS8_PRIV_KEY_INFO_free(p8info); } } diff --git a/crypto/trace.c b/crypto/trace.c index a8316c12b1..a8316c12b1 100755..100644 --- a/crypto/trace.c +++ b/crypto/trace.c diff --git a/crypto/x509/by_dir.c b/crypto/x509/by_dir.c index da04daf902..dd278981ef 100644 --- a/crypto/x509/by_dir.c +++ b/crypto/x509/by_dir.c @@ -47,12 +47,9 @@ static void free_dir(X509_LOOKUP *lu); static int add_cert_dir(BY_DIR *ctx, const char *dir, int type); static int get_cert_by_subject(X509_LOOKUP *xl, X509_LOOKUP_TYPE type, const X509_NAME *name, X509_OBJECT *ret); -static int get_cert_by_subject_with_libctx(X509_LOOKUP *xl, - X509_LOOKUP_TYPE type, - const X509_NAME *name, - X509_OBJECT *ret, - OPENSSL_CTX *libctx, - const char *propq); +static int get_cert_by_subject_ex(X509_LOOKUP *xl, X509_LOOKUP_TYPE type, + const X509_NAME *name, X509_OBJECT *ret, + OPENSSL_CTX *libctx, const char *propq); static X509_LOOKUP_METHOD x509_dir_lookup = { "Load certs from files in a directory", new_dir, /* new_item */ @@ -64,8 +61,8 @@ static X509_LOOKUP_METHOD x509_dir_lookup = { NULL, /* get_by_issuer_serial */ NULL, /* get_by_fingerprint */ NULL, /* get_by_alias */ - get_cert_by_subject_with_libctx, /* get_by_subject_with_libctx */ - NULL, /* ctrl_with_libctx */ + get_cert_by_subject_ex, /* get_by_subject_ex */ + NULL, /* ctrl_ex */ }; X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void) @@ -217,12 +214,9 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type) return 1; } -static int get_cert_by_subject_with_libctx(X509_LOOKUP *xl, - X509_LOOKUP_TYPE type, - const X509_NAME *name, - X509_OBJECT *ret, - OPENSSL_CTX *libctx, - const char *propq) +static int get_cert_by_subject_ex(X509_LOOKUP *xl, X509_LOOKUP_TYPE type, + const X509_NAME *name, X509_OBJECT *ret, + OPENSSL_CTX *libctx, const char *propq) { BY_DIR *ctx; union { @@ -327,8 +321,8 @@ static int get_cert_by_subject_with_libctx(X509_LOOKUP *xl, #endif /* found one. */ if (type == X509_LU_X509) { - if ((X509_load_cert_file_with_libctx(xl, b->data, ent->dir_type, - libctx, propq)) == 0) + if ((X509_load_cert_file_ex(xl, b->data, ent->dir_type, libctx, + propq)) == 0) break; } else if (type == X509_LU_CRL) { if ((X509_load_crl_file(xl, b->data, ent->dir_type)) == 0) @@ -406,5 +400,5 @@ static int get_cert_by_subject_with_libctx(X509_LOOKUP *xl, static int get_cert_by_subject(X509_LOOKUP *xl, X509_LOOKUP_TYPE type, const X509_NAME *name, X509_OBJECT *ret) { - return get_cert_by_subject_with_libctx(xl, type, name, ret, NULL, NULL); + return get_cert_by_subject_ex(xl, type, name, ret, NULL, NULL); } diff --git a/crypto/x509/by_file.c b/crypto/x509/by_file.c index a4ec328312..95223ea2af 100644 --- a/crypto/x509/by_file.c +++ b/crypto/x509/by_file.c @@ -19,9 +19,9 @@ static int by_file_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, long argl, char **ret); -static int by_file_ctrl_with_libctx(X509_LOOKUP *ctx, int cmd, - const char *argc, long argl, char **ret, - OPENSSL_CTX *libctx, const char *propq); +static int by_file_ctrl_ex(X509_LOOKUP *ctx, int cmd, const char *argc, + long argl, char **ret, OPENSSL_CTX *libctx, + const char *propq); static X509_LOOKUP_METHOD x509_file_lookup = { @@ -35,8 +35,8 @@ static X509_LOOKUP_METHOD x509_file_lookup = { NULL, /* get_by_issuer_serial */ NULL, /* get_by_fingerprint */ NULL, /* get_by_alias */ - NULL, /* get_by_subject_with_libctx */ - by_file_ctrl_with_libctx, /* ctrl_with_libctx */ + NULL, /* get_by_subject_ex */ + by_file_ctrl_ex, /* ctrl_ex */ }; X509_LOOKUP_METHOD *X509_LOOKUP_file(void) @@ -44,9 +44,9 @@ X509_LOOKUP_METHOD *X509_LOOKUP_file(void) return &x509_file_lookup; } -static int by_file_ctrl_with_libctx(X509_LOOKUP *ctx, int cmd, - const char *argp, long argl, char **ret, - OPENSSL_CTX *libctx, const char *propq) +static int by_file_ctrl_ex(X509_LOOKUP *ctx, int cmd, const char *argp, + long argl, char **ret, OPENSSL_CTX *libctx, + const char *propq) { int ok = 0; const char *file; @@ -56,12 +56,11 @@ static int by_file_ctrl_with_libctx(X509_LOOKUP *ctx, int cmd, if (argl == X509_FILETYPE_DEFAULT) { file = ossl_safe_getenv(X509_get_default_cert_file_env()); if (file) - ok = (X509_load_cert_crl_file_with_libctx(ctx, file, - X509_FILETYPE_PEM, - libctx, propq) != 0); + ok = (X509_load_cert_crl_file_ex(ctx, file, X509_FILETYPE_PEM, + libctx, propq) != 0); else - ok = (X509_load_cert_crl_file_with_libctx( + ok = (X509_load_cert_crl_file_ex( ctx, X509_get_default_cert_file(), X509_FILETYPE_PEM, libctx, propq) != 0); @@ -70,12 +69,11 @@ static int by_file_ctrl_with_libctx(X509_LOOKUP *ctx, int cmd, } } else { if (argl == X509_FILETYPE_PEM) - ok = (X509_load_cert_crl_file_with_libctx(ctx, argp, - X509_FILETYPE_PEM, - libctx, propq) != 0); + ok = (X509_load_cert_crl_file_ex(ctx, argp, X509_FILETYPE_PEM, + libctx, propq) != 0); else - ok = (X509_load_cert_file_with_libctx(ctx, argp, (int)argl, - libctx, propq) != 0); + ok = (X509_load_cert_file_ex(ctx, argp, (int)argl, libctx, + propq) != 0); } break; } @@ -85,11 +83,11 @@ static int by_file_ctrl_with_libctx(X509_LOOKUP *ctx, int cmd, static int by_file_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, long argl, char **ret) { - return by_file_ctrl_with_libctx(ctx, cmd, argp, argl, ret, NULL, NULL); + return by_file_ctrl_ex(ctx, cmd, argp, argl, ret, NULL, NULL); } -int X509_load_cert_file_with_libctx(X509_LOOKUP *ctx, const char *file, int type, - OPENSSL_CTX *libctx, const char *propq) +int X509_load_cert_file_ex(X509_LOOKUP *ctx, const char *file, int type, + OPENSSL_CTX *libctx, const char *propq) { int ret = 0; BIO *in = NULL; @@ -107,7 +105,7 @@ int X509_load_cert_file_with_libctx(X509_LOOKUP *ctx, const char *file, int type X509err(0, X509_R_BAD_X509_FILETYPE); goto err; } - x = X509_new_with_libctx(libctx, propq); + x = X509_new_ex(libctx, propq); if (x == NULL) { X509err(0, ERR_R_MALLOC_FAILURE); goto err; @@ -153,7 +151,7 @@ int X509_load_cert_file_with_libctx(X509_LOOKUP *ctx, const char *file, int type int X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type) { - return X509_load_cert_file_with_libctx(ctx, file, type, NULL, NULL); + return X509_load_cert_file_ex(ctx, file, type, NULL, NULL); } int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type) @@ -213,9 +211,8 @@ int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type) return ret; } -int X509_load_cert_crl_file_with_libctx(X509_LOOKUP *ctx, const char *file, - int type, OPENSSL_CTX *libctx, - const char *propq) +int X509_load_cert_crl_file_ex(X509_LOOKUP *ctx, const char *file, int type, + OPENSSL_CTX *libctx, const char *propq) { STACK_OF(X509_INFO) *inf; X509_INFO *itmp; @@ -223,13 +220,13 @@ int X509_load_cert_crl_file_with_libctx(X509_LOOKUP *ctx, const char *file, int i, count = 0; if (type != X509_FILETYPE_PEM) - return X509_load_cert_file_with_libctx(ctx, file, type, libctx, propq); + return X509_load_cert_file_ex(ctx, file, type, libctx, propq); in = BIO_new_file(file, "r"); if (!in) { X509err(0, ERR_R_SYS_LIB); return 0; } - inf = PEM_X509_INFO_read_bio_with_libctx(in, NULL, NULL, "", libctx, propq); + inf = PEM_X509_INFO_read_bio_ex(in, NULL, NULL, "", libctx, propq); BIO_free(in); if (!inf) { X509err(0, ERR_R_PEM_LIB); @@ -257,6 +254,6 @@ int X509_load_cert_crl_file_with_libctx(X509_LOOKUP *ctx, const char *file, int X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type) { - return X509_load_cert_crl_file_with_libctx(ctx, file, type, NULL, NULL); + return X509_load_cert_crl_file_ex(ctx, file, type, NULL, NULL); } diff --git a/crypto/x509/by_store.c b/crypto/x509/by_store.c index 7822da8cd5..e29e74f917 100644 --- a/crypto/x509/by_store.c +++ b/crypto/x509/by_store.c @@ -21,8 +21,7 @@ static int cache_objects(X509_LOOKUP *lctx, const char *uri, OSSL_STORE_CTX *ctx = NULL; X509_STORE *xstore = X509_LOOKUP_get_store(lctx); - if ((ctx = OSSL_STORE_open_with_libctx(uri, libctx, propq, - NULL, NULL, NULL, NULL)) == NULL) + if ((ctx = OSSL_STORE_open_ex(uri, libctx, propq, NULL, NULL, NULL, NULL)) == NULL) return 0; /* @@ -105,10 +104,9 @@ static void by_store_free(X509_LOOKUP *ctx) sk_OPENSSL_STRING_pop_free(uris, free_uri); } -static int by_store_ctrl_with_libctx(X509_LOOKUP *ctx, int cmd, - const char *argp, long argl, - char **retp, - OPENSSL_CTX *libctx, const char *propq) +static int by_store_ctrl_ex(X509_LOOKUP *ctx, int cmd, const char *argp, + long argl, char **retp, OPENSSL_CTX *libctx, + const char *propq) { switch (cmd) { case X509_L_ADD_STORE: @@ -138,7 +136,7 @@ static int by_store_ctrl_with_libctx(X509_LOOKUP *ctx, int cmd, static int by_store_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, long argl, char **retp) { - return by_store_ctrl_with_libctx(ctx, cmd, argp, argl, retp, NULL, NULL); + return by_store_ctrl_ex(ctx, cmd, argp, argl, retp, NULL, NULL); } static int by_store(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, @@ -159,9 +157,9 @@ static int by_store(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, return ok; } -static int by_store_subject_with_libctx(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, - const X509_NAME *name, X509_OBJECT *ret, - OPENSSL_CTX *libctx, const char *propq) +static int by_store_subject_ex(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, + const X509_NAME *name, X509_OBJECT *ret, + OPENSSL_CTX *libctx, const char *propq) { OSSL_STORE_SEARCH *criterion = OSSL_STORE_SEARCH_by_name((X509_NAME *)name); /* won't modify it */ @@ -216,7 +214,7 @@ static int by_store_subject_with_libctx(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, static int by_store_subject(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, const X509_NAME *name, X509_OBJECT *ret) { - return by_store_subject_with_libctx(ctx, type, name, ret, NULL, NULL); + return by_store_subject_ex(ctx, type, name, ret, NULL, NULL); } /* @@ -236,8 +234,8 @@ static X509_LOOKUP_METHOD x509_store_lookup = { NULL, /* get_by_issuer_serial */ NULL, /* get_by_fingerprint */ NULL, /* get_by_alias */ - by_store_subject_with_libctx, - by_store_ctrl_with_libctx + by_store_subject_ex, + by_store_ctrl_ex }; X509_LOOKUP_METHOD *X509_LOOKUP_store(void) diff --git a/crypto/x509/x509_d2.c b/crypto/x509/x509_d2.c index 512c7ae13e..40f751cde6 100644 --- a/crypto/x509/x509_d2.c +++ b/crypto/x509/x509_d2.c @@ -12,17 +12,15 @@ #include <openssl/crypto.h> #include <openssl/x509.h> -int X509_STORE_set_default_paths_with_libctx(X509_STORE *ctx, - OPENSSL_CTX *libctx, - const char *propq) +int X509_STORE_set_default_paths_ex(X509_STORE *ctx, OPENSSL_CTX *libctx, + const char *propq) { X509_LOOKUP *lookup; lookup = X509_STORE_add_lookup(ctx, X509_LOOKUP_file()); if (lookup == NULL) return 0; - X509_LOOKUP_load_file_with_libctx(lookup, NULL, X509_FILETYPE_DEFAULT, - libctx, propq); + X509_LOOKUP_load_file_ex(lookup, NULL, X509_FILETYPE_DEFAULT, libctx, propq); lookup = X509_STORE_add_lookup(ctx, X509_LOOKUP_hash_dir()); if (lookup == NULL) @@ -32,7 +30,7 @@ int X509_STORE_set_default_paths_with_libctx(X509_STORE *ctx, lookup = X509_STORE_add_lookup(ctx, X509_LOOKUP_store()); if (lookup == NULL) return 0; - X509_LOOKUP_add_store_with_libctx(lookup, NULL, libctx, propq); + X509_LOOKUP_add_store_ex(lookup, NULL, libctx, propq); /* clear any errors */ ERR_clear_error(); @@ -41,18 +39,18 @@ int X509_STORE_set_default_paths_with_libctx(X509_STORE *ctx, } int X509_STORE_set_default_paths(X509_STORE *ctx) { - return X509_STORE_set_default_paths_with_libctx(ctx, NULL, NULL); + return X509_STORE_set_default_paths_ex(ctx, NULL, NULL); } -int X509_STORE_load_file_with_libctx(X509_STORE *ctx, const char *file, - OPENSSL_CTX *libctx, const char *propq) +int X509_STORE_load_file_ex(X509_STORE *ctx, const char *file, + OPENSSL_CTX *libctx, const char *propq) { X509_LOOKUP *lookup; if (file == NULL || (lookup = X509_STORE_add_lookup(ctx, X509_LOOKUP_file())) == NULL - || X509_LOOKUP_load_file_with_libctx(lookup, file, X509_FILETYPE_PEM, - libctx, propq) == 0) + || X509_LOOKUP_load_file_ex(lookup, file, X509_FILETYPE_PEM, libctx, + propq) == 0) return 0; return 1; @@ -60,7 +58,7 @@ int X509_STORE_load_file_with_libctx(X509_STORE *ctx, const char *file, int X509_STORE_load_file(X509_STORE *ctx, const char *file) { - return X509_STORE_load_file_with_libctx(ctx, file, NULL, NULL); + return X509_STORE_load_file_ex(ctx, file, NULL, NULL); } int X509_STORE_load_path(X509_STORE *ctx, const char *path) @@ -75,14 +73,14 @@ int X509_STORE_load_path(X509_STORE *ctx, const char *path) return 1; } -int X509_STORE_load_store_with_libctx(X509_STORE *ctx, const char *uri, - OPENSSL_CTX *libctx, const char *propq) +int X509_STORE_load_store_ex(X509_STORE *ctx, const char *uri, + OPENSSL_CTX *libctx, const char *propq) { X509_LOOKUP *lookup; if (uri == NULL || (lookup = X509_STORE_add_lookup(ctx, X509_LOOKUP_store())) == NULL - || X509_LOOKUP_add_store_with_libctx(lookup, uri, libctx, propq) == 0) + || X509_LOOKUP_add_store_ex(lookup, uri, libctx, propq) == 0) return 0; return 1; @@ -90,17 +88,16 @@ int X509_STORE_load_store_with_libctx(X509_STORE *ctx, const char *uri, int X509_STORE_load_store(X509_STORE *ctx, const char *uri) { - return X509_STORE_load_store_with_libctx(ctx, uri, NULL, NULL); + return X509_STORE_load_store_ex(ctx, uri, NULL, NULL); } -int X509_STORE_load_locations_with_libctx(X509_STORE *ctx, const char *file, - const char *path, - OPENSSL_CTX *libctx, const char *propq) +int X509_STORE_load_locations_ex(X509_STORE *ctx, const char *file, + const char *path, OPENSSL_CTX *libctx, + const char *propq) { if (file == NULL && path == NULL) return 0; - if (file != NULL && !X509_STORE_load_file_with_libctx(ctx, file, - libctx, propq)) + if (file != NULL && !X509_STORE_load_file_ex(ctx, file, libctx, propq)) return 0; if (path != NULL && !X509_STORE_load_path(ctx, path)) return 0; @@ -110,5 +107,5 @@ int X509_STORE_load_locations_with_libctx(X509_STORE *ctx, const char *file, int X509_STORE_load_locations(X509_STORE *ctx, const char *file, const char *path) { - return X509_STORE_load_locations_with_libctx(ctx, file, path, NULL, NULL); + return X509_STORE_load_locations_ex(ctx, file, path, NULL, NULL); } diff --git a/crypto/x509/x509_local.h b/crypto/x509/x509_local.h index 6a2137129c..bdd5bfcb71 100644 --- a/crypto/x509/x509_local.h +++ b/crypto/x509/x509_local.h @@ -90,10 +90,10 @@ struct x509_lookup_method_st { X509_OBJECT *ret); int (*get_by_alias) (X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, const char *str, int len, X509_OBJECT *ret); - int (*get_by_subject_with_libctx) (X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, + int (*get_by_subject_ex) (X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, const X509_NAME *name, X509_OBJECT *ret, OPENSSL_CTX *libctx, const char *propq); - int (*ctrl_with_libctx) (X509_LOOKUP *ctx, int cmd, + int (*ctrl_ex) (X509_LOOKUP *ctx, int cmd, const char *argc, long argl, char **ret, OPENSSL_CTX *libctx, const char *propq); }; diff --git a/crypto/x509/x509_lu.c b/crypto/x509/x509_lu.c index de81fad513..69517e0b5e 100644 --- a/crypto/x509/x509_lu.c +++ b/crypto/x509/x509_lu.c @@ -71,15 +71,13 @@ int X509_LOOKUP_shutdown(X509_LOOKUP *ctx) return 1; } -int X509_LOOKUP_ctrl_with_libctx(X509_LOOKUP *ctx, int cmd, const char *argc, - long argl, char **ret, - OPENSSL_CTX *libctx, const char *propq) +int X509_LOOKUP_ctrl_ex(X509_LOOKUP *ctx, int cmd, const char *argc, long argl, + char **ret, OPENSSL_CTX *libctx, const char *propq) { if (ctx->method == NULL) return -1; - if (ctx->method->ctrl_with_libctx != NULL) - return ctx->method->ctrl_with_libctx(ctx, cmd, argc, argl, ret, - libctx, propq); + if (ctx->method->ctrl_ex != NULL) + return ctx->method->ctrl_ex(ctx, cmd, argc, argl, ret, libctx, propq); if (ctx->method->ctrl != NULL) return ctx->method->ctrl(ctx, cmd, argc, argl, ret); return 1; @@ -88,21 +86,21 @@ int X509_LOOKUP_ctrl_with_libctx(X509_LOOKUP *ctx, int cmd, const char *argc, int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, long argl, char **ret) { - return X509_LOOKUP_ctrl_with_libctx(ctx, cmd, argc, argl, ret, NULL, NULL); + return X509_LOOKUP_ctrl_ex(ctx, cmd, argc, argl, ret, NULL, NULL); } -int X509_LOOKUP_by_subject_with_libctx(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, - const X509_NAME *name, X509_OBJECT *ret, - OPENSSL_CTX *libctx, const char *propq) +int X509_LOOKUP_by_subject_ex(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, + const X509_NAME *name, X509_OBJECT *ret, + OPENSSL_CTX *libctx, const char *propq) { if (ctx->skip || ctx->method == NULL || (ctx->method->get_by_subject == NULL - && ctx->method->get_by_subject_with_libctx == NULL)) + && ctx->method->get_by_subject_ex == NULL)) return 0; - if (ctx->method->get_by_subject_with_libctx != NULL) - return ctx->method->get_by_subject_with_libctx(ctx, type, name, ret, - libctx, propq); + if (ctx->method->get_by_subject_ex != NULL) + return ctx->method->get_by_subject_ex(ctx, type, name, ret, libctx, + propq); else return ctx->method->get_by_subject(ctx, type, name, ret); } @@ -110,7 +108,7 @@ int X509_LOOKUP_by_subject_with_libctx(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, const X509_NAME *name, X509_OBJECT *ret) { - return X509_LOOKUP_by_subject_with_libctx(ctx, type, name, ret, NULL, NULL); + return X509_LOOKUP_by_subject_ex(ctx, type, name, ret, NULL, NULL); } int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, @@ -330,8 +328,8 @@ int X509_STORE_CTX_get_by_subject(const X509_STORE_CTX *vs, if (tmp == NULL || type == X509_LU_CRL) { for (i = 0; i < sk_X509_LOOKUP_num(store->get_cert_methods); i++) { lu = sk_X509_LOOKUP_value(store->get_cert_methods, i); - j = X509_LOOKUP_by_subject_with_libctx(lu, type, name, &stmp, - vs->libctx, vs->propq); + j = X509_LOOKUP_by_subject_ex(lu, type, name, &stmp, vs->libctx, + vs->propq); if (j) { tmp = &stmp; break; diff --git a/crypto/x509/x509_vfy.c b/crypto/x509/x509_vfy.c index 3d6c665aed..cf89179dfd 100644 --- a/crypto/x509/x509_vfy.c +++ b/crypto/x509/x509_vfy.c @@ -2316,8 +2316,7 @@ int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose, return 1; } -X509_STORE_CTX *X509_STORE_CTX_new_with_libctx(OPENSSL_CTX *libctx, - const char *propq) +X509_STORE_CTX *X509_STORE_CTX_new_ex(OPENSSL_CTX *libctx, const char *propq) { X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx)); @@ -2341,7 +2340,7 @@ X509_STORE_CTX *X509_STORE_CTX_new_with_libctx(OPENSSL_CTX *libctx, X509_STORE_CTX *X509_STORE_CTX_new(void) { - return X509_STORE_CTX_new_with_libctx(NULL, NULL); + return X509_STORE_CTX_new_ex(NULL, NULL); } diff --git a/crypto/x509/x_all.c b/crypto/x509/x_all.c index 3e7dc42ef1..a7cf13f7b8 100644 --- a/crypto/x509/x_all.c +++ b/crypto/x509/x_all.c @@ -32,23 +32,22 @@ int X509_verify(X509 *a, EVP_PKEY *r) if (X509_ALGOR_cmp(&a->sig_alg, &a->cert_info.signature)) return 0; - return ASN1_item_verify_with_libctx(ASN1_ITEM_rptr(X509_CINF), &a->sig_alg, - &a->signature, &a->cert_info, - a->distinguishing_id, r, - a->libctx, a->propq); + return ASN1_item_verify_ex(ASN1_ITEM_rptr(X509_CINF), &a->sig_alg, + &a->signature, &a->cert_info, + a->distinguishing_id, r, a->libctx, a->propq); } -int X509_REQ_verify_with_libctx(X509_REQ *a, EVP_PKEY *r, OPENSSL_CTX *libctx, - const char *propq) +int X509_REQ_verify_ex(X509_REQ *a, EVP_PKEY *r, OPENSSL_CTX *libctx, + const char *propq) { - return ASN1_item_verify_with_libctx(ASN1_ITEM_rptr(X509_REQ_INFO), - &a->sig_alg, a->signature, &a->req_info, - a->distinguishing_id, r, libctx, propq); + return ASN1_item_verify_ex(ASN1_ITEM_rptr(X509_REQ_INFO), &a->sig_alg, + a->signature, &a->req_info, a->distinguishing_id, + r, libctx, propq); } int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r) { - return X509_REQ_verify_with_libctx(a, r, NULL, NULL); + return X509_REQ_verify_ex(a, r, NULL, NULL); } int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r) @@ -403,8 +402,8 @@ int X509_digest(const X509 *cert, const EVP_MD *md, unsigned char *data, memcpy(data, cert->sha1_hash, sizeof(cert->sha1_hash)); return 1; } - return (asn1_item_digest_with_libctx(ASN1_ITEM_rptr(X509), md, (char *)cert, - data, len, cert->libctx, cert->propq)); + return (asn1_item_digest_ex(ASN1_ITEM_rptr(X509), md, (char *)cert, data, + len, cert->libctx, cert->propq)); } /* calculate cert digest using the same hash algorithm as in its signature */ diff --git a/crypto/x509/x_x509.c b/crypto/x509/x_x509.c index 315787a5aa..e556eebdae 100644 --- a/crypto/x509/x_x509.c +++ b/crypto/x509/x_x509.c @@ -132,7 +132,7 @@ int i2d_X509(const X509 *a, unsigned char **out) /* * This should only be used if the X509 object was embedded inside another * asn1 object and it needs a libctx to operate. - * Use X509_new_with_libctx() instead if possible. + * Use X509_new_ex() instead if possible. */ int x509_set0_libctx(X509 *x, OPENSSL_CTX *libctx, const char *propq) { @@ -143,7 +143,7 @@ int x509_set0_libctx(X509 *x, OPENSSL_CTX *libctx, const char *propq) return 1; } -X509 *X509_new_with_libctx(OPENSSL_CTX *libctx, const char *propq) +X509 *X509_new_ex(OPENSSL_CTX *libctx, const char *propq) { X509 *cert = NULL; |