diff options
author | Pauli <ppzgs1@gmail.com> | 2021-02-23 09:52:15 +1000 |
---|---|---|
committer | Pauli <ppzgs1@gmail.com> | 2021-02-26 18:08:41 +1000 |
commit | caa60428cd8f0aa60cd2fb7e6da4f5aa9664ae16 (patch) | |
tree | 7e20c51cc6003db212ae2e7228623e22e1feab29 | |
parent | 1c9eaf42510d0756ce0d219c5127dff2f1a0b83d (diff) |
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)
-rw-r--r-- | crypto/evp/evp_rand.c | 32 | ||||
-rw-r--r-- | include/openssl/evp.h | 2 | ||||
-rw-r--r-- | util/libcrypto.num | 2 |
3 files changed, 32 insertions, 4 deletions
diff --git a/crypto/evp/evp_rand.c b/crypto/evp/evp_rand.c index b27f4e11a0..bc8c24b3b5 100644 --- a/crypto/evp/evp_rand.c +++ b/crypto/evp/evp_rand.c @@ -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, diff --git a/include/openssl/evp.h b/include/openssl/evp.h index 38cfefd10b..015cb9f158 100644 --- a/include/openssl/evp.h +++ b/include/openssl/evp.h @@ -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), diff --git a/util/libcrypto.num b/util/libcrypto.num index 2f04e81152..3dd02fea27 100644 --- a/util/libcrypto.num +++ b/util/libcrypto.num @@ -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: |