evp: support modified gettable/settable ctx calls for RNGs

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14240)
This commit is contained in:
Pauli 2021-02-23 09:52:15 +10:00
parent 1c9eaf4251
commit caa60428cd
3 changed files with 32 additions and 4 deletions

View File

@ -428,18 +428,42 @@ const OSSL_PARAM *EVP_RAND_gettable_params(const EVP_RAND *rand)
const OSSL_PARAM *EVP_RAND_gettable_ctx_params(const EVP_RAND *rand)
{
void *provctx;
if (rand->gettable_ctx_params == NULL)
return NULL;
return rand->gettable_ctx_params(
ossl_provider_ctx(EVP_RAND_provider(rand)));
provctx = ossl_provider_ctx(EVP_RAND_provider(rand));
return rand->gettable_ctx_params(NULL, provctx);
}
const OSSL_PARAM *EVP_RAND_settable_ctx_params(const EVP_RAND *rand)
{
void *provctx;
if (rand->settable_ctx_params == NULL)
return NULL;
return rand->settable_ctx_params(
ossl_provider_ctx(EVP_RAND_provider(rand)));
provctx = ossl_provider_ctx(EVP_RAND_provider(rand));
return rand->settable_ctx_params(NULL, provctx);
}
const OSSL_PARAM *EVP_RAND_CTX_gettable_params(EVP_RAND_CTX *ctx)
{
void *provctx;
if (ctx->meth->gettable_ctx_params == NULL)
return NULL;
provctx = ossl_provider_ctx(EVP_RAND_provider(ctx->meth));
return ctx->meth->gettable_ctx_params(ctx->data, provctx);
}
const OSSL_PARAM *EVP_RAND_CTX_settable_params(EVP_RAND_CTX *ctx)
{
void *provctx;
if (ctx->meth->settable_ctx_params == NULL)
return NULL;
provctx = ossl_provider_ctx(EVP_RAND_provider(ctx->meth));
return ctx->meth->settable_ctx_params(ctx->data, provctx);
}
void EVP_RAND_do_all_provided(OSSL_LIB_CTX *libctx,

View File

@ -1176,6 +1176,8 @@ int EVP_RAND_set_ctx_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);
const OSSL_PARAM *EVP_RAND_CTX_gettable_params(EVP_RAND_CTX *ctx);
const OSSL_PARAM *EVP_RAND_CTX_settable_params(EVP_RAND_CTX *ctx);
void EVP_RAND_do_all_provided(OSSL_LIB_CTX *libctx,
void (*fn)(EVP_RAND *rand, void *arg),

View File

@ -5302,5 +5302,7 @@ EVP_PKEY_fromdata_settable ? 3_0_0 EXIST::FUNCTION:
EVP_PKEY_param_check_quick ? 3_0_0 EXIST::FUNCTION:
EVP_PKEY_public_check_quick ? 3_0_0 EXIST::FUNCTION:
EVP_PKEY_CTX_is_a ? 3_0_0 EXIST::FUNCTION:
EVP_RAND_CTX_gettable_params ? 3_0_0 EXIST::FUNCTION:
EVP_RAND_CTX_settable_params ? 3_0_0 EXIST::FUNCTION:
RAND_set_DRBG_type ? 3_0_0 EXIST::FUNCTION:
RAND_set_seed_source_type ? 3_0_0 EXIST::FUNCTION: