Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Issue 141753009: Use RtlGenRandom() directly instead of going through rand_s(). (Closed)

Created:
6 years, 11 months ago by DaleCurtis
Modified:
6 years, 11 months ago
CC:
chromium-reviews, erikwright+watch_chromium.org
Base URL:
http://chromium.googlesource.com/chromium/src.git@master
Visibility:
Public.

Description

Use RtlGenRandom() directly instead of going through rand_s(). Results in a massive 44x improvement to RandBytes() for larger buffer sizes. Using the RandBytesPerf test, the results are: Original: 2961196.6us Modified: 63656.8us Improvement: 44x BUG=none TEST=randbytes unittests. NOTRY=true Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=246736

Patch Set 1 : Fix types. #

Total comments: 12

Patch Set 2 : Comments. #

Total comments: 3

Patch Set 3 : Use RtlGenRandom directly. #

Patch Set 4 : Add comments. #

Total comments: 4

Patch Set 5 : Comments. #

Patch Set 6 : Add missing header. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+22 lines, -20 lines) Patch
M base/rand_util_win.cc View 1 2 3 4 5 1 chunk +22 lines, -20 lines 0 comments Download

Messages

Total messages: 18 (0 generated)
DaleCurtis
Now with more Windows!
6 years, 11 months ago (2014-01-22 21:47:30 UTC) #1
DaleCurtis
6 years, 11 months ago (2014-01-22 21:59:13 UTC) #2
Ryan Sleevi
To answer Brad's question about "Why not CryptGenRandom" - because it's slow and multiple layers ...
6 years, 11 months ago (2014-01-22 22:12:26 UTC) #3
DaleCurtis
https://codereview.chromium.org/141753009/diff/80001/base/rand_util_win.cc File base/rand_util_win.cc (right): https://codereview.chromium.org/141753009/diff/80001/base/rand_util_win.cc#newcode41 base/rand_util_win.cc:41: uint64 number; On 2014/01/22 22:12:26, Ryan Sleevi wrote: > ...
6 years, 11 months ago (2014-01-22 22:27:52 UTC) #4
Ryan Sleevi
LGTM
6 years, 11 months ago (2014-01-22 22:29:28 UTC) #5
bradn
https://codereview.chromium.org/141753009/diff/80001/base/rand_util_win.cc File base/rand_util_win.cc (right): https://codereview.chromium.org/141753009/diff/80001/base/rand_util_win.cc#newcode21 base/rand_util_win.cc:21: ::GetProcAddress(::GetModuleHandle(L"advapi32.dll"), Any accomodation need to be made for failure ...
6 years, 11 months ago (2014-01-22 22:31:29 UTC) #6
wtc
Patch set 2 LGTM. https://codereview.chromium.org/141753009/diff/80001/base/rand_util_win.cc File base/rand_util_win.cc (right): https://codereview.chromium.org/141753009/diff/80001/base/rand_util_win.cc#newcode21 base/rand_util_win.cc:21: ::GetProcAddress(::GetModuleHandle(L"advapi32.dll"), On 2014/01/22 22:31:29, bradn ...
6 years, 11 months ago (2014-01-22 22:42:04 UTC) #7
Nico
lgtm If the dll can't be loaded on some systems, the crash servers will tell ...
6 years, 11 months ago (2014-01-22 22:46:53 UTC) #8
jschuh
https://codereview.chromium.org/141753009/diff/80001/base/rand_util_win.cc File base/rand_util_win.cc (right): https://codereview.chromium.org/141753009/diff/80001/base/rand_util_win.cc#newcode21 base/rand_util_win.cc:21: ::GetProcAddress(::GetModuleHandle(L"advapi32.dll"), One thing I forgot. Contrary to popular belief, ...
6 years, 11 months ago (2014-01-22 23:04:24 UTC) #9
DaleCurtis
PTAL. No more lazy initializer needed. https://codereview.chromium.org/141753009/diff/80001/base/rand_util_win.cc File base/rand_util_win.cc (right): https://codereview.chromium.org/141753009/diff/80001/base/rand_util_win.cc#newcode21 base/rand_util_win.cc:21: ::GetProcAddress(::GetModuleHandle(L"advapi32.dll"), On 2014/01/22 ...
6 years, 11 months ago (2014-01-22 23:50:50 UTC) #10
jschuh
lgtm for all the windowsieness. https://codereview.chromium.org/141753009/diff/80001/base/rand_util_win.cc File base/rand_util_win.cc (right): https://codereview.chromium.org/141753009/diff/80001/base/rand_util_win.cc#newcode51 base/rand_util_win.cc:51: std::min(output_length, static_cast<size_t>(kuint32max)); On 2014/01/22 ...
6 years, 11 months ago (2014-01-23 17:24:12 UTC) #11
wtc
Patch set 4 LGTM. Just some nits. https://codereview.chromium.org/141753009/diff/310001/base/rand_util_win.cc File base/rand_util_win.cc (right): https://codereview.chromium.org/141753009/diff/310001/base/rand_util_win.cc#newcode15 base/rand_util_win.cc:15: #include <stdint.h> ...
6 years, 11 months ago (2014-01-23 18:06:49 UTC) #12
DaleCurtis
Thanks for the reviews everyone! https://codereview.chromium.org/141753009/diff/310001/base/rand_util_win.cc File base/rand_util_win.cc (right): https://codereview.chromium.org/141753009/diff/310001/base/rand_util_win.cc#newcode15 base/rand_util_win.cc:15: #include <stdint.h> On 2014/01/23 ...
6 years, 11 months ago (2014-01-23 20:02:17 UTC) #13
wtc
Patch set 5 LGTM!
6 years, 11 months ago (2014-01-23 20:50:08 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dalecurtis@chromium.org/141753009/190002
6 years, 11 months ago (2014-01-23 21:11:29 UTC) #15
DaleCurtis
Patch set #6 adds a missing <algorithm> header for std::min (which broke the VS2013 build) ...
6 years, 11 months ago (2014-01-23 23:57:11 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dalecurtis@chromium.org/141753009/540001
6 years, 11 months ago (2014-01-23 23:58:53 UTC) #17
commit-bot: I haz the power
6 years, 11 months ago (2014-01-24 00:01:16 UTC) #18
Message was sent while issue was closed.
Change committed as 246736

Powered by Google App Engine
This is Rietveld 408576698