Lines Matching refs:ri
110 int ossl_cms_env_asn1_ctrl(CMS_RecipientInfo *ri, int cmd) in ossl_cms_env_asn1_ctrl() argument
114 if (ri->type == CMS_RECIPINFO_TRANS) in ossl_cms_env_asn1_ctrl()
115 pkey = ri->d.ktri->pkey; in ossl_cms_env_asn1_ctrl()
116 else if (ri->type == CMS_RECIPINFO_AGREE) { in ossl_cms_env_asn1_ctrl()
117 EVP_PKEY_CTX *pctx = ri->d.kari->pctx; in ossl_cms_env_asn1_ctrl()
128 return ossl_cms_dh_envelope(ri, cmd); in ossl_cms_env_asn1_ctrl()
130 return ossl_cms_ecdh_envelope(ri, cmd); in ossl_cms_env_asn1_ctrl()
132 return ossl_cms_rsa_envelope(ri, cmd); in ossl_cms_env_asn1_ctrl()
137 i = pkey->ameth->pkey_ctrl(pkey, ASN1_PKEY_CTRL_CMS_ENVELOPE, cmd, ri); in ossl_cms_env_asn1_ctrl()
182 CMS_RecipientInfo *ri; in ossl_cms_RecipientInfos_set_cmsctx() local
187 ri = sk_CMS_RecipientInfo_value(rinfos, i); in ossl_cms_RecipientInfos_set_cmsctx()
188 if (ri != NULL) { in ossl_cms_RecipientInfos_set_cmsctx()
189 switch (ri->type) { in ossl_cms_RecipientInfos_set_cmsctx()
191 ri->d.kari->cms_ctx = ctx; in ossl_cms_RecipientInfos_set_cmsctx()
194 ri->d.ktri->cms_ctx = ctx; in ossl_cms_RecipientInfos_set_cmsctx()
195 ossl_x509_set0_libctx(ri->d.ktri->recip, in ossl_cms_RecipientInfos_set_cmsctx()
200 ri->d.kekri->cms_ctx = ctx; in ossl_cms_RecipientInfos_set_cmsctx()
203 ri->d.pwri->cms_ctx = ctx; in ossl_cms_RecipientInfos_set_cmsctx()
212 int CMS_RecipientInfo_type(CMS_RecipientInfo *ri) in CMS_RecipientInfo_type() argument
214 return ri->type; in CMS_RecipientInfo_type()
217 EVP_PKEY_CTX *CMS_RecipientInfo_get0_pkey_ctx(CMS_RecipientInfo *ri) in CMS_RecipientInfo_get0_pkey_ctx() argument
219 if (ri->type == CMS_RECIPINFO_TRANS) in CMS_RecipientInfo_get0_pkey_ctx()
220 return ri->d.ktri->pctx; in CMS_RecipientInfo_get0_pkey_ctx()
221 else if (ri->type == CMS_RECIPINFO_AGREE) in CMS_RecipientInfo_get0_pkey_ctx()
222 return ri->d.kari->pctx; in CMS_RecipientInfo_get0_pkey_ctx()
329 static int cms_RecipientInfo_ktri_init(CMS_RecipientInfo *ri, X509 *recip, in cms_RecipientInfo_ktri_init() argument
336 ri->d.ktri = M_ASN1_new_of(CMS_KeyTransRecipientInfo); in cms_RecipientInfo_ktri_init()
337 if (!ri->d.ktri) in cms_RecipientInfo_ktri_init()
339 ri->type = CMS_RECIPINFO_TRANS; in cms_RecipientInfo_ktri_init()
341 ktri = ri->d.ktri; in cms_RecipientInfo_ktri_init()
374 } else if (!ossl_cms_env_asn1_ctrl(ri, 0)) in cms_RecipientInfo_ktri_init()
387 CMS_RecipientInfo *ri = NULL; in CMS_add1_recipient() local
397 ri = M_ASN1_new_of(CMS_RecipientInfo); in CMS_add1_recipient()
398 if (ri == NULL) { in CMS_add1_recipient()
412 if (!cms_RecipientInfo_ktri_init(ri, recip, pk, flags, ctx)) in CMS_add1_recipient()
417 if (!ossl_cms_RecipientInfo_kari_init(ri, recip, pk, originator, in CMS_add1_recipient()
428 if (!sk_CMS_RecipientInfo_push(ris, ri)) { in CMS_add1_recipient()
433 return ri; in CMS_add1_recipient()
436 M_ASN1_free_of(ri, CMS_RecipientInfo); in CMS_add1_recipient()
447 int CMS_RecipientInfo_ktri_get0_algs(CMS_RecipientInfo *ri, in CMS_RecipientInfo_ktri_get0_algs() argument
452 if (ri->type != CMS_RECIPINFO_TRANS) { in CMS_RecipientInfo_ktri_get0_algs()
457 ktri = ri->d.ktri; in CMS_RecipientInfo_ktri_get0_algs()
468 int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri, in CMS_RecipientInfo_ktri_get0_signer_id() argument
474 if (ri->type != CMS_RECIPINFO_TRANS) { in CMS_RecipientInfo_ktri_get0_signer_id()
478 ktri = ri->d.ktri; in CMS_RecipientInfo_ktri_get0_signer_id()
484 int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert) in CMS_RecipientInfo_ktri_cert_cmp() argument
486 if (ri->type != CMS_RECIPINFO_TRANS) { in CMS_RecipientInfo_ktri_cert_cmp()
490 return ossl_cms_SignerIdentifier_cert_cmp(ri->d.ktri->rid, cert); in CMS_RecipientInfo_ktri_cert_cmp()
493 int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey) in CMS_RecipientInfo_set0_pkey() argument
495 if (ri->type != CMS_RECIPINFO_TRANS) { in CMS_RecipientInfo_set0_pkey()
499 EVP_PKEY_free(ri->d.ktri->pkey); in CMS_RecipientInfo_set0_pkey()
500 ri->d.ktri->pkey = pkey; in CMS_RecipientInfo_set0_pkey()
507 CMS_RecipientInfo *ri) in cms_RecipientInfo_ktri_encrypt() argument
518 if (ri->type != CMS_RECIPINFO_TRANS) { in cms_RecipientInfo_ktri_encrypt()
522 ktri = ri->d.ktri; in cms_RecipientInfo_ktri_encrypt()
528 if (!ossl_cms_env_asn1_ctrl(ri, 0)) in cms_RecipientInfo_ktri_encrypt()
566 CMS_RecipientInfo *ri) in cms_RecipientInfo_ktri_decrypt() argument
568 CMS_KeyTransRecipientInfo *ktri = ri->d.ktri; in cms_RecipientInfo_ktri_decrypt()
620 if (!ossl_cms_env_asn1_ctrl(ri, 1)) in cms_RecipientInfo_ktri_decrypt()
652 int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri, in CMS_RecipientInfo_kekri_id_cmp() argument
657 if (ri->type != CMS_RECIPINFO_KEK) { in CMS_RecipientInfo_kekri_id_cmp()
661 kekri = ri->d.kekri; in CMS_RecipientInfo_kekri_id_cmp()
695 CMS_RecipientInfo *ri = NULL; in CMS_add0_recipient_key() local
738 ri = M_ASN1_new_of(CMS_RecipientInfo); in CMS_add0_recipient_key()
739 if (!ri) { in CMS_add0_recipient_key()
744 ri->d.kekri = M_ASN1_new_of(CMS_KEKRecipientInfo); in CMS_add0_recipient_key()
745 if (!ri->d.kekri) { in CMS_add0_recipient_key()
749 ri->type = CMS_RECIPINFO_KEK; in CMS_add0_recipient_key()
751 kekri = ri->d.kekri; in CMS_add0_recipient_key()
761 if (!sk_CMS_RecipientInfo_push(ris, ri)) { in CMS_add0_recipient_key()
785 return ri; in CMS_add0_recipient_key()
788 M_ASN1_free_of(ri, CMS_RecipientInfo); in CMS_add0_recipient_key()
792 int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri, in CMS_RecipientInfo_kekri_get0_id() argument
800 if (ri->type != CMS_RECIPINFO_KEK) { in CMS_RecipientInfo_kekri_get0_id()
804 rkid = ri->d.kekri->kekid; in CMS_RecipientInfo_kekri_get0_id()
806 *palg = ri->d.kekri->keyEncryptionAlgorithm; in CMS_RecipientInfo_kekri_get0_id()
826 int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri, in CMS_RecipientInfo_set0_key() argument
830 if (ri->type != CMS_RECIPINFO_KEK) { in CMS_RecipientInfo_set0_key()
835 kekri = ri->d.kekri; in CMS_RecipientInfo_set0_key()
866 CMS_RecipientInfo *ri) in cms_RecipientInfo_kekri_encrypt() argument
882 kekri = ri->d.kekri; in cms_RecipientInfo_kekri_encrypt()
935 CMS_RecipientInfo *ri) in cms_RecipientInfo_kekri_decrypt() argument
951 kekri = ri->d.kekri; in cms_RecipientInfo_kekri_decrypt()
1012 int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri) in CMS_RecipientInfo_decrypt() argument
1014 switch (ri->type) { in CMS_RecipientInfo_decrypt()
1016 return cms_RecipientInfo_ktri_decrypt(cms, ri); in CMS_RecipientInfo_decrypt()
1019 return cms_RecipientInfo_kekri_decrypt(cms, ri); in CMS_RecipientInfo_decrypt()
1022 return ossl_cms_RecipientInfo_pwri_crypt(cms, ri, 0); in CMS_RecipientInfo_decrypt()
1030 int CMS_RecipientInfo_encrypt(const CMS_ContentInfo *cms, CMS_RecipientInfo *ri) in CMS_RecipientInfo_encrypt() argument
1032 switch (ri->type) { in CMS_RecipientInfo_encrypt()
1034 return cms_RecipientInfo_ktri_encrypt(cms, ri); in CMS_RecipientInfo_encrypt()
1037 return ossl_cms_RecipientInfo_kari_encrypt(cms, ri); in CMS_RecipientInfo_encrypt()
1040 return cms_RecipientInfo_kekri_encrypt(cms, ri); in CMS_RecipientInfo_encrypt()
1043 return ossl_cms_RecipientInfo_pwri_crypt(cms, ri, 1); in CMS_RecipientInfo_encrypt()
1084 CMS_RecipientInfo *ri; in cms_env_set_version() local
1098 ri = sk_CMS_RecipientInfo_value(env->recipientInfos, i); in cms_env_set_version()
1099 if (ri->type == CMS_RECIPINFO_PASS || ri->type == CMS_RECIPINFO_OTHER) { in cms_env_set_version()
1102 } else if (ri->type != CMS_RECIPINFO_TRANS in cms_env_set_version()
1103 || ri->d.ktri->version != 0) { in cms_env_set_version()
1118 CMS_RecipientInfo *ri; in cms_env_encrypt_content_key() local
1121 ri = sk_CMS_RecipientInfo_value(ris, i); in cms_env_encrypt_content_key()
1122 if (CMS_RecipientInfo_encrypt(cms, ri) <= 0) in cms_env_encrypt_content_key()