[openssl-commits] [openssl] master update
nic.tuv at gmail.com
nic.tuv at gmail.com
Fri Aug 24 12:34:07 UTC 2018
The branch master has been updated
via c87af534e6387dda5b81c762c83b19d014f156b2 (commit)
from 324b95605225410763fe63f7cff36eb46ca54ee9 (commit)
- Log -----------------------------------------------------------------
commit c87af534e6387dda5b81c762c83b19d014f156b2
Author: Dmitry Belyavskiy <beldmit at gmail.com>
Date: Sat Aug 18 19:43:23 2018 +0300
Do not ignore EVP_PKEY_print_public/EVP_PKEY_print_private return values
Reviewed-by: Kurt Roeckx <kurt at roeckx.be>
Reviewed-by: Nicola Tuveri <nic.tuv at gmail.com>
(Merged from https://github.com/openssl/openssl/pull/7007)
-----------------------------------------------------------------------
Summary of changes:
apps/pkey.c | 32 ++++++++++++++++++++------------
1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/apps/pkey.c b/apps/pkey.c
index 760fc1b..0dd5590 100644
--- a/apps/pkey.c
+++ b/apps/pkey.c
@@ -186,23 +186,29 @@ int pkey_main(int argc, char **argv)
if (!noout) {
if (outformat == FORMAT_PEM) {
if (pubout) {
- PEM_write_bio_PUBKEY(out, pkey);
+ if (!PEM_write_bio_PUBKEY(out, pkey))
+ goto end;
} else {
assert(private);
- if (traditional)
- PEM_write_bio_PrivateKey_traditional(out, pkey, cipher,
- NULL, 0, NULL,
- passout);
- else
- PEM_write_bio_PrivateKey(out, pkey, cipher,
- NULL, 0, NULL, passout);
+ if (traditional) {
+ if (!PEM_write_bio_PrivateKey_traditional(out, pkey, cipher,
+ NULL, 0, NULL,
+ passout))
+ goto end;
+ } else {
+ if (!PEM_write_bio_PrivateKey(out, pkey, cipher,
+ NULL, 0, NULL, passout))
+ goto end;
+ }
}
} else if (outformat == FORMAT_ASN1) {
if (pubout) {
- i2d_PUBKEY_bio(out, pkey);
+ if (!i2d_PUBKEY_bio(out, pkey))
+ goto end;
} else {
assert(private);
- i2d_PrivateKey_bio(out, pkey);
+ if (!i2d_PrivateKey_bio(out, pkey))
+ goto end;
}
} else {
BIO_printf(bio_err, "Bad format specified for key\n");
@@ -212,10 +218,12 @@ int pkey_main(int argc, char **argv)
if (text) {
if (pubtext) {
- EVP_PKEY_print_public(out, pkey, 0, NULL);
+ if (EVP_PKEY_print_public(out, pkey, 0, NULL) <= 0)
+ goto end;
} else {
assert(private);
- EVP_PKEY_print_private(out, pkey, 0, NULL);
+ if (EVP_PKEY_print_private(out, pkey, 0, NULL) <= 0)
+ goto end;
}
}
More information about the openssl-commits
mailing list