diff options
Diffstat (limited to 'src/stream')
-rw-r--r-- | src/stream/arc4/arc4.cpp | 3 | ||||
-rw-r--r-- | src/stream/arc4/arc4.h | 4 | ||||
-rw-r--r-- | src/stream/salsa20/salsa20.h | 6 | ||||
-rw-r--r-- | src/stream/turing/turing.h | 13 | ||||
-rw-r--r-- | src/stream/wid_wake/wid_wake.h | 15 |
5 files changed, 26 insertions, 15 deletions
diff --git a/src/stream/arc4/arc4.cpp b/src/stream/arc4/arc4.cpp index 90f0f0904..97364bd1a 100644 --- a/src/stream/arc4/arc4.cpp +++ b/src/stream/arc4/arc4.cpp @@ -97,7 +97,8 @@ void ARC4::clear() /* * ARC4 Constructor */ -ARC4::ARC4(u32bit s) : StreamCipher(1, 256), SKIP(s) +ARC4::ARC4(u32bit s) : StreamCipher(1, 256), SKIP(s), + state(256), buffer(DEFAULT_BUFFERSIZE) { clear(); } diff --git a/src/stream/arc4/arc4.h b/src/stream/arc4/arc4.h index 0488783ef..1b8684e75 100644 --- a/src/stream/arc4/arc4.h +++ b/src/stream/arc4/arc4.h @@ -38,8 +38,8 @@ class BOTAN_DLL ARC4 : public StreamCipher const u32bit SKIP; - SecureVector<byte, DEFAULT_BUFFERSIZE> buffer; - SecureVector<u32bit, 256> state; + SecureVector<u32bit> state; + SecureVector<byte> buffer; u32bit X, Y, position; }; diff --git a/src/stream/salsa20/salsa20.h b/src/stream/salsa20/salsa20.h index 4ba483082..7e6c523cd 100644 --- a/src/stream/salsa20/salsa20.h +++ b/src/stream/salsa20/salsa20.h @@ -29,13 +29,13 @@ class BOTAN_DLL Salsa20 : public StreamCipher std::string name() const; StreamCipher* clone() const { return new Salsa20; } - Salsa20() : StreamCipher(16, 32, 16) { position = 0; } + Salsa20() : StreamCipher(16, 32, 16), state(16), buffer(64) { position = 0; } ~Salsa20() { clear(); } private: void key_schedule(const byte key[], u32bit key_len); - SecureVector<u32bit, 16> state; - SecureVector<byte, 64> buffer; + SecureVector<u32bit> state; + SecureVector<byte> buffer; u32bit position; }; diff --git a/src/stream/turing/turing.h b/src/stream/turing/turing.h index 92c5083a4..c0b11fd7b 100644 --- a/src/stream/turing/turing.h +++ b/src/stream/turing/turing.h @@ -27,7 +27,12 @@ class BOTAN_DLL Turing : public StreamCipher void clear(); std::string name() const { return "Turing"; } StreamCipher* clone() const { return new Turing; } - Turing() : StreamCipher(4, 32, 4) { position = 0; } + + Turing() : StreamCipher(4, 32, 4), + S0(256), S1(256), S2(256), S3(256), + R(17), buffer(340) + { position = 0; } + private: void key_schedule(const byte[], u32bit); void generate(); @@ -37,10 +42,10 @@ class BOTAN_DLL Turing : public StreamCipher static const u32bit Q_BOX[256]; static const byte SBOX[256]; - SecureVector<u32bit, 256> S0, S1, S2, S3; - SecureVector<u32bit, 17> R; + SecureVector<u32bit> S0, S1, S2, S3; + SecureVector<u32bit> R; SecureVector<u32bit> K; - SecureVector<byte, 340> buffer; + SecureVector<byte> buffer; u32bit position; }; diff --git a/src/stream/wid_wake/wid_wake.h b/src/stream/wid_wake/wid_wake.h index 365a6d9ff..88f5690bf 100644 --- a/src/stream/wid_wake/wid_wake.h +++ b/src/stream/wid_wake/wid_wake.h @@ -30,16 +30,21 @@ class BOTAN_DLL WiderWake_41_BE : public StreamCipher void clear(); std::string name() const { return "WiderWake4+1-BE"; } StreamCipher* clone() const { return new WiderWake_41_BE; } - WiderWake_41_BE() : StreamCipher(16, 16, 1) {} + + WiderWake_41_BE() : StreamCipher(16, 16, 1), + T(256), state(5), t_key(4), + buffer(DEFAULT_BUFFERSIZE), position(0) + { } + private: void key_schedule(const byte[], u32bit); void generate(u32bit); - SecureVector<byte, DEFAULT_BUFFERSIZE> buffer; - SecureVector<u32bit, 256> T; - SecureVector<u32bit, 5> state; - SecureVector<u32bit, 4> t_key; + SecureVector<u32bit> T; + SecureVector<u32bit> state; + SecureVector<u32bit> t_key; + SecureVector<byte> buffer; u32bit position; }; |