The unified diff between revisions [b6e59278..] and [cc2a894e..] is displayed below. It can also be downloaded as a raw diff.
#
#
# patch "checks/common.h"
# from [5674a54e331f38353b894249e9c860d6bb946f85]
# to [79908f52e9b2dba8ef3b0af8c2a66dcb95aae27c]
#
# patch "include/rng.h"
# from [8502fe19d188b9eee96d408195f3c048fc530b33]
# to [1ab18e972e64fc15b0d4743dfba6cf53a4e2b4e8]
#
# patch "include/x931_rng.h"
# from [6e143d024003fef74e18ccc9ecec222230def3d7]
# to [b11d85b132557653dc4c8222c9110199fc0d81be]
#
# patch "src/pubkey.cpp"
# from [c3da0efce6a87a28b97f3f733261f2ae4bc77914]
# to [8fea8de68ebcd4d6f9db3b9c8e6252d97cd6ab41]
#
# patch "src/x931_rng.cpp"
# from [2abb4bc550069f17d9d7a6071b9c98d3a0616566]
# to [9ef7dc6b27bd1b5186d94c696a2cbf393b323420]
#
============================================================
--- checks/common.h 5674a54e331f38353b894249e9c860d6bb946f85
+++ checks/common.h 79908f52e9b2dba8ef3b0af8c2a66dcb95aae27c
@@ -78,21 +78,19 @@ class Fixed_Output_RNG : public Botan::R
std::string name() const { return "Fixed_Output_RNG"; }
- void clear() throw() {}
+ void add_entropy_source(Botan::EntropySource* src) { delete src; }
+ void add_entropy(const byte[], u32bit) {};
- void add_randomness(const byte in[], u32bit len) throw()
- {
- buf.insert(buf.end(), in, in + len);
- }
+ void clear() throw() {}
- Fixed_Output_RNG(const Botan::SecureVector<byte>& x)
+ Fixed_Output_RNG(const Botan::SecureVector<byte>& in)
{
- add_randomness(x.begin(), x.size());
+ buf.insert(buf.end(), in.begin(), in.begin() + in.size());
}
- Fixed_Output_RNG(const std::string& in)
+ Fixed_Output_RNG(const std::string& in_str)
{
- Botan::SecureVector<byte> x = decode_hex(in);
- add_randomness(x.begin(), x.size());
+ Botan::SecureVector<byte> in = decode_hex(in_str);
+ buf.insert(buf.end(), in.begin(), in.begin() + in.size());
}
Fixed_Output_RNG() {}
============================================================
--- include/rng.h 8502fe19d188b9eee96d408195f3c048fc530b33
+++ include/rng.h 1ab18e972e64fc15b0d4743dfba6cf53a4e2b4e8
@@ -35,11 +35,25 @@ class BOTAN_DLL RandomNumberGenerator
byte next_byte();
- virtual void reseed() {};
+ virtual void reseed() {}
+ virtual void add_entropy_source(EntropySource*) = 0;
+ virtual void add_entropy(const byte[], u32bit) = 0;
virtual ~RandomNumberGenerator() {}
};
+/*************************************************
+* Null Random Number Generator *
+*************************************************/
+class BOTAN_DLL Null_RNG : public RandomNumberGenerator
+ {
+ public:
+ void randomize(byte[], u32bit) { throw PRNG_Unseeded("Null_RNG"); }
+ bool is_seeded() const { return false; }
+ void add_entropy(const byte[], u32bit) {}
+ void add_entropy_source(EntropySource* es) { delete es; }
+ };
+
}
#endif
============================================================
--- include/x931_rng.h 6e143d024003fef74e18ccc9ecec222230def3d7
+++ include/x931_rng.h b11d85b132557653dc4c8222c9110199fc0d81be
@@ -23,6 +23,8 @@ class BOTAN_DLL ANSI_X931_RNG : public R
std::string name() const;
void reseed();
+ void add_entropy_source(EntropySource*);
+ void add_entropy(const byte[], u32bit);
ANSI_X931_RNG(const std::string&, RandomNumberGenerator*);
~ANSI_X931_RNG();
============================================================
--- src/pubkey.cpp c3da0efce6a87a28b97f3f733261f2ae4bc77914
+++ src/pubkey.cpp 8fea8de68ebcd4d6f9db3b9c8e6252d97cd6ab41
@@ -367,14 +367,6 @@ bool PK_Verifier_wo_MR::validate_signatu
bool PK_Verifier_wo_MR::validate_signature(const MemoryRegion<byte>& msg,
const byte sig[], u32bit sig_len)
{
- class Null_RNG : public RandomNumberGenerator
- {
- public:
- void randomize(byte[], u32bit) { throw PRNG_Unseeded("Null_RNG"); }
- bool is_seeded() const { return false; }
- void add_randomness(const byte[], u32bit) {}
- };
-
Null_RNG rng;
SecureVector<byte> encoded =
============================================================
--- src/x931_rng.cpp 2abb4bc550069f17d9d7a6071b9c98d3a0616566
+++ src/x931_rng.cpp 9ef7dc6b27bd1b5186d94c696a2cbf393b323420
@@ -70,6 +70,22 @@ void ANSI_X931_RNG::reseed()
}
/*************************************************
+* Add a entropy source to the underlying PRNG *
+*************************************************/
+void ANSI_X931_RNG::add_entropy_source(EntropySource* src)
+ {
+ prng->add_entropy_source(src);
+ }
+
+/*************************************************
+* Add some entropy to the underlying PRNG *
+*************************************************/
+void ANSI_X931_RNG::add_entropy(const byte input[], u32bit length)
+ {
+ prng->add_entropy(input, length);
+ }
+
+/*************************************************
* Check if the the PRNG is seeded *
*************************************************/
bool ANSI_X931_RNG::is_seeded() const