diff options
author | Shane Lontis <shane.lontis@oracle.com> | 2020-01-31 08:18:46 +1000 |
---|---|---|
committer | Shane Lontis <shane.lontis@oracle.com> | 2020-01-31 08:18:46 +1000 |
commit | ca2bf555cd64bc9624af1259ce3cd27f95a5763e (patch) | |
tree | e02beb157e56973ada62c679cb7b3b8756e86dfe /test/dhtest.c | |
parent | cd624ccd41ac3ac779c1c7a7a1e63427ce9588dd (diff) |
Add support for DH 'modp' group parameters (RFC 3526)
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10897)
Diffstat (limited to 'test/dhtest.c')
-rw-r--r-- | test/dhtest.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/dhtest.c b/test/dhtest.c index e8a91f17f8..a357d0262f 100644 --- a/test/dhtest.c +++ b/test/dhtest.c @@ -676,6 +676,38 @@ static int rfc7919_test(void) DH_free(b); return ret; } + +static int prime_groups[] = { + NID_ffdhe2048, + NID_ffdhe3072, + NID_ffdhe4096, + NID_ffdhe6144, + NID_ffdhe8192, + NID_modp_2048, + NID_modp_3072, + NID_modp_4096, + NID_modp_6144, +}; + +static int dh_test_prime_groups(int index) +{ + int ok = 0; + DH *dh = NULL; + const BIGNUM *p, *q, *g; + + if (!TEST_ptr(dh = DH_new_by_nid(prime_groups[index]))) + goto err; + DH_get0_pqg(dh, &p, &q, &g); + if (!TEST_ptr(p) || !TEST_ptr(q) || !TEST_ptr(g)) + goto err; + + if (!TEST_int_eq(DH_get_nid(dh), prime_groups[index])) + goto err; + ok = 1; +err: + DH_free(dh); + return ok; +} #endif @@ -687,6 +719,7 @@ int setup_tests(void) ADD_TEST(dh_test); ADD_TEST(rfc5114_test); ADD_TEST(rfc7919_test); + ADD_ALL_TESTS(dh_test_prime_groups, OSSL_NELEM(prime_groups)); #endif return 1; } |