diff options
Diffstat (limited to 'src/stream/arc4')
-rw-r--r-- | src/stream/arc4/arc4.cpp | 18 | ||||
-rw-r--r-- | src/stream/arc4/arc4.h | 4 |
2 files changed, 10 insertions, 12 deletions
diff --git a/src/stream/arc4/arc4.cpp b/src/stream/arc4/arc4.cpp index 6eea7bb45..13eb6ff9e 100644 --- a/src/stream/arc4/arc4.cpp +++ b/src/stream/arc4/arc4.cpp @@ -61,7 +61,10 @@ void ARC4::generate() */ void ARC4::key_schedule(const byte key[], size_t length) { - clear(); + state.resize(256); + buffer.resize(DEFAULT_BUFFERSIZE); + + position = X = Y = 0; for(size_t i = 0; i != 256; ++i) state[i] = static_cast<byte>(i); @@ -85,7 +88,7 @@ std::string ARC4::name() const { if(SKIP == 0) return "ARC4"; if(SKIP == 256) return "MARK-4"; - else return "RC4_skip(" + to_string(SKIP) + ")"; + else return "RC4_skip(" + std::to_string(SKIP) + ")"; } /* @@ -93,19 +96,14 @@ std::string ARC4::name() const */ void ARC4::clear() { - zeroise(state); - zeroise(buffer); + state.clear(); + buffer.clear(); position = X = Y = 0; } /* * ARC4 Constructor */ -ARC4::ARC4(size_t s) : SKIP(s), - state(256), - buffer(DEFAULT_BUFFERSIZE) - { - clear(); - } +ARC4::ARC4(size_t s) : SKIP(s) {} } diff --git a/src/stream/arc4/arc4.h b/src/stream/arc4/arc4.h index e3df97f83..8f8de87b6 100644 --- a/src/stream/arc4/arc4.h +++ b/src/stream/arc4/arc4.h @@ -44,9 +44,9 @@ class BOTAN_DLL ARC4 : public StreamCipher const size_t SKIP; byte X, Y; - SecureVector<byte> state; + secure_vector<byte> state; - SecureVector<byte> buffer; + secure_vector<byte> buffer; size_t position; }; |