8 #include <botan/internal/openssl_engine.h>
9 #include <botan/parsing.h>
10 #include <openssl/rc4.h>
19 class ARC4_OpenSSL :
public StreamCipher
22 void clear() { std::memset(&
state, 0,
sizeof(
state)); }
23 std::string name()
const;
24 StreamCipher* clone()
const {
return new ARC4_OpenSSL(
SKIP); }
26 Key_Length_Specification key_spec()
const
28 return Key_Length_Specification(1, 32);
32 ARC4_OpenSSL(
size_t s = 0) :
SKIP(
s) { clear(); }
33 ~ARC4_OpenSSL() { clear(); }
35 void cipher(
const byte[],
byte[],
size_t);
36 void key_schedule(
const byte[],
size_t);
45 std::string ARC4_OpenSSL::name()
const
47 if(
SKIP == 0)
return "ARC4";
48 if(
SKIP == 256)
return "MARK-4";
55 void ARC4_OpenSSL::key_schedule(
const byte key[],
size_t length)
57 RC4_set_key(&
state, length, key);
59 for(
size_t i = 0; i !=
SKIP; ++i)
60 RC4(&
state, 1, &dummy, &dummy);
66 void ARC4_OpenSSL::cipher(
const byte in[],
byte out[],
size_t length)
68 RC4(&
state, length, in, out);
83 return new ARC4_OpenSSL(768);
StreamCipher * find_stream_cipher(const SCAN_Name &, Algorithm_Factory &) const
std::string algo_name() const
size_t arg_as_integer(size_t i, size_t def_value) const
std::string to_string(u64bit n, size_t min_len)