summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2023-03-12 17:29:02 +0000
committertb <>2023-03-12 17:29:02 +0000
commit2bc94b417c66333b4acae96b46d4aff34b3813cd (patch)
tree123977fbf1c7356e7153139baaf88b154f6912db /src
parentb47b779f39c9bb247f8b61b2cf22ed2c7941ef56 (diff)
downloadopenbsd-2bc94b417c66333b4acae96b46d4aff34b3813cd.tar.gz
openbsd-2bc94b417c66333b4acae96b46d4aff34b3813cd.tar.bz2
openbsd-2bc94b417c66333b4acae96b46d4aff34b3813cd.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/cms/cms_asn1.c10
-rw-r--r--src/lib/libcrypto/pkcs7/pk7_asn1.c3
2 files changed, 8 insertions, 5 deletions
diff --git a/src/lib/libcrypto/cms/cms_asn1.c b/src/lib/libcrypto/cms/cms_asn1.c
index d6138f93aa..5285afd7ff 100644
--- a/src/lib/libcrypto/cms/cms_asn1.c
+++ b/src/lib/libcrypto/cms/cms_asn1.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cms_asn1.c,v 1.20 2022/11/26 16:08:51 tb Exp $ */ 1/* $OpenBSD: cms_asn1.c,v 1.21 2023/03/12 17:29:02 tb Exp $ */
2/* 2/*
3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
4 * project. 4 * project.
@@ -1335,16 +1335,18 @@ cms_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg)
1335{ 1335{
1336 ASN1_STREAM_ARG *sarg = exarg; 1336 ASN1_STREAM_ARG *sarg = exarg;
1337 CMS_ContentInfo *cms = NULL; 1337 CMS_ContentInfo *cms = NULL;
1338
1338 if (pval) 1339 if (pval)
1339 cms = (CMS_ContentInfo *)*pval; 1340 cms = (CMS_ContentInfo *)*pval;
1340 else 1341 else
1341 return 1; 1342 return 1;
1342 switch (operation) {
1343 1343
1344 switch (operation) {
1344 case ASN1_OP_STREAM_PRE: 1345 case ASN1_OP_STREAM_PRE:
1345 if (CMS_stream(&sarg->boundary, cms) <= 0) 1346 if (CMS_stream(&sarg->boundary, cms) <= 0)
1346 return 0; 1347 return 0;
1347 /* fall thru */ 1348 /* FALLTHROUGH */
1349
1348 case ASN1_OP_DETACHED_PRE: 1350 case ASN1_OP_DETACHED_PRE:
1349 sarg->ndef_bio = CMS_dataInit(cms, sarg->out); 1351 sarg->ndef_bio = CMS_dataInit(cms, sarg->out);
1350 if (!sarg->ndef_bio) 1352 if (!sarg->ndef_bio)
@@ -1356,8 +1358,8 @@ cms_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg)
1356 if (CMS_dataFinal(cms, sarg->ndef_bio) <= 0) 1358 if (CMS_dataFinal(cms, sarg->ndef_bio) <= 0)
1357 return 0; 1359 return 0;
1358 break; 1360 break;
1359
1360 } 1361 }
1362
1361 return 1; 1363 return 1;
1362} 1364}
1363 1365
diff --git a/src/lib/libcrypto/pkcs7/pk7_asn1.c b/src/lib/libcrypto/pkcs7/pk7_asn1.c
index e5366ca45e..f24f6be347 100644
--- a/src/lib/libcrypto/pkcs7/pk7_asn1.c
+++ b/src/lib/libcrypto/pkcs7/pk7_asn1.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pk7_asn1.c,v 1.15 2023/02/16 08:38:17 tb Exp $ */ 1/* $OpenBSD: pk7_asn1.c,v 1.16 2023/03/12 17:29:02 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 2000. 3 * project 2000.
4 */ 4 */
@@ -163,6 +163,7 @@ pk7_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg)
163 case ASN1_OP_STREAM_PRE: 163 case ASN1_OP_STREAM_PRE:
164 if (PKCS7_stream(&sarg->boundary, *pp7) <= 0) 164 if (PKCS7_stream(&sarg->boundary, *pp7) <= 0)
165 return 0; 165 return 0;
166 /* FALLTHROUGH */
166 167
167 case ASN1_OP_DETACHED_PRE: 168 case ASN1_OP_DETACHED_PRE:
168 sarg->ndef_bio = PKCS7_dataInit(*pp7, sarg->out); 169 sarg->ndef_bio = PKCS7_dataInit(*pp7, sarg->out);