From: tb Date: Sun, 12 Mar 2023 17:29:02 +0000 (+0000) Subject: pk7_cb() and cms_cb() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a92a32d233212d1924e7eed9ae4fa2ddfef23ef5;p=openbsd pk7_cb() and cms_cb() Add and fix FALLTHROUGH statement. I was confused for way too long since I hadn't noticed that this case fell through to the next. Also add and move some empty lines in the cms_cb() to make this resemble KNF more. --- diff --git a/lib/libcrypto/cms/cms_asn1.c b/lib/libcrypto/cms/cms_asn1.c index d6138f93aa8..5285afd7ff2 100644 --- a/lib/libcrypto/cms/cms_asn1.c +++ b/lib/libcrypto/cms/cms_asn1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cms_asn1.c,v 1.20 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: cms_asn1.c,v 1.21 2023/03/12 17:29:02 tb Exp $ */ /* * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. @@ -1335,16 +1335,18 @@ cms_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) { ASN1_STREAM_ARG *sarg = exarg; CMS_ContentInfo *cms = NULL; + if (pval) cms = (CMS_ContentInfo *)*pval; else return 1; - switch (operation) { + switch (operation) { case ASN1_OP_STREAM_PRE: if (CMS_stream(&sarg->boundary, cms) <= 0) return 0; - /* fall thru */ + /* FALLTHROUGH */ + case ASN1_OP_DETACHED_PRE: sarg->ndef_bio = CMS_dataInit(cms, sarg->out); if (!sarg->ndef_bio) @@ -1356,8 +1358,8 @@ cms_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) if (CMS_dataFinal(cms, sarg->ndef_bio) <= 0) return 0; break; - } + return 1; } diff --git a/lib/libcrypto/pkcs7/pk7_asn1.c b/lib/libcrypto/pkcs7/pk7_asn1.c index e5366ca45e8..f24f6be3477 100644 --- a/lib/libcrypto/pkcs7/pk7_asn1.c +++ b/lib/libcrypto/pkcs7/pk7_asn1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pk7_asn1.c,v 1.15 2023/02/16 08:38:17 tb Exp $ */ +/* $OpenBSD: pk7_asn1.c,v 1.16 2023/03/12 17:29:02 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -163,6 +163,7 @@ pk7_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) case ASN1_OP_STREAM_PRE: if (PKCS7_stream(&sarg->boundary, *pp7) <= 0) return 0; + /* FALLTHROUGH */ case ASN1_OP_DETACHED_PRE: sarg->ndef_bio = PKCS7_dataInit(*pp7, sarg->out);