diff options
author | David Asraf <dasraf9@gmail.com> | 2019-02-07 10:51:39 +0100 |
---|---|---|
committer | Nicola Tuveri <nic.tuv@gmail.com> | 2019-02-15 15:43:18 +0100 |
commit | fa1f03061037cbdac5369849a885c1191a2550d9 (patch) | |
tree | 06b371795d89501717698c4a6f5cadf38666d182 /test/ectest.c | |
parent | Mark generated functions unused (applies to safestack, lhash, sparse_array) (diff) | |
download | openssl-fa1f03061037cbdac5369849a885c1191a2550d9.tar.xz openssl-fa1f03061037cbdac5369849a885c1191a2550d9.zip |
Add EC_GROUP_get0_field
New function to return internal pointer for field.
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8195)
Diffstat (limited to 'test/ectest.c')
-rw-r--r-- | test/ectest.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/ectest.c b/test/ectest.c index cdfaeb69eb..0f4259796e 100644 --- a/test/ectest.c +++ b/test/ectest.c @@ -1159,6 +1159,43 @@ static int internal_curve_test_method(int n) return r; } +static int group_field_test(void) +{ + int r = 1; + BIGNUM *secp521r1_field = NULL; + BIGNUM *sect163r2_field = NULL; + EC_GROUP *secp521r1_group = NULL; + EC_GROUP *sect163r2_group = NULL; + + BN_hex2bn(&secp521r1_field, + "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + "FFFF"); + + + BN_hex2bn(§163r2_field, + "08000000000000000000000000000000" + "00000000C9"); + + secp521r1_group = EC_GROUP_new_by_curve_name(NID_secp521r1); + if (BN_cmp(secp521r1_field, EC_GROUP_get0_field(secp521r1_group))) + r = 0; + + # ifndef OPENSSL_NO_EC2M + sect163r2_group = EC_GROUP_new_by_curve_name(NID_sect163r2); + if (BN_cmp(sect163r2_field, EC_GROUP_get0_field(sect163r2_group))) + r = 0; + # endif + + EC_GROUP_free(secp521r1_group); + EC_GROUP_free(sect163r2_group); + BN_free(secp521r1_field); + BN_free(sect163r2_field); + return r; +} + # ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 /* * nistp_test_params contains magic numbers for testing our optimized @@ -1513,6 +1550,7 @@ int setup_tests(void) # endif ADD_ALL_TESTS(internal_curve_test, crv_len); ADD_ALL_TESTS(internal_curve_test_method, crv_len); + ADD_TEST(group_field_test); #endif return 1; } |