aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/entropy/entropy_srcs.cpp
diff options
context:
space:
mode:
authorDaniel Seither <[email protected]>2015-09-25 14:10:01 +0200
committerDaniel Seither <[email protected]>2015-09-25 14:10:01 +0200
commitee0460cff538a3de7ca89fb54d37215757659a42 (patch)
tree9e2c04abf1b84c7cadbd81cd819aab1cf4e508fd /src/lib/entropy/entropy_srcs.cpp
parent84fc298cce26305f7eae59ce59a82ebd9801a04e (diff)
Add the Darwin_SecRandom entropy source
It uses the SecRandomCopyBytes function from the Security framework of OS X and iOS. We need this because it is the official way to get cryptographically secure random numbers on iOS, where /dev/random is not accessible due to sandboxing.
Diffstat (limited to 'src/lib/entropy/entropy_srcs.cpp')
-rw-r--r--src/lib/entropy/entropy_srcs.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/entropy/entropy_srcs.cpp b/src/lib/entropy/entropy_srcs.cpp
index d44ab8c92..d57160c88 100644
--- a/src/lib/entropy/entropy_srcs.cpp
+++ b/src/lib/entropy/entropy_srcs.cpp
@@ -43,6 +43,10 @@
#include <botan/internal/proc_walk.h>
#endif
+#if defined(BOTAN_HAS_ENTROPY_SRC_DARWIN_SECRANDOM)
+ #include <botan/internal/darwin_secrandom.h>
+#endif
+
namespace Botan {
namespace {
@@ -97,6 +101,10 @@ std::vector<std::unique_ptr<EntropySource>> get_default_entropy_sources()
));
#endif
+#if defined(BOTAN_HAS_ENTROPY_SRC_DARWIN_SECRANDOM)
+ sources.push_back(std::unique_ptr<EntropySource>(new Darwin_SecRandom));
+#endif
+
return sources;
}