diff options
Diffstat (limited to 'src/block/rc2')
-rw-r--r-- | src/block/rc2/rc2.cpp | 5 | ||||
-rw-r--r-- | src/block/rc2/rc2.h | 6 |
2 files changed, 5 insertions, 6 deletions
diff --git a/src/block/rc2/rc2.cpp b/src/block/rc2/rc2.cpp index 97ca5d577..548c2f095 100644 --- a/src/block/rc2/rc2.cpp +++ b/src/block/rc2/rc2.cpp @@ -124,8 +124,8 @@ void RC2::key_schedule(const byte key[], size_t length) 0xC5, 0xF3, 0xDB, 0x47, 0xE5, 0xA5, 0x9C, 0x77, 0x0A, 0xA6, 0x20, 0x68, 0xFE, 0x7F, 0xC1, 0xAD }; - SecureVector<byte> L(128); - L.copy(key, length); + secure_vector<byte> L(128); + copy_mem(&L[0], key, length); for(size_t i = length; i != 128; ++i) L[i] = TABLE[(L[i-1] + L[i-length]) % 256]; @@ -135,6 +135,7 @@ void RC2::key_schedule(const byte key[], size_t length) for(s32bit i = 127-length; i >= 0; --i) L[i] = TABLE[L[i+1] ^ L[i+length]]; + K.resize(64); load_le<u16bit>(&K[0], &L[0], 64); } diff --git a/src/block/rc2/rc2.h b/src/block/rc2/rc2.h index 1ebad1e73..223c48792 100644 --- a/src/block/rc2/rc2.h +++ b/src/block/rc2/rc2.h @@ -28,15 +28,13 @@ class BOTAN_DLL RC2 : public Block_Cipher_Fixed_Params<8, 1, 32> */ static byte EKB_code(size_t bits); - void clear() { zeroise(K); } + void clear() { K.clear(); } std::string name() const { return "RC2"; } BlockCipher* clone() const { return new RC2; } - - RC2() : K(64) {} private: void key_schedule(const byte[], size_t); - SecureVector<u16bit> K; + secure_vector<u16bit> K; }; } |