~ubuntu-branches/debian/sid/botan/sid

« back to all changes in this revision

Viewing changes to src/lib/kdf/sp800_56c/sp800_56c.cpp

  • Committer: Package Import Robot
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2018-03-01 22:23:25 UTC
  • mfrom: (1.2.2)
  • Revision ID: package-import@ubuntu.com-20180301222325-7p7vc45gu3hta34d
Tags: 2.4.0-2
* Don't remove .doctrees from the manual if it doesn't exist.
* Don't specify parallel to debhelper.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
      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
}