diff options
author | lloyd <[email protected]> | 2015-02-18 04:21:21 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2015-02-18 04:21:21 +0000 |
commit | 88285f51ba4fd5bc1a1cc06b0760b3926046f29b (patch) | |
tree | 7443b2b266b8445433b9c63704b7a09e216282f2 /src/lib/kdf/prf_tls/prf_tls.h | |
parent | aced9e88d970546c6324e768ce11b0a483bd3bd0 (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.h | 24 |
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: |