mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* random.c (fill_random_seed): needs wincrypt.h.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b12c5a85b4
commit
8195282dfc
1 changed files with 4 additions and 1 deletions
5
random.c
5
random.c
|
@ -380,6 +380,9 @@ random_init(int argc, VALUE *argv, VALUE obj)
|
||||||
#else
|
#else
|
||||||
# define USE_DEV_URANDOM 0
|
# define USE_DEV_URANDOM 0
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <wincrypt.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fill_random_seed(unsigned int seed[DEFAULT_SEED_CNT])
|
fill_random_seed(unsigned int seed[DEFAULT_SEED_CNT])
|
||||||
|
@ -414,7 +417,7 @@ fill_random_seed(unsigned int seed[DEFAULT_SEED_CNT])
|
||||||
}
|
}
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
if (CryptAcquireContext(&prov, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
|
if (CryptAcquireContext(&prov, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
|
||||||
CryptGenRandom(prov, DEFAULT_SEED_LEN, seed);
|
CryptGenRandom(prov, DEFAULT_SEED_LEN, (void *)seed);
|
||||||
CryptReleaseContext(prov, 0);
|
CryptReleaseContext(prov, 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue