From 197f7cd4f744ae8246832343dc514296632554b2 Mon Sep 17 00:00:00 2001 From: lloyd Date: Tue, 7 Sep 2010 23:40:31 +0000 Subject: 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. --- src/block/aes_ssse3/aes_ssse3.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/block/aes_ssse3') diff --git a/src/block/aes_ssse3/aes_ssse3.h b/src/block/aes_ssse3/aes_ssse3.h index 8087b58a0..babd30509 100644 --- a/src/block/aes_ssse3/aes_ssse3.h +++ b/src/block/aes_ssse3/aes_ssse3.h @@ -21,7 +21,7 @@ class BOTAN_DLL AES_128_SSSE3 : 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() { EK.clear(); DK.clear(); } + void clear() { zeroise(EK); zeroise(DK); } std::string name() const { return "AES-128"; } BlockCipher* clone() const { return new AES_128_SSSE3; } @@ -41,7 +41,7 @@ class BOTAN_DLL AES_192_SSSE3 : 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() { EK.clear(); DK.clear(); } + void clear() { zeroise(EK); zeroise(DK); } std::string name() const { return "AES-192"; } BlockCipher* clone() const { return new AES_192_SSSE3; } @@ -61,7 +61,7 @@ class BOTAN_DLL AES_256_SSSE3 : 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() { EK.clear(); DK.clear(); } + void clear() { zeroise(EK); zeroise(DK); } std::string name() const { return "AES-256"; } BlockCipher* clone() const { return new AES_256_SSSE3; } -- cgit v1.2.3