зеркало из https://github.com/github/ruby.git
* random.c (fill_random_seed): use cryptographic service on Windows.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
924e2fcefa
Коммит
b12c5a85b4
|
@ -1,3 +1,7 @@
|
||||||
|
Sat Jul 18 09:07:00 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* random.c (fill_random_seed): use cryptographic service on Windows.
|
||||||
|
|
||||||
Sat Jul 18 07:56:00 2009 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
Sat Jul 18 07:56:00 2009 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||||
|
|
||||||
* ext/tk/lib/tk.rb: fail to create a widget object for an unknown
|
* ext/tk/lib/tk.rb: fail to create a widget object for an unknown
|
||||||
|
|
7
random.c
7
random.c
|
@ -389,6 +389,8 @@ fill_random_seed(unsigned int seed[DEFAULT_SEED_CNT])
|
||||||
#if USE_DEV_URANDOM
|
#if USE_DEV_URANDOM
|
||||||
int fd;
|
int fd;
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
|
#elif defined(_WIN32)
|
||||||
|
HCRYPTPROV prov;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
memset(seed, 0, DEFAULT_SEED_LEN);
|
memset(seed, 0, DEFAULT_SEED_LEN);
|
||||||
|
@ -410,6 +412,11 @@ fill_random_seed(unsigned int seed[DEFAULT_SEED_CNT])
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
#elif defined(_WIN32)
|
||||||
|
if (CryptAcquireContext(&prov, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
|
||||||
|
CryptGenRandom(prov, DEFAULT_SEED_LEN, seed);
|
||||||
|
CryptReleaseContext(prov, 0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gettimeofday(&tv, 0);
|
gettimeofday(&tv, 0);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче