aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/kdf/prf_tls/prf_tls.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2015-02-18 04:21:21 +0000
committerlloyd <[email protected]>2015-02-18 04:21:21 +0000
commit88285f51ba4fd5bc1a1cc06b0760b3926046f29b (patch)
tree7443b2b266b8445433b9c63704b7a09e216282f2 /src/lib/kdf/prf_tls/prf_tls.h
parentaced9e88d970546c6324e768ce11b0a483bd3bd0 (diff)
Modify interfaces of KDF and PBKDF to write output to an array, with
higher level functions on interface handling returning a vector.
Diffstat (limited to 'src/lib/kdf/prf_tls/prf_tls.h')
-rw-r--r--src/lib/kdf/prf_tls/prf_tls.h24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/lib/kdf/prf_tls/prf_tls.h b/src/lib/kdf/prf_tls/prf_tls.h
index c3adc6caf..e2289a6e8 100644
--- a/src/lib/kdf/prf_tls/prf_tls.h
+++ b/src/lib/kdf/prf_tls/prf_tls.h
@@ -19,17 +19,18 @@ namespace Botan {
class BOTAN_DLL TLS_PRF : public KDF
{
public:
- secure_vector<byte> derive(size_t key_len,
- 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; }
+ size_t kdf(byte key[], size_t key_len,
+ const byte secret[], size_t secret_len,
+ const byte salt[], size_t salt_len) const override;
+
TLS_PRF();
private:
- std::unique_ptr<MessageAuthenticationCode> hmac_md5;
- std::unique_ptr<MessageAuthenticationCode> hmac_sha1;
+ std::unique_ptr<MessageAuthenticationCode> m_hmac_md5;
+ std::unique_ptr<MessageAuthenticationCode> m_hmac_sha1;
};
/**
@@ -38,14 +39,15 @@ class BOTAN_DLL TLS_PRF : public KDF
class BOTAN_DLL TLS_12_PRF : public KDF
{
public:
- secure_vector<byte> derive(size_t key_len,
- const byte secret[], size_t secret_len,
- const byte seed[], size_t seed_len) const;
-
std::string name() const { return "TLS-12-PRF(" + m_mac->name() + ")"; }
+
KDF* clone() const { return new TLS_12_PRF(m_mac->clone()); }
- TLS_12_PRF(MessageAuthenticationCode* mac);
+ size_t kdf(byte key[], size_t key_len,
+ const byte secret[], size_t secret_len,
+ const byte salt[], size_t salt_len) const override;
+
+ TLS_12_PRF(MessageAuthenticationCode* mac) : m_mac(mac) {}
static TLS_12_PRF* make(const Spec& spec);
private: