aboutsummaryrefslogtreecommitdiffstats
path: root/src/hash
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-09-13 20:53:31 +0000
committerlloyd <[email protected]>2010-09-13 20:53:31 +0000
commit4fe8a34f1869805d9115f39cad53d1fd7f7eb6c4 (patch)
tree2ff6c30d1a7d5f2244b6f1b459a5ea10b6d43fe0 /src/hash
parent36bfef27271eadffefbc6891a9d7fa7eed7b1e10 (diff)
Remove more uses of vector to pointer implicit conversions
Diffstat (limited to 'src/hash')
-rw-r--r--src/hash/mdx_hash/mdx_hash.cpp6
-rw-r--r--src/hash/sha1_amd64/sha1_amd64.cpp2
-rw-r--r--src/hash/sha1_ia32/sha1_ia32.cpp2
-rw-r--r--src/hash/skein/skein_512.cpp13
-rw-r--r--src/hash/tiger/tiger.cpp29
-rw-r--r--src/hash/tiger/tiger.h4
6 files changed, 38 insertions, 18 deletions
diff --git a/src/hash/mdx_hash/mdx_hash.cpp b/src/hash/mdx_hash/mdx_hash.cpp
index 69341c53f..560832542 100644
--- a/src/hash/mdx_hash/mdx_hash.cpp
+++ b/src/hash/mdx_hash/mdx_hash.cpp
@@ -75,13 +75,13 @@ void MDx_HashFunction::final_result(byte output[])
if(position >= HASH_BLOCK_SIZE - COUNT_SIZE)
{
- compress_n(buffer, 1);
+ compress_n(&buffer[0], 1);
zeroise(buffer);
}
- write_count(buffer + HASH_BLOCK_SIZE - COUNT_SIZE);
+ write_count(&buffer[HASH_BLOCK_SIZE - COUNT_SIZE]);
- compress_n(buffer, 1);
+ compress_n(&buffer[0], 1);
copy_out(output);
clear();
}
diff --git a/src/hash/sha1_amd64/sha1_amd64.cpp b/src/hash/sha1_amd64/sha1_amd64.cpp
index 0efbd8559..885853182 100644
--- a/src/hash/sha1_amd64/sha1_amd64.cpp
+++ b/src/hash/sha1_amd64/sha1_amd64.cpp
@@ -23,7 +23,7 @@ void SHA_160_AMD64::compress_n(const byte input[], u32bit blocks)
{
for(u32bit i = 0; i != blocks; ++i)
{
- botan_sha160_amd64_compress(digest, input, W);
+ botan_sha160_amd64_compress(&digest[0], input, &W[0]);
input += HASH_BLOCK_SIZE;
}
}
diff --git a/src/hash/sha1_ia32/sha1_ia32.cpp b/src/hash/sha1_ia32/sha1_ia32.cpp
index 6eecdab56..611cc1961 100644
--- a/src/hash/sha1_ia32/sha1_ia32.cpp
+++ b/src/hash/sha1_ia32/sha1_ia32.cpp
@@ -23,7 +23,7 @@ void SHA_160_IA32::compress_n(const byte input[], u32bit blocks)
{
for(u32bit i = 0; i != blocks; ++i)
{
- botan_sha160_ia32_compress(digest, input, W);
+ botan_sha160_ia32_compress(&digest[0], input, &W[0]);
input += HASH_BLOCK_SIZE;
}
}
diff --git a/src/hash/skein/skein_512.cpp b/src/hash/skein/skein_512.cpp
index dabaa5da2..5aa49ab7a 100644
--- a/src/hash/skein/skein_512.cpp
+++ b/src/hash/skein/skein_512.cpp
@@ -27,7 +27,9 @@ enum type_code {
SKEIN_OUTPUT = 63
};
-void ubi_512(u64bit H[9], u64bit T[], const byte msg[], u32bit msg_len)
+void ubi_512(MemoryRegion<u64bit>& H,
+ MemoryRegion<u64bit>& T,
+ const byte msg[], u32bit msg_len)
{
do
{
@@ -122,16 +124,19 @@ void ubi_512(u64bit H[9], u64bit T[], const byte msg[], u32bit msg_len)
} while(msg_len);
}
-void reset_tweak(u64bit T[3], type_code type, bool final)
+void reset_tweak(MemoryRegion<u64bit>& T,
+ type_code type, bool final)
{
T[0] = 0;
T[1] = ((u64bit)type << 56) | ((u64bit)1 << 62) | ((u64bit)final << 63);
}
-void initial_block(u64bit H[9], u64bit T[3], u32bit output_bits,
+void initial_block(MemoryRegion<u64bit>& H,
+ MemoryRegion<u64bit>& T,
+ u32bit output_bits,
const std::string& personalization)
{
- clear_mem(H, 9);
+ zeroise(H);
// ASCII("SHA3") followed by version (0x0001) code
byte config_str[32] = { 0x53, 0x48, 0x41, 0x33, 0x01, 0x00, 0 };
diff --git a/src/hash/tiger/tiger.cpp b/src/hash/tiger/tiger.cpp
index dd41841c9..d931324e0 100644
--- a/src/hash/tiger/tiger.cpp
+++ b/src/hash/tiger/tiger.cpp
@@ -17,14 +17,25 @@ namespace {
/*
* Tiger Mixing Function
*/
-inline void mix(u64bit X[8])
+inline void mix(MemoryRegion<u64bit>& X)
{
- X[0] -= X[7] ^ 0xA5A5A5A5A5A5A5A5; X[1] ^= X[0];
- X[2] += X[1]; X[3] -= X[2] ^ ((~X[1]) << 19); X[4] ^= X[3];
- X[5] += X[4]; X[6] -= X[5] ^ ((~X[4]) >> 23); X[7] ^= X[6];
- X[0] += X[7]; X[1] -= X[0] ^ ((~X[7]) << 19); X[2] ^= X[1];
- X[3] += X[2]; X[4] -= X[3] ^ ((~X[2]) >> 23); X[5] ^= X[4];
- X[6] += X[5]; X[7] -= X[6] ^ 0x0123456789ABCDEF;
+ X[0] -= X[7] ^ 0xA5A5A5A5A5A5A5A5;
+ X[1] ^= X[0];
+ X[2] += X[1];
+ X[3] -= X[2] ^ ((~X[1]) << 19);
+ X[4] ^= X[3];
+ X[5] += X[4];
+ X[6] -= X[5] ^ ((~X[4]) >> 23);
+ X[7] ^= X[6];
+
+ X[0] += X[7];
+ X[1] -= X[0] ^ ((~X[7]) << 19);
+ X[2] ^= X[1];
+ X[3] += X[2];
+ X[4] -= X[3] ^ ((~X[2]) >> 23);
+ X[5] ^= X[4];
+ X[6] += X[5];
+ X[7] -= X[6] ^ 0x0123456789ABCDEF;
}
}
@@ -71,7 +82,9 @@ void Tiger::copy_out(byte output[])
/*
* Tiger Pass
*/
-void Tiger::pass(u64bit& A, u64bit& B, u64bit& C, u64bit X[8], byte mul)
+void Tiger::pass(u64bit& A, u64bit& B, u64bit& C,
+ const MemoryRegion<u64bit>& X,
+ byte mul)
{
C ^= X[0];
A -= SBOX1[get_byte(7, C)] ^ SBOX2[get_byte(5, C)] ^
diff --git a/src/hash/tiger/tiger.h b/src/hash/tiger/tiger.h
index 380f6eb24..94665b902 100644
--- a/src/hash/tiger/tiger.h
+++ b/src/hash/tiger/tiger.h
@@ -35,7 +35,9 @@ class BOTAN_DLL Tiger : public MDx_HashFunction
void compress_n(const byte[], u32bit block);
void copy_out(byte[]);
- static void pass(u64bit&, u64bit&, u64bit&, u64bit[8], byte);
+ static void pass(u64bit& A, u64bit& B, u64bit& C,
+ const MemoryRegion<u64bit>& M,
+ byte mul);
static const u64bit SBOX1[256];
static const u64bit SBOX2[256];