Botan  2.7.0
Crypto and TLS for C++11
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_56c.h>
9 
10 namespace Botan {
11 
12 size_t SP800_56C::kdf(uint8_t key[], size_t key_len,
13  const uint8_t secret[], size_t secret_len,
14  const uint8_t salt[], size_t salt_len,
15  const uint8_t label[], size_t label_len) const
16  {
17  // Randomness Extraction
19 
20  m_prf->set_key(salt, salt_len);
21  m_prf->update(secret, secret_len);
22  m_prf->final(k_dk);
23 
24  // Key Expansion
25  m_exp->kdf(key, key_len, k_dk.data(), k_dk.size(), nullptr, 0, label, label_len);
26 
27  return key_len;
28  }
29 
30 }
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:12
size_t salt_len
Definition: x509_obj.cpp:26
Definition: alg_id.cpp:13
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:88