diff options
author | Nicola Tuveri <nic.tuv@gmail.com> | 2020-11-09 22:35:28 +0200 |
---|---|---|
committer | Nicola Tuveri <nic.tuv@gmail.com> | 2021-01-08 23:59:02 +0200 |
commit | ed37336b6383cacbcbb8f6b1334eba0ad43530d5 (patch) | |
tree | 11a30a6030ac761e2ac39b1a7d17242dc52da8db /apps/pkey.c | |
parent | c5bc5ec849273ae0c3f8b32f1d23c33d93be3203 (diff) |
[apps/pkey] Return error on failed `-[pub]check`
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/13359)
Diffstat (limited to 'apps/pkey.c')
-rw-r--r-- | apps/pkey.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/apps/pkey.c b/apps/pkey.c index 65988a8fc2..67dc8c012c 100644 --- a/apps/pkey.c +++ b/apps/pkey.c @@ -82,6 +82,7 @@ int pkey_main(int argc, char **argv) BIO *in = NULL, *out = NULL; ENGINE *e = NULL; EVP_PKEY *pkey = NULL; + EVP_PKEY_CTX *ctx = NULL; const EVP_CIPHER *cipher = NULL; char *infile = NULL, *outfile = NULL, *passin = NULL, *passout = NULL; char *passinarg = NULL, *passoutarg = NULL, *prog; @@ -231,7 +232,6 @@ int pkey_main(int argc, char **argv) if (check || pub_check) { int r; - EVP_PKEY_CTX *ctx; ctx = EVP_PKEY_CTX_new(pkey, e); if (ctx == NULL) { @@ -260,8 +260,8 @@ int pkey_main(int argc, char **argv) ERR_reason_error_string(err)); ERR_get_error(); /* remove err from error stack */ } + goto end; } - EVP_PKEY_CTX_free(ctx); } if (!noout) { @@ -313,6 +313,7 @@ int pkey_main(int argc, char **argv) end: if (ret != 0) ERR_print_errors(bio_err); + EVP_PKEY_CTX_free(ctx); EVP_PKEY_free(pkey); release_engine(e); BIO_free_all(out); |