Coverage Report

Created: 2023-01-25 06:35

/src/botan/build/include/botan/internal/prf_tls.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
* TLSv1.2 PRF
3
* (C) 2004-2010 Jack Lloyd
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
*/
7
8
#ifndef BOTAN_TLS_V12_PRF_H_
9
#define BOTAN_TLS_V12_PRF_H_
10
11
#include <botan/kdf.h>
12
#include <botan/mac.h>
13
14
namespace Botan {
15
16
/**
17
* PRF used in TLS 1.2
18
*/
19
class TLS_12_PRF final : public KDF
20
   {
21
   public:
22
0
      std::string name() const override { return "TLS-12-PRF(" + m_mac->name() + ")"; }
23
24
0
      std::unique_ptr<KDF> new_object() const override { return std::make_unique<TLS_12_PRF>(m_mac->new_object()); }
25
26
      void kdf(uint8_t key[], size_t key_len,
27
               const uint8_t secret[], size_t secret_len,
28
               const uint8_t salt[], size_t salt_len,
29
               const uint8_t label[], size_t label_len) const override;
30
31
      /**
32
      * @param mac MAC algorithm to use
33
      */
34
14.9k
      explicit TLS_12_PRF(std::unique_ptr<MessageAuthenticationCode> mac) : m_mac(std::move(mac)) {}
35
   private:
36
      std::unique_ptr<MessageAuthenticationCode> m_mac;
37
   };
38
39
}
40
41
#endif