From e216474b78d60cd3fe50ea104eaab003d214b7d3 Mon Sep 17 00:00:00 2001 From: jsing Date: Sat, 20 Jun 2015 14:17:07 +0000 Subject: [PATCH] Have ECPKParameters_print() include the NIST curve name, if known. From OpenSSL. ok miod@ (a while ago). --- lib/libcrypto/ec/eck_prn.c | 11 ++++++++++- lib/libssl/src/crypto/ec/eck_prn.c | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/libcrypto/ec/eck_prn.c b/lib/libcrypto/ec/eck_prn.c index aa13d8b08c4..06cdd69591f 100644 --- a/lib/libcrypto/ec/eck_prn.c +++ b/lib/libcrypto/ec/eck_prn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eck_prn.c,v 1.10 2014/07/12 16:03:37 miod Exp $ */ +/* $OpenBSD: eck_prn.c,v 1.11 2015/06/20 14:17:07 jsing Exp $ */ /* * Written by Nils Larsch for the OpenSSL project. */ @@ -161,6 +161,7 @@ ECPKParameters_print(BIO * bp, const EC_GROUP * x, int off) *cofactor = NULL; const unsigned char *seed; size_t seed_len = 0; + const char *nname; static const char *gen_compressed = "Generator (compressed):"; static const char *gen_uncompressed = "Generator (uncompressed):"; @@ -190,6 +191,14 @@ ECPKParameters_print(BIO * bp, const EC_GROUP * x, int off) goto err; if (BIO_printf(bp, "\n") <= 0) goto err; + + nname = EC_curve_nid2nist(nid); + if (nname) { + if (!BIO_indent(bp, off, 128)) + goto err; + if (BIO_printf(bp, "NIST CURVE: %s\n", nname) <= 0) + goto err; + } } else { /* explicit parameters */ int is_char_two = 0; diff --git a/lib/libssl/src/crypto/ec/eck_prn.c b/lib/libssl/src/crypto/ec/eck_prn.c index aa13d8b08c4..06cdd69591f 100644 --- a/lib/libssl/src/crypto/ec/eck_prn.c +++ b/lib/libssl/src/crypto/ec/eck_prn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eck_prn.c,v 1.10 2014/07/12 16:03:37 miod Exp $ */ +/* $OpenBSD: eck_prn.c,v 1.11 2015/06/20 14:17:07 jsing Exp $ */ /* * Written by Nils Larsch for the OpenSSL project. */ @@ -161,6 +161,7 @@ ECPKParameters_print(BIO * bp, const EC_GROUP * x, int off) *cofactor = NULL; const unsigned char *seed; size_t seed_len = 0; + const char *nname; static const char *gen_compressed = "Generator (compressed):"; static const char *gen_uncompressed = "Generator (uncompressed):"; @@ -190,6 +191,14 @@ ECPKParameters_print(BIO * bp, const EC_GROUP * x, int off) goto err; if (BIO_printf(bp, "\n") <= 0) goto err; + + nname = EC_curve_nid2nist(nid); + if (nname) { + if (!BIO_indent(bp, off, 128)) + goto err; + if (BIO_printf(bp, "NIST CURVE: %s\n", nname) <= 0) + goto err; + } } else { /* explicit parameters */ int is_char_two = 0; -- 2.20.1