@@ -247,6 +247,13 @@ static int we_rand_add(const void *buf, int num, double entropy)
247247}
248248
249249#ifndef WE_STATIC_WOLFSSL
250+
251+ #ifdef ADD_WEAK_ENTROPY_OVERRIDE
252+ /* Prototype for user implemenations of XADD_WEAK_ENTROPY() */
253+ extern int my_add_weak_entropy (unsigned char * buf , int num );
254+ #define XADD_WEAK_ENTROPY (b , n ) my_add_weak_entropy(b, n)
255+ #endif /* ADD_WEAK_ENTROPY_OVERRIDE */
256+
250257/**
251258 * Add weak entropy to the input buffer. Used by we_rand_bytes to add entropy
252259 * for RNG. Uses thread ID, a timer value, and PID.
@@ -257,6 +264,9 @@ static int we_rand_add(const void *buf, int num, double entropy)
257264 */
258265static int we_rand_add_weak_entropy (unsigned char * buf , int num )
259266{
267+ #ifdef ADD_WEAK_ENTROPY_OVERRIDE
268+ return XADD_WEAK_ENTROPY (buf , num );
269+ #else
260270 int ret = 1 ;
261271 unsigned char * idx ;
262272#if OPENSSL_VERSION_NUMBER >= 0x1010000fL
@@ -339,6 +349,7 @@ static int we_rand_add_weak_entropy(unsigned char* buf, int num)
339349 WOLFENGINE_LEAVE (WE_LOG_RNG , "we_rand_add_weak_entropy" , ret );
340350
341351 return ret ;
352+ #endif /* ADD_WEAK_ENTROPY_OVERRIDE */
342353}
343354#endif /* WE_STATIC_WOLFSSL */
344355
0 commit comments