Log if non-cryptographic random numbers are used.
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
#define NOMINMAX // for Windows
|
#define NOMINMAX // for Windows
|
||||||
|
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
#include <core/loghelper.h>
|
||||||
#include <openssl/rand.h>
|
#include <openssl/rand.h>
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
@@ -41,6 +42,7 @@ void Tools::getRandNumber(int start, int end, int howMany, int* randArray, bool
|
|||||||
if(!RAND_bytes(rand_buf, 4))
|
if(!RAND_bytes(rand_buf, 4))
|
||||||
{
|
{
|
||||||
RAND_pseudo_bytes(rand_buf, 4);
|
RAND_pseudo_bytes(rand_buf, 4);
|
||||||
|
LOG_MSG("RAND_bytes failed, using RAND_pseudo_bytes.");
|
||||||
}
|
}
|
||||||
|
|
||||||
randNumber = 0;
|
randNumber = 0;
|
||||||
@@ -65,6 +67,7 @@ void Tools::getRandNumber(int start, int end, int howMany, int* randArray, bool
|
|||||||
if(!RAND_bytes(rand_buf, 4))
|
if(!RAND_bytes(rand_buf, 4))
|
||||||
{
|
{
|
||||||
RAND_pseudo_bytes(rand_buf, 4);
|
RAND_pseudo_bytes(rand_buf, 4);
|
||||||
|
LOG_MSG("RAND_bytes failed, using RAND_pseudo_bytes.");
|
||||||
}
|
}
|
||||||
|
|
||||||
randNumber = 0;
|
randNumber = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user