aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/stream/rc4
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2015-12-19 16:34:42 -0500
committerJack Lloyd <[email protected]>2015-12-19 16:34:42 -0500
commita8b20fc90c6f2dc1df9f8533964c72cf29c947e0 (patch)
treefefe3754796f238bac73d1ce27cbb5056bfe455e /src/lib/stream/rc4
parent0fae1884079518e4f6d1c049cc7f341cd96c8a65 (diff)
Merge the openssl code together.
Having the code diffused all over the place was ugly and would not scale well to multiple alternative providers. GH #368
Diffstat (limited to 'src/lib/stream/rc4')
-rw-r--r--src/lib/stream/rc4/openssl_rc4.cpp73
1 files changed, 0 insertions, 73 deletions
diff --git a/src/lib/stream/rc4/openssl_rc4.cpp b/src/lib/stream/rc4/openssl_rc4.cpp
deleted file mode 100644
index 84d739c91..000000000
--- a/src/lib/stream/rc4/openssl_rc4.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-* OpenSSL RC4
-* (C) 1999-2007,2015 Jack Lloyd
-*
-* Botan is released under the Simplified BSD License (see license.txt)
-*/
-
-#include <botan/stream_cipher.h>
-
-#if defined(BOTAN_HAS_OPENSSL)
-
-#include <botan/internal/algo_registry.h>
-#include <botan/internal/openssl.h>
-#include <botan/parsing.h>
-#include <openssl/rc4.h>
-
-namespace Botan {
-
-namespace {
-
-class OpenSSL_RC4 : public StreamCipher
- {
- public:
- void clear() { clear_mem(&m_rc4, 1); }
-
- std::string name() const
- {
- switch(m_skip)
- {
- case 0:
- return "RC4";
- case 256:
- return "MARK-4";
- default:
- return "RC4_skip(" + std::to_string(m_skip) + ")";
- }
- }
-
- StreamCipher* clone() const { return new OpenSSL_RC4; }
-
- Key_Length_Specification key_spec() const
- {
- return Key_Length_Specification(1, 32);
- }
-
- OpenSSL_RC4(size_t skip = 0) : m_skip(skip) { clear(); }
- ~OpenSSL_RC4() { clear(); }
- private:
- void cipher(const byte in[], byte out[], size_t length)
- {
- ::RC4(&m_rc4, length, in, out);
- }
-
- void key_schedule(const byte key[], size_t length)
- {
- ::RC4_set_key(&m_rc4, length, key);
- byte d = 0;
- for(size_t i = 0; i != m_skip; ++i)
- ::RC4(&m_rc4, 1, &d, &d);
- }
-
- size_t m_skip;
- RC4_KEY m_rc4;
- };
-
-}
-
-BOTAN_REGISTER_TYPE(StreamCipher, OpenSSL_RC4, "RC4", (make_new_T_1len<OpenSSL_RC4,0>),
- "openssl", BOTAN_OPENSSL_RC4_PRIO);
-
-}
-
-#endif