diff options
author | René Korthaus <[email protected]> | 2016-07-19 15:28:09 +0200 |
---|---|---|
committer | René Korthaus <[email protected]> | 2016-07-20 09:04:05 +0200 |
commit | adfc3e082d176f2f5141374f507a13d575898cff (patch) | |
tree | e13bc9adb3989bf907359be93916a7d15accf5af /src/lib/stream/rc4 | |
parent | 308c7d5eda678566edd26e9ab20edbe772f46363 (diff) |
Make Stream_Cipher::set_iv() pure virtual
It provided a default implementation that only checked
that the length was correct, but ignored the actual data
and did not notify the caller, which seemed like a
rather odd behaviour.
The only implementation that used this default implementation,
RC4, now throws an exception.
Diffstat (limited to 'src/lib/stream/rc4')
-rw-r--r-- | src/lib/stream/rc4/rc4.cpp | 6 | ||||
-rw-r--r-- | src/lib/stream/rc4/rc4.h | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/stream/rc4/rc4.cpp b/src/lib/stream/rc4/rc4.cpp index a4dea9e2b..e5ea2e2b8 100644 --- a/src/lib/stream/rc4/rc4.cpp +++ b/src/lib/stream/rc4/rc4.cpp @@ -6,6 +6,7 @@ */ #include <botan/rc4.h> +#include <botan/exceptn.h> namespace Botan { @@ -35,6 +36,11 @@ void RC4::cipher(const byte in[], byte out[], size_t length) m_position += length; } +void RC4::set_iv(const byte*, size_t) + { + throw Exception("RC4 does not support an IV"); + } + /* * Generate cipher stream */ diff --git a/src/lib/stream/rc4/rc4.h b/src/lib/stream/rc4/rc4.h index 88798fae6..82dd6097b 100644 --- a/src/lib/stream/rc4/rc4.h +++ b/src/lib/stream/rc4/rc4.h @@ -21,6 +21,8 @@ class BOTAN_DLL RC4 final : public StreamCipher public: void cipher(const byte in[], byte out[], size_t length) override; + void set_iv(const byte iv[], size_t iv_len) override; + void clear() override; std::string name() const override; |