diff options
Diffstat (limited to 'crypto/cms')
-rw-r--r-- | crypto/cms/cms_cd.c | 2 | ||||
-rw-r--r-- | crypto/cms/cms_dd.c | 2 | ||||
-rw-r--r-- | crypto/cms/cms_env.c | 19 | ||||
-rw-r--r-- | crypto/cms/cms_ess.c | 13 | ||||
-rw-r--r-- | crypto/cms/cms_io.c | 10 | ||||
-rw-r--r-- | crypto/cms/cms_lib.c | 7 | ||||
-rw-r--r-- | crypto/cms/cms_sd.c | 20 | ||||
-rw-r--r-- | crypto/cms/cms_smime.c | 65 |
8 files changed, 62 insertions, 76 deletions
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, |