Botan 2.19.2
Crypto and TLS for C&
cmac.h
Go to the documentation of this file.
1/*
2* CMAC
3* (C) 1999-2007,2014 Jack Lloyd
4*
5* Botan is released under the Simplified BSD License (see license.txt)
6*/
7
8#ifndef BOTAN_CMAC_H_
9#define BOTAN_CMAC_H_
10
11#include <botan/mac.h>
12#include <botan/block_cipher.h>
13
15
16namespace Botan {
17
18/**
19* CMAC, also known as OMAC1
20*/
22 {
23 public:
24 std::string name() const override;
25 size_t output_length() const override { return m_block_size; }
26 MessageAuthenticationCode* clone() const override;
27
28 void clear() override;
29
31 {
32 return m_cipher->key_spec();
33 }
34
35 /**
36 * CMAC's polynomial doubling operation
37 *
38 * This function was only exposed for use elsewhere in the library, but it is not
39 * longer used. This function will be removed in a future release.
40 *
41 * @param in the input
42 */
44 BOTAN_DEPRECATED("This was only for internal use and is no longer used")
45 poly_double(const secure_vector<uint8_t>& in);
46
47 /**
48 * @param cipher the block cipher to use
49 */
50 explicit CMAC(BlockCipher* cipher);
51
52 CMAC(const CMAC&) = delete;
53 CMAC& operator=(const CMAC&) = delete;
54 private:
55 void add_data(const uint8_t[], size_t) override;
56 void final_result(uint8_t[]) override;
57 void key_schedule(const uint8_t[], size_t) override;
58
59 std::unique_ptr<BlockCipher> m_cipher;
60 secure_vector<uint8_t> m_buffer, m_state, m_B, m_P;
61 const size_t m_block_size;
62 size_t m_position;
63 };
64
65}
66
67#endif
size_t output_length() const override
Definition: cmac.h:25
Key_Length_Specification key_spec() const override
Definition: cmac.h:30
virtual MessageAuthenticationCode * clone() const =0
virtual std::string name() const =0
virtual void clear()=0
int(* final)(unsigned char *, CTX *)
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:31
#define BOTAN_FUTURE_INTERNAL_HEADER(hdr)
Definition: compiler.h:136
Definition: alg_id.cpp:13
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:65
Definition: bigint.h:1143