diff options
Diffstat (limited to 'libcxx/src/random.cpp')
-rw-r--r-- | libcxx/src/random.cpp | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/libcxx/src/random.cpp b/libcxx/src/random.cpp index 5c66448..79815aa 100644 --- a/libcxx/src/random.cpp +++ b/libcxx/src/random.cpp @@ -31,8 +31,6 @@ # include <linux/random.h> # include <sys/ioctl.h> # endif -#elif defined(_LIBCPP_USING_NACL_RANDOM) -# include <nacl/nacl_random.h> #elif defined(_LIBCPP_USING_FUCHSIA_CPRNG) # include <zircon/syscalls.h> #endif @@ -93,30 +91,6 @@ unsigned random_device::operator()() { return r; } -#elif defined(_LIBCPP_USING_NACL_RANDOM) - -random_device::random_device(const string& __token) { - if (__token != "/dev/urandom") - std::__throw_system_error(ENOENT, ("random device not supported " + __token).c_str()); - int error = nacl_secure_random_init(); - if (error) - std::__throw_system_error(error, ("random device failed to open " + __token).c_str()); -} - -random_device::~random_device() {} - -unsigned random_device::operator()() { - unsigned r; - size_t n = sizeof(r); - size_t bytes_written; - int error = nacl_secure_random(&r, n, &bytes_written); - if (error != 0) - std::__throw_system_error(error, "random_device failed getting bytes"); - else if (bytes_written != n) - std::__throw_runtime_error("random_device failed to obtain enough bytes"); - return r; -} - #elif defined(_LIBCPP_USING_WIN32_RANDOM) random_device::random_device(const string& __token) { |