diff options
Diffstat (limited to 'src/lib/mac')
-rw-r--r-- | src/lib/mac/ssl3mac/info.txt | 5 | ||||
-rw-r--r-- | src/lib/mac/ssl3mac/ssl3_mac.cpp | 90 | ||||
-rw-r--r-- | src/lib/mac/ssl3mac/ssl3_mac.h | 48 |
3 files changed, 0 insertions, 143 deletions
diff --git a/src/lib/mac/ssl3mac/info.txt b/src/lib/mac/ssl3mac/info.txt deleted file mode 100644 index 5e69b0ae8..000000000 --- a/src/lib/mac/ssl3mac/info.txt +++ /dev/null @@ -1,5 +0,0 @@ -define SSL3_MAC 20131128 - -<requires> -hash -</requires> diff --git a/src/lib/mac/ssl3mac/ssl3_mac.cpp b/src/lib/mac/ssl3mac/ssl3_mac.cpp deleted file mode 100644 index 5ab5ff727..000000000 --- a/src/lib/mac/ssl3mac/ssl3_mac.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* -* SSL3-MAC -* (C) 1999-2004 Jack Lloyd -* -* Botan is released under the Simplified BSD License (see license.txt) -*/ - -#include <botan/ssl3_mac.h> - -namespace Botan { - -/* -* Update a SSL3-MAC Calculation -*/ -void SSL3_MAC::add_data(const byte input[], size_t length) - { - m_hash->update(input, length); - } - -/* -* Finalize a SSL3-MAC Calculation -*/ -void SSL3_MAC::final_result(byte mac[]) - { - m_hash->final(mac); - m_hash->update(m_okey); - m_hash->update(mac, output_length()); - m_hash->final(mac); - m_hash->update(m_ikey); - } - -/* -* SSL3-MAC Key Schedule -*/ -void SSL3_MAC::key_schedule(const byte key[], size_t length) - { - m_hash->clear(); - - // Quirk to deal with specification bug - const size_t inner_hash_length = - (m_hash->name() == "SHA-160") ? 60 : m_hash->hash_block_size(); - - m_ikey.resize(inner_hash_length); - m_okey.resize(inner_hash_length); - - std::fill(m_ikey.begin(), m_ikey.end(), 0x36); - std::fill(m_okey.begin(), m_okey.end(), 0x5C); - - copy_mem(&m_ikey[0], key, length); - copy_mem(&m_okey[0], key, length); - - m_hash->update(m_ikey); - } - -/* -* Clear memory of sensitive data -*/ -void SSL3_MAC::clear() - { - m_hash->clear(); - zap(m_ikey); - zap(m_okey); - } - -/* -* Return the name of this type -*/ -std::string SSL3_MAC::name() const - { - return "SSL3-MAC(" + m_hash->name() + ")"; - } - -/* -* Return a clone of this object -*/ -MessageAuthenticationCode* SSL3_MAC::clone() const - { - return new SSL3_MAC(m_hash->clone()); - } - -/* -* SSL3-MAC Constructor -*/ -SSL3_MAC::SSL3_MAC(HashFunction* hash) : m_hash(hash) - { - if(m_hash->hash_block_size() == 0) - throw Invalid_Argument("SSL3-MAC cannot be used with " + m_hash->name()); - } - -} diff --git a/src/lib/mac/ssl3mac/ssl3_mac.h b/src/lib/mac/ssl3mac/ssl3_mac.h deleted file mode 100644 index 290fffd01..000000000 --- a/src/lib/mac/ssl3mac/ssl3_mac.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -* SSL3-MAC -* (C) 1999-2004 Jack Lloyd -* -* Botan is released under the Simplified BSD License (see license.txt) -*/ - -#ifndef BOTAN_SSL3_MAC_H__ -#define BOTAN_SSL3_MAC_H__ - -#include <botan/hash.h> -#include <botan/mac.h> - -namespace Botan { - -/** -* A MAC only used in SSLv3. Do not use elsewhere! Use HMAC instead. -*/ -class BOTAN_DLL SSL3_MAC : public MessageAuthenticationCode - { - public: - std::string name() const; - size_t output_length() const { return m_hash->output_length(); } - MessageAuthenticationCode* clone() const; - - void clear(); - - Key_Length_Specification key_spec() const - { - return Key_Length_Specification(m_hash->output_length()); - } - - /** - * @param hash the underlying hash to use - */ - SSL3_MAC(HashFunction* hash); - private: - void add_data(const byte[], size_t); - void final_result(byte[]); - void key_schedule(const byte[], size_t); - - std::unique_ptr<HashFunction> m_hash; - secure_vector<byte> m_ikey, m_okey; - }; - -} - -#endif |