Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

sp800_56c.cpp
Go to the documentation of this file.
1 /*
2 * KDF defined in NIST SP 800-56c
3 * (C) 2016 Kai Michaelis
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7
8 #include <botan/sp800_108.h>
9 #include <botan/sp800_56c.h>
10 #include <botan/hmac.h>
11
12 namespace Botan {
13
14 size_t SP800_56C::kdf(uint8_t key[], size_t key_len,
15 const uint8_t secret[], size_t secret_len,
16 const uint8_t salt[], size_t salt_len,
17 const uint8_t label[], size_t label_len) const
18 {
19 // Randomness Extraction
20 secure_vector< uint8_t > k_dk;
21
22 m_prf->set_key(salt, salt_len);
23 m_prf->update(secret, secret_len);
24 m_prf->final(k_dk);
25
26 // Key Expansion
27 m_exp->kdf(key, key_len, k_dk.data(), k_dk.size(), nullptr, 0, label, label_len);
28
29 return key_len;
30 }
31
32 }
Botan::secure_vector
std::vector< T, secure_allocator< T >> secure_vector
Definition: secmem.h:121
Botan::SP800_56C::kdf
size_t kdf(uint8_t key[], size_t key_len, const uint8_t secret[], size_t secret_len, const uint8_t salt[], size_t salt_len, const uint8_t label[], size_t label_len) const override
Definition: sp800_56c.cpp:14
Botan
Definition: alg_id.cpp:13