-/* $OpenBSD: pk7_mime.c,v 1.18 2023/05/02 09:38:33 tb Exp $ */
+/* $OpenBSD: pk7_mime.c,v 1.19 2023/05/02 09:56:12 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
*/
int
SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags)
{
- STACK_OF(X509_ALGOR) *mdalgs;
- int ctype_nid = OBJ_obj2nid(p7->type);
- if (ctype_nid == NID_pkcs7_signed)
+ STACK_OF(X509_ALGOR) *mdalgs = NULL;
+ int ctype_nid;
+
+ if ((ctype_nid = OBJ_obj2nid(p7->type)) == NID_pkcs7_signed)
mdalgs = p7->d.sign->md_algs;
- else
- mdalgs = NULL;
flags ^= SMIME_OLDMIME;
-
return SMIME_write_ASN1(bio, (ASN1_VALUE *)p7, data, flags,
ctype_nid, NID_undef, mdalgs, &PKCS7_it);
}