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;
108 /**********************************************
109  * FUNCTIONS
110  **********************************************/
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 
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 
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 
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 
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 
#define MCUXCLCSS_API
Marks a function as a public API function of the mcuxClCss component.
Definition: mcuxClCss_Common.h:40
uint8_t mcuxClCss_KeyIndex_t
Type for CSS keystore indices.
Definition: mcuxClCss_Types.h:193
CSSv2 header for common functionality.
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_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)
uint32_t extkey
Defines whether an external key shall be used.
Definition: mcuxClCss_Aead.h:100
uint32_t acpmod
This field is managed internally.
Definition: mcuxClCss_Aead.h:94
uint32_t value
Accesses the bit field as a full word.
Definition: mcuxClCss_Aead.h:88
uint32_t dcrpt
Defines if encryption or decryption shall be performed.
Definition: mcuxClCss_Aead.h:93
uint32_t acpsie
This field is managed internally.
Definition: mcuxClCss_Aead.h:96
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_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.
Command option bit field for mcuxClCss_Aead_Init_Async, mcuxClCss_Aead_UpdateAad_Async,...
Definition: mcuxClCss_Aead.h:84
uint32_t lastinit
Defines whether this is the last call to init.
Definition: mcuxClCss_Aead.h:98
uint32_t msgendw
The size of the last data block (plain/cipher text) in bytes, without padding.
Definition: mcuxClCss_Aead.h:97
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.
uint32_t acpsoe
This field is managed internally.
Definition: mcuxClCss_Aead.h:95
#define MCUX_CSSL_FP_FUNCTION_DECL(id)
Declaration of a flow protected function.
Definition: mcuxCsslFlowProtection.h:119
uint64_t mcuxClCss_Status_Protected_t
Type for CSS driver protected status codes.
Definition: mcuxClCss_Types.h:183