Make EVP_PKEY_CTX_[get|set]_group_name work for DH too
[openssl.git] / test / dsatest.c
index 39a271307b11072130c11ff3de3900e492f01880..614a8ea1d8ecd6b4332cc3fcd0dc9de89fd4997b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -155,6 +155,7 @@ static int dsa_keygen_test(void)
     unsigned char seed_out[32];
     char group_out[32];
     size_t len = 0;
+    const OSSL_PARAM *settables = NULL;
     static const unsigned char seed_data[] = {
         0xa6, 0xf5, 0x28, 0x8c, 0x50, 0x77, 0xa5, 0x68,
         0x6d, 0x3a, 0xf5, 0xf1, 0xc6, 0x4c, 0xdc, 0x35,
@@ -244,6 +245,10 @@ static int dsa_keygen_test(void)
         goto end;
     if (!TEST_ptr(pg_ctx = EVP_PKEY_CTX_new_from_name(NULL, "DSA", NULL))
         || !TEST_int_gt(EVP_PKEY_paramgen_init(pg_ctx), 0)
+        || !TEST_ptr_null(EVP_PKEY_CTX_gettable_params(pg_ctx))
+        || !TEST_ptr(settables = EVP_PKEY_CTX_settable_params(pg_ctx))
+        || !TEST_ptr(OSSL_PARAM_locate_const(settables,
+                                             OSSL_PKEY_PARAM_FFC_PBITS))
         || !TEST_true(EVP_PKEY_CTX_set_dsa_paramgen_bits(pg_ctx, 2048))
         || !TEST_true(EVP_PKEY_CTX_set_dsa_paramgen_q_bits(pg_ctx, 224))
         || !TEST_true(EVP_PKEY_CTX_set_dsa_paramgen_seed(pg_ctx, seed_data,
@@ -277,7 +282,7 @@ static int dsa_keygen_test(void)
                                              &pcount_out))
         || !TEST_int_eq(pcount_out, expected_c)
         || !TEST_false(EVP_PKEY_get_utf8_string_param(key,
-                                                      OSSL_PKEY_PARAM_FFC_GROUP,
+                                                      OSSL_PKEY_PARAM_GROUP_NAME,
                                                       group_out,
                                                       sizeof(group_out), &len)))
         goto end;