aboutsummaryrefslogtreecommitdiffstats
path: root/src/constructs
diff options
context:
space:
mode:
authorlloyd <lloyd@randombit.net>2010-09-07 23:40:31 +0000
committerlloyd <lloyd@randombit.net>2010-09-07 23:40:31 +0000
commit197f7cd4f744ae8246832343dc514296632554b2 (patch)
tree63963dfab01e29ce32be4c1d43e62506d9f0246d /src/constructs
parent5f83d344e49a6d62cd8989d9fb8f8ca80ed48fc1 (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/constructs')
-rw-r--r--src/constructs/aont/package.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/constructs/aont/package.cpp b/src/constructs/aont/package.cpp
index e10087060..1e25a3b24 100644
--- a/src/constructs/aont/package.cpp
+++ b/src/constructs/aont/package.cpp
@@ -49,7 +49,7 @@ void aont_package(RandomNumberGenerator& rng,
u32bit left = std::min<u32bit>(cipher->BLOCK_SIZE,
input_len - cipher->BLOCK_SIZE * i);
- buf.clear();
+ zeroise(buf);
copy_mem(&buf[0], output + cipher->BLOCK_SIZE * i, left);
for(u32bit j = 0; j != 4; ++j)
@@ -95,7 +95,7 @@ void aont_unpackage(BlockCipher* cipher,
u32bit left = std::min<u32bit>(cipher->BLOCK_SIZE,
input_len - cipher->BLOCK_SIZE * (i+1));
- buf.clear();
+ zeroise(buf);
copy_mem(&buf[0], input + cipher->BLOCK_SIZE * i, left);
for(u32bit j = 0; j != 4; ++j)