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