From 9c3b120b618f3678a807d693b2e6f331aaa54605 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Wed, 27 Jun 2018 09:30:46 -0700 Subject: [PATCH] [fuchsia] Update to zx_cprng_draw This change moves to the final version of zx_cprng_draw, which cannot fail. If the syscall would fail, either the operating system terminates or the kernel kills the userspace process (depending on where the error comes from). Change-Id: Iea9563c9f63ea5802e2cde741879fa58c19028f4 Reviewed-on: https://boringssl-review.googlesource.com/29424 Reviewed-by: David Benjamin Commit-Queue: David Benjamin CQ-Verified: CQ bot account: commit-bot@chromium.org --- crypto/rand_extra/fuchsia.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/crypto/rand_extra/fuchsia.c b/crypto/rand_extra/fuchsia.c index 0a0d7f09..0514d809 100644 --- a/crypto/rand_extra/fuchsia.c +++ b/crypto/rand_extra/fuchsia.c @@ -24,18 +24,7 @@ #include "../fipsmodule/rand/internal.h" void CRYPTO_sysrand(uint8_t *out, size_t requested) { - while (requested > 0) { - size_t output_bytes_this_pass = ZX_CPRNG_DRAW_MAX_LEN; - if (requested < output_bytes_this_pass) { - output_bytes_this_pass = requested; - } - zx_status_t status = zx_cprng_draw_new(out, output_bytes_this_pass); - if (status != ZX_OK) { - abort(); - } - requested -= output_bytes_this_pass; - out += output_bytes_this_pass; - } + zx_cprng_draw(out, requested); } #endif // OPENSSL_FUCHSIA && !BORINGSSL_UNSAFE_DETERMINISTIC_MODE