Coverage Report

Created: 2020-02-14 15:38

/src/botan/src/lib/kdf/kdf1/kdf1.cpp
Line
Count
Source (jump to first uncovered line)
1
/*
2
* KDF1
3
* (C) 1999-2007 Jack Lloyd
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
*/
7
8
#include <botan/kdf1.h>
9
10
namespace Botan {
11
12
size_t KDF1::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
0
   {
17
0
   m_hash->update(secret, secret_len);
18
0
   m_hash->update(label, label_len);
19
0
   m_hash->update(salt, salt_len);
20
0
21
0
   if(key_len < m_hash->output_length())
22
0
      {
23
0
      secure_vector<uint8_t> v = m_hash->final();
24
0
      copy_mem(key, v.data(), key_len);
25
0
      return key_len;
26
0
      }
27
0
28
0
   m_hash->final(key);
29
0
   return m_hash->output_length();
30
0
   }
31
32
}