aboutsummaryrefslogtreecommitdiffstats
path: root/src/build-data
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-08-19 07:51:47 -0400
committerJack Lloyd <[email protected]>2016-08-24 11:31:54 -0400
commit80c160f08f2a69eb4e41a68380796bf31fd2f924 (patch)
tree83259da316524ed3b96b0913e5b023bc40f26a28 /src/build-data
parent91474f60d72937ad3c21d8aa53c14f7a0cceb9ca (diff)
RNG changes (GH #593)
Change reseed interval logic to count calls to `randomize` rather than bytes, to match SP 800-90A Changes RNG reseeding API: there is no implicit reference to the global entropy sources within the RNGs anymore. The entropy sources must be supplied with the API call. Adds support for reseding directly from another RNG (such as a system or hardware RNG). Stateful_RNG keeps optional references to both an RNG and a set of entropy sources. During a reseed, both sources are used if set. These can be provided to HMAC_DRBG constructor. For HMAC_DRBG, SP800-90A requires we output no more than 2**16 bytes per DRBG request. We treat requests longer than that as if the caller had instead made several sequential maximum-length requests. This means it is possible for one or more reseeds to trigger even in the course of generating a single (long) output (generate a 256-bit key and use ChaCha or HKDF if this is a problem). Adds RNG::randomize_with_ts_input which takes timestamps and uses them as the additional_data DRBG field. Stateful_RNG overrides this to also include the process ID and the reseed counter. AutoSeeded_RNG's `randomize` uses this. Officially deprecates RNG::make_rng and the Serialized_RNG construtor which creates an AutoSeeded_RNG. With these removed, it would be possible to perform a build with no AutoSeeded_RNG/HMAC_DRBG at all (eg, for applications which only use the system RNG). Tests courtesy @cordney in GH PRs #598 and #600
Diffstat (limited to 'src/build-data')
-rw-r--r--src/build-data/buildh.in10
-rw-r--r--src/build-data/policy/bsi.txt1
-rw-r--r--src/build-data/policy/modern.txt2
3 files changed, 6 insertions, 7 deletions
diff --git a/src/build-data/buildh.in b/src/build-data/buildh.in
index 01527b522..e943973a0 100644
--- a/src/build-data/buildh.in
+++ b/src/build-data/buildh.in
@@ -98,11 +98,10 @@
#define BOTAN_PRIVATE_KEY_STRONG_CHECKS_ON_GENERATE 1
/*
-* RNGs will automatically poll the system for additional seed material
-* after producing this many bytes of output. Set to zero to disable
-* automatic reseeding.
+* Userspace RNGs like HMAC_DRBG will reseed after a specified number
+* of outputs are generated. Set to zero to disable automatic reseeding.
*/
-#define BOTAN_RNG_DEFAULT_MAX_OUTPUT_BEFORE_RESEED 16384
+#define BOTAN_RNG_DEFAULT_RESEED_INTERVAL 1024
#define BOTAN_RNG_RESEED_POLL_BITS 256
#define BOTAN_RNG_AUTO_RESEED_TIMEOUT std::chrono::milliseconds(10)
#define BOTAN_RNG_RESEED_DEFAULT_TIMEOUT std::chrono::milliseconds(50)
@@ -111,8 +110,7 @@
* Controls how AutoSeeded_RNG is instantiated
*/
#define BOTAN_AUTO_RNG_DRBG HMAC_DRBG
-#define BOTAN_AUTO_RNG_HASH "SHA-256"
-#define BOTAN_AUTO_RNG_ENTROPY_TARGET 256
+#define BOTAN_AUTO_RNG_HMAC "HMAC(SHA-384)"
/*
* Specifies (in order) the list of entropy sources that will be used
diff --git a/src/build-data/policy/bsi.txt b/src/build-data/policy/bsi.txt
index 7eb092292..7f2b09610 100644
--- a/src/build-data/policy/bsi.txt
+++ b/src/build-data/policy/bsi.txt
@@ -41,6 +41,7 @@ eckcdsa
ecdh
# rng
+auto_rng
hmac_rng
hmac_drbg
</required>
diff --git a/src/build-data/policy/modern.txt b/src/build-data/policy/modern.txt
index 30b7fbfd8..a98ec5077 100644
--- a/src/build-data/policy/modern.txt
+++ b/src/build-data/policy/modern.txt
@@ -38,7 +38,7 @@ eme_oaep
emsa_pssr
emsa1
-hmac_rng
+auto_rng
hmac_drbg
ffi