diff options
author | Jack Lloyd <[email protected]> | 2018-09-05 09:06:13 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-09-05 09:06:13 -0400 |
commit | 0acbd3ce1d2d13c81926db6cb1c6f76e1edacc06 (patch) | |
tree | 5396f62d34e1b8f02387a3160aaec4d9a5233c0b /src | |
parent | f3f06d8893a58d111eaec10f26f1ca65597f8aad (diff) | |
parent | f69979b0e6829f58925ebce9344d7f9d0f1650a4 (diff) |
Merge GH #1668 Remove Darwin SecRandom entropy source
Diffstat (limited to 'src')
-rw-r--r-- | src/build-data/buildh.in | 4 | ||||
-rw-r--r-- | src/build-data/os/darwin.txt | 1 | ||||
-rw-r--r-- | src/build-data/policy/bsi.txt | 1 | ||||
-rw-r--r-- | src/build-data/policy/modern.txt | 1 | ||||
-rw-r--r-- | src/build-data/policy/nist.txt | 1 | ||||
-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 |
9 files changed, 2 insertions, 91 deletions
diff --git a/src/build-data/buildh.in b/src/build-data/buildh.in index 653c56bc7..023bfa5fe 100644 --- a/src/build-data/buildh.in +++ b/src/build-data/buildh.in @@ -170,8 +170,8 @@ * broken system RNG. */ #define BOTAN_ENTROPY_DEFAULT_SOURCES \ - { "rdseed", "rdrand", "darwin_secrandom", "getentropy", \ - "dev_random", "system_rng", "proc_walk", "system_stats" } + { "rdseed", "rdrand", "getentropy", "dev_random", \ + "system_rng", "proc_walk", "system_stats" } /* Multiplier on a block cipher's native parallelism */ #define BOTAN_BLOCK_CIPHER_PAR_MULT 4 diff --git a/src/build-data/os/darwin.txt b/src/build-data/os/darwin.txt index 5f460b1c6..1a2f80690 100644 --- a/src/build-data/os/darwin.txt +++ b/src/build-data/os/darwin.txt @@ -14,7 +14,6 @@ posix1 posix_mlock arc4random dev_random -security_framework commoncrypto sockets diff --git a/src/build-data/policy/bsi.txt b/src/build-data/policy/bsi.txt index f9950c7c7..5f601bfe2 100644 --- a/src/build-data/policy/bsi.txt +++ b/src/build-data/policy/bsi.txt @@ -65,7 +65,6 @@ sha2_32_x86 sha2_32_armv8 # entropy sources -darwin_secrandom dev_random proc_walk rdrand diff --git a/src/build-data/policy/modern.txt b/src/build-data/policy/modern.txt index ae659087c..f53322e79 100644 --- a/src/build-data/policy/modern.txt +++ b/src/build-data/policy/modern.txt @@ -82,7 +82,6 @@ rdrand_rng system_rng # entropy sources -darwin_secrandom dev_random proc_walk rdrand diff --git a/src/build-data/policy/nist.txt b/src/build-data/policy/nist.txt index d9f698e31..cbc08eacb 100644 --- a/src/build-data/policy/nist.txt +++ b/src/build-data/policy/nist.txt @@ -69,7 +69,6 @@ sha2_32_x86 sha2_32_armv8 # entropy sources -darwin_secrandom dev_random proc_walk rdrand 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") { |