mirror of
https://github.com/ntop/n2n.git
synced 2024-09-20 00:51:10 +02:00
enabled windows random numbers for seed (#622)
This commit is contained in:
parent
b2d16f4162
commit
b3a4eac4d7
|
@ -43,12 +43,9 @@
|
||||||
#include <immintrin.h> /* _rdrand64_step, rdseed4_step */
|
#include <immintrin.h> /* _rdrand64_step, rdseed4_step */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// the WIN32 code is still untested and thus commented, also see random_numbers.c
|
|
||||||
/*
|
|
||||||
#if defined (WIN32)
|
#if defined (WIN32)
|
||||||
#include <Wincrypt.h> // HCTYPTPROV, Crypt*-functions
|
#include <Wincrypt.h> // HCTYPTPROV, Crypt*-functions
|
||||||
#endif
|
#endif
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct rn_generator_state_t {
|
typedef struct rn_generator_state_t {
|
||||||
|
|
|
@ -155,17 +155,14 @@ uint64_t n2n_seed (void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// the following WIN32 code is still untested and thus commented
|
|
||||||
/*
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
HCRYPTPROV crypto_provider;
|
HCRYPTPROV crypto_provider;
|
||||||
CryptAcquireContext (&crypto_provider, NULL, (LPCWSTR)L"Microsoft Base Cryptographic Provider v1.0",
|
CryptAcquireContext (&crypto_provider, NULL, NULL,
|
||||||
PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
|
PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
|
||||||
CryptGenRandom (crypto_provider, 8, &seed);
|
CryptGenRandom (crypto_provider, 8, &seed);
|
||||||
CryptReleaseContext (crypto_provider, 0);
|
CryptReleaseContext (crypto_provider, 0);
|
||||||
ret += seed;
|
ret += seed;
|
||||||
#endif
|
#endif
|
||||||
*/
|
|
||||||
|
|
||||||
seed = time(NULL); /* UTC in seconds */
|
seed = time(NULL); /* UTC in seconds */
|
||||||
ret += seed;
|
ret += seed;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user