From: Dmitry Meshkov Date: Thu, 27 Dec 2018 10:03:13 +0000 (+0300) Subject: Replace orders of groups with orders of cyclic subgroups X-Git-Tag: v3.0.0~316^2^2 X-Git-Url: http://wagner.pp.ru/gitweb/?a=commitdiff_plain;h=e73b5da38fe3e541d076093f7dd96fd2f8f527cc;p=openssl-gost%2Fengine.git Replace orders of groups with orders of cyclic subgroups According to OpenSSL documentation EC_GROUP's member named order contains the cardinality of cyclic subgroup. Some paramsets contain cardinalities of elliptic curves' groups. --- diff --git a/gost_params.c b/gost_params.c index 799672b..b73d5a9 100644 --- a/gost_params.c +++ b/gost_params.c @@ -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", diff --git a/test_curves.c b/test_curves.c index ba1da89..1ee15b0 100644 --- a/test_curves.c +++ b/test_curves.c @@ -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;