mac_algorithms.h
Go to the documentation of this file.
1 /**
2  * @file mac_algorithms.h
3  * @brief Collection of MAC algorithms
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2026 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneCRYPTO Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.6.6
29  **/
30 
31 #ifndef _MAC_ALGORITHMS_H
32 #define _MAC_ALGORITHMS_H
33 
34 //Dependencies
35 #include "core/crypto.h"
36 
37 //CMAC support?
38 #if (CMAC_SUPPORT == ENABLED)
39  #include "mac/cmac.h"
40 #endif
41 
42 //HMAC support?
43 #if (HMAC_SUPPORT == ENABLED)
44  #include "mac/hmac.h"
45 #endif
46 
47 //GMAC support?
48 #if (GMAC_SUPPORT == ENABLED)
49  #include "mac/gmac.h"
50 #endif
51 
52 //KMAC support?
53 #if (KMAC_SUPPORT == ENABLED)
54  #include "mac/kmac.h"
55 #endif
56 
57 //XCBC-MAC support?
58 #if (XCBC_MAC_SUPPORT == ENABLED)
59  #include "mac/xcbc_mac.h"
60 #endif
61 
62 //BLAKE2b support?
63 #if (BLAKE2B_SUPPORT == ENABLED)
64  #include "mac/blake2b.h"
65 #endif
66 
67 //BLAKE2s support?
68 #if (BLAKE2S_SUPPORT == ENABLED)
69  #include "mac/blake2s.h"
70 #endif
71 
72 //Poly1305 support?
73 #if (POLY1305_SUPPORT == ENABLED)
74  #include "mac/poly1305.h"
75 #endif
76 
77 //C++ guard
78 #ifdef __cplusplus
79 extern "C" {
80 #endif
81 
82 
83 /**
84  * @brief MAC algorithms
85  **/
86 
87 typedef enum
88 {
100 
101 
102 /**
103  * @brief Generic MAC algorithm context
104  **/
105 
106 typedef union
107 {
108 #if (CMAC_SUPPORT == ENABLED)
110 #endif
111 #if (HMAC_SUPPORT == ENABLED)
113 #endif
114 #if (GMAC_SUPPORT == ENABLED)
116 #endif
117 #if (KMAC_SUPPORT == ENABLED)
119 #endif
120 #if (XCBC_MAC_SUPPORT == ENABLED)
122 #endif
123 #if (BLAKE2B_SUPPORT == ENABLED)
125 #endif
126 #if (BLAKE2S_SUPPORT == ENABLED)
128 #endif
129 #if (POLY1305_SUPPORT == ENABLED)
131 #endif
132 } MacContext;
133 
134 
135 //C++ guard
136 #ifdef __cplusplus
137 }
138 #endif
139 
140 #endif
@ MAC_ALGO_CMAC
XCBC-MAC algorithm context.
Definition: xcbc_mac.h:54
HMAC algorithm context.
Definition: hmac.h:59
Poly1305 context.
Definition: poly1305.h:48
BLAKE2 cryptographic hash and MAC (BLAKE2s variant)
HmacContext hmacContext
GmacContext gmacContext
@ MAC_ALGO_BLAKE2S
XCBC-MAC message authentication code.
Poly1305 message-authentication code.
@ MAC_ALGO_NONE
General definitions for cryptographic algorithms.
@ MAC_ALGO_GMAC
@ MAC_ALGO_KMAC128
BLAKE2s algorithm context.
Definition: blake2s.h:51
KMAC (Keccak Message Authentication Code)
@ MAC_ALGO_KMAC256
BLAKE2b algorithm context.
Definition: blake2b.h:51
CMAC algorithm context.
Definition: cmac.h:54
Poly1305Context poly1305Context
XcbcMacContext xcbcMacContext
BLAKE2 cryptographic hash and MAC (BLAKE2b variant)
@ MAC_ALGO_BLAKE2B
KmacContext kmacContext
Blake2sContext blake2sContext
GMAC (Galois Message Authentication Code)
@ MAC_ALGO_HMAC
GMAC algorithm context.
Definition: gmac.h:70
Blake2bContext blake2bContext
CMAC (Cipher-based Message Authentication Code)
MacAlgo
MAC algorithms.
KMAC algorithm context.
Definition: kmac.h:54
CmacContext cmacContext
Generic MAC algorithm context.
HMAC (Keyed-Hashing for Message Authentication)
@ MAC_ALGO_POLY1305
@ MAC_ALGO_XCBC_MAC