MCUX CLNS MCUX Crypto Library Normal Secure |

mcuxClCss_Cmac.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------*/
2 /* Copyright 2020-2021 NXP */
3 /* */
4 /* NXP Confidential. This software is owned or controlled by NXP and may */
5 /* only be used strictly in accordance with the applicable license terms. */
6 /* By expressly accepting such terms or by downloading, installing, */
7 /* activating and/or otherwise using the software, you are agreeing that */
8 /* you have read, and that you agree to comply with and are bound by, such */
9 /* license terms. If you do not agree to be bound by the applicable license */
10 /* terms, then you may not retain, install, activate or otherwise use the */
11 /* software. */
12 /*--------------------------------------------------------------------------*/
13
29 #ifndef MCUXCLCSS_CMAC_H_
30 #define MCUXCLCSS_CMAC_H_
31
32 #include <mcuxClCss_Common.h> // Common functionality
33
34 /**********************************************
35 * MACROS
36 **********************************************/
49 #define MCUXCLCSS_CMAC_KEY_SIZE_128 ((size_t) 16U)
50 #define MCUXCLCSS_CMAC_KEY_SIZE_256 ((size_t) 32U)
51
58 #define MCUXCLCSS_CMAC_EXTERNAL_KEY_ENABLE 1U
59 #define MCUXCLCSS_CMAC_EXTERNAL_KEY_DISABLE 0U
60 #define MCUXCLCSS_CMAC_INITIALIZE_DISABLE 0U
61 #define MCUXCLCSS_CMAC_INITIALIZE_ENABLE 1U
62 #define MCUXCLCSS_CMAC_FINALIZE_DISABLE 0U
63 #define MCUXCLCSS_CMAC_FINALIZE_ENABLE 1U
64 #define MCUXCLCSS_CMAC_STATE_IN_DISABLE 0U
65 #define MCUXCLCSS_CMAC_STATE_IN_ENABLE 1U
66 #define MCUXCLCSS_CMAC_STATE_OUT_DISABLE 0U
67 #define MCUXCLCSS_CMAC_STATE_OUT_ENABLE 1U
68
72 #define MCUXCLCSS_CMAC_OUT_SIZE ((size_t) 16U)
73
74
78 /**********************************************
79 * TYPEDEFS
80 **********************************************/
90 typedef union
91 {
92 struct
93 {
94 uint32_t value;
95 } word;
96 struct
97 {
98 uint32_t initialize : 1;
99 uint32_t finalize : 1;
100 uint32_t soe : 1;
101 uint32_t sie : 1;
102 uint32_t :9;
103 uint32_t extkey :1;
104 uint32_t :18;
105 } bits;
106 } mcuxClCss_CmacOption_t;
111 /**********************************************
112 * FUNCTIONS
113 **********************************************/
169 MCUX_CSSL_FP_FUNCTION_DECL(mcuxClCss_Cmac_Async)
170 MCUXCLCSS_API mcuxClCss_Status_Protected_t mcuxClCss_Cmac_Async(
171 mcuxClCss_CmacOption_t options,
172 mcuxClCss_KeyIndex_t keyIdx,
173 uint8_t const * pKey,
174 size_t keyLength,
175 uint8_t const * pInput,
176 size_t inputLength,
177 uint8_t * pMac
178 );
179
180 #endif /* MCUXCLCSS_CMAC_H_ */
181
MCUXCLCSS_API
#define MCUXCLCSS_API
Marks a function as a public API function of the mcuxClCss component.
Definition: mcuxClCss_Common.h:40
mcuxClCss_KeyIndex_t
uint8_t mcuxClCss_KeyIndex_t
Type for CSS keystore indices.
Definition: mcuxClCss_Types.h:193
mcuxClCss_CmacOption_t
Command option bit field for mcuxClCss_Cmac_Async.
Definition: mcuxClCss_Cmac.h:90
mcuxClCss_CmacOption_t::sie
uint32_t sie
This field is managed internally.
Definition: mcuxClCss_Cmac.h:101
mcuxClCss_CmacOption_t::finalize
uint32_t finalize
Request final processing for the last block of the message.
Definition: mcuxClCss_Cmac.h:99
mcuxClCss_CmacOption_t::extkey
uint32_t extkey
An external key should be used.
Definition: mcuxClCss_Cmac.h:103
mcuxClCss_Common.h
CSSv2 header for common functionality.
mcuxClCss_CmacOption_t::initialize
uint32_t initialize
Request initial processing for the first block of the message.
Definition: mcuxClCss_Cmac.h:98
mcuxClCss_Cmac_Async
MCUXCLCSS_API mcuxClCss_Status_Protected_t mcuxClCss_Cmac_Async(mcuxClCss_CmacOption_t options, mcuxClCss_KeyIndex_t keyIdx, uint8_t const *pKey, size_t keyLength, uint8_t const *pInput, size_t inputLength, uint8_t *pMac)
Performs CMAC with AES-128 or AES-256.
mcuxClCss_CmacOption_t::soe
uint32_t soe
This field is managed internally.
Definition: mcuxClCss_Cmac.h:100
MCUX_CSSL_FP_FUNCTION_DECL
#define MCUX_CSSL_FP_FUNCTION_DECL(id)
Declaration of a flow protected function.
Definition: mcuxCsslFlowProtection.h:119
mcuxClCss_CmacOption_t::value
uint32_t value
Accesses the bit field as a full word.
Definition: mcuxClCss_Cmac.h:94
mcuxClCss_Status_Protected_t
uint64_t mcuxClCss_Status_Protected_t
Type for CSS driver protected status codes.
Definition: mcuxClCss_Types.h:183