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/stream/ctr/ctr.cpp | |
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/stream/ctr/ctr.cpp')
-rw-r--r-- | src/stream/ctr/ctr.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/stream/ctr/ctr.cpp b/src/stream/ctr/ctr.cpp index 8a24cd4d0..cd1b1b7fb 100644 --- a/src/stream/ctr/ctr.cpp +++ b/src/stream/ctr/ctr.cpp @@ -40,8 +40,8 @@ CTR_BE::~CTR_BE() void CTR_BE::clear() { permutation->clear(); - buffer.clear(); - counter.clear(); + zeroise(buffer); + zeroise(counter); position = 0; } @@ -91,7 +91,7 @@ void CTR_BE::set_iv(const byte iv[], u32bit iv_len) const u32bit BLOCK_SIZE = permutation->BLOCK_SIZE; - counter.clear(); + zeroise(counter); counter.copy(0, iv, iv_len); |