diff options
author | lloyd <[email protected]> | 2008-07-18 14:36:05 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-07-18 14:36:05 +0000 |
commit | 51b77904aff48a0f0daf1908482447d7b28e308c (patch) | |
tree | b8986d0995c1e1ef3c741b90530e5a99c361999b /include | |
parent | 992dcfb75403d448ad1d0c964d0e3ec444b03889 (diff) |
Make the declaration of clear() in base classes pure virtual. So if an
implementation wishes to make this operation a no-op it has to explicitly
declare it as such, rather than just letting the no-op default in from
the base class. (Falko Strenzke was the one who pointed out this was
potentially problematic.)
Diffstat (limited to 'include')
-rw-r--r-- | include/base.h | 8 | ||||
-rw-r--r-- | include/rng.h | 4 |
2 files changed, 7 insertions, 5 deletions
diff --git a/include/base.h b/include/base.h index 69bc71bca..9f63c0aad 100644 --- a/include/base.h +++ b/include/base.h @@ -49,7 +49,7 @@ class BOTAN_DLL BlockCipher : public SymmetricAlgorithm void decrypt(byte block[]) const { dec(block, block); } virtual BlockCipher* clone() const = 0; - virtual void clear() throw() {}; + virtual void clear() throw() = 0; BlockCipher(u32bit, u32bit, u32bit = 0, u32bit = 1); virtual ~BlockCipher() {} @@ -74,7 +74,7 @@ class BOTAN_DLL StreamCipher : public SymmetricAlgorithm virtual void seek(u32bit); virtual StreamCipher* clone() const = 0; - virtual void clear() throw() {}; + virtual void clear() throw() = 0; StreamCipher(u32bit, u32bit = 0, u32bit = 1, u32bit = 0); virtual ~StreamCipher() {} @@ -115,7 +115,7 @@ class BOTAN_DLL HashFunction : public BufferedComputation virtual HashFunction* clone() const = 0; virtual std::string name() const = 0; - virtual void clear() throw() {}; + virtual void clear() throw() = 0; HashFunction(u32bit, u32bit = 0); virtual ~HashFunction() {} @@ -132,7 +132,7 @@ class BOTAN_DLL MessageAuthenticationCode : public BufferedComputation, virtual MessageAuthenticationCode* clone() const = 0; virtual std::string name() const = 0; - virtual void clear() throw() {}; + virtual void clear() throw() = 0; MessageAuthenticationCode(u32bit, u32bit, u32bit = 0, u32bit = 1); virtual ~MessageAuthenticationCode() {} diff --git a/include/rng.h b/include/rng.h index e9a6f4a6c..f8b9a7f62 100644 --- a/include/rng.h +++ b/include/rng.h @@ -31,7 +31,7 @@ class BOTAN_DLL RandomNumberGenerator virtual void randomize(byte[], u32bit) = 0; virtual bool is_seeded() const = 0; - virtual void clear() throw() {}; + virtual void clear() throw() = 0; byte next_byte(); @@ -54,6 +54,8 @@ class BOTAN_DLL Null_RNG : public RandomNumberGenerator { public: void randomize(byte[], u32bit) { throw PRNG_Unseeded("Null_RNG"); } + void clear() throw() {}; + bool is_seeded() const { return false; } void add_entropy(const byte[], u32bit) {} void add_entropy_source(EntropySource* es) { delete es; } |