[PATCH 1/4] ecc: rename 512-bit GOST curves

dbaryshkov at gmail.com dbaryshkov at gmail.com
Tue Nov 12 08:58:16 CET 2019


From: Paul Wolneykien <manowar at altlinux.org>

* cipher/ecc-curves.c (domain_parms): rename GOST 2012 curves to contain
  curve bit size
  (curve_aliases): rename curves and provide backwards-compatible
  aliases.
* tests/basic.c (check_pubkey): use new name for GOST2012 512-bit test
  curve.
* tests/benchmark.c (ecc_bench): use new name for GOST2012 512-bit test
  curve.

--
In preparation to adding new GOST2012 curves, rename old GOST2012 curves
to specifically mention that they are 512-bit curves.

Signed-off-by: Paul Wolneykien <manowar at altlinux.org>
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov at gmail.com>
---
 cipher/ecc-curves.c | 12 +++++++-----
 tests/basic.c       |  4 ++--
 tests/benchmark.c   |  2 +-
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/cipher/ecc-curves.c b/cipher/ecc-curves.c
index 581ba4d66e54..4ba66cb353dd 100644
--- a/cipher/ecc-curves.c
+++ b/cipher/ecc-curves.c
@@ -97,8 +97,10 @@ static const struct
     { "GOST2001-CryptoPro-A", "1.2.643.2.2.36.0" },
     { "GOST2001-CryptoPro-C", "1.2.643.2.2.36.1" },
 
-    { "GOST2012-tc26-A", "1.2.643.7.1.2.1.2.1" },
-    { "GOST2012-tc26-B", "1.2.643.7.1.2.1.2.2" },
+    { "GOST2012-512-tc26-A", "GOST2012-tc26-A" },
+    { "GOST2012-512-tc26-B", "GOST2012-tc26-B" },
+    { "GOST2012-512-tc26-A", "1.2.643.7.1.2.1.2.1" },
+    { "GOST2012-512-tc26-B", "1.2.643.7.1.2.1.2.2" },
 
     { "secp256k1", "1.3.132.0.10" },
 
@@ -408,7 +410,7 @@ static const ecc_domain_parms_t domain_parms[] =
       1
     },
     {
-      "GOST2012-test", 511, 0,
+      "GOST2012-512-test", 511, 0,
       MPI_EC_WEIERSTRASS, ECC_DIALECT_STANDARD,
       "0x4531acd1fe0023c7550d267b6b2fee80922b14b2ffb90f04d4eb7c09b5d2d15d"
       "f1d852741af4704a0458047e80e4546d35b8336fac224dd81664bbf528be6373",
@@ -425,7 +427,7 @@ static const ecc_domain_parms_t domain_parms[] =
       1
     },
     {
-      "GOST2012-tc26-A", 512, 0,
+      "GOST2012-512-tc26-A", 512, 0,
       MPI_EC_WEIERSTRASS, ECC_DIALECT_STANDARD,
       "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
         "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdc7",
@@ -442,7 +444,7 @@ static const ecc_domain_parms_t domain_parms[] =
       1
     },
     {
-      "GOST2012-tc26-B", 512, 0,
+      "GOST2012-512-tc26-B", 512, 0,
       MPI_EC_WEIERSTRASS, ECC_DIALECT_STANDARD,
       "0x8000000000000000000000000000000000000000000000000000000000000000"
         "000000000000000000000000000000000000000000000000000000000000006f",
diff --git a/tests/basic.c b/tests/basic.c
index b798eaafa21c..8337bcfb7ba0 100644
--- a/tests/basic.c
+++ b/tests/basic.c
@@ -13227,7 +13227,7 @@ check_pubkey (void)
     {
       "(private-key\n"
       " (ecc\n"
-      "  (curve GOST2012-test)\n"
+      "  (curve GOST2012-512-test)\n"
       "  (q #04115DC5BC96760C7B48598D8AB9E740D4C4A85A65BE33C1"
       "        815B5C320C854621DD5A515856D13314AF69BC5B924C8B"
       "        4DDFF75C45415C1D9DD9DD33612CD530EFE137C7C90CD4"
@@ -13240,7 +13240,7 @@ check_pubkey (void)
 
       "(public-key\n"
       " (ecc\n"
-      "  (curve GOST2012-test)\n"
+      "  (curve GOST2012-512-test)\n"
       "  (q #04115DC5BC96760C7B48598D8AB9E740D4C4A85A65BE33C1"
       "        815B5C320C854621DD5A515856D13314AF69BC5B924C8B"
       "        4DDFF75C45415C1D9DD9DD33612CD530EFE137C7C90CD4"
diff --git a/tests/benchmark.c b/tests/benchmark.c
index 0f15c0d89fe7..a245152c0228 100644
--- a/tests/benchmark.c
+++ b/tests/benchmark.c
@@ -1528,7 +1528,7 @@ ecc_bench (int iterations, int print_header)
       else if (is_gost)
         err = gcry_sexp_build (&key_spec, NULL,
                                "(genkey (ecdsa (curve %s)))",
-                               p_size == 256 ? "GOST2001-test" : "GOST2012-test");
+                               p_size == 256 ? "GOST2001-test" : "GOST2012-512-test");
       else
         err = gcry_sexp_build (&key_spec, NULL,
                                "(genkey (ECDSA (nbits %d)))", p_size);
-- 
2.24.0




More information about the Gcrypt-devel mailing list