[libcxx-commits] [PATCH] D122628: [libcxx] random_device, use arc4random() on FreeBSD, NetBSD and DragonFlyBSD

Brad Smith via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 28 19:59:45 PDT 2022


brad created this revision.
brad added reviewers: ldionne, emaste, krytarowski.
brad added a project: libc++.
Herald added a project: All.
brad requested review of this revision.
Herald added a reviewer: libc++.

With OpenBSD and now macOS using arc4random() for the random device, might as well look at the other BSD's that have arc4random().


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122628

Files:
  libcxx/include/__config


Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -348,7 +348,8 @@
 //      Use rand_s(), for use on Windows.
 //      When this option is used, the token passed to `std::random_device`'s
 //      constructor *must* be "/dev/urandom" -- anything else is an error.
-#if defined(__OpenBSD__) || defined(__APPLE__)
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
+    defined(__OpenBSD__) || defined(__DragonFly__)
 #  define _LIBCPP_USING_ARC4_RANDOM
 #elif defined(__wasi__)
 #  define _LIBCPP_USING_GETENTROPY


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122628.418763.patch
Type: text/x-patch
Size: 646 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220329/40d79493/attachment.bin>


More information about the libcxx-commits mailing list