summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authoratishkov <a.tishkov@aladdin.ru>2023-07-17 13:10:44 +0300
committerTomas Mraz <tomas@openssl.org>2023-07-19 14:48:21 +0200
commitdfdc9e364db78b24b7107db12c52e02f3b227fa3 (patch)
tree11f498e9c4d25ded439365de4960bac5841220bf /apps
parent1ec281fc6d40c15d41ca0f762e753743b2643d7a (diff)
apps/cms.c: Fix unreachable code in cms_main()
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21474) (cherry picked from commit 8c34367e434c6b9555f21cc4fc77a18d6ef84a85)
Diffstat (limited to 'apps')
-rw-r--r--apps/cms.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/apps/cms.c b/apps/cms.c
index 76c7896719..dbb5145611 100644
--- a/apps/cms.c
+++ b/apps/cms.c
@@ -796,6 +796,9 @@ int cms_main(int argc, char **argv)
if ((operation & SMIME_IP) == 0 && contfile != NULL)
BIO_printf(bio_err,
"Warning: -contfile option is ignored for the given operation\n");
+ if (operation != SMIME_ENCRYPT && *argv != NULL)
+ BIO_printf(bio_err,
+ "Warning: recipient certificate file parameters ignored for operation other than -encrypt\n");
if ((flags & CMS_BINARY) != 0) {
if (!(operation & SMIME_OP))
@@ -823,19 +826,13 @@ int cms_main(int argc, char **argv)
goto end;
}
- if (*argv != NULL) {
- if (operation == SMIME_ENCRYPT) {
- for (; *argv != NULL; argv++) {
- cert = load_cert(*argv, FORMAT_UNDEF,
- "recipient certificate file");
- if (cert == NULL)
- goto end;
- sk_X509_push(encerts, cert);
- cert = NULL;
- }
- } else {
- BIO_printf(bio_err, "Warning: recipient certificate file parameters ignored for operation other than -encrypt\n");
- }
+ for (; *argv != NULL; argv++) {
+ cert = load_cert(*argv, FORMAT_UNDEF,
+ "recipient certificate file");
+ if (cert == NULL)
+ goto end;
+ sk_X509_push(encerts, cert);
+ cert = NULL;
}
}