RandBytes could be simpler on Fuchsia |
|||
Issue description
Current:
void RandBytes(void* output, size_t output_length) {
size_t remaining = output_length;
unsigned char* cur = reinterpret_cast<unsigned char*>(output);
while (remaining > 0) {
// The syscall has a maximum number of bytes that can be read at once.
size_t read_len =
std::min(remaining, static_cast<size_t>(ZX_CPRNG_DRAW_MAX_LEN));
zx_cprng_draw(cur, read_len);
remaining -= read_len;
cur += read_len;
}
}
Better:
void RandBytes(void* output, size_t output_length) {
zx_cprng_draw(output, output_length);
}
,
Jun 28 2018
,
Jun 29 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/5304962d65497696f9e0ca65e888827eab207d3a commit 5304962d65497696f9e0ca65e888827eab207d3a Author: Wez <wez@chromium.org> Date: Fri Jun 29 05:46:49 2018 [fuchsia] Reduce RandBytes() to a single zx_cprng_draw() call. Bug: 858194 Change-Id: I051084347da2f395e25b090ba54439c866b0c044 Reviewed-on: https://chromium-review.googlesource.com/1119357 Commit-Queue: Wez <wez@chromium.org> Reviewed-by: Sergey Ulanov <sergeyu@chromium.org> Cr-Commit-Position: refs/heads/master@{#571396} [modify] https://crrev.com/5304962d65497696f9e0ca65e888827eab207d3a/base/rand_util_fuchsia.cc
,
Jun 29 2018
|
|||
►
Sign in to add a comment |
|||
Comment 1 by abarth@chromium.org
, Jun 28 2018