[libcxx-commits] [PATCH] D94571: [libcxx] random_device, for OpenBSD specify optimal entropy properties
Brad Smith via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jan 13 08:41:26 PST 2021
brad updated this revision to Diff 316415.
brad added a comment.
Updated diff after moving header up to the top and removing the OpenBSD guard.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94571/new/
https://reviews.llvm.org/D94571
Files:
libcxx/src/random.cpp
Index: libcxx/src/random.cpp
===================================================================
--- libcxx/src/random.cpp
+++ libcxx/src/random.cpp
@@ -13,6 +13,7 @@
#define _CRT_RAND_S
#endif // defined(_LIBCPP_USING_WIN32_RANDOM)
+#include "limits"
#include "random"
#include "system_error"
@@ -33,7 +34,6 @@
#include <nacl/nacl_random.h>
#endif
-
_LIBCPP_BEGIN_NAMESPACE_STD
#if defined(_LIBCPP_USING_GETENTROPY)
@@ -172,7 +172,11 @@
double
random_device::entropy() const _NOEXCEPT
{
+#ifdef __OpenBSD__
+ return std::numeric_limits<unsigned int>::digits;
+#else
return 0;
+#endif
}
_LIBCPP_END_NAMESPACE_STD
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94571.316415.patch
Type: text/x-patch
Size: 644 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210113/bc9d5be5/attachment-0001.bin>
More information about the libcxx-commits
mailing list