From: tb Date: Tue, 2 May 2023 09:56:12 +0000 (+0000) Subject: Style tweaks for SMIME_write_PKCS7() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=158e7cafb192e0731982796768038bd07019206e;p=openbsd 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 --- diff --git a/lib/libcrypto/pkcs7/pk7_mime.c b/lib/libcrypto/pkcs7/pk7_mime.c index 48fa79979d4..f00e18c7ef9 100644 --- a/lib/libcrypto/pkcs7/pk7_mime.c +++ b/lib/libcrypto/pkcs7/pk7_mime.c @@ -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); }