Commit 2157adf6 authored by Konstantin Shemyak's avatar Konstantin Shemyak
Browse files

Corrected 'cms' exit status when key or certificate cannot be opened



A backport of #4997.
Fixes #4996.

Reviewed-by: default avatarMatt Caswell <matt@openssl.org>
Reviewed-by: default avatarBernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/5020)
parent 58cc2962
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -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;