diff options
author | Jack Lloyd <[email protected]> | 2016-11-18 15:08:56 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-11-18 15:08:56 -0500 |
commit | dc94557f0f72766dbfba5e129da25dd0111fa564 (patch) | |
tree | f2bb54c05769d3218abf3ba29e8bc9909445e4bd /src | |
parent | 2031d93f0c07e0f310cb1366a07a8350301f19b0 (diff) |
Don't force HMAC_DRBG to be enabled
No need to strictly require it, and some applications may only want
system RNG or RDRAND.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/ffi/info.txt | 1 | ||||
-rw-r--r-- | src/lib/pubkey/xmss/xmss_privatekey.h | 2 | ||||
-rw-r--r-- | src/lib/pubkey/xmss/xmss_wots_publickey.h | 1 | ||||
-rw-r--r-- | src/lib/rng/info.txt | 1 | ||||
-rw-r--r-- | src/lib/rng/rng.h | 2 | ||||
-rw-r--r-- | src/tests/test_mceliece.cpp | 40 |
6 files changed, 27 insertions, 20 deletions
diff --git a/src/lib/ffi/info.txt b/src/lib/ffi/info.txt index 057bbd012..7b3068274 100644 --- a/src/lib/ffi/info.txt +++ b/src/lib/ffi/info.txt @@ -8,5 +8,6 @@ pubkey x509 #tls system_rng +auto_rng </requires> diff --git a/src/lib/pubkey/xmss/xmss_privatekey.h b/src/lib/pubkey/xmss/xmss_privatekey.h index 064d899a8..a0abb87e7 100644 --- a/src/lib/pubkey/xmss/xmss_privatekey.h +++ b/src/lib/pubkey/xmss/xmss_privatekey.h @@ -45,7 +45,7 @@ class BOTAN_DLL XMSS_PrivateKey : public virtual XMSS_PublicKey, /** * Creates a new XMSS private key for the chosen XMSS signature method. * New seeds for public/private key and pseudo random function input are - * generated using AutoSeeded_RNG. The appropriate WOTS signature method + * generated using the provided RNG. The appropriate WOTS signature method * will be automatically set based on the chosen XMSS signature method. * * @param xmss_algo_id Identifier for the selected XMSS signature method. diff --git a/src/lib/pubkey/xmss/xmss_wots_publickey.h b/src/lib/pubkey/xmss/xmss_wots_publickey.h index a3e5232e8..bf3a8110d 100644 --- a/src/lib/pubkey/xmss/xmss_wots_publickey.h +++ b/src/lib/pubkey/xmss/xmss_wots_publickey.h @@ -11,7 +11,6 @@ #include <cstddef> #include <string> #include <vector> -#include <botan/auto_rng.h> #include <botan/alg_id.h> #include <botan/asn1_oid.h> #include <botan/assert.h> diff --git a/src/lib/rng/info.txt b/src/lib/rng/info.txt index 655e35fd1..4c88ba382 100644 --- a/src/lib/rng/info.txt +++ b/src/lib/rng/info.txt @@ -1,4 +1,3 @@ <requires> entropy -hmac_drbg </requires> diff --git a/src/lib/rng/rng.h b/src/lib/rng/rng.h index 879c1acb7..98ac4982f 100644 --- a/src/lib/rng/rng.h +++ b/src/lib/rng/rng.h @@ -204,6 +204,8 @@ class BOTAN_DLL Null_RNG final : public RandomNumberGenerator #if defined(BOTAN_TARGET_OS_HAS_THREADS) /** * Wraps access to a RNG in a mutex +* Note that most of the time it's much better to use a RNG per thread +* otherwise the RNG will act as an unnecessary contention point */ class BOTAN_DLL Serialized_RNG final : public RandomNumberGenerator { diff --git a/src/tests/test_mceliece.cpp b/src/tests/test_mceliece.cpp index 0ffed8176..1d581e938 100644 --- a/src/tests/test_mceliece.cpp +++ b/src/tests/test_mceliece.cpp @@ -13,13 +13,16 @@ #include <botan/mceliece.h> #include <botan/pubkey.h> #include <botan/oids.h> -#include <botan/hmac_drbg.h> #include <botan/loadstor.h> #include <botan/hash.h> #include <botan/hex.h> +#if defined(BOTAN_HAS_HMAC_DRBG) + #include <botan/hmac_drbg.h> +#endif + #if defined(BOTAN_HAS_MCEIES) -#include <botan/mceies.h> + #include <botan/mceies.h> #endif #endif @@ -30,21 +33,7 @@ namespace { #if defined(BOTAN_HAS_MCELIECE) -std::vector<byte> hash_bytes(const byte b[], size_t len, const std::string& hash_fn = "SHA-256") - { - std::unique_ptr<Botan::HashFunction> hash(Botan::HashFunction::create(hash_fn)); - hash->update(b, len); - std::vector<byte> r(hash->output_length()); - hash->final(r.data()); - return r; - } - -template<typename A> -std::vector<byte> hash_bytes(const std::vector<byte, A>& v) - { - return hash_bytes(v.data(), v.size()); - } - +#if defined(BOTAN_HAS_HMAC_DRBG) class McEliece_Keygen_Encrypt_Test : public Text_Based_Test { public: @@ -100,9 +89,26 @@ class McEliece_Keygen_Encrypt_Test : public Text_Based_Test return result; } + private: + std::vector<byte> hash_bytes(const byte b[], size_t len, const std::string& hash_fn = "SHA-256") + { + std::unique_ptr<Botan::HashFunction> hash(Botan::HashFunction::create(hash_fn)); + hash->update(b, len); + std::vector<byte> r(hash->output_length()); + hash->final(r.data()); + return r; + } + + template<typename A> + std::vector<byte> hash_bytes(const std::vector<byte, A>& v) + { + return hash_bytes(v.data(), v.size()); + } + }; BOTAN_REGISTER_TEST("mce_keygen", McEliece_Keygen_Encrypt_Test); +#endif class McEliece_Tests : public Test { |