diff options
author | lloyd <[email protected]> | 2010-09-07 23:40:31 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-09-07 23:40:31 +0000 |
commit | 197f7cd4f744ae8246832343dc514296632554b2 (patch) | |
tree | 63963dfab01e29ce32be4c1d43e62506d9f0246d /src/hash/sha2 | |
parent | 5f83d344e49a6d62cd8989d9fb8f8ca80ed48fc1 (diff) |
Big, invasive but mostly automated change, with a further attempt at
harmonising MemoryRegion with std::vector:
The MemoryRegion::clear() function would zeroise the buffer, but keep
the memory allocated and the size unchanged. This is very different
from STL's clear(), which is basically the equivalent to what is
called destroy() in MemoryRegion. So to be able to replace MemoryRegion
with a std::vector, we have to rename destroy() to clear() and we have
to expose the current functionality of clear() in some other way, since
vector doesn't support this operation. Do so by adding a global function
named zeroise() which takes a MemoryRegion which is zeroed. Remove clear()
to ensure all callers are updated.
Diffstat (limited to 'src/hash/sha2')
-rw-r--r-- | src/hash/sha2/sha2_32.cpp | 4 | ||||
-rw-r--r-- | src/hash/sha2/sha2_64.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/hash/sha2/sha2_32.cpp b/src/hash/sha2/sha2_32.cpp index 4315e10d6..a18a4d8c4 100644 --- a/src/hash/sha2/sha2_32.cpp +++ b/src/hash/sha2/sha2_32.cpp @@ -181,7 +181,7 @@ void SHA_224::copy_out(byte output[]) void SHA_224::clear() { MDx_HashFunction::clear(); - W.clear(); + zeroise(W); digest[0] = 0xC1059ED8; digest[1] = 0x367CD507; digest[2] = 0x3070DD17; @@ -215,7 +215,7 @@ void SHA_256::copy_out(byte output[]) void SHA_256::clear() { MDx_HashFunction::clear(); - W.clear(); + zeroise(W); digest[0] = 0x6A09E667; digest[1] = 0xBB67AE85; digest[2] = 0x3C6EF372; diff --git a/src/hash/sha2/sha2_64.cpp b/src/hash/sha2/sha2_64.cpp index 10fe81a5e..aecf9a0db 100644 --- a/src/hash/sha2/sha2_64.cpp +++ b/src/hash/sha2/sha2_64.cpp @@ -188,7 +188,7 @@ void SHA_384::copy_out(byte output[]) void SHA_384::clear() { MDx_HashFunction::clear(); - W.clear(); + zeroise(W); digest[0] = 0xCBBB9D5DC1059ED8; digest[1] = 0x629A292A367CD507; digest[2] = 0x9159015A3070DD17; @@ -222,7 +222,7 @@ void SHA_512::copy_out(byte output[]) void SHA_512::clear() { MDx_HashFunction::clear(); - W.clear(); + zeroise(W); digest[0] = 0x6A09E667F3BCC908; digest[1] = 0xBB67AE8584CAA73B; digest[2] = 0x3C6EF372FE94F82B; |