Botan 2.19.5 Crypto and TLS for C&

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
18 secure_vector<uint8_t> k_dk;
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 return m_exp->kdf(key, key_len, k_dk.data(), k_dk.size(), nullptr, 0, label, label_len);
26 }
27
28}
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:12
Botan
Definition: alg_id.cpp:13
Botan::secure_vector
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:65
salt_len
size_t salt_len
Definition: x509_obj.cpp:25