summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorKonstantin Shemyak <konstantin@shemyak.com>2017-12-28 23:12:59 +0200
committerKonstantin Shemyak <konstantin@shemyak.com>2018-01-05 15:17:47 +0200
commit2157adf66a3cb43b25a1441c5dcca0b287fa7c0d (patch)
tree7e7950cb233bc6b1d61a1735b18f40869473e327 /apps
parent58cc2962db17183c039bbbd08e31e179c1126c63 (diff)
Corrected 'cms' exit status when key or certificate cannot be opened
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)
Diffstat (limited to 'apps')
-rw-r--r--apps/cms.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/cms.c b/apps/cms.c
index f9a63bc0d0..2626bbb6f8 100644
--- a/apps/cms.c
+++ b/apps/cms.c
@@ -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;