diff options
author | lloyd <[email protected]> | 2015-03-05 04:28:24 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2015-03-05 04:28:24 +0000 |
commit | 0c28ab5f95b444649fdaa417dd680ab28a6e7c85 (patch) | |
tree | f3da82aed7603f46feaa5444c2704b8515a39912 /src/lib/vendor | |
parent | 2591a2cd863696b91128ff4a8461bb96d497e7b4 (diff) |
In Algo_Registry if a maker func fails, try the next most preferred one
instead of bailing out immediately.
Rename the 'builtin' provider to 'base' since really they are all built in.
Fix MARK-4 when OpenSSL was enabled - it did not respect the skip param.
Diffstat (limited to 'src/lib/vendor')
-rw-r--r-- | src/lib/vendor/openssl/openssl_rc4.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/vendor/openssl/openssl_rc4.cpp b/src/lib/vendor/openssl/openssl_rc4.cpp index 9a11ca949..494b30974 100644 --- a/src/lib/vendor/openssl/openssl_rc4.cpp +++ b/src/lib/vendor/openssl/openssl_rc4.cpp @@ -26,7 +26,7 @@ class OpenSSL_RC4 : public StreamCipher return Key_Length_Specification(1, 32); } - OpenSSL_RC4() { clear(); } + OpenSSL_RC4(size_t skip = 0) : m_skip(skip) { clear(); } ~OpenSSL_RC4() { clear(); } private: void cipher(const byte in[], byte out[], size_t length) @@ -37,13 +37,17 @@ class OpenSSL_RC4 : public StreamCipher 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<OpenSSL_RC4>, "openssl", 64); +BOTAN_REGISTER_TYPE(StreamCipher, OpenSSL_RC4, "RC4", (make_new_T_1len<OpenSSL_RC4,0>), "openssl", 64); } |