diff options
Diffstat (limited to 'crypto/evp')
-rw-r--r-- | crypto/evp/e_aria.c | 1 | ||||
-rw-r--r-- | crypto/evp/evp_enc.c | 1 | ||||
-rw-r--r-- | crypto/evp/evp_local.h | 27 | ||||
-rw-r--r-- | crypto/evp/evp_rand.c | 63 |
4 files changed, 26 insertions, 66 deletions
diff --git a/crypto/evp/e_aria.c b/crypto/evp/e_aria.c index 9720fcb7e5..ba654f6b94 100644 --- a/crypto/evp/e_aria.c +++ b/crypto/evp/e_aria.c @@ -13,7 +13,6 @@ # include <openssl/evp.h> # include <openssl/modes.h> # include <openssl/rand.h> -# include <openssl/rand_drbg.h> # include "crypto/aria.h" # include "crypto/evp.h" # include "crypto/modes.h" diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c index 6ade73e978..2f00f9a13b 100644 --- a/crypto/evp/evp_enc.c +++ b/crypto/evp/evp_enc.c @@ -16,7 +16,6 @@ #include <openssl/evp.h> #include <openssl/err.h> #include <openssl/rand.h> -#include <openssl/rand_drbg.h> #include <openssl/engine.h> #include <openssl/params.h> #include <openssl/core_names.h> diff --git a/crypto/evp/evp_local.h b/crypto/evp/evp_local.h index 99c53484a6..1e1d689070 100644 --- a/crypto/evp/evp_local.h +++ b/crypto/evp/evp_local.h @@ -71,33 +71,6 @@ struct evp_rand_ctx_st { void *data; /* Algorithm-specific data */ } /* EVP_RAND_CTX */ ; -struct evp_rand_st { - OSSL_PROVIDER *prov; - int name_id; - CRYPTO_REF_COUNT refcnt; - CRYPTO_RWLOCK *refcnt_lock; - - const OSSL_DISPATCH *dispatch; - OSSL_FUNC_rand_newctx_fn *newctx; - OSSL_FUNC_rand_freectx_fn *freectx; - OSSL_FUNC_rand_instantiate_fn *instantiate; - OSSL_FUNC_rand_uninstantiate_fn *uninstantiate; - OSSL_FUNC_rand_generate_fn *generate; - OSSL_FUNC_rand_reseed_fn *reseed; - OSSL_FUNC_rand_nonce_fn *nonce; - OSSL_FUNC_rand_enable_locking_fn *enable_locking; - OSSL_FUNC_rand_lock_fn *lock; - OSSL_FUNC_rand_unlock_fn *unlock; - OSSL_FUNC_rand_gettable_params_fn *gettable_params; - OSSL_FUNC_rand_gettable_ctx_params_fn *gettable_ctx_params; - OSSL_FUNC_rand_settable_ctx_params_fn *settable_ctx_params; - OSSL_FUNC_rand_get_params_fn *get_params; - OSSL_FUNC_rand_get_ctx_params_fn *get_ctx_params; - OSSL_FUNC_rand_set_ctx_params_fn *set_ctx_params; - OSSL_FUNC_rand_set_callbacks_fn *set_callbacks; - OSSL_FUNC_rand_verify_zeroization_fn *verify_zeroization; -} /* EVP_RAND */ ; - struct evp_keymgmt_st { int id; /* libcrypto internal */ diff --git a/crypto/evp/evp_rand.c b/crypto/evp/evp_rand.c index 9056f6d20b..0e5e8c11f9 100644 --- a/crypto/evp/evp_rand.c +++ b/crypto/evp/evp_rand.c @@ -25,6 +25,32 @@ #include "internal/provider.h" #include "evp_local.h" +struct evp_rand_st { + OSSL_PROVIDER *prov; + int name_id; + CRYPTO_REF_COUNT refcnt; + CRYPTO_RWLOCK *refcnt_lock; + + const OSSL_DISPATCH *dispatch; + OSSL_FUNC_rand_newctx_fn *newctx; + OSSL_FUNC_rand_freectx_fn *freectx; + OSSL_FUNC_rand_instantiate_fn *instantiate; + OSSL_FUNC_rand_uninstantiate_fn *uninstantiate; + OSSL_FUNC_rand_generate_fn *generate; + OSSL_FUNC_rand_reseed_fn *reseed; + OSSL_FUNC_rand_nonce_fn *nonce; + OSSL_FUNC_rand_enable_locking_fn *enable_locking; + OSSL_FUNC_rand_lock_fn *lock; + OSSL_FUNC_rand_unlock_fn *unlock; + OSSL_FUNC_rand_gettable_params_fn *gettable_params; + OSSL_FUNC_rand_gettable_ctx_params_fn *gettable_ctx_params; + OSSL_FUNC_rand_settable_ctx_params_fn *settable_ctx_params; + OSSL_FUNC_rand_get_params_fn *get_params; + OSSL_FUNC_rand_get_ctx_params_fn *get_ctx_params; + OSSL_FUNC_rand_set_ctx_params_fn *set_ctx_params; + OSSL_FUNC_rand_verify_zeroization_fn *verify_zeroization; +} /* EVP_RAND */ ; + static int evp_rand_up_ref(void *vrand) { EVP_RAND *rand = (EVP_RAND *)vrand; @@ -144,11 +170,6 @@ static void *evp_rand_from_dispatch(int name_id, break; rand->nonce = OSSL_FUNC_rand_nonce(fns); break; - case OSSL_FUNC_RAND_SET_CALLBACKS: - if (rand->set_callbacks != NULL) - break; - rand->set_callbacks = OSSL_FUNC_rand_set_callbacks(fns); - break; case OSSL_FUNC_RAND_ENABLE_LOCKING: if (rand->enable_locking != NULL) break; @@ -579,38 +600,6 @@ int EVP_RAND_state(EVP_RAND_CTX *ctx) return state; } -static int evp_rand_set_callbacks_locked(EVP_RAND_CTX *ctx, - OSSL_INOUT_CALLBACK *get_entropy, - OSSL_CALLBACK *cleanup_entropy, - OSSL_INOUT_CALLBACK *get_nonce, - OSSL_CALLBACK *cleanup_nonce, - void *arg) -{ - if (ctx->meth->set_callbacks == NULL) { - EVPerr(0, EVP_R_UNABLE_TO_SET_CALLBACKS); - return 0; - } - ctx->meth->set_callbacks(ctx->data, get_entropy, cleanup_entropy, - get_nonce, cleanup_nonce, arg); - return 1; -} - -int EVP_RAND_set_callbacks(EVP_RAND_CTX *ctx, - OSSL_INOUT_CALLBACK *get_entropy, - OSSL_CALLBACK *cleanup_entropy, - OSSL_INOUT_CALLBACK *get_nonce, - OSSL_CALLBACK *cleanup_nonce, void *arg) -{ - int res; - - if (!evp_rand_lock(ctx)) - return 0; - res = evp_rand_set_callbacks_locked(ctx, get_entropy, cleanup_entropy, - get_nonce, cleanup_nonce, arg); - evp_rand_unlock(ctx); - return res; -} - static int evp_rand_verify_zeroization_locked(EVP_RAND_CTX *ctx) { if (ctx->meth->verify_zeroization != NULL) |