Coverage Report

Created: 2020-05-23 13:54

/src/botan/build/include/botan/cbc_mac.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
* CBC-MAC
3
* (C) 1999-2007 Jack Lloyd
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
*/
7
8
#ifndef BOTAN_CBC_MAC_H_
9
#define BOTAN_CBC_MAC_H_
10
11
#include <botan/mac.h>
12
#include <botan/block_cipher.h>
13
14
BOTAN_FUTURE_INTERNAL_HEADER(cbc_mac.h)
15
16
namespace Botan {
17
18
/**
19
* CBC-MAC
20
*/
21
class BOTAN_PUBLIC_API(2,0) CBC_MAC final : public MessageAuthenticationCode
22
   {
23
   public:
24
      std::string name() const override;
25
      MessageAuthenticationCode* clone() const override;
26
0
      size_t output_length() const override { return m_cipher->block_size(); }
27
      void clear() override;
28
29
      Key_Length_Specification key_spec() const override
30
0
         {
31
0
         return m_cipher->key_spec();
32
0
         }
33
34
      /**
35
      * @param cipher the block cipher to use
36
      */
37
      explicit CBC_MAC(BlockCipher* cipher);
38
   private:
39
      void add_data(const uint8_t[], size_t) override;
40
      void final_result(uint8_t[]) override;
41
      void key_schedule(const uint8_t[], size_t) override;
42
43
      std::unique_ptr<BlockCipher> m_cipher;
44
      secure_vector<uint8_t> m_state;
45
      size_t m_position = 0;
46
   };
47
48
}
49
50
#endif