summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2018-03-24 15:17:11 +0100
committerBernd Edlinger <bernd.edlinger@hotmail.de>2018-03-25 11:12:46 +0200
commit4bdc25b07f007d9c383fbad159f81543f2e95965 (patch)
tree4dd4869ea055cf0e8c5a59292c90c885baa28594
parentAdds multiple checks to avoid buffer over reads (diff)
downloadopenssl-4bdc25b07f007d9c383fbad159f81543f2e95965.tar.xz
openssl-4bdc25b07f007d9c383fbad159f81543f2e95965.zip
Fix ecparam -genkey with point compression or DER outform
Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5741)
-rw-r--r--apps/ecparam.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/apps/ecparam.c b/apps/ecparam.c
index 51877f5991..2290242310 100644
--- a/apps/ecparam.c
+++ b/apps/ecparam.c
@@ -384,6 +384,9 @@ int ecparam_main(int argc, char **argv)
"}\n");
}
+ if (outformat == FORMAT_ASN1 && genkey)
+ noout = 1;
+
if (!noout) {
if (outformat == FORMAT_ASN1)
i = i2d_ECPKParameters_bio(out, group);
@@ -410,6 +413,9 @@ int ecparam_main(int argc, char **argv)
goto end;
}
+ if (new_form)
+ EC_KEY_set_conv_form(eckey, form);
+
if (!EC_KEY_generate_key(eckey)) {
BIO_printf(bio_err, "unable to generate key\n");
EC_KEY_free(eckey);