Fix ecparam -genkey with point compression or DER outform
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Sat, 24 Mar 2018 14:17:11 +0000 (15:17 +0100)
committerBernd Edlinger <bernd.edlinger@hotmail.de>
Sun, 25 Mar 2018 09:14:57 +0000 (11:14 +0200)
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5741)

(cherry picked from commit 4bdc25b07f007d9c383fbad159f81543f2e95965)

apps/ecparam.c

index a9bf489cdd4c7af22dc0bfa97e979db3524bf491..deb670550316ed90c4baa8239976d0691a20cfdb 100644 (file)
@@ -546,6 +546,9 @@ int MAIN(int argc, char **argv)
         BIO_printf(out, "\treturn(group);\n\t}\n");
     }
 
+    if (outformat == FORMAT_ASN1 && genkey)
+        noout = 1;
+
     if (!noout) {
         if (outformat == FORMAT_ASN1)
             i = i2d_ECPKParameters_bio(out, group);
@@ -582,6 +585,9 @@ int MAIN(int argc, char **argv)
         if (EC_KEY_set_group(eckey, group) == 0)
             goto end;
 
+        if (new_form)
+            EC_KEY_set_conv_form(eckey, form);
+
         if (!EC_KEY_generate_key(eckey)) {
             EC_KEY_free(eckey);
             goto end;