diff options
Diffstat (limited to 'test/evp_extra_test2.c')
-rw-r--r-- | test/evp_extra_test2.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/evp_extra_test2.c b/test/evp_extra_test2.c index cacd04ce3c..c549334467 100644 --- a/test/evp_extra_test2.c +++ b/test/evp_extra_test2.c @@ -356,6 +356,30 @@ static int test_dh_tofrom_data_select(void) EVP_PKEY_CTX_free(gctx); return ret; } + +static int test_dh_paramgen(void) +{ + int ret; + OSSL_PARAM params[3]; + EVP_PKEY *pkey = NULL; + EVP_PKEY_CTX *gctx = NULL; + unsigned int pbits = 512; /* minimum allowed for speed */ + + params[0] = OSSL_PARAM_construct_uint(OSSL_PKEY_PARAM_FFC_PBITS, &pbits); + params[1] = OSSL_PARAM_construct_utf8_string(OSSL_PKEY_PARAM_FFC_TYPE, + "generator", 0); + params[2] = OSSL_PARAM_construct_end(); + + ret = TEST_ptr(gctx = EVP_PKEY_CTX_new_from_name(mainctx, "DH", NULL)) + && TEST_int_gt(EVP_PKEY_paramgen_init(gctx), 0) + && TEST_true(EVP_PKEY_CTX_set_params(gctx, params)) + && TEST_true(EVP_PKEY_paramgen(gctx, &pkey)) + && TEST_ptr(pkey); + + EVP_PKEY_CTX_free(gctx); + EVP_PKEY_free(pkey); + return ret; +} #endif #ifndef OPENSSL_NO_EC @@ -1111,6 +1135,7 @@ int setup_tests(void) #endif #ifndef OPENSSL_NO_DH ADD_TEST(test_dh_tofrom_data_select); + ADD_TEST(test_dh_paramgen); #endif ADD_TEST(test_rsa_tofrom_data_select); |