[openssl-commits] [openssl] master update

Dr. Stephen Henson steve at openssl.org
Mon Feb 1 15:12:22 UTC 2016


The branch master has been updated
       via  167548061dd00cc1f2ea36b6c3113165f1b643a4 (commit)
       via  f6de4eb77f667e14fa6fb4024107ccd094fdc9b1 (commit)
      from  f1f07a2367e5381ff6e96a89b2512adfa3e14d0e (commit)


- Log -----------------------------------------------------------------
commit 167548061dd00cc1f2ea36b6c3113165f1b643a4
Author: Dr. Stephen Henson <steve at openssl.org>
Date:   Wed Jan 27 23:45:15 2016 +0000

    add option to exclude public key from EC keys
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit f6de4eb77f667e14fa6fb4024107ccd094fdc9b1
Author: Dr. Stephen Henson <steve at openssl.org>
Date:   Mon Jan 25 16:59:19 2016 +0000

    Fix memory leak and print out keygen errors.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 apps/ec.c       | 11 ++++++++++-
 apps/ecparam.c  |  8 +++++++-
 doc/apps/ec.pod |  5 +++++
 3 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/apps/ec.c b/apps/ec.c
index 8800cdf..a0a96b7 100644
--- a/apps/ec.c
+++ b/apps/ec.c
@@ -83,7 +83,8 @@ typedef enum OPTION_choice {
     OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
     OPT_INFORM, OPT_OUTFORM, OPT_ENGINE, OPT_IN, OPT_OUT,
     OPT_NOOUT, OPT_TEXT, OPT_PARAM_OUT, OPT_PUBIN, OPT_PUBOUT,
-    OPT_PASSIN, OPT_PASSOUT, OPT_PARAM_ENC, OPT_CONV_FORM, OPT_CIPHER
+    OPT_PASSIN, OPT_PASSOUT, OPT_PARAM_ENC, OPT_CONV_FORM, OPT_CIPHER,
+    OPT_NO_PUBLIC
 } OPTION_CHOICE;
 
 OPTIONS ec_options[] = {
@@ -97,6 +98,7 @@ OPTIONS ec_options[] = {
     {"param_out", OPT_PARAM_OUT, '-', "Print the elliptic curve parameters"},
     {"pubin", OPT_PUBIN, '-'},
     {"pubout", OPT_PUBOUT, '-'},
+    {"no_public", OPT_NO_PUBLIC, '-', "exclude public key from private key"},
     {"passin", OPT_PASSIN, 's', "Input file pass phrase source"},
     {"passout", OPT_PASSOUT, 's', "Output file pass phrase source"},
     {"param_enc", OPT_PARAM_ENC, 's',
@@ -122,6 +124,7 @@ int ec_main(int argc, char **argv)
     int asn1_flag = OPENSSL_EC_NAMED_CURVE, new_form = 0, new_asn1_flag = 0;
     int informat = FORMAT_PEM, outformat = FORMAT_PEM, text = 0, noout = 0;
     int pubin = 0, pubout = 0, param_out = 0, i, ret = 1, private = 0;
+    int no_public = 0;
 
     prog = opt_init(argc, argv, ec_options);
     while ((o = opt_next()) != OPT_EOF) {
@@ -189,6 +192,9 @@ int ec_main(int argc, char **argv)
             new_asn1_flag = 1;
             asn1_flag = i;
             break;
+        case OPT_NO_PUBLIC:
+            no_public = 1;
+            break;
         }
     }
     argc = opt_num_rest();
@@ -236,6 +242,9 @@ int ec_main(int argc, char **argv)
     if (new_asn1_flag)
         EC_KEY_set_asn1_flag(eckey, asn1_flag);
 
+    if (no_public)
+        EC_KEY_set_enc_flags(eckey, EC_PKEY_NO_PUBKEY);
+
     if (text) {
         assert(pubin || private);
         if (!EC_KEY_print(out, eckey, 0)) {
diff --git a/apps/ecparam.c b/apps/ecparam.c
index 122125e..b90247c 100644
--- a/apps/ecparam.c
+++ b/apps/ecparam.c
@@ -462,11 +462,17 @@ int ecparam_main(int argc, char **argv)
 
         assert(need_rand);
 
-        if (EC_KEY_set_group(eckey, group) == 0)
+        if (EC_KEY_set_group(eckey, group) == 0) {
+            BIO_printf(bio_err, "unable to set group when generating key\n");
+            EC_KEY_free(eckey);
+            ERR_print_errors(bio_err);
             goto end;
+        }
 
         if (!EC_KEY_generate_key(eckey)) {
+            BIO_printf(bio_err, "unable to generate key\n");
             EC_KEY_free(eckey);
+            ERR_print_errors(bio_err);
             goto end;
         }
         assert(private);
diff --git a/doc/apps/ec.pod b/doc/apps/ec.pod
index 379d0a8..0c42d46 100644
--- a/doc/apps/ec.pod
+++ b/doc/apps/ec.pod
@@ -23,6 +23,7 @@ B<openssl> B<ec>
 [B<-pubout>]
 [B<-conv_form arg>]
 [B<-param_enc arg>]
+[B<-no_public>]
 [B<-engine id>]
 
 =head1 DESCRIPTION
@@ -128,6 +129,10 @@ EC parameters structures). The default value is B<named_curve>.
 B<Note> the B<implicitlyCA> alternative ,as specified in RFC 3279,
 is currently not implemented in OpenSSL.
 
+=item B<-no_public>
+
+This option omits the public key components from the private key output.
+
 =item B<-engine id>
 
 specifying an engine (by its unique B<id> string) will cause B<ec>


More information about the openssl-commits mailing list