blob: a66d68da431edde7307730079554adb944c7b8a4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
/*
* HKDF
* (C) 2013,2015 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
#ifndef BOTAN_HKDF_H__
#define BOTAN_HKDF_H__
#include <botan/mac.h>
#include <botan/hash.h>
#include <botan/kdf.h>
namespace Botan {
/**
* HKDF, see RFC 5869 for details.
* This is only the expansion portion of HKDF.
* An appropriate extraction function should be used before.
*/
class BOTAN_DLL HKDF final : public KDF
{
public:
/**
* @param prf underlying MAC algorithm
*/
explicit HKDF(MessageAuthenticationCode* prf) : m_prf(prf) {}
static HKDF* make(const Spec& spec);
KDF* clone() const override { return new HKDF(m_prf->clone()); }
std::string name() const override { return "HKDF(" + m_prf->name() + ")"; }
size_t kdf(byte out[], size_t out_len,
const byte secret[], size_t secret_len,
const byte salt[], size_t salt_len,
const byte label[], size_t label_len) const override;
private:
std::unique_ptr<MessageAuthenticationCode> m_prf;
};
}
#endif
|