]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix naming for EVP_RAND_CTX_gettable functions.
authorPauli <pauli@openssl.org>
Thu, 15 Apr 2021 23:13:43 +0000 (09:13 +1000)
committerPauli <pauli@openssl.org>
Sat, 17 Apr 2021 08:22:13 +0000 (18:22 +1000)
Change:

    EVP_RAND_gettable_ctx_params -> EVP_RAND_CTX_gettable_params
    EVP_RAND_settable_ctx_params -> EVP_RAND_CTX_settable_params

Which brings them in line with the other similar functions for other algorithm
types.

Fixes #14880

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14893)

apps/list.c
crypto/evp/evp_rand.c
doc/man3/EVP_RAND.pod
doc/man7/life_cycle-rand.pod
include/openssl/evp.h
providers/fips/self_test_kats.c
test/acvp_test.c
test/drbgtest.c
test/evp_extra_test.c
test/evp_test.c
util/libcrypto.num

index df87880ba71c84f2d2460f6e85f9b93aab4ee84e..af6ae3f1a024b91e354f256f7c0026d621982ae2 100644 (file)
@@ -444,7 +444,7 @@ static void display_random(const char *name, EVP_RAND_CTX *drbg)
                     params->data_size = sizeof(buf);
                 }
                 params->return_size = 0;
-                if (EVP_RAND_get_ctx_params(drbg, params))
+                if (EVP_RAND_CTX_get_params(drbg, params))
                     print_param_value(params, 2);
             }
     }
index cae21891ee8cb6771eacbf201a3ac39e27b78021..2444be5dea2c6515db6a5202e6f27ddfcffb2f2e 100644 (file)
@@ -397,7 +397,7 @@ static int evp_rand_get_ctx_params_locked(EVP_RAND_CTX *ctx,
     return ctx->meth->get_ctx_params(ctx->data, params);
 }
 
-int EVP_RAND_get_ctx_params(EVP_RAND_CTX *ctx, OSSL_PARAM params[])
+int EVP_RAND_CTX_get_params(EVP_RAND_CTX *ctx, OSSL_PARAM params[])
 {
     int res;
 
@@ -416,7 +416,7 @@ static int evp_rand_set_ctx_params_locked(EVP_RAND_CTX *ctx,
     return 1;
 }
 
-int EVP_RAND_set_ctx_params(EVP_RAND_CTX *ctx, const OSSL_PARAM params[])
+int EVP_RAND_CTX_set_params(EVP_RAND_CTX *ctx, const OSSL_PARAM params[])
 {
     int res;
 
@@ -653,7 +653,7 @@ int EVP_RAND_state(EVP_RAND_CTX *ctx)
     int state;
 
     params[0] = OSSL_PARAM_construct_int(OSSL_RAND_PARAM_STATE, &state);
-    if (!EVP_RAND_get_ctx_params(ctx, params))
+    if (!EVP_RAND_CTX_get_params(ctx, params))
         state = EVP_RAND_STATE_ERROR;
     return state;
 }
index 23906da5ba3c190be3e6593ba47c581839287d1e..b2d1e184173345128525d01fb7904c5b5d61fbad 100644 (file)
@@ -9,8 +9,8 @@ EVP_RAND_enable_locking, EVP_RAND_verify_zeroization, EVP_RAND_strength,
 EVP_RAND_state,
 EVP_RAND_provider, EVP_RAND_CTX_rand, EVP_RAND_is_a, EVP_RAND_number,
 EVP_RAND_name, EVP_RAND_names_do_all, EVP_RAND_description,
-EVP_RAND_get_ctx_params,
-EVP_RAND_set_ctx_params, EVP_RAND_do_all_provided, EVP_RAND_get_params,
+EVP_RAND_CTX_get_params,
+EVP_RAND_CTX_set_params, EVP_RAND_do_all_provided, EVP_RAND_get_params,
 EVP_RAND_gettable_ctx_params, EVP_RAND_settable_ctx_params,
 EVP_RAND_CTX_gettable_params, EVP_RAND_CTX_settable_params,
 EVP_RAND_gettable_params, EVP_RAND_STATE_UNINITIALISED, EVP_RAND_STATE_READY,
@@ -31,8 +31,8 @@ EVP_RAND_STATE_ERROR - EVP RAND routines
  void EVP_RAND_CTX_free(EVP_RAND_CTX *ctx);
  EVP_RAND *EVP_RAND_CTX_rand(EVP_RAND_CTX *ctx);
  int EVP_RAND_get_params(EVP_RAND *rand, OSSL_PARAM params[]);
- int EVP_RAND_get_ctx_params(EVP_RAND_CTX *ctx, OSSL_PARAM params[]);
- int EVP_RAND_set_ctx_params(EVP_RAND_CTX *ctx, const OSSL_PARAM params[]);
+ int EVP_RAND_CTX_get_params(EVP_RAND_CTX *ctx, OSSL_PARAM params[]);
+ int EVP_RAND_CTX_set_params(EVP_RAND_CTX *ctx, const OSSL_PARAM params[]);
  const OSSL_PARAM *EVP_RAND_gettable_params(const EVP_RAND *rand);
  const OSSL_PARAM *EVP_RAND_gettable_ctx_params(const EVP_RAND *rand);
  const OSSL_PARAM *EVP_RAND_settable_ctx_params(const EVP_RAND *rand);
@@ -83,7 +83,7 @@ RAND and RAND_DRBG functions.
 After creating a B<EVP_RAND_CTX> for the required algorithm using
 EVP_RAND_CTX_new(), inputs to the algorithm are supplied either by
 passing them as part of the EVP_RAND_instantiate() call or using calls to
-EVP_RAND_set_ctx_params() before calling EVP_RAND_instantiate().  Finally,
+EVP_RAND_CTX_set_params() before calling EVP_RAND_instantiate().  Finally,
 call EVP_RAND_generate() to produce cryptographically secure random bytes.
 
 =head2 Types
@@ -170,14 +170,14 @@ parameters should be retrieved.
 Note that a parameter that is unknown in the underlying context is
 simply ignored.
 
-EVP_RAND_get_ctx_params() retrieves chosen parameters, given the
+EVP_RAND_CTX_get_params() retrieves chosen parameters, given the
 context I<ctx> and its underlying context.
 The set of parameters given with I<params> determine exactly what
 parameters should be retrieved.
 Note that a parameter that is unknown in the underlying context is
 simply ignored.
 
-EVP_RAND_set_ctx_params() passes chosen parameters to the underlying
+EVP_RAND_CTX_set_params() passes chosen parameters to the underlying
 context, given a context I<ctx>.
 The set of parameters given with I<params> determine exactly what
 parameters are passed down.
index b78b8484d2328410f56aa3707b7ca590558c4fd3..5b3e81caa9a6f9fd2eec1bd992ba01514a375c5d 100644 (file)
@@ -92,8 +92,8 @@ This is the canonical list.
  EVP_RAND_generate                          instantiated
  EVP_RAND_uninstantiate                    uninstantiated
  EVP_RAND_CTX_free          freed   freed      freed          freed
- EVP_RAND_get_ctx_params            newed   instantiated  uninstantiated  freed
- EVP_RAND_set_ctx_params            newed   instantiated  uninstantiated  freed
+ EVP_RAND_CTX_get_params            newed   instantiated  uninstantiated  freed
+ EVP_RAND_CTX_set_params            newed   instantiated  uninstantiated  freed
  EVP_RAND_CTX_gettable_params       newed   instantiated  uninstantiated  freed
  EVP_RAND_CTX_settable_params       newed   instantiated  uninstantiated  freed
 
@@ -140,13 +140,13 @@ This is the canonical list.
     <td style="border:1px solid" align="center">freed</td>
     <td style="border:1px solid" align="center">freed</td>
     <td style="border:1px solid" align="center"></td></tr>
-<tr><th style="border:1px solid" align="left">EVP_RAND_get_ctx_params</th>
+<tr><th style="border:1px solid" align="left">EVP_RAND_CTX_get_params</th>
     <td style="border:1px solid" align="center"></td>
     <td style="border:1px solid" align="center">newed</td>
     <td style="border:1px solid" align="center">instantiated</td>
     <td style="border:1px solid" align="center">uninstantiated</td>
     <td style="border:1px solid" align="center"></td></tr>
-<tr><th style="border:1px solid" align="left">EVP_RAND_set_ctx_params</th>
+<tr><th style="border:1px solid" align="left">EVP_RAND_CTX_set_params</th>
     <td style="border:1px solid" align="center"></td>
     <td style="border:1px solid" align="center">newed</td>
     <td style="border:1px solid" align="center">instantiated</td>
index 35cdfe1c057d0a1b8232af890332ec008874256f..6fd895a221c37823ecb445e0d2a847111ffd5678 100644 (file)
@@ -1199,8 +1199,8 @@ int EVP_RAND_get_params(EVP_RAND *rand, OSSL_PARAM params[]);
 EVP_RAND_CTX *EVP_RAND_CTX_new(EVP_RAND *rand, EVP_RAND_CTX *parent);
 void EVP_RAND_CTX_free(EVP_RAND_CTX *ctx);
 EVP_RAND *EVP_RAND_CTX_rand(EVP_RAND_CTX *ctx);
-int EVP_RAND_get_ctx_params(EVP_RAND_CTX *ctx, OSSL_PARAM params[]);
-int EVP_RAND_set_ctx_params(EVP_RAND_CTX *ctx, const OSSL_PARAM params[]);
+int EVP_RAND_CTX_get_params(EVP_RAND_CTX *ctx, OSSL_PARAM params[]);
+int EVP_RAND_CTX_set_params(EVP_RAND_CTX *ctx, const OSSL_PARAM params[]);
 const OSSL_PARAM *EVP_RAND_gettable_params(const EVP_RAND *rand);
 const OSSL_PARAM *EVP_RAND_gettable_ctx_params(const EVP_RAND *rand);
 const OSSL_PARAM *EVP_RAND_settable_ctx_params(const EVP_RAND *rand);
index 0041a888427d211158d43fadd653e6a678fb1a1d..1b89cc82ae9d7a55930f03601479be64c7b008fe 100644 (file)
@@ -273,7 +273,7 @@ static int self_test_drbg(const ST_KAT_DRBG *t, OSSL_SELF_TEST *st,
 
     drbg_params[0] = OSSL_PARAM_construct_uint(OSSL_RAND_PARAM_STRENGTH,
                                                &strength);
-    if (!EVP_RAND_set_ctx_params(test, drbg_params))
+    if (!EVP_RAND_CTX_set_params(test, drbg_params))
         goto err;
 
     rand = EVP_RAND_fetch(libctx, t->algorithm, NULL);
@@ -292,7 +292,7 @@ static int self_test_drbg(const ST_KAT_DRBG *t, OSSL_SELF_TEST *st,
     /* This is only used by HMAC-DRBG but it is ignored by the others */
     drbg_params[1] =
         OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_MAC, "HMAC", 0);
-    if (!EVP_RAND_set_ctx_params(drbg, drbg_params))
+    if (!EVP_RAND_CTX_set_params(drbg, drbg_params))
         goto err;
 
     drbg_params[0] =
@@ -312,7 +312,7 @@ static int self_test_drbg(const ST_KAT_DRBG *t, OSSL_SELF_TEST *st,
         OSSL_PARAM_construct_octet_string(OSSL_RAND_PARAM_TEST_ENTROPY,
                                           (void *)t->entropyinpr1,
                                           t->entropyinpr1len);
-    if (!EVP_RAND_set_ctx_params(test, drbg_params))
+    if (!EVP_RAND_CTX_set_params(test, drbg_params))
         goto err;
 
     if (!EVP_RAND_generate(drbg, out, t->expectedlen, strength,
@@ -324,7 +324,7 @@ static int self_test_drbg(const ST_KAT_DRBG *t, OSSL_SELF_TEST *st,
         OSSL_PARAM_construct_octet_string(OSSL_RAND_PARAM_TEST_ENTROPY,
                                          (void *)t->entropyinpr2,
                                          t->entropyinpr2len);
-    if (!EVP_RAND_set_ctx_params(test, drbg_params))
+    if (!EVP_RAND_CTX_set_params(test, drbg_params))
         goto err;
 
     /*
index daa2e6843aa412c7f7e731c02975855c7765099a..c2b024da012da7b1a36d331e7bd4f3b8c0b164f5 100644 (file)
@@ -1351,7 +1351,7 @@ static int drbg_test(int id)
 
     params[0] = OSSL_PARAM_construct_uint(OSSL_RAND_PARAM_STRENGTH, &strength);
     params[1] = OSSL_PARAM_construct_end();
-    if (!TEST_true(EVP_RAND_set_ctx_params(parent, params)))
+    if (!TEST_true(EVP_RAND_CTX_set_params(parent, params)))
         goto err;
 
     /* Get the DRBG */
@@ -1365,7 +1365,7 @@ static int drbg_test(int id)
     params[1] = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_CIPHER,
                                                  (char *)tst->cipher, 0);
     params[2] = OSSL_PARAM_construct_end();
-    if (!TEST_true(EVP_RAND_set_ctx_params(ctx, params)))
+    if (!TEST_true(EVP_RAND_CTX_set_params(ctx, params)))
         goto err;
 
     /* Feed in the entropy and nonce */
@@ -1376,7 +1376,7 @@ static int drbg_test(int id)
                                                   (void *)tst->nonce,
                                                   tst->nonce_len);
     params[2] = OSSL_PARAM_construct_end();
-    if (!TEST_true(EVP_RAND_set_ctx_params(parent, params)))
+    if (!TEST_true(EVP_RAND_CTX_set_params(parent, params)))
         goto err;
 
     /*
index 07f123dce8705a2d13231aec4493988126ade4d4..70e062ce75055d854b4aca73afabb02f07244b7e 100644 (file)
@@ -90,7 +90,7 @@ static unsigned int query_rand_uint(EVP_RAND_CTX *drbg, const char *name)
     unsigned int n;
 
     *params = OSSL_PARAM_construct_uint(name, &n);
-    if (EVP_RAND_get_ctx_params(drbg, params))
+    if (EVP_RAND_CTX_get_params(drbg, params))
         return n;
     return 0;
 }
@@ -125,7 +125,7 @@ static time_t reseed_time(EVP_RAND_CTX *drbg)
     time_t t;
 
     *params = OSSL_PARAM_construct_time_t(OSSL_DRBG_PARAM_RESEED_TIME, &t);
-    if (EVP_RAND_get_ctx_params(drbg, params))
+    if (EVP_RAND_CTX_get_params(drbg, params))
         return t;
     return 0;
 }
@@ -691,7 +691,7 @@ static int set_reseed_time_interval(EVP_RAND_CTX *drbg, int t)
     params[0] = OSSL_PARAM_construct_int(OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL,
                                          &t);
     params[1] = OSSL_PARAM_construct_end();
-    return EVP_RAND_set_ctx_params(drbg, params);
+    return EVP_RAND_CTX_set_params(drbg, params);
 }
 
 static void run_multi_thread_test(void)
@@ -808,7 +808,7 @@ static EVP_RAND_CTX *new_drbg(EVP_RAND_CTX *parent)
 
     if (!TEST_ptr(rand = EVP_RAND_fetch(NULL, "CTR-DRBG", NULL))
             || !TEST_ptr(drbg = EVP_RAND_CTX_new(rand, parent))
-            || !TEST_true(EVP_RAND_set_ctx_params(drbg, params))) {
+            || !TEST_true(EVP_RAND_CTX_set_params(drbg, params))) {
         EVP_RAND_CTX_free(drbg);
         drbg = NULL;
     }
index afba7ea75b2268663846e89a54bf1e5888c49047..24eff86c5d93d93646dc02934bcb5456da02ed10 100644 (file)
@@ -2416,7 +2416,7 @@ static int test_rand_agglomeration(void)
                                              seed, sizeof(seed));
     *p++ = OSSL_PARAM_construct_uint(OSSL_RAND_PARAM_MAX_REQUEST, &step);
     *p = OSSL_PARAM_construct_end();
-    res = TEST_true(EVP_RAND_set_ctx_params(ctx, params))
+    res = TEST_true(EVP_RAND_CTX_set_params(ctx, params))
           && TEST_true(EVP_RAND_generate(ctx, out, sizeof(out), 0, 1, NULL, 0))
           && TEST_mem_eq(seed, sizeof(seed), out, sizeof(out));
     EVP_RAND_CTX_free(ctx);
index 503aaa0e8e200f15820b52d156c9a5b9707d2282..08341e46178d451735dd0079abccf471ec5ac0dd 100644 (file)
@@ -2117,7 +2117,7 @@ static int rand_test_init(EVP_TEST *t, const char *name)
         goto err;
 
     *params = OSSL_PARAM_construct_uint(OSSL_RAND_PARAM_STRENGTH, &strength);
-    if (!EVP_RAND_set_ctx_params(rdata->parent, params))
+    if (!EVP_RAND_CTX_set_params(rdata->parent, params))
         goto err;
 
     rand = EVP_RAND_fetch(libctx, name, NULL);
@@ -2250,7 +2250,7 @@ static int rand_test_run(EVP_TEST *t)
                                                 expected->digest, 0);
     *p++ = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_MAC, "HMAC", 0);
     *p = OSSL_PARAM_construct_end();
-    if (!TEST_true(EVP_RAND_set_ctx_params(expected->ctx, params)))
+    if (!TEST_true(EVP_RAND_CTX_set_params(expected->ctx, params)))
         goto err;
 
     strength = EVP_RAND_strength(expected->ctx);
@@ -2281,7 +2281,7 @@ static int rand_test_run(EVP_TEST *t)
                            (OSSL_RAND_PARAM_TEST_ENTROPY, item->reseed_entropy,
                             item->reseed_entropy_len);
             params[1] = OSSL_PARAM_construct_end();
-            if (!TEST_true(EVP_RAND_set_ctx_params(expected->parent, params)))
+            if (!TEST_true(EVP_RAND_CTX_set_params(expected->parent, params)))
                 goto err;
 
             if (!TEST_true(EVP_RAND_reseed
@@ -2295,7 +2295,7 @@ static int rand_test_run(EVP_TEST *t)
                            (OSSL_RAND_PARAM_TEST_ENTROPY, item->pr_entropyA,
                             item->pr_entropyA_len);
             params[1] = OSSL_PARAM_construct_end();
-            if (!TEST_true(EVP_RAND_set_ctx_params(expected->parent, params)))
+            if (!TEST_true(EVP_RAND_CTX_set_params(expected->parent, params)))
                 goto err;
         }
         if (!TEST_true(EVP_RAND_generate
@@ -2309,7 +2309,7 @@ static int rand_test_run(EVP_TEST *t)
                            (OSSL_RAND_PARAM_TEST_ENTROPY, item->pr_entropyB,
                             item->pr_entropyB_len);
             params[1] = OSSL_PARAM_construct_end();
-            if (!TEST_true(EVP_RAND_set_ctx_params(expected->parent, params)))
+            if (!TEST_true(EVP_RAND_CTX_set_params(expected->parent, params)))
                 return 0;
         }
         if (!TEST_true(EVP_RAND_generate
index 2350438478154133d055f095b26ba7184aef5ece..bf208e8414ef7eff135eb4aee88b44efa5b1f846 100644 (file)
@@ -5043,8 +5043,8 @@ EVP_RAND_get_params                     ? 3_0_0   EXIST::FUNCTION:
 EVP_RAND_CTX_new                        ?      3_0_0   EXIST::FUNCTION:
 EVP_RAND_CTX_free                       ?      3_0_0   EXIST::FUNCTION:
 EVP_RAND_CTX_rand                       ?      3_0_0   EXIST::FUNCTION:
-EVP_RAND_get_ctx_params                 ?      3_0_0   EXIST::FUNCTION:
-EVP_RAND_set_ctx_params                 ?      3_0_0   EXIST::FUNCTION:
+EVP_RAND_CTX_get_params                 ?      3_0_0   EXIST::FUNCTION:
+EVP_RAND_CTX_set_params                 ?      3_0_0   EXIST::FUNCTION:
 EVP_RAND_gettable_params                ?      3_0_0   EXIST::FUNCTION:
 EVP_RAND_gettable_ctx_params            ?      3_0_0   EXIST::FUNCTION:
 EVP_RAND_settable_ctx_params            ?      3_0_0   EXIST::FUNCTION: