diff options
author | Pauli <paul.dale@oracle.com> | 2020-11-16 12:04:56 +1000 |
---|---|---|
committer | Pauli <paul.dale@oracle.com> | 2020-11-19 07:39:12 +1000 |
commit | 1dc188ba0e7bd00e206d0190b2128e96287838df (patch) | |
tree | 728b864ab84eeea5b578015566a33cacf0414602 | |
parent | 893d3df9728aedece5aa9fc6eef9db4f1a215c25 (diff) | |
download | openssl-new-1dc188ba0e7bd00e206d0190b2128e96287838df.tar.gz |
Provide side RNG functions renamed to have an ossl_ prefix.
These are: prov_crngt_cleanup_entropy(), prov_crngt_get_entropy(),
prov_pool_acquire_entropy(), prov_pool_add_nonce_data(),
prov_rand_drbg_free() and prov_rand_drbg_new().
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13417)
-rw-r--r-- | crypto/rand/rand_lib.c | 2 | ||||
-rw-r--r-- | providers/implementations/include/prov/seeding.h | 4 | ||||
-rw-r--r-- | providers/implementations/rands/crngt.c | 6 | ||||
-rw-r--r-- | providers/implementations/rands/drbg.c | 16 | ||||
-rw-r--r-- | providers/implementations/rands/drbg_ctr.c | 4 | ||||
-rw-r--r-- | providers/implementations/rands/drbg_hash.c | 4 | ||||
-rw-r--r-- | providers/implementations/rands/drbg_hmac.c | 4 | ||||
-rw-r--r-- | providers/implementations/rands/drbg_local.h | 8 | ||||
-rw-r--r-- | providers/implementations/rands/seeding/rand_unix.c | 6 | ||||
-rw-r--r-- | providers/implementations/rands/seeding/rand_vms.c | 4 | ||||
-rw-r--r-- | providers/implementations/rands/seeding/rand_vxworks.c | 4 | ||||
-rw-r--r-- | providers/implementations/rands/seeding/rand_win.c | 4 | ||||
-rw-r--r-- | providers/implementations/rands/test_rng.c | 4 |
13 files changed, 35 insertions, 35 deletions
diff --git a/crypto/rand/rand_lib.c b/crypto/rand/rand_lib.c index 211f4f3f51..9790b21646 100644 --- a/crypto/rand/rand_lib.c +++ b/crypto/rand/rand_lib.c @@ -125,7 +125,7 @@ int RAND_poll(void) if (pool == NULL) return 0; - if (prov_pool_acquire_entropy(pool) == 0) + if (ossl_pool_acquire_entropy(pool) == 0) goto err; if (meth->add == NULL diff --git a/providers/implementations/include/prov/seeding.h b/providers/implementations/include/prov/seeding.h index bd0a57a769..ec69040606 100644 --- a/providers/implementations/include/prov/seeding.h +++ b/providers/implementations/include/prov/seeding.h @@ -18,8 +18,8 @@ size_t prov_drbg_get_additional_data(RAND_POOL *pool, unsigned char **pout); void prov_drbg_cleanup_additional_data(RAND_POOL *pool, unsigned char *out); -size_t prov_pool_acquire_entropy(RAND_POOL *pool); -int prov_pool_add_nonce_data(RAND_POOL *pool); +size_t ossl_pool_acquire_entropy(RAND_POOL *pool); +int ossl_pool_add_nonce_data(RAND_POOL *pool); /* * Add some platform specific additional data diff --git a/providers/implementations/rands/crngt.c b/providers/implementations/rands/crngt.c index 5f613f1c4e..72907b5a88 100644 --- a/providers/implementations/rands/crngt.c +++ b/providers/implementations/rands/crngt.c @@ -41,7 +41,7 @@ static int crngt_get_entropy(OSSL_LIB_CTX *ctx, RAND_POOL *pool, if (pool == NULL) return 0; - n = prov_pool_acquire_entropy(pool); + n = ossl_pool_acquire_entropy(pool); if (n >= CRNGT_BUFSIZ) { fmd = EVP_MD_fetch(ctx, "SHA256", ""); if (fmd == NULL) @@ -104,7 +104,7 @@ static int prov_crngt_compare_previous(const unsigned char *prev, return res; } -size_t prov_crngt_get_entropy(PROV_DRBG *drbg, +size_t ossl_crngt_get_entropy(PROV_DRBG *drbg, unsigned char **pout, int entropy, size_t min_len, size_t max_len, int prediction_resistance) @@ -164,7 +164,7 @@ err: return r; } -void prov_crngt_cleanup_entropy(PROV_DRBG *drbg, +void ossl_crngt_cleanup_entropy(PROV_DRBG *drbg, unsigned char *out, size_t outlen) { OPENSSL_secure_clear_free(out, outlen); diff --git a/providers/implementations/rands/drbg.c b/providers/implementations/rands/drbg.c index f3111fddb6..eb1353a5e7 100644 --- a/providers/implementations/rands/drbg.c +++ b/providers/implementations/rands/drbg.c @@ -139,7 +139,7 @@ static unsigned int get_parent_reseed_count(PROV_DRBG *drbg) * is fetched using the parent's ossl_prov_drbg_generate(). * * Otherwise, the entropy is polled from the system entropy sources - * using prov_pool_acquire_entropy(). + * using ossl_pool_acquire_entropy(). * * If a random pool has been added to the DRBG using RAND_add(), then * its entropy will be used up first. @@ -214,7 +214,7 @@ static size_t prov_drbg_get_entropy(PROV_DRBG *drbg, unsigned char **pout, } } else { /* Get entropy by polling system entropy sources. */ - entropy_available = prov_pool_acquire_entropy(pool); + entropy_available = ossl_pool_acquire_entropy(pool); } if (entropy_available > 0) { @@ -246,7 +246,7 @@ static size_t get_entropy(PROV_DRBG *drbg, unsigned char **pout, int entropy, { #ifdef FIPS_MODULE if (drbg->parent == NULL) - return prov_crngt_get_entropy(drbg, pout, entropy, min_len, max_len, + return ossl_crngt_get_entropy(drbg, pout, entropy, min_len, max_len, prediction_resistance); #endif @@ -258,7 +258,7 @@ static void cleanup_entropy(PROV_DRBG *drbg, unsigned char *out, size_t outlen) { #ifdef FIPS_MODULE if (drbg->parent == NULL) - prov_crngt_cleanup_entropy(drbg, out, outlen); + ossl_crngt_cleanup_entropy(drbg, out, outlen); else #endif prov_drbg_cleanup_entropy(drbg, out, outlen); @@ -353,7 +353,7 @@ static size_t prov_drbg_get_nonce(PROV_DRBG *drbg, if (pool == NULL) return 0; - if (prov_pool_add_nonce_data(pool) == 0) + if (ossl_pool_add_nonce_data(pool) == 0) goto err; data.instance = drbg; @@ -807,7 +807,7 @@ int drbg_enable_locking(void *vctx) * * Returns a pointer to the new DRBG instance on success, NULL on failure. */ -PROV_DRBG *prov_rand_drbg_new +PROV_DRBG *ossl_rand_drbg_new (void *provctx, void *parent, const OSSL_DISPATCH *p_dispatch, int (*dnew)(PROV_DRBG *ctx), int (*instantiate)(PROV_DRBG *drbg, @@ -883,11 +883,11 @@ PROV_DRBG *prov_rand_drbg_new return drbg; err: - prov_rand_drbg_free(drbg); + ossl_rand_drbg_free(drbg); return NULL; } -void prov_rand_drbg_free(PROV_DRBG *drbg) +void ossl_rand_drbg_free(PROV_DRBG *drbg) { if (drbg == NULL) return; diff --git a/providers/implementations/rands/drbg_ctr.c b/providers/implementations/rands/drbg_ctr.c index 6f9dc658d7..4a5b0b23da 100644 --- a/providers/implementations/rands/drbg_ctr.c +++ b/providers/implementations/rands/drbg_ctr.c @@ -606,7 +606,7 @@ static int drbg_ctr_new(PROV_DRBG *drbg) static void *drbg_ctr_new_wrapper(void *provctx, void *parent, const OSSL_DISPATCH *parent_dispatch) { - return prov_rand_drbg_new(provctx, parent, parent_dispatch, &drbg_ctr_new, + return ossl_rand_drbg_new(provctx, parent, parent_dispatch, &drbg_ctr_new, &drbg_ctr_instantiate, &drbg_ctr_uninstantiate, &drbg_ctr_reseed, &drbg_ctr_generate); } @@ -625,7 +625,7 @@ static void drbg_ctr_free(void *vdrbg) OPENSSL_secure_clear_free(ctr, sizeof(*ctr)); } - prov_rand_drbg_free(drbg); + ossl_rand_drbg_free(drbg); } static int drbg_ctr_get_ctx_params(void *vdrbg, OSSL_PARAM params[]) diff --git a/providers/implementations/rands/drbg_hash.c b/providers/implementations/rands/drbg_hash.c index 2b7ac2bd5f..9d8816996f 100644 --- a/providers/implementations/rands/drbg_hash.c +++ b/providers/implementations/rands/drbg_hash.c @@ -407,7 +407,7 @@ static int drbg_hash_new(PROV_DRBG *ctx) static void *drbg_hash_new_wrapper(void *provctx, void *parent, const OSSL_DISPATCH *parent_dispatch) { - return prov_rand_drbg_new(provctx, parent, parent_dispatch, &drbg_hash_new, + return ossl_rand_drbg_new(provctx, parent, parent_dispatch, &drbg_hash_new, &drbg_hash_instantiate, &drbg_hash_uninstantiate, &drbg_hash_reseed, &drbg_hash_generate); } @@ -422,7 +422,7 @@ static void drbg_hash_free(void *vdrbg) ossl_prov_digest_reset(&hash->digest); OPENSSL_secure_clear_free(hash, sizeof(*hash)); } - prov_rand_drbg_free(drbg); + ossl_rand_drbg_free(drbg); } static int drbg_hash_get_ctx_params(void *vdrbg, OSSL_PARAM params[]) diff --git a/providers/implementations/rands/drbg_hmac.c b/providers/implementations/rands/drbg_hmac.c index 95ee2a1db5..0436684a33 100644 --- a/providers/implementations/rands/drbg_hmac.c +++ b/providers/implementations/rands/drbg_hmac.c @@ -304,7 +304,7 @@ static int drbg_hmac_new(PROV_DRBG *drbg) static void *drbg_hmac_new_wrapper(void *provctx, void *parent, const OSSL_DISPATCH *parent_dispatch) { - return prov_rand_drbg_new(provctx, parent, parent_dispatch, &drbg_hmac_new, + return ossl_rand_drbg_new(provctx, parent, parent_dispatch, &drbg_hmac_new, &drbg_hmac_instantiate, &drbg_hmac_uninstantiate, &drbg_hmac_reseed, &drbg_hmac_generate); } @@ -319,7 +319,7 @@ static void drbg_hmac_free(void *vdrbg) ossl_prov_digest_reset(&hmac->digest); OPENSSL_secure_clear_free(hmac, sizeof(*hmac)); } - prov_rand_drbg_free(drbg); + ossl_rand_drbg_free(drbg); } static int drbg_hmac_get_ctx_params(void *vdrbg, OSSL_PARAM params[]) diff --git a/providers/implementations/rands/drbg_local.h b/providers/implementations/rands/drbg_local.h index 40ca6fadaa..7c3fcabbe0 100644 --- a/providers/implementations/rands/drbg_local.h +++ b/providers/implementations/rands/drbg_local.h @@ -191,7 +191,7 @@ struct prov_drbg_st { OSSL_CALLBACK *cleanup_nonce_fn; }; -PROV_DRBG *prov_rand_drbg_new +PROV_DRBG *ossl_rand_drbg_new (void *provctx, void *parent, const OSSL_DISPATCH *parent_dispatch, int (*dnew)(PROV_DRBG *ctx), int (*instantiate)(PROV_DRBG *drbg, @@ -203,7 +203,7 @@ PROV_DRBG *prov_rand_drbg_new const unsigned char *adin, size_t adin_len), int (*generate)(PROV_DRBG *, unsigned char *out, size_t outlen, const unsigned char *adin, size_t adin_len)); -void prov_rand_drbg_free(PROV_DRBG *drbg); +void ossl_rand_drbg_free(PROV_DRBG *drbg); int ossl_prov_drbg_instantiate(PROV_DRBG *drbg, unsigned int strength, int prediction_resistance, @@ -258,11 +258,11 @@ int drbg_set_ctx_params(PROV_DRBG *drbg, const OSSL_PARAM params[]); OSSL_PARAM_uint64(OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL, NULL) /* Continuous test "entropy" calls */ -size_t prov_crngt_get_entropy(PROV_DRBG *drbg, +size_t ossl_crngt_get_entropy(PROV_DRBG *drbg, unsigned char **pout, int entropy, size_t min_len, size_t max_len, int prediction_resistance); -void prov_crngt_cleanup_entropy(PROV_DRBG *drbg, +void ossl_crngt_cleanup_entropy(PROV_DRBG *drbg, unsigned char *out, size_t outlen); #endif diff --git a/providers/implementations/rands/seeding/rand_unix.c b/providers/implementations/rands/seeding/rand_unix.c index 3696688dd2..35d2878d5c 100644 --- a/providers/implementations/rands/seeding/rand_unix.c +++ b/providers/implementations/rands/seeding/rand_unix.c @@ -165,7 +165,7 @@ static uint64_t get_timer_bits(void); * * As a precaution, we assume only 2 bits of entropy per byte. */ -size_t prov_pool_acquire_entropy(RAND_POOL *pool) +size_t ossl_pool_acquire_entropy(RAND_POOL *pool) { short int code; int i, k; @@ -649,7 +649,7 @@ void rand_pool_keep_random_devices_open(int keep) * of input from the different entropy sources (trust, quality, * possibility of blocking). */ -size_t prov_pool_acquire_entropy(RAND_POOL *pool) +size_t ossl_pool_acquire_entropy(RAND_POOL *pool) { # if defined(OPENSSL_RAND_SEED_NONE) return rand_pool_entropy_available(pool); @@ -777,7 +777,7 @@ size_t prov_pool_acquire_entropy(RAND_POOL *pool) #if (defined(OPENSSL_SYS_UNIX) && !defined(OPENSSL_SYS_VXWORKS)) \ || defined(__DJGPP__) -int prov_pool_add_nonce_data(RAND_POOL *pool) +int ossl_pool_add_nonce_data(RAND_POOL *pool) { struct { pid_t pid; diff --git a/providers/implementations/rands/seeding/rand_vms.c b/providers/implementations/rands/seeding/rand_vms.c index 7adf3e718a..da143f3dbe 100644 --- a/providers/implementations/rands/seeding/rand_vms.c +++ b/providers/implementations/rands/seeding/rand_vms.c @@ -474,7 +474,7 @@ size_t data_collect_method(RAND_POOL *pool) return rand_pool_entropy_available(pool); } -int prov_pool_add_nonce_data(RAND_POOL *pool) +int ossl_pool_add_nonce_data(RAND_POOL *pool) { struct { pid_t pid; @@ -568,7 +568,7 @@ size_t get_entropy_method(RAND_POOL *pool) * These functions are called by the RAND / DRBG functions */ -size_t prov_pool_acquire_entropy(RAND_POOL *pool) +size_t ossl_pool_acquire_entropy(RAND_POOL *pool) { if (init_get_entropy_address()) return get_entropy_method(pool); diff --git a/providers/implementations/rands/seeding/rand_vxworks.c b/providers/implementations/rands/seeding/rand_vxworks.c index f601f77a47..70b4c7b677 100644 --- a/providers/implementations/rands/seeding/rand_vxworks.c +++ b/providers/implementations/rands/seeding/rand_vxworks.c @@ -96,7 +96,7 @@ int rand_pool_add_additional_data(RAND_POOL *pool) return rand_pool_add(pool, (unsigned char *)&data, sizeof(data), 0); } -int prov_pool_add_nonce_data(RAND_POOL *pool) +int ossl_pool_add_nonce_data(RAND_POOL *pool) { struct { pid_t pid; @@ -118,7 +118,7 @@ int prov_pool_add_nonce_data(RAND_POOL *pool) return rand_pool_add(pool, (unsigned char *)&data, sizeof(data), 0); } -size_t prov_pool_acquire_entropy(RAND_POOL *pool) +size_t ossl_pool_acquire_entropy(RAND_POOL *pool) { #if defined(RAND_SEED_VXRANDLIB) /* vxRandLib based entropy method */ diff --git a/providers/implementations/rands/seeding/rand_win.c b/providers/implementations/rands/seeding/rand_win.c index d820d3e395..bac6b5723e 100644 --- a/providers/implementations/rands/seeding/rand_win.c +++ b/providers/implementations/rands/seeding/rand_win.c @@ -42,7 +42,7 @@ # define INTEL_DEF_PROV L"Intel Hardware Cryptographic Service Provider" # endif -size_t prov_pool_acquire_entropy(RAND_POOL *pool) +size_t ossl_pool_acquire_entropy(RAND_POOL *pool) { # ifndef USE_BCRYPTGENRANDOM HCRYPTPROV hProvider; @@ -122,7 +122,7 @@ size_t prov_pool_acquire_entropy(RAND_POOL *pool) } -int prov_pool_add_nonce_data(RAND_POOL *pool) +int ossl_pool_add_nonce_data(RAND_POOL *pool) { struct { DWORD pid; diff --git a/providers/implementations/rands/test_rng.c b/providers/implementations/rands/test_rng.c index bb0d2a46a9..5ad4ad6d6f 100644 --- a/providers/implementations/rands/test_rng.c +++ b/providers/implementations/rands/test_rng.c @@ -61,7 +61,7 @@ static void test_rng_free(void *vdrbg) OPENSSL_free(t->entropy); OPENSSL_free(t->nonce); OPENSSL_free(drbg->data); - prov_rand_drbg_free(drbg); + ossl_rand_drbg_free(drbg); } static int test_rng_instantiate(PROV_DRBG *drbg, @@ -293,7 +293,7 @@ static int test_rng_verify_zeroization(void *vdrbg) static void *test_rng_new_wrapper(void *provctx, void *parent, const OSSL_DISPATCH *parent_dispatch) { - return prov_rand_drbg_new(provctx, parent, parent_dispatch, + return ossl_rand_drbg_new(provctx, parent, parent_dispatch, &test_rng_new, &test_rng_instantiate, &test_rng_uninstantiate, &test_rng_reseed, &test_rng_generate); |