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
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
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)
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)
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);
* 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.
}
} 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) {
{
#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
{
#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);
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;
*
* 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,
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;
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);
}
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[])
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);
}
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[])
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);
}
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[])
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,
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,
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
*
* 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;
* 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);
#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;
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;
* 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);
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;
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 */
# 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;
}
-int prov_pool_add_nonce_data(RAND_POOL *pool)
+int ossl_pool_add_nonce_data(RAND_POOL *pool)
{
struct {
DWORD pid;
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,
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);