Commit 5edeb623 authored by Bernd Edlinger's avatar Bernd Edlinger
Browse files

Fix ecparam -genkey with point compression or DER outform



Reviewed-by: default avatarRich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5741)

(cherry picked from commit 4bdc25b0)
parent 1bfb7860
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -393,6 +393,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);
@@ -428,6 +431,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);