diff options
author | lloyd <[email protected]> | 2014-01-01 21:20:55 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2014-01-01 21:20:55 +0000 |
commit | 197dc467dec28a04c3b2f30da7cef122dfbb13e9 (patch) | |
tree | cdbd3ddaec051c72f0a757db461973d90c37b97a /src/tls/tls_handshake_hash.cpp | |
parent | 62faac373c07cfe10bc8c309e89ebdd30d8e5eaa (diff) |
Shuffle things around. Add NIST X.509 test to build.
Diffstat (limited to 'src/tls/tls_handshake_hash.cpp')
-rw-r--r-- | src/tls/tls_handshake_hash.cpp | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/src/tls/tls_handshake_hash.cpp b/src/tls/tls_handshake_hash.cpp deleted file mode 100644 index 4e7a0b9b7..000000000 --- a/src/tls/tls_handshake_hash.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* -* TLS Handshake Hash -* (C) 2004-2006,2011,2012 Jack Lloyd -* -* Released under the terms of the Botan license -*/ - -#include <botan/internal/tls_handshake_hash.h> -#include <botan/tls_exceptn.h> -#include <botan/libstate.h> -#include <botan/hash.h> -#include <memory> - -namespace Botan { - -namespace TLS { - -/** -* Return a TLS Handshake Hash -*/ -secure_vector<byte> Handshake_Hash::final(Protocol_Version version, - const std::string& mac_algo) const - { - Algorithm_Factory& af = global_state().algorithm_factory(); - - std::unique_ptr<HashFunction> hash; - - if(version.supports_ciphersuite_specific_prf()) - { - if(mac_algo == "MD5" || mac_algo == "SHA-1") - hash.reset(af.make_hash_function("SHA-256")); - else - hash.reset(af.make_hash_function(mac_algo)); - } - else - hash.reset(af.make_hash_function("Parallel(MD5,SHA-160)")); - - hash->update(data); - return hash->final(); - } - -/** -* Return a SSLv3 Handshake Hash -*/ -secure_vector<byte> Handshake_Hash::final_ssl3(const secure_vector<byte>& secret) const - { - const byte PAD_INNER = 0x36, PAD_OUTER = 0x5C; - - Algorithm_Factory& af = global_state().algorithm_factory(); - - std::unique_ptr<HashFunction> md5(af.make_hash_function("MD5")); - std::unique_ptr<HashFunction> sha1(af.make_hash_function("SHA-1")); - - md5->update(data); - sha1->update(data); - - md5->update(secret); - sha1->update(secret); - - for(size_t i = 0; i != 48; ++i) - md5->update(PAD_INNER); - for(size_t i = 0; i != 40; ++i) - sha1->update(PAD_INNER); - - secure_vector<byte> inner_md5 = md5->final(), inner_sha1 = sha1->final(); - - md5->update(secret); - sha1->update(secret); - - for(size_t i = 0; i != 48; ++i) - md5->update(PAD_OUTER); - for(size_t i = 0; i != 40; ++i) - sha1->update(PAD_OUTER); - - md5->update(inner_md5); - sha1->update(inner_sha1); - - secure_vector<byte> output; - output += md5->final(); - output += sha1->final(); - return output; - } - -} - -} |