summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2023-05-02 09:56:12 +0000
committertb <>2023-05-02 09:56:12 +0000
commit9af6dbe70d5ae2a95ae111e23f0f4e8c44a674a9 (patch)
tree9b60ad78359811fbd45de9f8216d214b64f98390
parent429be3436c683c1ebad8877fbe8e1e0b7bf3e957 (diff)
downloadopenbsd-9af6dbe70d5ae2a95ae111e23f0f4e8c44a674a9.tar.gz
openbsd-9af6dbe70d5ae2a95ae111e23f0f4e8c44a674a9.tar.bz2
openbsd-9af6dbe70d5ae2a95ae111e23f0f4e8c44a674a9.zip
Style tweaks for SMIME_write_PKCS7()
Initialize the mdalgs stack at the top and test and assign for ctype_nid. Use an empty line to separate variable declarations from the actual code and zap an extra empty line. ok jsing
-rw-r--r--src/lib/libcrypto/pkcs7/pk7_mime.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/lib/libcrypto/pkcs7/pk7_mime.c b/src/lib/libcrypto/pkcs7/pk7_mime.c
index 48fa79979d..f00e18c7ef 100644
--- a/src/lib/libcrypto/pkcs7/pk7_mime.c
+++ b/src/lib/libcrypto/pkcs7/pk7_mime.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pk7_mime.c,v 1.18 2023/05/02 09:38:33 tb Exp $ */ 1/* $OpenBSD: pk7_mime.c,v 1.19 2023/05/02 09:56:12 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project. 3 * project.
4 */ 4 */
@@ -86,16 +86,14 @@ LCRYPTO_ALIAS(PEM_write_bio_PKCS7_stream);
86int 86int
87SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags) 87SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags)
88{ 88{
89 STACK_OF(X509_ALGOR) *mdalgs; 89 STACK_OF(X509_ALGOR) *mdalgs = NULL;
90 int ctype_nid = OBJ_obj2nid(p7->type); 90 int ctype_nid;
91 if (ctype_nid == NID_pkcs7_signed) 91
92 if ((ctype_nid = OBJ_obj2nid(p7->type)) == NID_pkcs7_signed)
92 mdalgs = p7->d.sign->md_algs; 93 mdalgs = p7->d.sign->md_algs;
93 else
94 mdalgs = NULL;
95 94
96 flags ^= SMIME_OLDMIME; 95 flags ^= SMIME_OLDMIME;
97 96
98
99 return SMIME_write_ASN1(bio, (ASN1_VALUE *)p7, data, flags, 97 return SMIME_write_ASN1(bio, (ASN1_VALUE *)p7, data, flags,
100 ctype_nid, NID_undef, mdalgs, &PKCS7_it); 98 ctype_nid, NID_undef, mdalgs, &PKCS7_it);
101} 99}