diff options
author | Shane Lontis <shane.lontis@oracle.com> | 2021-02-18 14:03:25 +1000 |
---|---|---|
committer | Shane Lontis <shane.lontis@oracle.com> | 2021-02-22 09:16:36 +1000 |
commit | 53155f1c814be6d8bfdd77333a16ec9cee7fc3bb (patch) | |
tree | 54aba774e91c8f5d6d1a8ce79514200d7ac91a4c /crypto | |
parent | 937a62323b67bfff59c795e90df3acf66bb4579a (diff) |
Fix external symbols for cms.
Partial fix for #12964
This adds ossl_ names for symbols related to cms_* and ess_*
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14241)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/cms/cms_cd.c | 7 | ||||
-rw-r--r-- | crypto/cms/cms_dd.c | 16 | ||||
-rw-r--r-- | crypto/cms/cms_dh.c | 2 | ||||
-rw-r--r-- | crypto/cms/cms_ec.c | 4 | ||||
-rw-r--r-- | crypto/cms/cms_enc.c | 25 | ||||
-rw-r--r-- | crypto/cms/cms_env.c | 122 | ||||
-rw-r--r-- | crypto/cms/cms_ess.c | 29 | ||||
-rw-r--r-- | crypto/cms/cms_io.c | 10 | ||||
-rw-r--r-- | crypto/cms/cms_kari.c | 57 | ||||
-rw-r--r-- | crypto/cms/cms_lib.c | 66 | ||||
-rw-r--r-- | crypto/cms/cms_local.h | 154 | ||||
-rw-r--r-- | crypto/cms/cms_pwri.c | 20 | ||||
-rw-r--r-- | crypto/cms/cms_rsa.c | 4 | ||||
-rw-r--r-- | crypto/cms/cms_sd.c | 90 | ||||
-rw-r--r-- | crypto/cms/cms_smime.c | 41 | ||||
-rw-r--r-- | crypto/ess/ess_asn1.c | 10 | ||||
-rw-r--r-- | crypto/ess/ess_lib.c | 28 | ||||
-rw-r--r-- | crypto/ts/ts_rsp_sign.c | 11 | ||||
-rw-r--r-- | crypto/ts/ts_rsp_verify.c | 12 |
19 files changed, 365 insertions, 343 deletions
diff --git a/crypto/cms/cms_cd.c b/crypto/cms/cms_cd.c index c781268659..de38288d09 100644 --- a/crypto/cms/cms_cd.c +++ b/crypto/cms/cms_cd.c @@ -21,8 +21,9 @@ /* CMS CompressedData Utilities */ -CMS_ContentInfo *cms_CompressedData_create(int comp_nid, OSSL_LIB_CTX *libctx, - const char *propq) +CMS_ContentInfo *ossl_cms_CompressedData_create(int comp_nid, + OSSL_LIB_CTX *libctx, + const char *propq) { CMS_ContentInfo *cms; CMS_CompressedData *cd; @@ -61,7 +62,7 @@ CMS_ContentInfo *cms_CompressedData_create(int comp_nid, OSSL_LIB_CTX *libctx, return NULL; } -BIO *cms_CompressedData_init_bio(const CMS_ContentInfo *cms) +BIO *ossl_cms_CompressedData_init_bio(const CMS_ContentInfo *cms) { CMS_CompressedData *cd; const ASN1_OBJECT *compoid; diff --git a/crypto/cms/cms_dd.c b/crypto/cms/cms_dd.c index 4eba827d62..31b0a6f23f 100644 --- a/crypto/cms/cms_dd.c +++ b/crypto/cms/cms_dd.c @@ -17,9 +17,9 @@ /* CMS DigestedData Utilities */ -CMS_ContentInfo *cms_DigestedData_create(const EVP_MD *md, - OSSL_LIB_CTX *libctx, - const char *propq) +CMS_ContentInfo *ossl_cms_DigestedData_create(const EVP_MD *md, + OSSL_LIB_CTX *libctx, + const char *propq) { CMS_ContentInfo *cms; CMS_DigestedData *dd; @@ -48,14 +48,16 @@ CMS_ContentInfo *cms_DigestedData_create(const EVP_MD *md, return NULL; } -BIO *cms_DigestedData_init_bio(const CMS_ContentInfo *cms) +BIO *ossl_cms_DigestedData_init_bio(const CMS_ContentInfo *cms) { CMS_DigestedData *dd = cms->d.digestedData; - return cms_DigestAlgorithm_init_bio(dd->digestAlgorithm, cms_get0_cmsctx(cms)); + return ossl_cms_DigestAlgorithm_init_bio(dd->digestAlgorithm, + ossl_cms_get0_cmsctx(cms)); } -int cms_DigestedData_do_final(const CMS_ContentInfo *cms, BIO *chain, int verify) +int ossl_cms_DigestedData_do_final(const CMS_ContentInfo *cms, BIO *chain, + int verify) { EVP_MD_CTX *mctx = EVP_MD_CTX_new(); unsigned char md[EVP_MAX_MD_SIZE]; @@ -70,7 +72,7 @@ int cms_DigestedData_do_final(const CMS_ContentInfo *cms, BIO *chain, int verify dd = cms->d.digestedData; - if (!cms_DigestAlgorithm_find_ctx(mctx, chain, dd->digestAlgorithm)) + if (!ossl_cms_DigestAlgorithm_find_ctx(mctx, chain, dd->digestAlgorithm)) goto err; if (EVP_DigestFinal_ex(mctx, md, &mdlen) <= 0) diff --git a/crypto/cms/cms_dh.c b/crypto/cms/cms_dh.c index e55b4a062f..95ce8e8351 100644 --- a/crypto/cms/cms_dh.c +++ b/crypto/cms/cms_dh.c @@ -327,7 +327,7 @@ static int dh_cms_encrypt(CMS_RecipientInfo *ri) return rv; } -int cms_dh_envelope(CMS_RecipientInfo *ri, int decrypt) +int ossl_cms_dh_envelope(CMS_RecipientInfo *ri, int decrypt) { assert(decrypt == 0 || decrypt == 1); diff --git a/crypto/cms/cms_ec.c b/crypto/cms/cms_ec.c index a4c6da6069..096eafd815 100644 --- a/crypto/cms/cms_ec.c +++ b/crypto/cms/cms_ec.c @@ -370,7 +370,7 @@ static int ecdh_cms_encrypt(CMS_RecipientInfo *ri) return rv; } -int cms_ecdh_envelope(CMS_RecipientInfo *ri, int decrypt) +int ossl_cms_ecdh_envelope(CMS_RecipientInfo *ri, int decrypt) { assert(decrypt == 0 || decrypt == 1); @@ -385,7 +385,7 @@ int cms_ecdh_envelope(CMS_RecipientInfo *ri, int decrypt) } /* ECDSA and DSA implementation is the same */ -int cms_ecdsa_dsa_sign(CMS_SignerInfo *si, int verify) +int ossl_cms_ecdsa_dsa_sign(CMS_SignerInfo *si, int verify) { assert(verify == 0 || verify == 1); diff --git a/crypto/cms/cms_enc.c b/crypto/cms/cms_enc.c index cf19b7604b..3bec60bcf0 100644 --- a/crypto/cms/cms_enc.c +++ b/crypto/cms/cms_enc.c @@ -21,8 +21,8 @@ /* Return BIO based on EncryptedContentInfo and key */ -BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec, - const CMS_CTX *cms_ctx) +BIO *ossl_cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec, + const CMS_CTX *cms_ctx) { BIO *b; EVP_CIPHER_CTX *ctx; @@ -37,8 +37,8 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec, size_t tkeylen = 0; int ok = 0; int enc, keep_key = 0; - OSSL_LIB_CTX *libctx = cms_ctx_get0_libctx(cms_ctx); - const char *propq = cms_ctx_get0_propq(cms_ctx); + OSSL_LIB_CTX *libctx = ossl_cms_ctx_get0_libctx(cms_ctx); + const char *propq = ossl_cms_ctx_get0_propq(cms_ctx); enc = ec->cipher ? 1 : 0; @@ -193,10 +193,10 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec, return NULL; } -int cms_EncryptedContent_init(CMS_EncryptedContentInfo *ec, - const EVP_CIPHER *cipher, - const unsigned char *key, size_t keylen, - const CMS_CTX *cms_ctx) +int ossl_cms_EncryptedContent_init(CMS_EncryptedContentInfo *ec, + const EVP_CIPHER *cipher, + const unsigned char *key, size_t keylen, + const CMS_CTX *cms_ctx) { ec->cipher = cipher; if (key) { @@ -234,14 +234,15 @@ int CMS_EncryptedData_set1_key(CMS_ContentInfo *cms, const EVP_CIPHER *ciph, return 0; } ec = cms->d.encryptedData->encryptedContentInfo; - return cms_EncryptedContent_init(ec, ciph, key, keylen, cms_get0_cmsctx(cms)); + return ossl_cms_EncryptedContent_init(ec, ciph, key, keylen, + ossl_cms_get0_cmsctx(cms)); } -BIO *cms_EncryptedData_init_bio(const CMS_ContentInfo *cms) +BIO *ossl_cms_EncryptedData_init_bio(const CMS_ContentInfo *cms) { CMS_EncryptedData *enc = cms->d.encryptedData; if (enc->encryptedContentInfo->cipher && enc->unprotectedAttrs) enc->version = 2; - return cms_EncryptedContent_init_bio(enc->encryptedContentInfo, - cms_get0_cmsctx(cms)); + return ossl_cms_EncryptedContent_init_bio(enc->encryptedContentInfo, + ossl_cms_get0_cmsctx(cms)); } diff --git a/crypto/cms/cms_env.c b/crypto/cms/cms_env.c index d133b15136..b0b9e4aaac 100644 --- a/crypto/cms/cms_env.c +++ b/crypto/cms/cms_env.c @@ -42,7 +42,7 @@ static int cms_get_enveloped_type(const CMS_ContentInfo *cms) } } -CMS_EnvelopedData *cms_get0_enveloped(CMS_ContentInfo *cms) +CMS_EnvelopedData *ossl_cms_get0_enveloped(CMS_ContentInfo *cms) { if (OBJ_obj2nid(cms->contentType) != NID_pkcs7_enveloped) { ERR_raise(ERR_LIB_CMS, CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA); @@ -51,7 +51,7 @@ CMS_EnvelopedData *cms_get0_enveloped(CMS_ContentInfo *cms) return cms->d.envelopedData; } -CMS_AuthEnvelopedData *cms_get0_auth_enveloped(CMS_ContentInfo *cms) +CMS_AuthEnvelopedData *ossl_cms_get0_auth_enveloped(CMS_ContentInfo *cms) { if (OBJ_obj2nid(cms->contentType) != NID_id_smime_ct_authEnvelopedData) { ERR_raise(ERR_LIB_CMS, CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA); @@ -75,7 +75,7 @@ static CMS_EnvelopedData *cms_enveloped_data_init(CMS_ContentInfo *cms) cms->contentType = OBJ_nid2obj(NID_pkcs7_enveloped); return cms->d.envelopedData; } - return cms_get0_enveloped(cms); + return ossl_cms_get0_enveloped(cms); } static CMS_AuthEnvelopedData * @@ -95,10 +95,10 @@ cms_auth_enveloped_data_init(CMS_ContentInfo *cms) cms->contentType = OBJ_nid2obj(NID_id_smime_ct_authEnvelopedData); return cms->d.authEnvelopedData; } - return cms_get0_auth_enveloped(cms); + return ossl_cms_get0_auth_enveloped(cms); } -int cms_env_asn1_ctrl(CMS_RecipientInfo *ri, int cmd) +int ossl_cms_env_asn1_ctrl(CMS_RecipientInfo *ri, int cmd) { EVP_PKEY *pkey; int i; @@ -116,11 +116,11 @@ int cms_env_asn1_ctrl(CMS_RecipientInfo *ri, int cmd) return 0; if (EVP_PKEY_is_a(pkey, "DHX") || EVP_PKEY_is_a(pkey, "DH")) - return cms_dh_envelope(ri, cmd); + return ossl_cms_dh_envelope(ri, cmd); else if (EVP_PKEY_is_a(pkey, "EC")) - return cms_ecdh_envelope(ri, cmd); + return ossl_cms_ecdh_envelope(ri, cmd); else if (EVP_PKEY_is_a(pkey, "RSA")) - return cms_rsa_envelope(ri, cmd); + return ossl_cms_rsa_envelope(ri, cmd); /* Something else? We'll give engines etc a chance to handle this */ if (pkey->ameth == NULL || pkey->ameth->pkey_ctrl == NULL) @@ -137,7 +137,7 @@ int cms_env_asn1_ctrl(CMS_RecipientInfo *ri, int cmd) return 1; } -CMS_EncryptedContentInfo* cms_get0_env_enc_content(const CMS_ContentInfo *cms) +CMS_EncryptedContentInfo* ossl_cms_get0_env_enc_content(const CMS_ContentInfo *cms) { switch (cms_get_enveloped_type(cms)) { case CMS_ENVELOPED_STANDARD: @@ -165,11 +165,11 @@ STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms) } } -void cms_RecipientInfos_set_cmsctx(CMS_ContentInfo *cms) +void ossl_cms_RecipientInfos_set_cmsctx(CMS_ContentInfo *cms) { int i; CMS_RecipientInfo *ri; - const CMS_CTX *ctx = cms_get0_cmsctx(cms); + const CMS_CTX *ctx = ossl_cms_get0_cmsctx(cms); STACK_OF(CMS_RecipientInfo) *rinfos = CMS_get0_RecipientInfos(cms); for (i = 0; i < sk_CMS_RecipientInfo_num(rinfos); i++) { @@ -181,8 +181,9 @@ void cms_RecipientInfos_set_cmsctx(CMS_ContentInfo *cms) break; case CMS_RECIPINFO_TRANS: ri->d.ktri->cms_ctx = ctx; - x509_set0_libctx(ri->d.ktri->recip, cms_ctx_get0_libctx(ctx), - cms_ctx_get0_propq(ctx)); + x509_set0_libctx(ri->d.ktri->recip, + ossl_cms_ctx_get0_libctx(ctx), + ossl_cms_ctx_get0_propq(ctx)); break; case CMS_RECIPINFO_KEK: ri->d.kekri->cms_ctx = ctx; @@ -225,8 +226,8 @@ CMS_ContentInfo *CMS_EnvelopedData_create_ex(const EVP_CIPHER *cipher, if (env == NULL) goto merr; - if (!cms_EncryptedContent_init(env->encryptedContentInfo, cipher, NULL, 0, - cms_get0_cmsctx(cms))) + if (!ossl_cms_EncryptedContent_init(env->encryptedContentInfo, cipher, NULL, + 0, ossl_cms_get0_cmsctx(cms))) goto merr; return cms; merr: @@ -253,8 +254,9 @@ CMS_AuthEnvelopedData_create_ex(const EVP_CIPHER *cipher, OSSL_LIB_CTX *libctx, aenv = cms_auth_enveloped_data_init(cms); if (aenv == NULL) goto merr; - if (!cms_EncryptedContent_init(aenv->authEncryptedContentInfo, - cipher, NULL, 0, cms_get0_cmsctx(cms))) + if (!ossl_cms_EncryptedContent_init(aenv->authEncryptedContentInfo, + cipher, NULL, 0, + ossl_cms_get0_cmsctx(cms))) goto merr; return cms; merr: @@ -301,7 +303,7 @@ static int cms_RecipientInfo_ktri_init(CMS_RecipientInfo *ri, X509 *recip, * structure. */ - if (!cms_set1_SignerIdentifier(ktri->rid, recip, idtype, ctx)) + if (!ossl_cms_set1_SignerIdentifier(ktri->rid, recip, idtype, ctx)) return 0; X509_up_ref(recip); @@ -311,14 +313,14 @@ static int cms_RecipientInfo_ktri_init(CMS_RecipientInfo *ri, X509 *recip, ktri->recip = recip; if (flags & CMS_KEY_PARAM) { - ktri->pctx = EVP_PKEY_CTX_new_from_pkey(cms_ctx_get0_libctx(ctx), + ktri->pctx = EVP_PKEY_CTX_new_from_pkey(ossl_cms_ctx_get0_libctx(ctx), ktri->pkey, - cms_ctx_get0_propq(ctx)); + ossl_cms_ctx_get0_propq(ctx)); if (ktri->pctx == NULL) return 0; if (EVP_PKEY_encrypt_init(ktri->pctx) <= 0) return 0; - } else if (!cms_env_asn1_ctrl(ri, 0)) + } else if (!ossl_cms_env_asn1_ctrl(ri, 0)) return 0; return 1; } @@ -334,7 +336,7 @@ CMS_RecipientInfo *CMS_add1_recipient(CMS_ContentInfo *cms, X509 *recip, CMS_RecipientInfo *ri = NULL; STACK_OF(CMS_RecipientInfo) *ris; EVP_PKEY *pk = NULL; - const CMS_CTX *ctx = cms_get0_cmsctx(cms); + const CMS_CTX *ctx = ossl_cms_get0_cmsctx(cms); ris = CMS_get0_RecipientInfos(cms); if (ris == NULL) @@ -351,7 +353,7 @@ CMS_RecipientInfo *CMS_add1_recipient(CMS_ContentInfo *cms, X509 *recip, goto err; } - switch (cms_pkey_get_ri_type(pk)) { + switch (ossl_cms_pkey_get_ri_type(pk)) { case CMS_RECIPINFO_TRANS: if (!cms_RecipientInfo_ktri_init(ri, recip, pk, flags, ctx)) @@ -359,8 +361,8 @@ CMS_RecipientInfo *CMS_add1_recipient(CMS_ContentInfo *cms, X509 *recip, break; case CMS_RECIPINFO_AGREE: - if (!cms_RecipientInfo_kari_init(ri, recip, pk, originator, - originatorPrivKey, flags, ctx)) + if (!ossl_cms_RecipientInfo_kari_init(ri, recip, pk, originator, + originatorPrivKey, flags, ctx)) goto err; break; @@ -422,7 +424,8 @@ int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri, } ktri = ri->d.ktri; - return cms_SignerIdentifier_get0_signer_id(ktri->rid, keyid, issuer, sno); + return ossl_cms_SignerIdentifier_get0_signer_id(ktri->rid, keyid, issuer, + sno); } int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert) @@ -431,7 +434,7 @@ int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert) ERR_raise(ERR_LIB_CMS, CMS_R_NOT_KEY_TRANSPORT); return -2; } - return cms_SignerIdentifier_cert_cmp(ri->d.ktri->rid, cert); + return ossl_cms_SignerIdentifier_cert_cmp(ri->d.ktri->rid, cert); } int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey) @@ -455,7 +458,7 @@ static int cms_RecipientInfo_ktri_encrypt(const CMS_ContentInfo *cms, EVP_PKEY_CTX *pctx; unsigned char *ek = NULL; size_t eklen; - const CMS_CTX *ctx = cms_get0_cmsctx(cms); + const CMS_CTX *ctx = ossl_cms_get0_cmsctx(cms); int ret = 0; @@ -464,16 +467,17 @@ static int cms_RecipientInfo_ktri_encrypt(const CMS_ContentInfo *cms, return 0; } ktri = ri->d.ktri; - ec = cms_get0_env_enc_content(cms); + ec = ossl_cms_get0_env_enc_content(cms); pctx = ktri->pctx; if (pctx) { - if (!cms_env_asn1_ctrl(ri, 0)) + if (!ossl_cms_env_asn1_ctrl(ri, 0)) goto err; } else { - pctx = EVP_PKEY_CTX_new_from_pkey(cms_ctx_get0_libctx(ctx), ktri->pkey, - cms_ctx_get0_propq(ctx)); + pctx = EVP_PKEY_CTX_new_from_pkey(ossl_cms_ctx_get0_libctx(ctx), + ktri->pkey, + ossl_cms_ctx_get0_propq(ctx)); if (pctx == NULL) return 0; @@ -526,11 +530,11 @@ static int cms_RecipientInfo_ktri_decrypt(CMS_ContentInfo *cms, const EVP_CIPHER *cipher = NULL; EVP_CIPHER *fetched_cipher = NULL; CMS_EncryptedContentInfo *ec; - const CMS_CTX *ctx = cms_get0_cmsctx(cms); - OSSL_LIB_CTX *libctx = cms_ctx_get0_libctx(ctx); - const char *propq = cms_ctx_get0_propq(ctx); + const CMS_CTX *ctx = ossl_cms_get0_cmsctx(cms); + OSSL_LIB_CTX *libctx = ossl_cms_ctx_get0_libctx(ctx); + const char *propq = ossl_cms_ctx_get0_propq(ctx); - ec = cms_get0_env_enc_content(cms); + ec = ossl_cms_get0_env_enc_content(cms); if (ktri->pkey == NULL) { ERR_raise(ERR_LIB_CMS, CMS_R_NO_PRIVATE_KEY); @@ -567,7 +571,7 @@ static int cms_RecipientInfo_ktri_decrypt(CMS_ContentInfo *cms, if (EVP_PKEY_decrypt_init(ktri->pctx) <= 0) goto err; - if (!cms_env_asn1_ctrl(ri, 1)) + if (!ossl_cms_env_asn1_ctrl(ri, 1)) goto err; if (EVP_PKEY_CTX_ctrl(ktri->pctx, -1, EVP_PKEY_OP_DECRYPT, @@ -813,8 +817,8 @@ static EVP_CIPHER *cms_get_key_wrap_cipher(size_t keylen, const CMS_CTX *ctx) default: return NULL; } - return EVP_CIPHER_fetch(cms_ctx_get0_libctx(ctx), alg, - cms_ctx_get0_propq(ctx)); + return EVP_CIPHER_fetch(ossl_cms_ctx_get0_libctx(ctx), alg, + ossl_cms_ctx_get0_propq(ctx)); } @@ -831,9 +835,9 @@ static int cms_RecipientInfo_kekri_encrypt(const CMS_ContentInfo *cms, EVP_CIPHER *cipher = NULL; int outlen = 0; EVP_CIPHER_CTX *ctx = NULL; - const CMS_CTX *cms_ctx = cms_get0_cmsctx(cms); + const CMS_CTX *cms_ctx = ossl_cms_get0_cmsctx(cms); - ec = cms_get0_env_enc_content(cms); + ec = ossl_cms_get0_env_enc_content(cms); if (ec == NULL) return 0; @@ -902,9 +906,9 @@ static int cms_RecipientInfo_kekri_decrypt(CMS_ContentInfo *cms, EVP_CIPHER *cipher = NULL; int outlen = 0; EVP_CIPHER_CTX *ctx = NULL; - const CMS_CTX *cms_ctx = cms_get0_cmsctx(cms); + const CMS_CTX *cms_ctx = ossl_cms_get0_cmsctx(cms); - ec = cms_get0_env_enc_content(cms); + ec = ossl_cms_get0_env_enc_content(cms); if (ec == NULL) return 0; @@ -980,7 +984,7 @@ int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri) return cms_RecipientInfo_kekri_decrypt(cms, ri); case CMS_RECIPINFO_PASS: - return cms_RecipientInfo_pwri_crypt(cms, ri, 0); + return ossl_cms_RecipientInfo_pwri_crypt(cms, ri, 0); default: ERR_raise(ERR_LIB_CMS, CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE); @@ -995,13 +999,13 @@ int CMS_RecipientInfo_encrypt(const CMS_ContentInfo *cms, CMS_RecipientInfo *ri) return cms_RecipientInfo_ktri_encrypt(cms, ri); case CMS_RECIPINFO_AGREE: - return cms_RecipientInfo_kari_encrypt(cms, ri); + return ossl_cms_RecipientInfo_kari_encrypt(cms, ri); case CMS_RECIPINFO_KEK: return cms_RecipientInfo_kekri_encrypt(cms, ri); case CMS_RECIPINFO_PASS: - return cms_RecipientInfo_pwri_crypt(cms, ri, 1); + return ossl_cms_RecipientInfo_pwri_crypt(cms, ri, 1); default: ERR_raise(ERR_LIB_CMS, CMS_R_UNSUPPORTED_RECIPIENT_TYPE); @@ -1097,7 +1101,8 @@ static void cms_env_clear_ec(CMS_EncryptedContentInfo *ec) static BIO *cms_EnvelopedData_Decryption_init_bio(CMS_ContentInfo *cms) { CMS_EncryptedContentInfo *ec = cms->d.envelopedData->encryptedContentInfo; - BIO *contentBio = cms_EncryptedContent_init_bio(ec, cms_get0_cmsctx(cms)); + BIO *contentBio = ossl_cms_EncryptedContent_init_bio(ec, + ossl_cms_get0_cmsctx(cms)); EVP_CIPHER_CTX *ctx = NULL; if (contentBio == NULL) @@ -1112,7 +1117,8 @@ static BIO *cms_EnvelopedData_Decryption_init_bio(CMS_ContentInfo *cms) * If the selected cipher supports unprotected attributes, * deal with it using special ctrl function */ - if ((EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(ctx)) & EVP_CIPH_FLAG_CIPHER_WITH_MAC) + if ((EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(ctx)) + & EVP_CIPH_FLAG_CIPHER_WITH_MAC) && EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_PROCESS_UNPROTECTED, 0, cms->d.envelopedData->unprotectedAttrs) <= 0) { BIO_free(contentBio); @@ -1132,7 +1138,7 @@ static BIO *cms_EnvelopedData_Encryption_init_bio(CMS_ContentInfo *cms) /* Get BIO first to set up key */ ec = env->encryptedContentInfo; - ret = cms_EncryptedContent_init_bio(ec, cms_get0_cmsctx(cms)); + ret = ossl_cms_EncryptedContent_init_bio(ec, ossl_cms_get0_cmsctx(cms)); /* If error end of processing */ if (!ret) @@ -1158,7 +1164,7 @@ static BIO *cms_EnvelopedData_Encryption_init_bio(CMS_ContentInfo *cms) return NULL; } -BIO *cms_EnvelopedData_init_bio(CMS_ContentInfo *cms) +BIO *ossl_cms_EnvelopedData_init_bio(CMS_ContentInfo *cms) { if (cms->d.envelopedData->encryptedContentInfo->cipher != NULL) { /* If cipher is set it's encryption */ @@ -1169,7 +1175,7 @@ BIO *cms_EnvelopedData_init_bio(CMS_ContentInfo *cms) return cms_EnvelopedData_Decryption_init_bio(cms); } -BIO *cms_AuthEnvelopedData_init_bio(CMS_ContentInfo *cms) +BIO *ossl_cms_AuthEnvelopedData_init_bio(CMS_ContentInfo *cms) { CMS_EncryptedContentInfo *ec; STACK_OF(CMS_RecipientInfo) *rinfos; @@ -1184,7 +1190,7 @@ BIO *cms_AuthEnvelopedData_init_bio(CMS_ContentInfo *cms) ec->tag = aenv->mac->data; ec->taglen = aenv->mac->length; } - ret = cms_EncryptedContent_init_bio(ec, cms_get0_cmsctx(cms)); + ret = ossl_cms_EncryptedContent_init_bio(ec, ossl_cms_get0_cmsctx(cms)); /* If error or no cipher end of processing */ if (ret == NULL || ec->cipher == NULL) @@ -1210,13 +1216,13 @@ BIO *cms_AuthEnvelopedData_init_bio(CMS_ContentInfo *cms) return NULL; } -int cms_EnvelopedData_final(CMS_ContentInfo *cms, BIO *chain) +int ossl_cms_EnvelopedData_final(CMS_ContentInfo *cms, BIO *chain) { CMS_EnvelopedData *env = NULL; EVP_CIPHER_CTX *ctx = NULL; BIO *mbio = BIO_find_type(chain, BIO_TYPE_CIPHER); - env = cms_get0_enveloped(cms); + env = ossl_cms_get0_enveloped(cms); if (env == NULL) return 0; @@ -1251,7 +1257,7 @@ int cms_EnvelopedData_final(CMS_ContentInfo *cms, BIO *chain) return 1; } -int cms_AuthEnvelopedData_final(CMS_ContentInfo *cms, BIO *cmsbio) +int ossl_cms_AuthEnvelopedData_final(CMS_ContentInfo *cms, BIO *cmsbio) { EVP_CIPHER_CTX *ctx; unsigned char *tag = NULL; @@ -1289,7 +1295,7 @@ err: * retain compatibility with previous behaviour if the ctrl value isn't * supported we assume key transport. */ -int cms_pkey_get_ri_type(EVP_PKEY *pk) +int ossl_cms_pkey_get_ri_type(EVP_PKEY *pk) { /* Check types that we know about */ if (EVP_PKEY_is_a(pk, "DH")) @@ -1316,7 +1322,7 @@ int cms_pkey_get_ri_type(EVP_PKEY *pk) return CMS_RECIPINFO_TRANS; } -int cms_pkey_is_ri_type_supported(EVP_PKEY *pk, int ri_type) +int ossl_cms_pkey_is_ri_type_supported(EVP_PKEY *pk, int ri_type) { int supportedRiType; @@ -1329,7 +1335,7 @@ int cms_pkey_is_ri_type_supported(EVP_PKEY *pk, int ri_type) return r; } - supportedRiType = cms_pkey_get_ri_type(pk); + supportedRiType = ossl_cms_pkey_get_ri_type(pk); if (supportedRiType < 0) return 0; diff --git a/crypto/cms/cms_ess.c b/crypto/cms/cms_ess.c index 2cdad46efb..b8b0076e03 100644 --- a/crypto/cms/cms_ess.c +++ b/crypto/cms/cms_ess.c @@ -52,18 +52,19 @@ int CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **prr) the |cert_ids|(Hash+IssuerID) list from this ESS_SIGNING_CERT. Derived from ts_check_signing_certs() */ -int ess_check_signing_certs(CMS_SignerInfo *si, STACK_OF(X509) *chain) +int ossl_ess_check_signing_certs(CMS_SignerInfo *si, STACK_OF(X509) *chain) { ESS_SIGNING_CERT *ss = NULL; ESS_SIGNING_CERT_V2 *ssv2 = NULL; X509 *cert; int i = 0, ret = 0; - if (cms_signerinfo_get_signing_cert(si, &ss) > 0 && ss->cert_ids != NULL) { + if (ossl_cms_signerinfo_get_signing_cert(si, &ss) > 0 + && ss->cert_ids != NULL) { STACK_OF(ESS_CERT_ID) *cert_ids = ss->cert_ids; cert = sk_X509_value(chain, 0); - if (ess_find_cert(cert_ids, cert) != 0) + if (ossl_ess_find_cert(cert_ids, cert) != 0) goto err; /* @@ -74,16 +75,16 @@ int ess_check_signing_certs(CMS_SignerInfo *si, STACK_OF(X509) *chain) /* for each chain cert, try to find its cert id */ for (i = 1; i < sk_X509_num(chain); ++i) { cert = sk_X509_value(chain, i); - if (ess_find_cert(cert_ids, cert) < 0) + if (ossl_ess_find_cert(cert_ids, cert) < 0) goto err; } } - } else if (cms_signerinfo_get_signing_cert_v2(si, &ssv2) > 0 + } else if (ossl_cms_signerinfo_get_signing_cert_v2(si, &ssv2) > 0 && ssv2->cert_ids!= NULL) { STACK_OF(ESS_CERT_ID_V2) *cert_ids_v2 = ssv2->cert_ids; cert = sk_X509_value(chain, 0); - if (ess_find_cert_v2(cert_ids_v2, cert) != 0) + if (ossl_ess_find_cert_v2(cert_ids_v2, cert) != 0) goto err; /* @@ -94,7 +95,7 @@ int ess_check_signing_certs(CMS_SignerInfo *si, STACK_OF(X509) *chain) /* for each chain cert, try to find its cert id */ for (i = 1; i < sk_X509_num(chain); ++i) { cert = sk_X509_value(chain, i); - if (ess_find_cert_v2(cert_ids_v2, cert) < 0) + if (ossl_ess_find_cert_v2(cert_ids_v2, cert) < 0) goto err; } } @@ -220,15 +221,15 @@ static int cms_msgSigDigest(CMS_SignerInfo *si, return 0; if (!asn1_item_digest_ex(ASN1_ITEM_rptr(CMS_Attributes_Verify), md, si->signedAttrs, dig, diglen, - cms_ctx_get0_libctx(si->cms_ctx), - cms_ctx_get0_propq(si->cms_ctx))) + ossl_cms_ctx_get0_libctx(si->cms_ctx), + ossl_cms_ctx_get0_propq(si->cms_ctx))) return 0; return 1; } /* Add a msgSigDigest attribute to a SignerInfo */ -int cms_msgSigDigest_add1(CMS_SignerInfo *dest, CMS_SignerInfo *src) +int ossl_cms_msgSigDigest_add1(CMS_SignerInfo *dest, CMS_SignerInfo *src) { unsigned char dig[EVP_MAX_MD_SIZE]; unsigned int diglen; @@ -247,7 +248,7 @@ int cms_msgSigDigest_add1(CMS_SignerInfo *dest, CMS_SignerInfo *src) /* Verify signed receipt after it has already passed normal CMS verify */ -int cms_Receipt_verify(CMS_ContentInfo *cms, CMS_ContentInfo *req_cms) +int ossl_cms_Receipt_verify(CMS_ContentInfo *cms, CMS_ContentInfo *req_cms) { int r = 0, i; CMS_ReceiptRequest *rr = NULL; @@ -376,7 +377,7 @@ int cms_Receipt_verify(CMS_ContentInfo *cms, CMS_ContentInfo *req_cms) * SignedData ContentInfo. */ -ASN1_OCTET_STRING *cms_encode_Receipt(CMS_SignerInfo *si) +ASN1_OCTET_STRING *ossl_cms_encode_Receipt(CMS_SignerInfo *si) { CMS_Receipt rct; CMS_ReceiptRequest *rr = NULL; @@ -418,7 +419,7 @@ ASN1_OCTET_STRING *cms_encode_Receipt(CMS_SignerInfo *si) * Add signer certificate's V2 digest |sc| to a SignerInfo structure |si| */ -int cms_add1_signing_cert_v2(CMS_SignerInfo *si, ESS_SIGNING_CERT_V2 *sc) +int ossl_cms_add1_signing_cert_v2(CMS_SignerInfo *si, ESS_SIGNING_CERT_V2 *sc) { ASN1_STRING *seq = NULL; unsigned char *p, *pp = NULL; @@ -450,7 +451,7 @@ int cms_add1_signing_cert_v2(CMS_SignerInfo *si, ESS_SIGNING_CERT_V2 *sc) * Add signer certificate's digest |sc| to a SignerInfo structure |si| */ -int cms_add1_signing_cert(CMS_SignerInfo *si, ESS_SIGNING_CERT *sc) +int ossl_cms_add1_signing_cert(CMS_SignerInfo *si, ESS_SIGNING_CERT *sc) { ASN1_STRING *seq = NULL; unsigned char *p, *pp = NULL; diff --git a/crypto/cms/cms_io.c b/crypto/cms/cms_io.c index 39c44d8416..6b71ddfa90 100644 --- a/crypto/cms/cms_io.c +++ b/crypto/cms/cms_io.c @@ -39,7 +39,7 @@ CMS_ContentInfo *d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms) ci = ASN1_item_d2i_bio(ASN1_ITEM_rptr(CMS_ContentInfo), bp, cms); if (ci != NULL) - cms_resolve_libctx(ci); + ossl_cms_resolve_libctx(ci); return ci; } @@ -76,7 +76,7 @@ int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags) STACK_OF(X509_ALGOR) *mdalgs; int ctype_nid = OBJ_obj2nid(cms->contentType); int econt_nid = OBJ_obj2nid(CMS_get0_eContentType(cms)); - const CMS_CTX *ctx = cms_get0_cmsctx(cms); + const CMS_CTX *ctx = ossl_cms_get0_cmsctx(cms); if (ctype_nid == NID_pkcs7_signed) mdalgs = cms->d.signedData->digestAlgorithms; @@ -86,8 +86,8 @@ int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags) 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)); + ossl_cms_ctx_get0_libctx(ctx), + ossl_cms_ctx_get0_propq(ctx)); } CMS_ContentInfo *SMIME_read_CMS_ex(BIO *bio, BIO **bcont, CMS_ContentInfo **cms) @@ -98,7 +98,7 @@ CMS_ContentInfo *SMIME_read_CMS_ex(BIO *bio, BIO **bcont, CMS_ContentInfo **cms) ASN1_ITEM_rptr(CMS_ContentInfo), (ASN1_VALUE **)cms); if (ci != NULL) - cms_resolve_libctx(ci); + ossl_cms_resolve_libctx(ci); return ci; } diff --git a/crypto/cms/cms_kari.c b/crypto/cms/cms_kari.c index 304a5f88e9..1422f350b0 100644 --- a/crypto/cms/cms_kari.c +++ b/crypto/cms/cms_kari.c @@ -104,9 +104,9 @@ int CMS_RecipientInfo_kari_orig_id_cmp(CMS_RecipientInfo *ri, X509 *cert) } oik = ri->d.kari->originator; if (oik->type == CMS_OIK_ISSUER_SERIAL) - return cms_ias_cert_cmp(oik->d.issuerAndSerialNumber, cert); + return ossl_cms_ias_cert_cmp(oik->d.issuerAndSerialNumber, cert); else if (oik->type == CMS_OIK_KEYIDENTIFIER) - return cms_keyid_cert_cmp(oik->d.subjectKeyIdentifier, cert); + return ossl_cms_keyid_cert_cmp(oik->d.subjectKeyIdentifier, cert); return -1; } @@ -151,14 +151,16 @@ int CMS_RecipientEncryptedKey_cert_cmp(CMS_RecipientEncryptedKey *rek, CMS_KeyAgreeRecipientIdentifier *rid = rek->rid; if (rid->type == CMS_REK_ISSUER_SERIAL) - return cms_ias_cert_cmp(rid->d.issuerAndSerialNumber, cert); + return ossl_cms_ias_cert_cmp(rid->d.issuerAndSerialNumber, |