зеркало из https://github.com/github/ruby.git
random.c: fix need_secure flags
* random.c (fill_random_seed): do not need to be secure, to get rid of blocking at the start-up time. [ruby-core:87462] [Bug #14837] * random.c (random_raw_seed): expected to be a cryptographically secure, as documented. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
744b0bdb7b
Коммит
8389f8c3c3
4
random.c
4
random.c
|
@ -563,7 +563,7 @@ fill_random_seed(uint32_t *seed, size_t cnt)
|
|||
|
||||
memset(seed, 0, len);
|
||||
|
||||
fill_random_bytes(seed, len, TRUE);
|
||||
fill_random_bytes(seed, len, FALSE);
|
||||
|
||||
gettimeofday(&tv, 0);
|
||||
seed[0] ^= tv.tv_usec;
|
||||
|
@ -635,7 +635,7 @@ random_raw_seed(VALUE self, VALUE size)
|
|||
long n = NUM2ULONG(size);
|
||||
VALUE buf = rb_str_new(0, n);
|
||||
if (n == 0) return buf;
|
||||
if (fill_random_bytes(RSTRING_PTR(buf), n, FALSE))
|
||||
if (fill_random_bytes(RSTRING_PTR(buf), n, TRUE))
|
||||
rb_raise(rb_eRuntimeError, "failed to get urandom");
|
||||
return buf;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче