Coverage Report

Created: 2020-10-17 06:46

/src/botan/build/include/botan/kdf2.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
* KDF2
3
* (C) 1999-2007 Jack Lloyd
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
*/
7
8
#ifndef BOTAN_KDF2_H_
9
#define BOTAN_KDF2_H_
10
11
#include <botan/kdf.h>
12
#include <botan/hash.h>
13
14
BOTAN_FUTURE_INTERNAL_HEADER(kdf2.h)
15
16
namespace Botan {
17
18
/**
19
* KDF2, from IEEE 1363
20
*/
21
class BOTAN_PUBLIC_API(2,0) KDF2 final : public KDF
22
   {
23
   public:
24
0
      std::string name() const override { return "KDF2(" + m_hash->name() + ")"; }
25
26
0
      KDF* clone() const override { return new KDF2(m_hash->clone()); }
27
28
      size_t kdf(uint8_t key[], size_t key_len,
29
                 const uint8_t secret[], size_t secret_len,
30
                 const uint8_t salt[], size_t salt_len,
31
                 const uint8_t label[], size_t label_len) const override;
32
33
      /**
34
      * @param h hash function to use
35
      */
36
0
      explicit KDF2(HashFunction* h) : m_hash(h) {}
37
   private:
38
      std::unique_ptr<HashFunction> m_hash;
39
   };
40
41
}
42
43
#endif