diff options
author | lloyd <[email protected]> | 2010-09-14 01:16:32 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-09-14 01:16:32 +0000 |
commit | ae59295ea945fdcc482df2233409a5f878fa20c7 (patch) | |
tree | 768c30635a17847dccb6db6f36fa3b033adc37bf /src/hash/sha2/sha2_32.h | |
parent | 548f48611760346fa2e47efd5c0865eff831946a (diff) |
Completely remove the second parameter to SecureVector which specifies
the initial/default length of the array, update all users to instead
pass the value to the constructor.
This is a old vestigal thing from a class (SecureBuffer) that used
this compile-time constant in order to store the values in an
array. However this was changed way back in 2002 to use the same
allocator hooks as the rest of the containers, so the only advantage
to using the length field was that the initial length was set and
didn't have to be set in the constructor which was midly convenient.
However this directly conflicts with the desire to be able to
(eventually) use std::vector with a custom allocator, since of course
vector doesn't support this.
Fortunately almost all of the uses are in classes which have only a
single constructor, so there is little to no duplication by instead
initializing the size in the constructor.
Diffstat (limited to 'src/hash/sha2/sha2_32.h')
-rw-r--r-- | src/hash/sha2/sha2_32.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/hash/sha2/sha2_32.h b/src/hash/sha2/sha2_32.h index 71f0cff4b..a3e3a6f19 100644 --- a/src/hash/sha2/sha2_32.h +++ b/src/hash/sha2/sha2_32.h @@ -22,13 +22,14 @@ class BOTAN_DLL SHA_224 : public MDx_HashFunction void clear(); std::string name() const { return "SHA-224"; } HashFunction* clone() const { return new SHA_224; } - SHA_224() : MDx_HashFunction(28, 64, true, true) { clear(); } + + SHA_224() : MDx_HashFunction(28, 64, true, true), W(64), digest(8) + { clear(); } private: void compress_n(const byte[], u32bit blocks); void copy_out(byte[]); - SecureVector<u32bit, 64> W; - SecureVector<u32bit, 8> digest; + SecureVector<u32bit> W, digest; }; /** @@ -40,13 +41,14 @@ class BOTAN_DLL SHA_256 : public MDx_HashFunction void clear(); std::string name() const { return "SHA-256"; } HashFunction* clone() const { return new SHA_256; } - SHA_256() : MDx_HashFunction(32, 64, true, true) { clear(); } + + SHA_256() : MDx_HashFunction(32, 64, true, true), W(64), digest(8) + { clear(); } private: void compress_n(const byte[], u32bit blocks); void copy_out(byte[]); - SecureVector<u32bit, 64> W; - SecureVector<u32bit, 8> digest; + SecureVector<u32bit> W, digest; }; } |