diff options
author | lloyd <[email protected]> | 2008-10-08 15:16:16 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-10-08 15:16:16 +0000 |
commit | 123f1dc39d54eaa144a746293921396e257903c6 (patch) | |
tree | fc0af1cd4cdd0d5fa6ff1fbd0e9cb0ff479362fc /src/kdf/sslv3 | |
parent | d40700c4b96c2f503991cbb36d72426d4b67a490 (diff) |
Append _prf to sslv3, tlsv1, x932 module names
Diffstat (limited to 'src/kdf/sslv3')
-rw-r--r-- | src/kdf/sslv3/info.txt | 10 | ||||
-rw-r--r-- | src/kdf/sslv3/prf_ssl3.cpp | 71 | ||||
-rw-r--r-- | src/kdf/sslv3/prf_ssl3.h | 25 |
3 files changed, 0 insertions, 106 deletions
diff --git a/src/kdf/sslv3/info.txt b/src/kdf/sslv3/info.txt deleted file mode 100644 index c41b59b12..000000000 --- a/src/kdf/sslv3/info.txt +++ /dev/null @@ -1,10 +0,0 @@ -realname "SSLv3 PRF" - -define SSL_V3_PRF - -load_on auto - -<add> -prf_ssl3.h -prf_ssl3.cpp -</add> diff --git a/src/kdf/sslv3/prf_ssl3.cpp b/src/kdf/sslv3/prf_ssl3.cpp deleted file mode 100644 index b241bf60f..000000000 --- a/src/kdf/sslv3/prf_ssl3.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************* -* SSLv3 PRF Source File * -* (C) 2004-2006 Jack Lloyd * -*************************************************/ - -#include <botan/prf_ssl3.h> -#include <botan/lookup.h> -#include <memory> - -namespace Botan { - -namespace { - -/************************************************* -* Return the next inner hash * -*************************************************/ -OctetString next_hash(u32bit where, u32bit want, - HashFunction* md5, HashFunction* sha1, - const byte secret[], u32bit secret_len, - const byte seed[], u32bit seed_len) - { - if(want > md5->OUTPUT_LENGTH) - throw Internal_Error("SSL3_PRF:next_hash: want is too big"); - - const byte ASCII_A_CHAR = 0x41; - - for(u32bit j = 0; j != where + 1; j++) - sha1->update(ASCII_A_CHAR + where); - sha1->update(secret, secret_len); - sha1->update(seed, seed_len); - SecureVector<byte> sha1_hash = sha1->final(); - - md5->update(secret, secret_len); - md5->update(sha1_hash); - SecureVector<byte> md5_hash = md5->final(); - - return OctetString(md5_hash, want); - } - -} - -/************************************************* -* SSL3 PRF * -*************************************************/ -SecureVector<byte> SSL3_PRF::derive(u32bit key_len, - const byte secret[], u32bit secret_len, - const byte seed[], u32bit seed_len) const - { - if(key_len > 416) - throw Internal_Error("SSL3_PRF: Requested key length is too large"); - - std::auto_ptr<HashFunction> md5(get_hash("MD5")); - std::auto_ptr<HashFunction> sha1(get_hash("SHA-1")); - - OctetString output; - - int counter = 0; - while(key_len) - { - const u32bit produce = std::min(key_len, md5->OUTPUT_LENGTH); - - output = output + next_hash(counter++, produce, md5.get(), sha1.get(), - secret, secret_len, seed, seed_len); - - key_len -= produce; - } - - return output.bits_of(); - } - -} diff --git a/src/kdf/sslv3/prf_ssl3.h b/src/kdf/sslv3/prf_ssl3.h deleted file mode 100644 index b8f498832..000000000 --- a/src/kdf/sslv3/prf_ssl3.h +++ /dev/null @@ -1,25 +0,0 @@ -/************************************************* -* SSLv3 PRF Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_SSLV3_PRF_H__ -#define BOTAN_SSLV3_PRF_H__ - -#include <botan/kdf.h> - -namespace Botan { - -/************************************************* -* SSL3 PRF * -*************************************************/ -class BOTAN_DLL SSL3_PRF : public KDF - { - public: - SecureVector<byte> derive(u32bit, const byte[], u32bit, - const byte[], u32bit) const; - }; - -} - -#endif |