Fix naming for EVP_RAND_CTX_gettable functions.

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)
This commit is contained in:
Pauli 2021-04-16 09:13:43 +10:00
parent 7b9f02798f
commit e494fac705
11 changed files with 36 additions and 36 deletions

View 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);
}
}

View 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;
}

View 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.

View 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>

View 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);

View 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;
/*

View 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;
/*

View 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;
}

View 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);

View 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

View 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: