[libcxx-commits] [PATCH] D116045: [libc++] Use arc4random instead of /dev/urandom on Apple platforms
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Dec 20 08:26:57 PST 2021
ldionne created this revision.
Herald added a subscriber: krytarowski.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
On Apple platforms, arc4random is faster than /dev/urandom, and it is the
recommended user-space RNG according to Apple's own OS folks.
rdar://86638350
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D116045
Files:
libcxx/include/__config
Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -333,7 +333,7 @@
# define _LIBCPP_SHORT_WCHAR 1
#endif
-#if defined(__OpenBSD__)
+#if defined(__OpenBSD__) || defined(__APPLE__)
// Certain architectures provide arc4random(). Prefer using
// arc4random() over /dev/{u,}random to make it possible to obtain
// random data even when using sandboxing mechanisms such as chroots,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116045.395463.patch
Type: text/x-patch
Size: 503 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211220/c7914107/attachment-0001.bin>
More information about the libcxx-commits
mailing list