Chromium Code Reviews| Index: runtime/bin/crypto_fuchsia.cc |
| diff --git a/runtime/bin/crypto_fuchsia.cc b/runtime/bin/crypto_fuchsia.cc |
| index 04c5f2254760ee7b279625a1190d32a34b5ddcb4..0c23b720b9393316e4417478f9f868bc51a1e4c9 100644 |
| --- a/runtime/bin/crypto_fuchsia.cc |
| +++ b/runtime/bin/crypto_fuchsia.cc |
| @@ -19,8 +19,9 @@ bool Crypto::GetRandomBytes(intptr_t count, uint8_t* buffer) { |
| const intptr_t len = |
| (MX_CPRNG_DRAW_MAX_LEN < remaining) ? MX_CPRNG_DRAW_MAX_LEN |
| : remaining; |
| - const mx_ssize_t res = mx_cprng_draw(buffer + read, len); |
| - if (res == ERR_INVALID_ARGS) { |
| + mx_size_t res; |
|
abarth
2016/11/03 22:00:31
I'd zero-initial because I'm paranoid. Is ERR_INV
kulakowski1
2016/11/03 22:08:56
Done.
|
| + const mx_status_t status = mx_cprng_draw(buffer + read, len, &res); |
| + if (status == ERR_INVALID_ARGS) { |
| return false; |
| } |
| read += res; |