Style tweaks for SMIME_write_PKCS7()
authortb <tb@openbsd.org>
Tue, 2 May 2023 09:56:12 +0000 (09:56 +0000)
committertb <tb@openbsd.org>
Tue, 2 May 2023 09:56:12 +0000 (09:56 +0000)
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

lib/libcrypto/pkcs7/pk7_mime.c

index 48fa799..f00e18c 100644 (file)
@@ -1,4 +1,4 @@
-/* $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.
  */
@@ -86,16 +86,14 @@ LCRYPTO_ALIAS(PEM_write_bio_PKCS7_stream);
 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);
 }