libraries/WM_Libraries/Platform/Common/crypto/prng/prng.c
int32 psInitPrng(psRandom_t *ctx)
{
#if defined(USE_FORTUNA) || defined(USE_YARROW)
	unsigned char	entropyBytes[RANDOM_ENTROPY_BYTES];
	int32			rc;
#endif
	
	ctx->bytecount = 0;

	
#if defined(USE_FORTUNA) || defined(USE_YARROW)
	if ((rc = psGetEntropy(entropyBytes, RANDOM_ENTROPY_BYTES)) < 0) {
		return rc;
	}
#endif

#ifdef USE_YARROW
	if ((rc = psYarrowStart(&ctx->yarrow)) < 0) {
		return rc;
	}
	if ((rc = psYarrowAddEntropy(entropyBytes, RANDOM_ENTROPY_BYTES,
			&ctx->yarrow)) < 0) {
		return rc;
	}
	if ((rc = psYarrowReseed(&ctx->yarrow)) < 0) {
		return rc;
	}
#endif
	return PS_SUCCESS;
}
/*
	Priority order of PRNG algorithms and then default GetEntropy if none.
	Does an initial entropy source and reseeding
*/
Priority order of PRNG algorithms and then default GetEntropy if none.
Does an initial entropy source and reseeding
Priority order of PRNG algorithms and then default GetEntropy if none . Does an initial entropy source and reseeding
int32 psInitPrng(psRandom_t *ctx)
{
#if defined(USE_FORTUNA) || defined(USE_YARROW)
	unsigned char	entropyBytes[RANDOM_ENTROPY_BYTES];
	int32			rc;
#endif
	ctx->bytecount = 0;
#if defined(USE_FORTUNA) || defined(USE_YARROW)
	if ((rc = psGetEntropy(entropyBytes, RANDOM_ENTROPY_BYTES)) < 0) {
		return rc;
	}
#endif
#ifdef USE_YARROW
	if ((rc = psYarrowStart(&ctx->yarrow)) < 0) {
		return rc;
	}
	if ((rc = psYarrowAddEntropy(entropyBytes, RANDOM_ENTROPY_BYTES,
			&ctx->yarrow)) < 0) {
		return rc;
	}
	if ((rc = psYarrowReseed(&ctx->yarrow)) < 0) {
		return rc;
	}
#endif
	return PS_SUCCESS;
}
int32 psInitPrng ( psRandom_t * ctx ) { #if defined ( USE_FORTUNA ) || defined ( USE_YARROW ) unsigned char entropyBytes [ RANDOM_ENTROPY_BYTES ] ; int32 rc ; #endif ctx -> bytecount = 0 ; #if defined ( USE_FORTUNA ) || defined ( USE_YARROW ) if ( ( rc = psGetEntropy ( entropyBytes , RANDOM_ENTROPY_BYTES ) ) < 0 ) { return rc ; } #endif #ifdef USE_YARROW if ( ( rc = psYarrowStart ( & ctx -> yarrow ) ) < 0 ) { return rc ; } if ( ( rc = psYarrowAddEntropy ( entropyBytes , RANDOM_ENTROPY_BYTES , & ctx -> yarrow ) ) < 0 ) { return rc ; } if ( ( rc = psYarrowReseed ( & ctx -> yarrow ) ) < 0 ) { return rc ; } #endif return PS_SUCCESS ; }
Priority order of PRNG algorithms and then default GetEntropy if none.
Priority order of PRNG algorithms and then default GetEntropy if none .