[PATCH] libc++: Add support for arc4random() to random_device.
JF Bastien
jfb at chromium.org
Sat Mar 7 09:10:59 PST 2015
arc4random was broken for a short while on FreeBSD: http://lwn.net/Articles/633805/rss
Not much can be done from libc++, but I'd avoid using it for a while on that platform so we can be reasonably certain they're fixed.
Another idea is having `arc4random` as a fallback on platforms where opening `/dev/urandom` fails and `arc4random` is available. The rationale is that the platforms offers a POSIX-y API but the `/dev/` access was blocked by a sandbox. I'm not sure I like that approach, but I think it's worth mentioning.
REPOSITORY
rL LLVM
================
Comment at: test/std/numerics/rand/rand.device/ctor.pass.cpp:32
@@ +31,3 @@
+#else
+ return true;
+#endif
----------------
We had a discussion about allowing any string on Windows: I think it's a bad idea. I realize it's implementation dependent, but I'd only allow `/dev/urandom` on new platforms if you don't offer the semantics of `/dev/random`.
http://reviews.llvm.org/D8134
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the cfe-commits
mailing list