aboutsummaryrefslogtreecommitdiffstats
path: root/src/kdf/tls_prf
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-11-01 17:32:39 +0000
committerlloyd <[email protected]>2010-11-01 17:32:39 +0000
commit89f8b0625ddd3eb7d2010324ec0fc2f0aa719b36 (patch)
tree20b6b5936d62360de409e6ac6b83665eb4a9f373 /src/kdf/tls_prf
parent04cb06b11bbb64a6bf947abec8849d1bf02ec093 (diff)
Derive KDF from Algorithm
Diffstat (limited to 'src/kdf/tls_prf')
-rw-r--r--src/kdf/tls_prf/prf_tls.cpp3
-rw-r--r--src/kdf/tls_prf/prf_tls.h8
2 files changed, 8 insertions, 3 deletions
diff --git a/src/kdf/tls_prf/prf_tls.cpp b/src/kdf/tls_prf/prf_tls.cpp
index 872997c28..2b57cdd25 100644
--- a/src/kdf/tls_prf/prf_tls.cpp
+++ b/src/kdf/tls_prf/prf_tls.cpp
@@ -85,9 +85,8 @@ SecureVector<byte> TLS_PRF::derive(size_t key_len,
/*
* TLS v1.2 PRF Constructor and Destructor
*/
-TLS_12_PRF::TLS_12_PRF(HashFunction* hash)
+TLS_12_PRF::TLS_12_PRF(MessageAuthenticationCode* mac) : hmac(mac)
{
- hmac = new HMAC(hash);
}
TLS_12_PRF::~TLS_12_PRF()
diff --git a/src/kdf/tls_prf/prf_tls.h b/src/kdf/tls_prf/prf_tls.h
index ee1b29df6..5237f17c0 100644
--- a/src/kdf/tls_prf/prf_tls.h
+++ b/src/kdf/tls_prf/prf_tls.h
@@ -24,6 +24,9 @@ class BOTAN_DLL TLS_PRF : public KDF
const byte secret[], size_t secret_len,
const byte seed[], size_t seed_len) const;
+ std::string name() const { return "TLS-PRF"; }
+ KDF* clone() const { return new TLS_PRF; }
+
TLS_PRF();
~TLS_PRF();
private:
@@ -41,7 +44,10 @@ class BOTAN_DLL TLS_12_PRF : public KDF
const byte secret[], size_t secret_len,
const byte seed[], size_t seed_len) const;
- TLS_12_PRF(HashFunction* hash);
+ std::string name() const { return "TLSv12-PRF(" + hmac->name() + ")"; }
+ KDF* clone() const { return new TLS_12_PRF(hmac->clone()); }
+
+ TLS_12_PRF(MessageAuthenticationCode* hmac);
~TLS_12_PRF();
private:
MessageAuthenticationCode* hmac;