New 'getRand' function.

This commit is contained in:
JoelKatz
2012-12-06 10:55:23 -08:00
parent c55eb72d76
commit fa5e328561
2 changed files with 15 additions and 0 deletions

View File

@@ -5,6 +5,17 @@
#include <boost/foreach.hpp>
#include <boost/regex.hpp>
#include <openssl/rand.h>
void getRand(unsigned char *buf, int num)
{
if (RAND_bytes(buf, num) != 1)
{
assert(false);
throw std::runtime_error("Entropy pool not seeded");
}
}
//
// Time support
// We have our own epoch.