diff options
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) |