예제 #1
0
파일: osrng.cpp 프로젝트: xfxf123444/japan
void AutoSeededRandomPool::Reseed(bool blocking, unsigned int seedSize)
{
#ifdef NONBLOCKING_RNG_AVAILABLE
	if (blocking)
#endif
	{
#ifdef BLOCKING_RNG_AVAILABLE
		BlockingRng rng;
		SecByteBlock seed(seedSize);
		rng.GenerateBlock(seed, seedSize);
		Put(seed, seedSize);
#endif
	}

#ifdef BLOCKING_RNG_AVAILABLE
	if (!blocking)
#endif
	{
#ifdef NONBLOCKING_RNG_AVAILABLE
		NonblockingRng rng;
		SecByteBlock seed(seedSize);
		rng.GenerateBlock(seed, seedSize);
		Put(seed, seedSize);
#endif
	}
}
예제 #2
0
파일: osrng.cpp 프로젝트: hon1nbo/BCTt
void OS_GenerateRandomBlock(bool blocking, byte *output, size_t size)
{
#ifdef NONBLOCKING_RNG_AVAILABLE
	if (blocking)
#endif
	{
#ifdef BLOCKING_RNG_AVAILABLE
		BlockingRng rng;
		rng.GenerateBlock(output, size);
#endif
	}

#ifdef BLOCKING_RNG_AVAILABLE
	if (!blocking)
#endif
	{
#ifdef NONBLOCKING_RNG_AVAILABLE
		NonblockingRng rng;
		rng.GenerateBlock(output, size);
#endif
	}
}