summaryrefslogtreecommitdiffstats
path: root/lib/libcxx/src/random.cpp
diff options
context:
space:
mode:
authorespie <espie@openbsd.org>2019-03-22 12:39:42 +0000
committerespie <espie@openbsd.org>2019-03-22 12:39:42 +0000
commit66c1d05b38aa3cbfdce71a5a1a4ad7ab85fe4ceb (patch)
treeecb993f4c960fb40b4baa808bbf828f229990022 /lib/libcxx/src/random.cpp
parentumbg now supports DCF600USB as well; adjust comment. from weerd@ (diff)
downloadwireguard-openbsd-66c1d05b38aa3cbfdce71a5a1a4ad7ab85fe4ceb.tar.xz
wireguard-openbsd-66c1d05b38aa3cbfdce71a5a1a4ad7ab85fe4ceb.zip
that "device" is an abstraction to the underlying OS PRNG.
In OpenBSD's case, we know it has optimal entropy properties, so just say so. okay mikeb@, "why not" deraadt@
Diffstat (limited to 'lib/libcxx/src/random.cpp')
-rw-r--r--lib/libcxx/src/random.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/libcxx/src/random.cpp b/lib/libcxx/src/random.cpp
index 4a2468368d0..9efac7a66a7 100644
--- a/lib/libcxx/src/random.cpp
+++ b/lib/libcxx/src/random.cpp
@@ -34,6 +34,7 @@
#include <nacl/nacl_random.h>
#endif
+#include <limits>
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -173,7 +174,11 @@ random_device::operator()()
double
random_device::entropy() const _NOEXCEPT
{
+#ifdef __OpenBSD__
+ return std::numeric_limits<unsigned int>::digits;
+#else
return 0;
+#endif
}
_LIBCPP_END_NAMESPACE_STD