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/gost_3411 | |
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/gost_3411')
-rw-r--r-- | src/hash/gost_3411/gost_3411.cpp | 9 | ||||
-rw-r--r-- | src/hash/gost_3411/gost_3411.h | 4 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/hash/gost_3411/gost_3411.cpp b/src/hash/gost_3411/gost_3411.cpp index ad874fe8a..ee43514d5 100644 --- a/src/hash/gost_3411/gost_3411.cpp +++ b/src/hash/gost_3411/gost_3411.cpp @@ -17,7 +17,10 @@ namespace Botan { */ GOST_34_11::GOST_34_11() : HashFunction(32, 32), - cipher(GOST_28147_89_Params("R3411_CryptoPro")) + cipher(GOST_28147_89_Params("R3411_CryptoPro")), + buffer(32), + sum(32), + hash(32) { count = 0; position = 0; @@ -223,11 +226,11 @@ void GOST_34_11::final_result(byte out[]) compress_n(buffer, 1); } - SecureVector<byte, 32> length_buf; + SecureVector<byte> length_buf(32); const u64bit bit_count = count * 8; store_le(bit_count, length_buf); - SecureVector<byte, 32> sum_buf(sum); + SecureVector<byte> sum_buf = sum; compress_n(length_buf, 1); compress_n(sum_buf, 1); diff --git a/src/hash/gost_3411/gost_3411.h b/src/hash/gost_3411/gost_3411.h index 04417d6fd..5d26e8557 100644 --- a/src/hash/gost_3411/gost_3411.h +++ b/src/hash/gost_3411/gost_3411.h @@ -31,9 +31,7 @@ class BOTAN_DLL GOST_34_11 : public HashFunction void final_result(byte[]); GOST_28147_89 cipher; - SecureVector<byte, 32> buffer; - SecureVector<byte, 32> sum; - SecureVector<byte, 32> hash; + SecureVector<byte> buffer, sum, hash; u64bit count; u32bit position; }; |