diff options
author | lloyd <[email protected]> | 2012-05-25 22:52:00 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2012-05-25 22:52:00 +0000 |
commit | 12090a7148d9ee73572cc1a7268fc489504a8173 (patch) | |
tree | 51e50ce0852c56231e9e6dc13f168b10edd45d01 /src/hash | |
parent | 9594979caf775dc4062850044715b804d1fda60c (diff) | |
parent | 65cc04445f8d40497f02a14bd8cb97081790e54b (diff) |
propagate from branch 'net.randombit.botan.x509-path-validation' (head 63b5a20eab129ca13287fda33d2d02eec329708f)
to branch 'net.randombit.botan' (head 8b8150f09c55184f028f2929c4e7f7cd0d46d96e)
Diffstat (limited to 'src/hash')
-rw-r--r-- | src/hash/bmw_512/bmw_512.h | 2 | ||||
-rw-r--r-- | src/hash/comb4p/comb4p.cpp | 10 | ||||
-rw-r--r-- | src/hash/gost_3411/gost_3411.cpp | 10 | ||||
-rw-r--r-- | src/hash/gost_3411/gost_3411.h | 2 | ||||
-rw-r--r-- | src/hash/has160/has160.h | 2 | ||||
-rw-r--r-- | src/hash/keccak/keccak.cpp | 8 | ||||
-rw-r--r-- | src/hash/keccak/keccak.h | 2 | ||||
-rw-r--r-- | src/hash/md2/md2.cpp | 6 | ||||
-rw-r--r-- | src/hash/md2/md2.h | 2 | ||||
-rw-r--r-- | src/hash/md4/md4.h | 4 | ||||
-rw-r--r-- | src/hash/md5/md5.h | 4 | ||||
-rw-r--r-- | src/hash/mdx_hash/mdx_hash.cpp | 4 | ||||
-rw-r--r-- | src/hash/mdx_hash/mdx_hash.h | 2 | ||||
-rw-r--r-- | src/hash/par_hash/par_hash.cpp | 51 | ||||
-rw-r--r-- | src/hash/rmd128/rmd128.h | 2 | ||||
-rw-r--r-- | src/hash/rmd160/rmd160.h | 2 | ||||
-rw-r--r-- | src/hash/sha1/sha160.h | 4 | ||||
-rw-r--r-- | src/hash/sha2_32/sha2_32.cpp | 2 | ||||
-rw-r--r-- | src/hash/sha2_32/sha2_32.h | 4 | ||||
-rw-r--r-- | src/hash/sha2_64/sha2_64.cpp | 2 | ||||
-rw-r--r-- | src/hash/sha2_64/sha2_64.h | 4 | ||||
-rw-r--r-- | src/hash/skein/skein_512.cpp | 23 | ||||
-rw-r--r-- | src/hash/skein/skein_512.h | 6 | ||||
-rw-r--r-- | src/hash/tiger/tiger.cpp | 11 | ||||
-rw-r--r-- | src/hash/tiger/tiger.h | 4 | ||||
-rw-r--r-- | src/hash/whirlpool/whrlpool.h | 2 |
26 files changed, 90 insertions, 85 deletions
diff --git a/src/hash/bmw_512/bmw_512.h b/src/hash/bmw_512/bmw_512.h index 474b607bb..b9ea63578 100644 --- a/src/hash/bmw_512/bmw_512.h +++ b/src/hash/bmw_512/bmw_512.h @@ -30,7 +30,7 @@ class BOTAN_DLL BMW_512 : public MDx_HashFunction void compress_n(const byte input[], size_t blocks); void copy_out(byte output[]); - SecureVector<u64bit> H, M, Q; + secure_vector<u64bit> H, M, Q; }; } diff --git a/src/hash/comb4p/comb4p.cpp b/src/hash/comb4p/comb4p.cpp index 1ea64a5cb..7aec5972e 100644 --- a/src/hash/comb4p/comb4p.cpp +++ b/src/hash/comb4p/comb4p.cpp @@ -13,8 +13,8 @@ namespace Botan { namespace { -void comb4p_round(MemoryRegion<byte>& out, - const MemoryRegion<byte>& in, +void comb4p_round(secure_vector<byte>& out, + const secure_vector<byte>& in, byte round_no, HashFunction* h1, HashFunction* h2) @@ -25,7 +25,7 @@ void comb4p_round(MemoryRegion<byte>& out, h1->update(&in[0], in.size()); h2->update(&in[0], in.size()); - SecureVector<byte> h_buf = h1->final(); + secure_vector<byte> h_buf = h1->final(); xor_buf(&out[0], &h_buf[0], std::min(out.size(), h_buf.size())); h_buf = h2->final(); @@ -78,8 +78,8 @@ void Comb4P::add_data(const byte input[], size_t length) void Comb4P::final_result(byte out[]) { - SecureVector<byte> h1 = hash1->final(); - SecureVector<byte> h2 = hash2->final(); + secure_vector<byte> h1 = hash1->final(); + secure_vector<byte> h2 = hash2->final(); // First round xor_buf(&h1[0], &h2[0], std::min(h1.size(), h2.size())); diff --git a/src/hash/gost_3411/gost_3411.cpp b/src/hash/gost_3411/gost_3411.cpp index c0f39da47..eb889c0a5 100644 --- a/src/hash/gost_3411/gost_3411.cpp +++ b/src/hash/gost_3411/gost_3411.cpp @@ -43,7 +43,7 @@ void GOST_34_11::add_data(const byte input[], size_t length) if(position) { - buffer.copy(position, input, length); + buffer_insert(buffer, position, input, length); if(position + length >= hash_block_size()) { @@ -60,7 +60,7 @@ void GOST_34_11::add_data(const byte input[], size_t length) if(full_blocks) compress_n(input, full_blocks); - buffer.copy(position, input + full_blocks * hash_block_size(), remaining); + buffer_insert(buffer, position, input + full_blocks * hash_block_size(), remaining); position += remaining; } @@ -210,7 +210,7 @@ void GOST_34_11::compress_n(const byte input[], size_t blocks) S2[30] = S[ 2] ^ S[ 4] ^ S[ 8] ^ S[14] ^ S[16] ^ S[18] ^ S[22] ^ S[24] ^ S[28] ^ S[30]; S2[31] = S[ 3] ^ S[ 5] ^ S[ 9] ^ S[15] ^ S[17] ^ S[19] ^ S[23] ^ S[25] ^ S[29] ^ S[31]; - hash.copy(S2, 32); + copy_mem(&hash[0], &S2[0], 32); } } @@ -225,11 +225,11 @@ void GOST_34_11::final_result(byte out[]) compress_n(&buffer[0], 1); } - SecureVector<byte> length_buf(32); + secure_vector<byte> length_buf(32); const u64bit bit_count = count * 8; store_le(bit_count, &length_buf[0]); - SecureVector<byte> sum_buf = sum; + secure_vector<byte> sum_buf = sum; compress_n(&length_buf[0], 1); compress_n(&sum_buf[0], 1); diff --git a/src/hash/gost_3411/gost_3411.h b/src/hash/gost_3411/gost_3411.h index fbbcb7a89..5437ca4d8 100644 --- a/src/hash/gost_3411/gost_3411.h +++ b/src/hash/gost_3411/gost_3411.h @@ -34,7 +34,7 @@ class BOTAN_DLL GOST_34_11 : public HashFunction void final_result(byte[]); GOST_28147_89 cipher; - SecureVector<byte> buffer, sum, hash; + secure_vector<byte> buffer, sum, hash; size_t position; u64bit count; }; diff --git a/src/hash/has160/has160.h b/src/hash/has160/has160.h index d32361601..9947d9580 100644 --- a/src/hash/has160/has160.h +++ b/src/hash/has160/has160.h @@ -31,7 +31,7 @@ class BOTAN_DLL HAS_160 : public MDx_HashFunction void compress_n(const byte[], size_t blocks); void copy_out(byte[]); - SecureVector<u32bit> X, digest; + secure_vector<u32bit> X, digest; }; } diff --git a/src/hash/keccak/keccak.cpp b/src/hash/keccak/keccak.cpp index 922167b61..e34c0fd43 100644 --- a/src/hash/keccak/keccak.cpp +++ b/src/hash/keccak/keccak.cpp @@ -112,12 +112,12 @@ Keccak_1600::Keccak_1600(size_t output_bits) : if(output_bits != 224 && output_bits != 256 && output_bits != 384 && output_bits != 512) throw Invalid_Argument("Keccak_1600: Invalid output length " + - to_string(output_bits)); + std::to_string(output_bits)); } std::string Keccak_1600::name() const { - return "Keccak-1600(" + to_string(output_bits) + ")"; + return "Keccak-1600(" + std::to_string(output_bits) + ")"; } HashFunction* Keccak_1600::clone() const @@ -178,12 +178,12 @@ void Keccak_1600::add_data(const byte input[], size_t length) void Keccak_1600::final_result(byte output[]) { - MemoryVector<byte> padding(bitrate / 8 - S_pos); + std::vector<byte> padding(bitrate / 8 - S_pos); padding[0] = 0x01; padding[padding.size()-1] |= 0x80; - add_data(padding, padding.size()); + add_data(&padding[0], padding.size()); /* * We never have to run the permutation again because we only support diff --git a/src/hash/keccak/keccak.h b/src/hash/keccak/keccak.h index 17ae632ba..e91a04d32 100644 --- a/src/hash/keccak/keccak.h +++ b/src/hash/keccak/keccak.h @@ -38,7 +38,7 @@ class BOTAN_DLL Keccak_1600 : public HashFunction void final_result(byte out[]); size_t output_bits, bitrate; - SecureVector<u64bit> S; + secure_vector<u64bit> S; size_t S_pos; }; diff --git a/src/hash/md2/md2.cpp b/src/hash/md2/md2.cpp index 761528dc6..8f6a90208 100644 --- a/src/hash/md2/md2.cpp +++ b/src/hash/md2/md2.cpp @@ -39,7 +39,7 @@ void MD2::hash(const byte input[]) 0x31, 0x44, 0x50, 0xB4, 0x8F, 0xED, 0x1F, 0x1A, 0xDB, 0x99, 0x8D, 0x33, 0x9F, 0x11, 0x83, 0x14 }; - X.copy(16, input, hash_block_size()); + buffer_insert(X, 16, input, hash_block_size()); xor_buf(&X[32], &X[0], &X[16], hash_block_size()); byte T = 0; @@ -66,7 +66,7 @@ void MD2::hash(const byte input[]) */ void MD2::add_data(const byte input[], size_t length) { - buffer.copy(position, input, length); + buffer_insert(buffer, position, input, length); if(position + length >= hash_block_size()) { @@ -79,7 +79,7 @@ void MD2::add_data(const byte input[], size_t length) input += hash_block_size(); length -= hash_block_size(); } - buffer.copy(input, length); + copy_mem(&buffer[0], input, length); position = 0; } position += length; diff --git a/src/hash/md2/md2.h b/src/hash/md2/md2.h index 84e0323f7..032d8a8e0 100644 --- a/src/hash/md2/md2.h +++ b/src/hash/md2/md2.h @@ -32,7 +32,7 @@ class BOTAN_DLL MD2 : public HashFunction void hash(const byte[]); void final_result(byte[]); - SecureVector<byte> X, checksum, buffer; + secure_vector<byte> X, checksum, buffer; size_t position; }; diff --git a/src/hash/md4/md4.h b/src/hash/md4/md4.h index d37dbe3b2..750be0fe7 100644 --- a/src/hash/md4/md4.h +++ b/src/hash/md4/md4.h @@ -33,12 +33,12 @@ class BOTAN_DLL MD4 : public MDx_HashFunction /** * The message buffer, exposed for use by subclasses (x86 asm) */ - SecureVector<u32bit> M; + secure_vector<u32bit> M; /** * The digest value, exposed for use by subclasses (x86 asm) */ - SecureVector<u32bit> digest; + secure_vector<u32bit> digest; }; } diff --git a/src/hash/md5/md5.h b/src/hash/md5/md5.h index 92c023c92..bc90df0af 100644 --- a/src/hash/md5/md5.h +++ b/src/hash/md5/md5.h @@ -33,12 +33,12 @@ class BOTAN_DLL MD5 : public MDx_HashFunction /** * The message buffer, exposed for use by subclasses (x86 asm) */ - SecureVector<u32bit> M; + secure_vector<u32bit> M; /** * The digest value, exposed for use by subclasses (x86 asm) */ - SecureVector<u32bit> digest; + secure_vector<u32bit> digest; }; } diff --git a/src/hash/mdx_hash/mdx_hash.cpp b/src/hash/mdx_hash/mdx_hash.cpp index 7bfcf6592..81042c1fa 100644 --- a/src/hash/mdx_hash/mdx_hash.cpp +++ b/src/hash/mdx_hash/mdx_hash.cpp @@ -44,7 +44,7 @@ void MDx_HashFunction::add_data(const byte input[], size_t length) if(position) { - buffer.copy(position, input, length); + buffer_insert(buffer, position, input, length); if(position + length >= buffer.size()) { @@ -61,7 +61,7 @@ void MDx_HashFunction::add_data(const byte input[], size_t length) if(full_blocks) compress_n(input, full_blocks); - buffer.copy(position, input + full_blocks * buffer.size(), remaining); + buffer_insert(buffer, position, input + full_blocks * buffer.size(), remaining); position += remaining; } diff --git a/src/hash/mdx_hash/mdx_hash.h b/src/hash/mdx_hash/mdx_hash.h index ed3381605..14d3c27a0 100644 --- a/src/hash/mdx_hash/mdx_hash.h +++ b/src/hash/mdx_hash/mdx_hash.h @@ -55,7 +55,7 @@ class BOTAN_DLL MDx_HashFunction : public HashFunction */ virtual void write_count(byte out[]); private: - SecureVector<byte> buffer; + secure_vector<byte> buffer; u64bit count; size_t position; diff --git a/src/hash/par_hash/par_hash.cpp b/src/hash/par_hash/par_hash.cpp index 328be6a11..df47780ef 100644 --- a/src/hash/par_hash/par_hash.cpp +++ b/src/hash/par_hash/par_hash.cpp @@ -1,11 +1,12 @@ /* * Parallel -* (C) 1999-2007 Jack Lloyd +* (C) 1999-2009 Jack Lloyd * * Distributed under the terms of the Botan license */ #include <botan/par_hash.h> +#include <botan/parsing.h> namespace Botan { @@ -14,20 +15,21 @@ namespace Botan { */ void Parallel::add_data(const byte input[], size_t length) { - for(size_t i = 0; i != hashes.size(); ++i) - hashes[i]->update(input, length); + for(auto hash : hashes) + hash->update(input, length); } /* * Finalize the hash */ -void Parallel::final_result(byte hash[]) +void Parallel::final_result(byte out[]) { - size_t offset = 0; - for(size_t i = 0; i != hashes.size(); ++i) + u32bit offset = 0; + + for(auto hash : hashes) { - hashes[i]->final(hash + offset); - offset += hashes[i]->output_length(); + hash->final(out + offset); + offset += hash->output_length(); } } @@ -37,8 +39,9 @@ void Parallel::final_result(byte hash[]) size_t Parallel::output_length() const { size_t sum = 0; - for(size_t i = 0; i != hashes.size(); ++i) - sum += hashes[i]->output_length(); + + for(auto hash : hashes) + sum += hash->output_length(); return sum; } @@ -47,14 +50,12 @@ size_t Parallel::output_length() const */ std::string Parallel::name() const { - std::string hash_names; - for(size_t i = 0; i != hashes.size(); ++i) - { - if(i) - hash_names += ','; - hash_names += hashes[i]->name(); - } - return "Parallel(" + hash_names + ")"; + std::vector<std::string> names; + + for(auto hash : hashes) + names.push_back(hash->name()); + + return "Parallel(" + string_join(names, ',') + ")"; } /* @@ -63,8 +64,10 @@ std::string Parallel::name() const HashFunction* Parallel::clone() const { std::vector<HashFunction*> hash_copies; - for(size_t i = 0; i != hashes.size(); ++i) - hash_copies.push_back(hashes[i]->clone()); + + for(auto hash : hashes) + hash_copies.push_back(hash->clone()); + return new Parallel(hash_copies); } @@ -73,8 +76,8 @@ HashFunction* Parallel::clone() const */ void Parallel::clear() { - for(size_t i = 0; i != hashes.size(); ++i) - hashes[i]->clear(); + for(auto hash : hashes) + hash->clear(); } /* @@ -90,8 +93,8 @@ Parallel::Parallel(const std::vector<HashFunction*>& hash_in) : */ Parallel::~Parallel() { - for(size_t i = 0; i != hashes.size(); ++i) - delete hashes[i]; + for(auto hash : hashes) + delete hash; } } diff --git a/src/hash/rmd128/rmd128.h b/src/hash/rmd128/rmd128.h index d64cf3c84..e37666a27 100644 --- a/src/hash/rmd128/rmd128.h +++ b/src/hash/rmd128/rmd128.h @@ -30,7 +30,7 @@ class BOTAN_DLL RIPEMD_128 : public MDx_HashFunction void compress_n(const byte[], size_t blocks); void copy_out(byte[]); - SecureVector<u32bit> M, digest; + secure_vector<u32bit> M, digest; }; } diff --git a/src/hash/rmd160/rmd160.h b/src/hash/rmd160/rmd160.h index 5df4ad490..0e43fed9a 100644 --- a/src/hash/rmd160/rmd160.h +++ b/src/hash/rmd160/rmd160.h @@ -30,7 +30,7 @@ class BOTAN_DLL RIPEMD_160 : public MDx_HashFunction void compress_n(const byte[], size_t blocks); void copy_out(byte[]); - SecureVector<u32bit> M, digest; + secure_vector<u32bit> M, digest; }; } diff --git a/src/hash/sha1/sha160.h b/src/hash/sha1/sha160.h index c3b264861..e2a81808d 100644 --- a/src/hash/sha1/sha160.h +++ b/src/hash/sha1/sha160.h @@ -47,12 +47,12 @@ class BOTAN_DLL SHA_160 : public MDx_HashFunction /** * The digest value, exposed for use by subclasses (asm, SSE2) */ - SecureVector<u32bit> digest; + secure_vector<u32bit> digest; /** * The message buffer, exposed for use by subclasses (asm, SSE2) */ - SecureVector<u32bit> W; + secure_vector<u32bit> W; }; } diff --git a/src/hash/sha2_32/sha2_32.cpp b/src/hash/sha2_32/sha2_32.cpp index 6dd780e64..cffc8bd2a 100644 --- a/src/hash/sha2_32/sha2_32.cpp +++ b/src/hash/sha2_32/sha2_32.cpp @@ -50,7 +50,7 @@ inline u32bit sigma(u32bit X, u32bit rot1, u32bit rot2, u32bit shift) /* * SHA-224 / SHA-256 compression function */ -void compress(MemoryRegion<u32bit>& digest, +void compress(secure_vector<u32bit>& digest, const byte input[], size_t blocks) { u32bit A = digest[0], B = digest[1], C = digest[2], diff --git a/src/hash/sha2_32/sha2_32.h b/src/hash/sha2_32/sha2_32.h index 807b979d1..ccb8e07f2 100644 --- a/src/hash/sha2_32/sha2_32.h +++ b/src/hash/sha2_32/sha2_32.h @@ -31,7 +31,7 @@ class BOTAN_DLL SHA_224 : public MDx_HashFunction void compress_n(const byte[], size_t blocks); void copy_out(byte[]); - SecureVector<u32bit> digest; + secure_vector<u32bit> digest; }; /** @@ -52,7 +52,7 @@ class BOTAN_DLL SHA_256 : public MDx_HashFunction void compress_n(const byte[], size_t blocks); void copy_out(byte[]); - SecureVector<u32bit> digest; + secure_vector<u32bit> digest; }; } diff --git a/src/hash/sha2_64/sha2_64.cpp b/src/hash/sha2_64/sha2_64.cpp index 3026c3a39..8dcb4684e 100644 --- a/src/hash/sha2_64/sha2_64.cpp +++ b/src/hash/sha2_64/sha2_64.cpp @@ -49,7 +49,7 @@ inline u64bit sigma(u64bit X, u32bit rot1, u32bit rot2, u32bit shift) /* * SHA-{384,512} Compression Function */ -void compress(MemoryRegion<u64bit>& digest, +void compress(secure_vector<u64bit>& digest, const byte input[], size_t blocks) { u64bit A = digest[0], B = digest[1], C = digest[2], diff --git a/src/hash/sha2_64/sha2_64.h b/src/hash/sha2_64/sha2_64.h index 124d4bbfb..58b154170 100644 --- a/src/hash/sha2_64/sha2_64.h +++ b/src/hash/sha2_64/sha2_64.h @@ -30,7 +30,7 @@ class BOTAN_DLL SHA_384 : public MDx_HashFunction void compress_n(const byte[], size_t blocks); void copy_out(byte[]); - SecureVector<u64bit> digest; + secure_vector<u64bit> digest; }; /** @@ -51,7 +51,7 @@ class BOTAN_DLL SHA_512 : public MDx_HashFunction void compress_n(const byte[], size_t blocks); void copy_out(byte[]); - SecureVector<u64bit> digest; + secure_vector<u64bit> digest; }; } diff --git a/src/hash/skein/skein_512.cpp b/src/hash/skein/skein_512.cpp index 571bf9c0b..28c2aa38b 100644 --- a/src/hash/skein/skein_512.cpp +++ b/src/hash/skein/skein_512.cpp @@ -27,8 +27,8 @@ enum type_code { SKEIN_OUTPUT = 63 }; -void ubi_512(MemoryRegion<u64bit>& H, - MemoryRegion<u64bit>& T, +void ubi_512(secure_vector<u64bit>& H, + secure_vector<u64bit>& T, const byte msg[], size_t msg_len) { do @@ -125,7 +125,7 @@ void ubi_512(MemoryRegion<u64bit>& H, } while(msg_len); } -void reset_tweak(MemoryRegion<u64bit>& T, +void reset_tweak(secure_vector<u64bit>& T, type_code type, bool final) { T[0] = 0; @@ -135,8 +135,8 @@ void reset_tweak(MemoryRegion<u64bit>& T, (static_cast<u64bit>(final) << 63); } -void initial_block(MemoryRegion<u64bit>& H, - MemoryRegion<u64bit>& T, +void initial_block(secure_vector<u64bit>& H, + secure_vector<u64bit>& T, size_t output_bits, const std::string& personalization) { @@ -185,8 +185,9 @@ Skein_512::Skein_512(size_t arg_output_bits, std::string Skein_512::name() const { if(personalization != "") - return "Skein-512(" + to_string(output_bits) + "," + personalization + ")"; - return "Skein-512(" + to_string(output_bits) + ")"; + return "Skein-512(" + std::to_string(output_bits) + "," + + personalization + ")"; + return "Skein-512(" + std::to_string(output_bits) + ")"; } HashFunction* Skein_512::clone() const @@ -209,7 +210,7 @@ void Skein_512::add_data(const byte input[], size_t length) if(buf_pos) { - buffer.copy(buf_pos, input, length); + buffer_insert(buffer, buf_pos, input, length); if(buf_pos + length > 64) { ubi_512(H, T, &buffer[0], buffer.size()); @@ -227,7 +228,7 @@ void Skein_512::add_data(const byte input[], size_t length) length -= full_blocks * 64; - buffer.copy(buf_pos, input + full_blocks * 64, length); + buffer_insert(buffer, buf_pos, input + full_blocks * 64, length); buf_pos += length; } @@ -244,13 +245,13 @@ void Skein_512::final_result(byte out[]) size_t out_bytes = output_bits / 8; - SecureVector<u64bit> H_out(9); + secure_vector<u64bit> H_out(9); while(out_bytes) { const size_t to_proc = std::min<size_t>(out_bytes, 64); - H_out.copy(&H[0], 8); + copy_mem(&H_out[0], &H[0], 8); reset_tweak(T, SKEIN_OUTPUT, true); ubi_512(H_out, T, counter, sizeof(counter)); diff --git a/src/hash/skein/skein_512.h b/src/hash/skein/skein_512.h index 8605e5991..e0abc06ae 100644 --- a/src/hash/skein/skein_512.h +++ b/src/hash/skein/skein_512.h @@ -41,9 +41,9 @@ class BOTAN_DLL Skein_512 : public HashFunction std::string personalization; size_t output_bits; - SecureVector<u64bit> H; - SecureVector<u64bit> T; - SecureVector<byte> buffer; + secure_vector<u64bit> H; + secure_vector<u64bit> T; + secure_vector<byte> buffer; size_t buf_pos; }; diff --git a/src/hash/tiger/tiger.cpp b/src/hash/tiger/tiger.cpp index 6f40f84c8..57250d6f5 100644 --- a/src/hash/tiger/tiger.cpp +++ b/src/hash/tiger/tiger.cpp @@ -17,7 +17,7 @@ namespace { /* * Tiger Mixing Function */ -inline void mix(MemoryRegion<u64bit>& X) +inline void mix(secure_vector<u64bit>& X) { X[0] -= X[7] ^ 0xA5A5A5A5A5A5A5A5; X[1] ^= X[0]; @@ -83,7 +83,7 @@ void Tiger::copy_out(byte output[]) * Tiger Pass */ void Tiger::pass(u64bit& A, u64bit& B, u64bit& C, - const MemoryRegion<u64bit>& X, + const secure_vector<u64bit>& X, byte mul) { C ^= X[0]; @@ -160,7 +160,8 @@ void Tiger::clear() */ std::string Tiger::name() const { - return "Tiger(" + to_string(output_length()) + "," + to_string(passes) + ")"; + return "Tiger(" + std::to_string(output_length()) + "," + + std::to_string(passes) + ")"; } /* @@ -175,11 +176,11 @@ Tiger::Tiger(size_t hash_len, size_t passes) : { if(output_length() != 16 && output_length() != 20 && output_length() != 24) throw Invalid_Argument("Tiger: Illegal hash output size: " + - to_string(output_length())); + std::to_string(output_length())); if(passes < 3) throw Invalid_Argument("Tiger: Invalid number of passes: " - + to_string(passes)); + + std::to_string(passes)); clear(); } diff --git a/src/hash/tiger/tiger.h b/src/hash/tiger/tiger.h index 09c9947fb..70c70958b 100644 --- a/src/hash/tiger/tiger.h +++ b/src/hash/tiger/tiger.h @@ -38,7 +38,7 @@ class BOTAN_DLL Tiger : public MDx_HashFunction void copy_out(byte[]); static void pass(u64bit& A, u64bit& B, u64bit& C, - const MemoryRegion<u64bit>& M, + const secure_vector<u64bit>& M, byte mul); static const u64bit SBOX1[256]; @@ -46,7 +46,7 @@ class BOTAN_DLL Tiger : public MDx_HashFunction static const u64bit SBOX3[256]; static const u64bit SBOX4[256]; - SecureVector<u64bit> X, digest; + secure_vector<u64bit> X, digest; const size_t hash_len, passes; }; diff --git a/src/hash/whirlpool/whrlpool.h b/src/hash/whirlpool/whrlpool.h index ab7a78bc8..d4ad805e1 100644 --- a/src/hash/whirlpool/whrlpool.h +++ b/src/hash/whirlpool/whrlpool.h @@ -39,7 +39,7 @@ class BOTAN_DLL Whirlpool : public MDx_HashFunction static const u64bit C6[256]; static const u64bit C7[256]; - SecureVector<u64bit> M, digest; + secure_vector<u64bit> M, digest; }; } |