[libcxx-commits] [PATCH] D122522: [libcxx] random_device, specify optimal entropy properties for all OS's using arc4random()

Brad Smith via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 25 22:01:52 PDT 2022


brad created this revision.
brad added reviewers: ldionne, libc++.
brad added a project: libc++.
Herald added a subscriber: krytarowski.
Herald added a project: All.
brad requested review of this revision.
Herald added 1 blocking reviewer(s): libc++.

After noticing D116045 <https://reviews.llvm.org/D116045>, fix the function to take into consideration other OS's using arc4random().


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122522

Files:
  libcxx/src/random.cpp


Index: libcxx/src/random.cpp
===================================================================
--- libcxx/src/random.cpp
+++ libcxx/src/random.cpp
@@ -210,7 +210,7 @@
     return std::numeric_limits<result_type>::digits;
 
   return ent;
-#elif defined(__OpenBSD__) || defined(_LIBCPP_USING_FUCHSIA_CPRNG)
+#elif defined(_LIBCPP_USING_ARC4_RANDOM) || defined(_LIBCPP_USING_FUCHSIA_CPRNG)
   return std::numeric_limits<result_type>::digits;
 #else
   return 0;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122522.418375.patch
Type: text/x-patch
Size: 462 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220326/b908f20e/attachment-0001.bin>


More information about the libcxx-commits mailing list