aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/kdf/hkdf/hkdf.h
blob: c5737b1ccbb4e98d07c13eb29725164856e339df (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
/*
* 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
*/
class BOTAN_DLL HKDF : public KDF
   {
   public:
      HKDF(MessageAuthenticationCode* prf) : m_prf(prf) {}

      static HKDF* make(const Spec& spec);

      KDF* clone() const { return new HKDF(m_prf->clone()); }

      std::string name() const { 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 override;

   private:
      std::unique_ptr<MessageAuthenticationCode> m_prf;
   };

}

#endif