[openssl-commits] [openssl] master update

Rich Salz rsalz at openssl.org
Sun Jun 26 21:28:40 UTC 2016


The branch master has been updated
       via  dca5eeb4d06262b5e48f21af5e5d4dd672a8c5af (commit)
      from  5d28ff38fd4127c5894d22533e842ee446c3d3c2 (commit)


- Log -----------------------------------------------------------------
commit dca5eeb4d06262b5e48f21af5e5d4dd672a8c5af
Author: Rich Salz <rsalz at akamai.com>
Date:   Sun Jun 26 14:34:00 2016 -0400

    RT2680: Public EC key is shown as private
    
    Re-implemented as suggested by Steve Henson.
    Also change ECParameters_print the same way.
    
    Reviewed-by: Dr. Stephen Henson <steve at openssl.org>

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

Summary of changes:
 crypto/ec/ec_ameth.c | 13 +++++++++++++
 crypto/ec/eck_prn.c  | 24 ------------------------
 2 files changed, 13 insertions(+), 24 deletions(-)

diff --git a/crypto/ec/ec_ameth.c b/crypto/ec/ec_ameth.c
index 6567a2f..7fcc2c8 100644
--- a/crypto/ec/ec_ameth.c
+++ b/crypto/ec/ec_ameth.c
@@ -543,6 +543,19 @@ const EVP_PKEY_ASN1_METHOD eckey_asn1_meth = {
     old_ec_priv_encode
 };
 
+int EC_KEY_print(BIO *bp, const EC_KEY *x, int off)
+{
+    int private = EC_KEY_get0_private_key(x) != NULL;
+
+    return do_EC_KEY_print(bp, x, off,
+                private ? EC_KEY_PRINT_PUBLIC : EC_KEY_PRINT_PUBLIC);
+}
+
+int ECParameters_print(BIO *bp, const EC_KEY *x)
+{
+    return do_EC_KEY_print(bp, x, 4, EC_KEY_PRINT_PARAM);
+}
+
 #ifndef OPENSSL_NO_CMS
 
 static int ecdh_cms_set_peerkey(EVP_PKEY_CTX *pctx,
diff --git a/crypto/ec/eck_prn.c b/crypto/ec/eck_prn.c
index c23d36f..dd3f857 100644
--- a/crypto/ec/eck_prn.c
+++ b/crypto/ec/eck_prn.c
@@ -66,30 +66,6 @@ int ECParameters_print_fp(FILE *fp, const EC_KEY *x)
 }
 #endif
 
-int EC_KEY_print(BIO *bp, const EC_KEY *x, int off)
-{
-    EVP_PKEY *pk;
-    int ret;
-    pk = EVP_PKEY_new();
-    if (pk == NULL || !EVP_PKEY_set1_EC_KEY(pk, (EC_KEY *)x))
-        return 0;
-    ret = EVP_PKEY_print_private(bp, pk, off, NULL);
-    EVP_PKEY_free(pk);
-    return ret;
-}
-
-int ECParameters_print(BIO *bp, const EC_KEY *x)
-{
-    EVP_PKEY *pk;
-    int ret;
-    pk = EVP_PKEY_new();
-    if (pk == NULL || !EVP_PKEY_set1_EC_KEY(pk, (EC_KEY *)x))
-        return 0;
-    ret = EVP_PKEY_print_params(bp, pk, 4, NULL);
-    EVP_PKEY_free(pk);
-    return ret;
-}
-
 static int print_bin(BIO *fp, const char *str, const unsigned char *num,
                      size_t len, int off);
 


More information about the openssl-commits mailing list