MCPcopy Create free account
hub / github.com/Tripwire/tripwire-open-source / randomize_by_device

Function randomize_by_device

src/twcrypto/crypto.cpp:1251–1266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1249
1250#if USE_DEV_URANDOM
1251static bool randomize_by_device(const char* device_name, int8* destbuf, int len)
1252{
1253 static int rng_device = -1;
1254
1255 if (-1 == rng_device)
1256 rng_device = open(device_name, O_RDONLY | O_NONBLOCK);
1257
1258 if (rng_device >= 0)
1259 {
1260 int bytes_read = read(rng_device, destbuf, len);
1261 if (bytes_read == len)
1262 return true;
1263 }
1264
1265 return false;
1266}
1267#else
1268static bool gRandomizeBytesSeeded = false;
1269#endif

Callers 1

RandomizeBytesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected