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/block/cast | |
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/block/cast')
-rw-r--r-- | src/block/cast/cast128.h | 2 | ||||
-rw-r--r-- | src/block/cast/cast256.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/block/cast/cast128.h b/src/block/cast/cast128.h index 967e91938..e5d4a884b 100644 --- a/src/block/cast/cast128.h +++ b/src/block/cast/cast128.h @@ -21,7 +21,7 @@ class BOTAN_DLL CAST_128 : public BlockCipher void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; - void clear() { MK.clear(); RK.clear(); } + void clear() { zeroise(MK); zeroise(RK); } std::string name() const { return "CAST-128"; } BlockCipher* clone() const { return new CAST_128; } diff --git a/src/block/cast/cast256.h b/src/block/cast/cast256.h index c4a305671..c9820c1ab 100644 --- a/src/block/cast/cast256.h +++ b/src/block/cast/cast256.h @@ -21,7 +21,7 @@ class BOTAN_DLL CAST_256 : public BlockCipher void encrypt_n(const byte in[], byte out[], u32bit blocks) const; void decrypt_n(const byte in[], byte out[], u32bit blocks) const; - void clear() { MK.clear(); RK.clear(); } + void clear() { zeroise(MK); zeroise(RK); } std::string name() const { return "CAST-256"; } BlockCipher* clone() const { return new CAST_256; } |