MCUX CLNS
MCUX Crypto Library Normal Secure
 
Loading...
Searching...
No Matches
mcuxClEls_Aead.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/* Copyright 2020-2023 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 MCUXCLELS_AEAD_H_
30#define MCUXCLELS_AEAD_H_
31
32#include <mcuxClConfig.h> // Exported features flags header
33#include <mcuxClEls_Common.h> // Common functionality
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39/**********************************************
40 * CONSTANTS
41 **********************************************/
54#define MCUXCLELS_AEAD_ENCRYPT ((uint8_t)0x00U)
55#define MCUXCLELS_AEAD_DECRYPT ((uint8_t)0x01U)
56
57#define MCUXCLELS_AEAD_STATE_IN_DISABLE ((uint8_t)0x00U)
58#define MCUXCLELS_AEAD_STATE_IN_ENABLE ((uint8_t)0x01U)
59
60#define MCUXCLELS_AEAD_LASTINIT_TRUE ((uint8_t)0x01U)
61#define MCUXCLELS_AEAD_LASTINIT_FALSE ((uint8_t)0x00U)
62
63#define MCUXCLELS_AEAD_EXTERN_KEY ((uint8_t)0x01U)
64#define MCUXCLELS_AEAD_INTERN_KEY ((uint8_t)0x00U)
65
66#define MCUXCLELS_AEAD_ACPMOD_INIT ((uint8_t)0x00U)
67#define MCUXCLELS_AEAD_ACPMOD_AADPROC ((uint8_t)0x01U)
68#define MCUXCLELS_AEAD_ACPMOD_MSGPROC ((uint8_t)0x02U)
69#define MCUXCLELS_AEAD_ACPMOD_FINAL ((uint8_t)0x03U)
70
71#ifndef MCUXCL_FEATURE_ELS_NO_INTERNAL_STATE_FLAGS
72#define MCUXCLELS_AEAD_STATE_OUT_ENABLE ((uint8_t)0x01U)
73#endif /* MCUXCL_FEATURE_ELS_NO_INTERNAL_STATE_FLAGS */
78#define MCUXCLELS_AEAD_IV_BLOCK_SIZE 16U
79#define MCUXCLELS_AEAD_AAD_BLOCK_SIZE 16U
80#define MCUXCLELS_AEAD_TAG_SIZE 16U
81#define MCUXCLELS_AEAD_CONTEXT_SIZE 80U
86/**********************************************
87 * TYPEDEFS
88 **********************************************/
98typedef union
99{
100 struct
101 {
102 uint32_t value;
103 } word;
104 struct
105 {
106 uint32_t :1;
107 uint32_t dcrpt :1;
108 uint32_t acpmod :2;
109#ifndef MCUXCL_FEATURE_ELS_NO_INTERNAL_STATE_FLAGS
110 uint32_t acpsoe :1;
111#else
112 uint32_t :1;
113#endif /* MCUXCL_FEATURE_ELS_NO_INTERNAL_STATE_FLAGS */
114 uint32_t acpsie :1;
115 uint32_t msgendw :4;
116 uint32_t lastinit :1;
117 uint32_t :2;
118 uint32_t extkey :1;
119 uint32_t :18;
120 } bits;
126/**********************************************
127 * FUNCTIONS
128 **********************************************/
186 uint8_t const * pKey,
187 size_t keyLength,
188 uint8_t const * pIV,
189 size_t ivLength,
190 uint8_t * pAeadCtx
191 );
192
246 uint8_t const * pKey,
247 size_t keyLength,
248 uint8_t const * pIV,
249 size_t ivLength,
250 uint8_t * pAeadCtx
251 );
252
308 uint8_t const * pKey,
309 size_t keyLength,
310 uint8_t const * pAad,
311 size_t aadLength,
312 uint8_t * pAeadCtx
313 );
314
373 uint8_t const * pKey,
374 size_t keyLength,
375 uint8_t const * pInput,
376 size_t inputLength,
377 uint8_t * pOutput,
378 uint8_t * pAeadCtx
379 );
380
439 uint8_t const * pKey,
440 size_t keyLength,
441 size_t aadLength,
442 size_t dataLength,
443 uint8_t * pTag,
444 uint8_t * pAeadCtx
445 );
446
447#ifdef __cplusplus
448} /* extern "C" */
449#endif
450
451#endif /* MCUXCLELS_AEAD_H_ */
452
ELS header for common functionality.
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_Aead_UpdateData_Async(mcuxClEls_AeadOption_t options, mcuxClEls_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.
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_Aead_PartialInit_Async(mcuxClEls_AeadOption_t options, mcuxClEls_KeyIndex_t keyIdx, uint8_t const *pKey, size_t keyLength, uint8_t const *pIV, size_t ivLength, uint8_t *pAeadCtx)
AES-GCM partial initialization.
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_Aead_Init_Async(mcuxClEls_AeadOption_t options, mcuxClEls_KeyIndex_t keyIdx, uint8_t const *pKey, size_t keyLength, uint8_t const *pIV, size_t ivLength, uint8_t *pAeadCtx)
AES-GCM initialization.
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_Aead_UpdateAad_Async(mcuxClEls_AeadOption_t options, mcuxClEls_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)
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_Aead_Finalize_Async(mcuxClEls_AeadOption_t options, mcuxClEls_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.
#define MCUXCLELS_API
Marks a function as a public API function of the mcuxClEls component.
Definition mcuxClEls_Common.h:46
uint32_t mcuxClEls_Status_t
Type for ELS driver status codes.
Definition mcuxClEls_Types.h:212
uint32_t mcuxClEls_KeyIndex_t
Type for ELS keystore indices.
Definition mcuxClEls_Types.h:222
#define MCUX_CSSL_FP_FUNCTION_DECL(...)
Declaration of a flow protected function.
Definition mcuxCsslFlowProtection.h:125
#define MCUX_CSSL_FP_PROTECTED_TYPE(resultType)
Based on a given base type, builds a return type with flow protection.
Definition mcuxCsslFlowProtection.h:81
Command option bit field for mcuxClEls_Aead_Init_Async, mcuxClEls_Aead_UpdateAad_Async,...
Definition mcuxClEls_Aead.h:99
uint32_t acpmod
This field is managed internally.
Definition mcuxClEls_Aead.h:108
uint32_t acpsie
This field is managed internally.
Definition mcuxClEls_Aead.h:114
uint32_t msgendw
The size of the last data block (plain/cipher text) in bytes, without padding.
Definition mcuxClEls_Aead.h:115
uint32_t extkey
Defines whether an external key shall be used.
Definition mcuxClEls_Aead.h:118
uint32_t lastinit
Defines whether this is the last call to init.
Definition mcuxClEls_Aead.h:116
uint32_t acpsoe
This field is managed internally.
Definition mcuxClEls_Aead.h:110
uint32_t dcrpt
Defines if encryption or decryption shall be performed.
Definition mcuxClEls_Aead.h:107
uint32_t value
Accesses the bit field as a full word.
Definition mcuxClEls_Aead.h:102