Added trace messages for category ENTROPY (#75)

Co-authored-by: neelimap <neelimaps@neominds.in>
Reviewed-on: http://13.234.246.121:3000/Neominds/ossl35vx69/pulls/75
Co-authored-by: Neelima P S <neelima.ps@neominds.in>
Co-committed-by: Neelima P S <neelima.ps@neominds.in>
This commit is contained in:
2026-07-30 20:46:34 +05:30
committed by neelimap
co-authored by neelimap
parent 1f8cf8b317
commit 52606ba138
3 changed files with 19 additions and 0 deletions
@@ -23,6 +23,8 @@
#include "crypto/evp.h" #include "crypto/evp.h"
#include "crypto/evp/evp_local.h" #include "crypto/evp/evp_local.h"
#include "internal/provider.h" #include "internal/provider.h"
#include <openssl/trace.h>
static OSSL_FUNC_rand_newctx_fn drbg_ctr_new_wrapper; static OSSL_FUNC_rand_newctx_fn drbg_ctr_new_wrapper;
static OSSL_FUNC_rand_freectx_fn drbg_ctr_free; static OSSL_FUNC_rand_freectx_fn drbg_ctr_free;
@@ -345,6 +347,15 @@ static int drbg_ctr_instantiate_wrapper(void *vdrbg, unsigned int strength,
goto err; goto err;
ret = ossl_prov_drbg_instantiate(drbg, strength, prediction_resistance, ret = ossl_prov_drbg_instantiate(drbg, strength, prediction_resistance,
pstr, pstr_len); pstr, pstr_len);
OSSL_TRACE_BEGIN(ENTROPY) {
BIO_printf(trc_out, "ossl_prov_drbg_instantiate returned: %d\n", ret);
if (ret == 1) {
BIO_printf(trc_out, "DRBG instantiated successfully: ret = %d\n", ret);
} else {
BIO_printf(trc_out, "DRBG instantiation failed: ret = %d\n", ret);
}
} OSSL_TRACE_END(ENTROPY);
err: err:
if (drbg->lock != NULL) if (drbg->lock != NULL)
CRYPTO_THREAD_unlock(drbg->lock); CRYPTO_THREAD_unlock(drbg->lock);
@@ -21,6 +21,8 @@
#include "prov/provider_ctx.h" #include "prov/provider_ctx.h"
#include "crypto/rand.h" #include "crypto/rand.h"
#include "crypto/rand_pool.h" #include "crypto/rand_pool.h"
#include <openssl/trace.h>
static OSSL_FUNC_rand_newctx_fn seed_src_new; static OSSL_FUNC_rand_newctx_fn seed_src_new;
static OSSL_FUNC_rand_freectx_fn seed_src_free; static OSSL_FUNC_rand_freectx_fn seed_src_free;
@@ -195,6 +197,8 @@ static size_t seed_get_seed(void *vseed, unsigned char **pout,
/* Get entropy by polling system entropy sources. */ /* Get entropy by polling system entropy sources. */
entropy_available = ossl_pool_acquire_entropy(pool); entropy_available = ossl_pool_acquire_entropy(pool);
OSSL_TRACE1(ENTROPY, "entropy_available = %d\n", entropy_available);
if (entropy_available > 0 if (entropy_available > 0
&& ossl_rand_pool_adin_mix_in(pool, adin, adin_len)) { && ossl_rand_pool_adin_mix_in(pool, adin, adin_len)) {
ret = ossl_rand_pool_length(pool); ret = ossl_rand_pool_length(pool);
@@ -17,6 +17,8 @@
#include <version.h> #include <version.h>
#include <taskLib.h> #include <taskLib.h>
#include "sysLib.h" #include "sysLib.h"
#include <openssl/trace.h>
extern unsigned char *collectEntropyFromInterruptJitter(void); extern unsigned char *collectEntropyFromInterruptJitter(void);
@@ -133,6 +135,8 @@ size_t ossl_pool_acquire_entropy(RAND_POOL *pool)
bytes_needed = ossl_rand_pool_bytes_needed(pool, 1 /*entropy_factor*/); bytes_needed = ossl_rand_pool_bytes_needed(pool, 1 /*entropy_factor*/);
OSSL_TRACE1(ENTROPY, "ossl_rand_pool_bytes_needed(),bytes_needed = %d\n", bytes_needed);
if (bytes_needed > 0) { if (bytes_needed > 0) {
int retryCount = 0; int retryCount = 0;
STATUS result = ERROR; STATUS result = ERROR;