aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/rng/rng.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/rng/rng.h')
-rw-r--r--src/lib/rng/rng.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/lib/rng/rng.h b/src/lib/rng/rng.h
index d5fae0261..476928ff7 100644
--- a/src/lib/rng/rng.h
+++ b/src/lib/rng/rng.h
@@ -42,9 +42,9 @@ class BOTAN_DLL RandomNumberGenerator
virtual void randomize(byte output[], size_t length) = 0;
/**
- * Incorporate some entropy into the RNG state. For example
- * adding nonces or timestamps from a peer's protocol message
- * can help hedge against VM state rollback attacks.
+ * Incorporate some additional data into the RNG state. For
+ * example adding nonces or timestamps from a peer's protocol
+ * message can help hedge against VM state rollback attacks.
*
* @param inputs a byte array containg the entropy to be added
* @param length the length of the byte array in
@@ -52,6 +52,14 @@ class BOTAN_DLL RandomNumberGenerator
virtual void add_entropy(const byte input[], size_t length) = 0;
/**
+ * Incorporate some additional data into the RNG state.
+ */
+ template<typename T> void add_entropy_T(const T& t)
+ {
+ add_entropy(reinterpret_cast<const uint8_t*>(&t), sizeof(T));
+ }
+
+ /**
* Incorporate entropy into the RNG state then produce output
* Some RNG types implement this using a single operation.
*/