]> wagner.pp.ru Git - openssl-gost/engine.git/commitdiff
Replace orders of groups with orders of cyclic subgroups 103/head
authorDmitry Meshkov <meshkov@rutoken.ru>
Thu, 27 Dec 2018 10:03:13 +0000 (13:03 +0300)
committerDmitry Meshkov <meshkov@rutoken.ru>
Fri, 28 Dec 2018 07:11:47 +0000 (10:11 +0300)
According to OpenSSL documentation EC_GROUP's member named order contains the cardinality of cyclic subgroup. Some paramsets contain cardinalities of elliptic curves' groups.

gost_params.c
test_curves.c

index 799672bebf89fae5a8cfe07730e215637256490d..b73d5a9160fd72f01c20533275c037fb11876cd9 100644 (file)
@@ -137,8 +137,8 @@ R3410_ec_params R3410_2012_512_paramset[] = {
      "295F9BAE7428ED9CCC20E7C359A9D41A22FCCD9108E17BF7BA9337A6F8AE9513",
      /* p */
      "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD97",
-     /* m */
-     "01000000000000000000000000000000003F63377F21ED98D70456BD55B0D8319C",
+     /* q */
+     "400000000000000000000000000000000FD8CDDFC87B6635C115AF556C360C67",
      /* x */
      "91E38443A5E82C0D880923425712B2BB658B9196932E02C78B2582FE742DAA28",
      /* y */
@@ -155,9 +155,9 @@ R3410_ec_params R3410_2012_512_paramset[] = {
      /* p */
      "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
      "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDC7",
-     /* m */
-     "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
-     "26336E91941AAC0130CEA7FD451D40B323B6A79E9DA6849A5188F3BD1FC08FB4",
+     /* q */
+     "3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+     "C98CDBA46506AB004C33A9FF5147502CC8EDA9E7A769A12694623CEF47F023ED",
      /* x */
      "E2E31EDFC23DE7BDEBE241CE593EF5DE2295B7A9CBAEF021D385F7074CEA043A"
      "A27272A7AE602BF2A7B9033DB9ED3610C6FB85487EAE97AAC5BC7928C1950148",
index ba1da89292d954f3d15fdfa56fb85315cb153bb8..1ee15b0fab706e665f53258a5ac1f4799b18d463 100644 (file)
@@ -182,8 +182,8 @@ static int parameter_test(struct test_curve *tc)
     const BIGNUM *order;
     T(order = EC_GROUP_get0_order(group));
     T(!BN_is_zero(order));
-    print_bn("m", order);
-    T(!BN_is_zero(order));
+    print_bn("q", order);
+    T(BN_is_odd(order));
     EC_POINT *point;
     T((point = EC_POINT_new(group)));
     T(EC_POINT_mul(group, point, NULL, generator, order, ctx));
@@ -204,10 +204,7 @@ static int parameter_test(struct test_curve *tc)
     /* Cofactor is 1 or 4 */
     const BIGNUM *c;
     T(c = EC_GROUP_get0_cofactor(group));
-    if (BN_is_odd(order))
-       T(BN_is_word(c, 1));
-    else
-       T(BN_is_word(c, 4));
+    T(BN_is_word(c, 1) || BN_is_word(c, 4));
 
     TEST_ASSERT(0);
     return test;