]> granicus.if.org Git - openssl/commitdiff
Corrected 'cms' exit status when key or certificate cannot be opened
authorKonstantin Shemyak <konstantin@shemyak.com>
Thu, 28 Dec 2017 21:12:59 +0000 (23:12 +0200)
committerKonstantin Shemyak <konstantin@shemyak.com>
Fri, 5 Jan 2018 13:17:47 +0000 (15:17 +0200)
A backport of #4997.
Fixes #4996.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/5020)

apps/cms.c

index f9a63bc0d0968e5a3af8e3b77339ae5c2a4f2c71..2626bbb6f8b5f503f2c23e3c993d7cf8fbf0f8d7 100644 (file)
@@ -977,12 +977,16 @@ int MAIN(int argc, char **argv)
 
             signer = load_cert(bio_err, signerfile, FORMAT_PEM, NULL,
                                e, "signer certificate");
-            if (!signer)
+            if (!signer) {
+                ret = 2;
                 goto end;
+            }
             key = load_key(bio_err, keyfile, keyform, 0, passin, e,
                            "signing key file");
-            if (!key)
+            if (!key) {
+                ret = 2;
                 goto end;
+            }
             for (kparam = key_first; kparam; kparam = kparam->next) {
                 if (kparam->idx == i) {
                     tflags |= CMS_KEY_PARAM;