Lines Matching refs:cms
78 static int check_content(CMS_ContentInfo *cms) in check_content() argument
80 ASN1_OCTET_STRING **pos = CMS_get0_content(cms); in check_content()
104 int CMS_data(CMS_ContentInfo *cms, BIO *out, unsigned int flags) in CMS_data() argument
109 if (OBJ_obj2nid(CMS_get0_type(cms)) != NID_pkcs7_data) { in CMS_data()
113 cont = CMS_dataInit(cms, NULL); in CMS_data()
124 CMS_ContentInfo *cms = ossl_cms_Data_create(libctx, propq); in CMS_data_create_ex() local
126 if (cms == NULL) in CMS_data_create_ex()
129 if ((flags & CMS_STREAM) || CMS_final(cms, in, NULL, flags)) in CMS_data_create_ex()
130 return cms; in CMS_data_create_ex()
132 CMS_ContentInfo_free(cms); in CMS_data_create_ex()
141 int CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out, in CMS_digest_verify() argument
147 if (OBJ_obj2nid(CMS_get0_type(cms)) != NID_pkcs7_digest) { in CMS_digest_verify()
152 if (dcont == NULL && !check_content(cms)) in CMS_digest_verify()
155 cont = CMS_dataInit(cms, dcont); in CMS_digest_verify()
161 r = ossl_cms_DigestedData_do_final(cms, cont, 1); in CMS_digest_verify()
170 CMS_ContentInfo *cms; in CMS_digest_create_ex() local
178 cms = ossl_cms_DigestedData_create(md, ctx, propq); in CMS_digest_create_ex()
179 if (cms == NULL) in CMS_digest_create_ex()
183 CMS_set_detached(cms, 0); in CMS_digest_create_ex()
185 if ((flags & CMS_STREAM) || CMS_final(cms, in, NULL, flags)) in CMS_digest_create_ex()
186 return cms; in CMS_digest_create_ex()
188 CMS_ContentInfo_free(cms); in CMS_digest_create_ex()
198 int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms, in CMS_EncryptedData_decrypt() argument
205 if (OBJ_obj2nid(CMS_get0_type(cms)) != NID_pkcs7_encrypted) { in CMS_EncryptedData_decrypt()
210 if (dcont == NULL && !check_content(cms)) in CMS_EncryptedData_decrypt()
213 if (CMS_EncryptedData_set1_key(cms, NULL, key, keylen) <= 0) in CMS_EncryptedData_decrypt()
215 cont = CMS_dataInit(cms, dcont); in CMS_EncryptedData_decrypt()
229 CMS_ContentInfo *cms; in CMS_EncryptedData_encrypt_ex() local
235 cms = CMS_ContentInfo_new_ex(libctx, propq); in CMS_EncryptedData_encrypt_ex()
236 if (cms == NULL) in CMS_EncryptedData_encrypt_ex()
238 if (!CMS_EncryptedData_set1_key(cms, cipher, key, keylen)) in CMS_EncryptedData_encrypt_ex()
242 CMS_set_detached(cms, 0); in CMS_EncryptedData_encrypt_ex()
245 || CMS_final(cms, in, NULL, flags)) in CMS_EncryptedData_encrypt_ex()
246 return cms; in CMS_EncryptedData_encrypt_ex()
248 CMS_ContentInfo_free(cms); in CMS_EncryptedData_encrypt_ex()
304 int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs, in CMS_verify() argument
316 const CMS_CTX *ctx = ossl_cms_get0_cmsctx(cms); in CMS_verify()
318 if (dcont == NULL && !check_content(cms)) in CMS_verify()
321 const ASN1_OBJECT *coid = CMS_get0_eContentType(cms); in CMS_verify()
329 sinfos = CMS_get0_SignerInfos(cms); in CMS_verify()
344 scount += CMS_set1_signers_certs(cms, certs, flags); in CMS_verify()
363 cms_certs = CMS_get1_certs(cms); in CMS_verify()
365 crls = CMS_get1_crls(cms); in CMS_verify()
428 cmsbio = CMS_dataInit(cms, tmpout); in CMS_verify()
444 cmsbio = CMS_dataInit(cms, tmpin); in CMS_verify()
508 CMS_ContentInfo *cms; in CMS_sign_ex() local
511 cms = CMS_ContentInfo_new_ex(libctx, propq); in CMS_sign_ex()
512 if (cms == NULL || !CMS_SignedData_init(cms)) in CMS_sign_ex()
515 && !CMS_set1_eContentType(cms, in CMS_sign_ex()
519 if (pkey != NULL && !CMS_add1_signer(cms, signcert, pkey, NULL, flags)) { in CMS_sign_ex()
527 if (!CMS_add1_cert(cms, x)) in CMS_sign_ex()
532 CMS_set_detached(cms, 0); in CMS_sign_ex()
535 || CMS_final(cms, data, NULL, flags)) in CMS_sign_ex()
536 return cms; in CMS_sign_ex()
544 CMS_ContentInfo_free(cms); in CMS_sign_ex()
559 CMS_ContentInfo *cms = NULL; in CMS_sign_receipt() local
575 cms = CMS_sign_ex(NULL, NULL, certs, NULL, flags, in CMS_sign_receipt()
578 if (cms == NULL) in CMS_sign_receipt()
582 if (!CMS_set1_eContentType(cms, OBJ_nid2obj(NID_id_smime_ct_receipt))) in CMS_sign_receipt()
585 rct_si = CMS_add1_signer(cms, signcert, pkey, NULL, flags); in CMS_sign_receipt()
606 if (!CMS_final(cms, rct_cont, NULL, flags)) in CMS_sign_receipt()
610 pos = CMS_get0_content(cms); in CMS_sign_receipt()
620 return cms; in CMS_sign_receipt()
621 CMS_ContentInfo_free(cms); in CMS_sign_receipt()
630 CMS_ContentInfo *cms; in CMS_encrypt_ex() local
635 cms = (EVP_CIPHER_get_flags(cipher) & EVP_CIPH_FLAG_AEAD_CIPHER) in CMS_encrypt_ex()
638 if (cms == NULL) in CMS_encrypt_ex()
642 if (!CMS_add1_recipient_cert(cms, recip, flags)) { in CMS_encrypt_ex()
649 CMS_set_detached(cms, 0); in CMS_encrypt_ex()
652 || CMS_final(cms, data, NULL, flags)) in CMS_encrypt_ex()
653 return cms; in CMS_encrypt_ex()
660 CMS_ContentInfo_free(cms); in CMS_encrypt_ex()
670 static int cms_kari_set1_pkey_and_peer(CMS_ContentInfo *cms, in cms_kari_set1_pkey_and_peer() argument
686 rv = CMS_RecipientInfo_kari_decrypt(cms, ri, rek); in cms_kari_set1_pkey_and_peer()
695 int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert) in CMS_decrypt_set1_pkey() argument
697 return CMS_decrypt_set1_pkey_and_peer(cms, pk, cert, NULL); in CMS_decrypt_set1_pkey()
700 int CMS_decrypt_set1_pkey_and_peer(CMS_ContentInfo *cms, EVP_PKEY *pk, in CMS_decrypt_set1_pkey_and_peer() argument
708 ris = CMS_get0_RecipientInfos(cms); in CMS_decrypt_set1_pkey_and_peer()
710 debug = ossl_cms_get0_env_enc_content(cms)->debug; in CMS_decrypt_set1_pkey_and_peer()
727 r = cms_kari_set1_pkey_and_peer(cms, ri, pk, cert, peer); in CMS_decrypt_set1_pkey_and_peer()
740 r = CMS_RecipientInfo_decrypt(cms, ri); in CMS_decrypt_set1_pkey_and_peer()
779 int CMS_decrypt_set1_key(CMS_ContentInfo *cms, in CMS_decrypt_set1_key() argument
787 ris = CMS_get0_RecipientInfos(cms); in CMS_decrypt_set1_key()
799 r = CMS_RecipientInfo_decrypt(cms, ri); in CMS_decrypt_set1_key()
816 int CMS_decrypt_set1_password(CMS_ContentInfo *cms, in CMS_decrypt_set1_password() argument
823 ris = CMS_get0_RecipientInfos(cms); in CMS_decrypt_set1_password()
829 r = CMS_RecipientInfo_decrypt(cms, ri); in CMS_decrypt_set1_password()
840 int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert, in CMS_decrypt() argument
846 int nid = OBJ_obj2nid(CMS_get0_type(cms)); in CMS_decrypt()
853 if (dcont == NULL && !check_content(cms)) in CMS_decrypt()
856 ossl_cms_get0_env_enc_content(cms)->debug = 1; in CMS_decrypt()
858 ossl_cms_get0_env_enc_content(cms)->debug = 0; in CMS_decrypt()
860 ossl_cms_get0_env_enc_content(cms)->havenocert = 1; in CMS_decrypt()
862 ossl_cms_get0_env_enc_content(cms)->havenocert = 0; in CMS_decrypt()
865 if (pk != NULL && !CMS_decrypt_set1_pkey(cms, pk, cert)) in CMS_decrypt()
867 cont = CMS_dataInit(cms, dcont); in CMS_decrypt()
875 int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, unsigned int flags) in CMS_final() argument
880 if ((cmsbio = CMS_dataInit(cms, dcont)) == NULL) { in CMS_final()
889 if (!CMS_dataFinal(cms, cmsbio)) { in CMS_final()
902 int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out, in CMS_uncompress() argument
908 if (OBJ_obj2nid(CMS_get0_type(cms)) != NID_id_smime_ct_compressedData) { in CMS_uncompress()
913 if (dcont == NULL && !check_content(cms)) in CMS_uncompress()
916 cont = CMS_dataInit(cms, dcont); in CMS_uncompress()
926 CMS_ContentInfo *cms; in CMS_compress() local
930 cms = ossl_cms_CompressedData_create(comp_nid, NULL, NULL); in CMS_compress()
931 if (cms == NULL) in CMS_compress()
935 CMS_set_detached(cms, 0); in CMS_compress()
937 if ((flags & CMS_STREAM) || CMS_final(cms, in, NULL, flags)) in CMS_compress()
938 return cms; in CMS_compress()
940 CMS_ContentInfo_free(cms); in CMS_compress()
946 int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out, in CMS_uncompress() argument