summaryrefslogtreecommitdiff
path: root/absl/random/internal/seed_material.cc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/random/internal/seed_material.cc')
-rw-r--r--absl/random/internal/seed_material.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/absl/random/internal/seed_material.cc b/absl/random/internal/seed_material.cc
index 85dd535f..ab4dd0c2 100644
--- a/absl/random/internal/seed_material.cc
+++ b/absl/random/internal/seed_material.cc
@@ -45,6 +45,9 @@
#define ABSL_RANDOM_USE_BCRYPT 1
#pragma comment(lib, "bcrypt.lib")
+#elif defined(__Fuchsia__)
+#include <zircon/syscalls.h>
+
#endif
#if defined(ABSL_RANDOM_USE_BCRYPT)
@@ -107,6 +110,15 @@ bool ReadSeedMaterialFromOSEntropyImpl(absl::Span<uint32_t> values) {
return true;
}
+#elif defined(__Fuchsia__)
+
+bool ReadSeedMaterialFromOSEntropyImpl(absl::Span<uint32_t> values) {
+ auto buffer = reinterpret_cast<uint8_t*>(values.data());
+ size_t buffer_size = sizeof(uint32_t) * values.size();
+ zx_cprng_draw(buffer, buffer_size);
+ return true;
+}
+
#else
// On *nix, read entropy from /dev/urandom.