diff options
Diffstat (limited to 'src/block/des')
-rw-r--r-- | src/block/des/des.cpp | 2 | ||||
-rw-r--r-- | src/block/des/des.h | 6 | ||||
-rw-r--r-- | src/block/des/desx.h | 4 |
3 files changed, 5 insertions, 7 deletions
diff --git a/src/block/des/des.cpp b/src/block/des/des.cpp index c500e9bab..2f0a3635d 100644 --- a/src/block/des/des.cpp +++ b/src/block/des/des.cpp @@ -206,6 +206,7 @@ void DES::decrypt_n(const byte in[], byte out[], size_t blocks) const */ void DES::key_schedule(const byte key[], size_t) { + round_key.resize(32); des_key_schedule(&round_key[0], key); } @@ -280,6 +281,7 @@ void TripleDES::decrypt_n(const byte in[], byte out[], size_t blocks) const */ void TripleDES::key_schedule(const byte key[], size_t length) { + round_key.resize(3*32); des_key_schedule(&round_key[0], key); des_key_schedule(&round_key[32], key + 8); diff --git a/src/block/des/des.h b/src/block/des/des.h index 711efb16d..fc42cfee5 100644 --- a/src/block/des/des.h +++ b/src/block/des/des.h @@ -21,11 +21,9 @@ class BOTAN_DLL DES : public Block_Cipher_Fixed_Params<8, 8> void encrypt_n(const byte in[], byte out[], size_t blocks) const; void decrypt_n(const byte in[], byte out[], size_t blocks) const; - void clear() { zeroise(round_key); } + void clear() { round_key.clear(); } std::string name() const { return "DES"; } BlockCipher* clone() const { return new DES; } - - DES() : round_key(32) {} private: void key_schedule(const byte[], size_t); @@ -41,7 +39,7 @@ class BOTAN_DLL TripleDES : public Block_Cipher_Fixed_Params<8, 16, 24, 8> void encrypt_n(const byte in[], byte out[], size_t blocks) const; void decrypt_n(const byte in[], byte out[], size_t blocks) const; - void clear() { zeroise(round_key); } + void clear() { round_key.clear(); } std::string name() const { return "TripleDES"; } BlockCipher* clone() const { return new TripleDES; } diff --git a/src/block/des/desx.h b/src/block/des/desx.h index 1fe8b000c..4ff41328f 100644 --- a/src/block/des/desx.h +++ b/src/block/des/desx.h @@ -21,11 +21,9 @@ class BOTAN_DLL DESX : public Block_Cipher_Fixed_Params<8, 24> void encrypt_n(const byte in[], byte out[], size_t blocks) const; void decrypt_n(const byte in[], byte out[], size_t blocks) const; - void clear() { des.clear(); zeroise(K1); zeroise(K2); } + void clear() { des.clear(); K1.clear(); K2.clear(); } std::string name() const { return "DESX"; } BlockCipher* clone() const { return new DESX; } - - DESX() : K1(8), K2(8) {} private: void key_schedule(const byte[], size_t); secure_vector<byte> K1, K2; |