MCUX CLNS MCUX Crypto Library Normal Secure |

mcuxClCss_Aead.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_AEAD_H_
30 #define MCUXCLCSS_AEAD_H_
31
32 #include <mcuxClCss_Common.h> // Common functionality
33
34 /**********************************************
35 * CONSTANTS
36 **********************************************/
49 #define MCUXCLCSS_AEAD_ENCRYPT ((uint32_t) 0U)
50 #define MCUXCLCSS_AEAD_DECRYPT ((uint32_t) 1U)
51
52 #define MCUXCLCSS_AEAD_STATE_IN_DISABLE ((uint32_t) 0U)
53 #define MCUXCLCSS_AEAD_STATE_IN_ENABLE ((uint32_t) 1U)
54
55 #define MCUXCLCSS_AEAD_LASTINIT_TRUE ((uint32_t) 1U)
56 #define MCUXCLCSS_AEAD_LASTINIT_FALSE ((uint32_t) 0U)
57
58 #define MCUXCLCSS_AEAD_EXTERN_KEY ((uint32_t) 1U)
59 #define MCUXCLCSS_AEAD_INTERN_KEY ((uint32_t) 0U)
60
61
65 #define MCUXCLCSS_AEAD_IV_BLOCK_SIZE 16U
66 #define MCUXCLCSS_AEAD_AAD_BLOCK_SIZE 16U
67 #define MCUXCLCSS_AEAD_CONTEXT_SIZE 80U
68
72 /**********************************************
73 * TYPEDEFS
74 **********************************************/
75
84 typedef union
85 {
86 struct
87 {
88 uint32_t value;
89 } word;
90 struct
91 {
92 uint32_t :1;
93 uint32_t dcrpt :1;
94 uint32_t acpmod :2;
95 uint32_t acpsoe :1;
96 uint32_t acpsie :1;
97 uint32_t msgendw :4;
98 uint32_t lastinit :1;
99 uint32_t :2;
100 uint32_t extkey :1;
101 uint32_t :18;
102 } bits;
103 } mcuxClCss_AeadOption_t;
108 /**********************************************
109 * FUNCTIONS
110 **********************************************/
164 MCUX_CSSL_FP_FUNCTION_DECL(mcuxClCss_Aead_Init_Async)
165 MCUXCLCSS_API mcuxClCss_Status_Protected_t mcuxClCss_Aead_Init_Async(
166 mcuxClCss_AeadOption_t options,
167 mcuxClCss_KeyIndex_t keyIdx,
168 uint8_t const * pKey,
169 size_t keyLength,
170 uint8_t const * pIV,
171 size_t ivLength,
172 uint8_t * pAeadCtx
173 );
174
224 MCUX_CSSL_FP_FUNCTION_DECL(mcuxClCss_Aead_PartialInit_Async)
225 MCUXCLCSS_API mcuxClCss_Status_Protected_t mcuxClCss_Aead_PartialInit_Async(
226 mcuxClCss_AeadOption_t options,
227 mcuxClCss_KeyIndex_t keyIdx,
228 uint8_t const * pKey,
229 size_t keyLength,
230 uint8_t const * pIV,
231 size_t ivLength,
232 uint8_t * pAeadCtx
233 );
234
286 MCUX_CSSL_FP_FUNCTION_DECL(mcuxClCss_Aead_UpdateAad_Async)
287 MCUXCLCSS_API mcuxClCss_Status_Protected_t mcuxClCss_Aead_UpdateAad_Async(
288 mcuxClCss_AeadOption_t options,
289 mcuxClCss_KeyIndex_t keyIdx,
290 uint8_t const * pKey,
291 size_t keyLength,
292 uint8_t const * pAad,
293 size_t aadLength,
294 uint8_t * pAeadCtx
295 );
296
350 MCUX_CSSL_FP_FUNCTION_DECL(mcuxClCss_Aead_UpdateData_Async)
351 MCUXCLCSS_API mcuxClCss_Status_Protected_t mcuxClCss_Aead_UpdateData_Async(
352 mcuxClCss_AeadOption_t options,
353 mcuxClCss_KeyIndex_t keyIdx,
354 uint8_t const * pKey,
355 size_t keyLength,
356 uint8_t const * pInput,
357 size_t inputLength,
358 uint8_t * pOutput,
359 uint8_t * pAeadCtx
360 );
361
416 MCUX_CSSL_FP_FUNCTION_DECL(mcuxClCss_Aead_Finalize_Async)
417 MCUXCLCSS_API mcuxClCss_Status_Protected_t mcuxClCss_Aead_Finalize_Async(
418 mcuxClCss_AeadOption_t options,
419 mcuxClCss_KeyIndex_t keyIdx,
420 uint8_t const * pKey,
421 size_t keyLength,
422 size_t aadLength,
423 size_t dataLength,
424 uint8_t * pTag,
425 uint8_t * pAeadCtx
426 );
427
428 #endif /* MCUXCLCSS_AEAD_H_ */
429
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_Common.h
CSSv2 header for common functionality.
mcuxClCss_Aead_PartialInit_Async
MCUXCLCSS_API mcuxClCss_Status_Protected_t mcuxClCss_Aead_PartialInit_Async(mcuxClCss_AeadOption_t options, mcuxClCss_KeyIndex_t keyIdx, uint8_t const *pKey, size_t keyLength, uint8_t const *pIV, size_t ivLength, uint8_t *pAeadCtx)
AES-GCM partial initialization.
mcuxClCss_Aead_UpdateAad_Async
MCUXCLCSS_API mcuxClCss_Status_Protected_t mcuxClCss_Aead_UpdateAad_Async(mcuxClCss_AeadOption_t options, mcuxClCss_KeyIndex_t keyIdx, uint8_t const *pKey, size_t keyLength, uint8_t const *pAad, size_t aadLength, uint8_t *pAeadCtx)
AES-GCM update of the Additional Authenticated Data (AAD)
mcuxClCss_AeadOption_t::extkey
uint32_t extkey
Defines whether an external key shall be used.
Definition: mcuxClCss_Aead.h:100
mcuxClCss_AeadOption_t::acpmod
uint32_t acpmod
This field is managed internally.
Definition: mcuxClCss_Aead.h:94
mcuxClCss_AeadOption_t::value
uint32_t value
Accesses the bit field as a full word.
Definition: mcuxClCss_Aead.h:88
mcuxClCss_AeadOption_t::dcrpt
uint32_t dcrpt
Defines if encryption or decryption shall be performed.
Definition: mcuxClCss_Aead.h:93
mcuxClCss_AeadOption_t::acpsie
uint32_t acpsie
This field is managed internally.
Definition: mcuxClCss_Aead.h:96
mcuxClCss_Aead_Init_Async
MCUXCLCSS_API mcuxClCss_Status_Protected_t mcuxClCss_Aead_Init_Async(mcuxClCss_AeadOption_t options, mcuxClCss_KeyIndex_t keyIdx, uint8_t const *pKey, size_t keyLength, uint8_t const *pIV, size_t ivLength, uint8_t *pAeadCtx)
AES-GCM initialization.
mcuxClCss_Aead_UpdateData_Async
MCUXCLCSS_API mcuxClCss_Status_Protected_t mcuxClCss_Aead_UpdateData_Async(mcuxClCss_AeadOption_t options, mcuxClCss_KeyIndex_t keyIdx, uint8_t const *pKey, size_t keyLength, uint8_t const *pInput, size_t inputLength, uint8_t *pOutput, uint8_t *pAeadCtx)
AES-GCM update of the encrypted data.
mcuxClCss_AeadOption_t
Command option bit field for mcuxClCss_Aead_Init_Async, mcuxClCss_Aead_UpdateAad_Async,...
Definition: mcuxClCss_Aead.h:84
mcuxClCss_AeadOption_t::lastinit
uint32_t lastinit
Defines whether this is the last call to init.
Definition: mcuxClCss_Aead.h:98
mcuxClCss_AeadOption_t::msgendw
uint32_t msgendw
The size of the last data block (plain/cipher text) in bytes, without padding.
Definition: mcuxClCss_Aead.h:97
mcuxClCss_Aead_Finalize_Async
MCUXCLCSS_API mcuxClCss_Status_Protected_t mcuxClCss_Aead_Finalize_Async(mcuxClCss_AeadOption_t options, mcuxClCss_KeyIndex_t keyIdx, uint8_t const *pKey, size_t keyLength, size_t aadLength, size_t dataLength, uint8_t *pTag, uint8_t *pAeadCtx)
AES-GCM final encryption/decryption.
mcuxClCss_AeadOption_t::acpsoe
uint32_t acpsoe
This field is managed internally.
Definition: mcuxClCss_Aead.h:95
MCUX_CSSL_FP_FUNCTION_DECL
#define MCUX_CSSL_FP_FUNCTION_DECL(id)
Declaration of a flow protected function.
Definition: mcuxCsslFlowProtection.h:119
mcuxClCss_Status_Protected_t
uint64_t mcuxClCss_Status_Protected_t
Type for CSS driver protected status codes.
Definition: mcuxClCss_Types.h:183