diff options
author | Jack Lloyd <[email protected]> | 2018-09-04 18:58:59 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-09-04 21:00:00 -0400 |
commit | f69979b0e6829f58925ebce9344d7f9d0f1650a4 (patch) | |
tree | 078814b2fbd904fe2078fcea32d69013aa9e7197 /src/lib | |
parent | bd523b1a08f9e9b7316b3613a5a589471c7785d4 (diff) |
Remove Darwin SecRandomCopyBytes
It is the same RNG as arc4random and /dev/urandom. And arc4random seems
to be working well for iOS and macOS.
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/entropy/darwin_secrandom/darwin_secrandom.cpp | 30 | ||||
-rw-r--r-- | src/lib/entropy/darwin_secrandom/darwin_secrandom.h | 28 | ||||
-rw-r--r-- | src/lib/entropy/darwin_secrandom/info.txt | 16 | ||||
-rw-r--r-- | src/lib/entropy/entropy_srcs.cpp | 11 |
4 files changed, 0 insertions, 85 deletions
diff --git a/src/lib/entropy/darwin_secrandom/darwin_secrandom.cpp b/src/lib/entropy/darwin_secrandom/darwin_secrandom.cpp deleted file mode 100644 index 1e3613615..000000000 --- a/src/lib/entropy/darwin_secrandom/darwin_secrandom.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* -* Darwin SecRandomCopyBytes EntropySource -* (C) 2015 Daniel Seither (Kullo GmbH) -* -* Botan is released under the Simplified BSD License (see license.txt) -*/ - -#include <botan/internal/darwin_secrandom.h> -#include <Security/Security.h> -#include <Security/SecRandom.h> - -namespace Botan { - -/** -* Gather entropy from SecRandomCopyBytes -*/ -size_t Darwin_SecRandom::poll(RandomNumberGenerator& rng) - { - secure_vector<uint8_t> buf(BOTAN_SYSTEM_RNG_POLL_REQUEST); - - if(0 == SecRandomCopyBytes(kSecRandomDefault, buf.size(), buf.data())) - { - rng.add_entropy(buf.data(), buf.size()); - return buf.size() * 8; - } - - return 0; - } - -} diff --git a/src/lib/entropy/darwin_secrandom/darwin_secrandom.h b/src/lib/entropy/darwin_secrandom/darwin_secrandom.h deleted file mode 100644 index 83b4da4f5..000000000 --- a/src/lib/entropy/darwin_secrandom/darwin_secrandom.h +++ /dev/null @@ -1,28 +0,0 @@ -/* -* Darwin SecRandomCopyBytes EntropySource -* (C) 2015 Daniel Seither (Kullo GmbH) -* -* Botan is released under the Simplified BSD License (see license.txt) -*/ - -#ifndef BOTAN_ENTROPY_SRC_DARWIN_SECRANDOM_H_ -#define BOTAN_ENTROPY_SRC_DARWIN_SECRANDOM_H_ - -#include <botan/entropy_src.h> - -namespace Botan { - -/** -* Entropy source using SecRandomCopyBytes from Darwin's Security.framework -*/ -class Darwin_SecRandom final : public Entropy_Source - { - public: - std::string name() const override { return "darwin_secrandom"; } - - size_t poll(RandomNumberGenerator& rng) override; - }; - -} - -#endif diff --git a/src/lib/entropy/darwin_secrandom/info.txt b/src/lib/entropy/darwin_secrandom/info.txt deleted file mode 100644 index c1943a04a..000000000 --- a/src/lib/entropy/darwin_secrandom/info.txt +++ /dev/null @@ -1,16 +0,0 @@ -<defines> -ENTROPY_SRC_DARWIN_SECRANDOM -> 20150925 -</defines> - -<header:internal> -darwin_secrandom.h -</header:internal> - -<os_features> -security_framework -</os_features> - -<frameworks> -darwin -> Security -ios -> Security -</frameworks> diff --git a/src/lib/entropy/entropy_srcs.cpp b/src/lib/entropy/entropy_srcs.cpp index c04b3b5b2..9141db366 100644 --- a/src/lib/entropy/entropy_srcs.cpp +++ b/src/lib/entropy/entropy_srcs.cpp @@ -32,10 +32,6 @@ #include <botan/internal/proc_walk.h> #endif -#if defined(BOTAN_HAS_ENTROPY_SRC_DARWIN_SECRANDOM) - #include <botan/internal/darwin_secrandom.h> -#endif - #if defined(BOTAN_HAS_ENTROPY_SRC_GETENTROPY) #include <botan/internal/getentropy.h> #endif @@ -86,13 +82,6 @@ std::unique_ptr<Entropy_Source> Entropy_Source::create(const std::string& name) } #endif -#if defined(BOTAN_HAS_ENTROPY_SRC_DARWIN_SECRANDOM) - if(name == "darwin_secrandom") - { - return std::unique_ptr<Entropy_Source>(new Darwin_SecRandom); - } -#endif - #if defined(BOTAN_HAS_ENTROPY_SRC_GETENTROPY) if(name == "getentropy") { |