Fuchsia has getentropy() via musl - use it and drop the custom file

Bug: 287
Change-Id: Ia907c5dd7fd31e95098730673d2da1bede6d79ed
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/61405
Commit-Queue: David Benjamin <davidben@google.com>
Auto-Submit: Bob Beck <bbe@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt
index 7c944c1..e004f19 100644
--- a/crypto/CMakeLists.txt
+++ b/crypto/CMakeLists.txt
@@ -199,7 +199,6 @@
   pool/pool.c
   rand_extra/deterministic.c
   rand_extra/forkunsafe.c
-  rand_extra/fuchsia.c
   rand_extra/getentropy.c
   rand_extra/ios.c
   rand_extra/passive.c
diff --git a/crypto/fipsmodule/rand/internal.h b/crypto/fipsmodule/rand/internal.h
index 1636722..595013d 100644
--- a/crypto/fipsmodule/rand/internal.h
+++ b/crypto/fipsmodule/rand/internal.h
@@ -28,8 +28,6 @@
 
 #if defined(BORINGSSL_UNSAFE_DETERMINISTIC_MODE)
 #define OPENSSL_RAND_DETERMINISTIC
-#elif defined(OPENSSL_FUCHSIA)
-#define OPENSSL_RAND_FUCHSIA
 #elif defined(OPENSSL_TRUSTY)
 // Trusty's PRNG file is, for now, maintained outside the tree.
 #elif defined(OPENSSL_WINDOWS)
diff --git a/crypto/rand_extra/fuchsia.c b/crypto/rand_extra/fuchsia.c
deleted file mode 100644
index d4fb979..0000000
--- a/crypto/rand_extra/fuchsia.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (c) 2017, Google Inc.
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
-
-#include <openssl/rand.h>
-
-#include "../fipsmodule/rand/internal.h"
-
-#if defined(OPENSSL_RAND_FUCHSIA)
-
-#include <limits.h>
-#include <stdlib.h>
-
-#include <zircon/syscalls.h>
-
-void CRYPTO_sysrand(uint8_t *out, size_t requested) {
-  zx_cprng_draw(out, requested);
-}
-
-void CRYPTO_sysrand_for_seed(uint8_t *out, size_t requested) {
-  CRYPTO_sysrand(out, requested);
-}
-
-#endif  // OPENSSL_RAND_FUCHSIA
diff --git a/crypto/rand_extra/getentropy.c b/crypto/rand_extra/getentropy.c
index fddf0be..d4b5e68 100644
--- a/crypto/rand_extra/getentropy.c
+++ b/crypto/rand_extra/getentropy.c
@@ -22,7 +22,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-#if defined(OPENSSL_MACOS)
+#if defined(OPENSSL_MACOS) || defined(OPENSSL_FUCHSIA)
 #include <sys/random.h>
 #endif