[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:47:55 PST 2021


brad updated this revision to Diff 316418.
brad added a comment.

Don't care about the removal of that one line.


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"
 
@@ -172,7 +173,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.316418.patch
Type: text/x-patch
Size: 513 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210113/a02ace06/attachment.bin>


More information about the libcxx-commits mailing list