MCUX CLNS MCUX Crypto Library Normal Secure |

mcuxClCss_Cipher.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
33 #ifndef MCUXCLCSS_CIPHER_H_
34 #define MCUXCLCSS_CIPHER_H_
35
36 #include <mcuxClCss_Common.h> // Common functionality
37
38 /**********************************************
39 * CONSTANTS
40 **********************************************/
57 #define MCUXCLCSS_CIPHER_ENCRYPT 0U
58 #define MCUXCLCSS_CIPHER_DECRYPT 1U
59
60 #define MCUXCLCSS_CIPHER_STATE_OUT_ENABLE 1U
61 #define MCUXCLCSS_CIPHER_STATE_OUT_DISABLE 0U
62
63 #define MCUXCLCSS_CIPHER_STATE_IN_ENABLE 1U
64 #define MCUXCLCSS_CIPHER_STATE_IN_DISABLE 0U
65
66 #define MCUXCLCSS_CIPHER_EXTERNAL_KEY 1U
67 #define MCUXCLCSS_CIPHER_INTERNAL_KEY 0U
68
69 #define MCUXCLCSS_CIPHERPARAM_ALGORITHM_AES_ECB 0x00U
70 #define MCUXCLCSS_CIPHERPARAM_ALGORITHM_AES_CBC 0x01U
71 #define MCUXCLCSS_CIPHERPARAM_ALGORITHM_AES_CTR 0x02U
72
80 #define MCUXCLCSS_CIPHER_BLOCK_SIZE_AES ((size_t) 16U)
81
82
89 #define MCUXCLCSS_CIPHER_KEY_SIZE_AES_128 ((size_t) 16U)
90 #define MCUXCLCSS_CIPHER_KEY_SIZE_AES_192 ((size_t) 24U)
91 #define MCUXCLCSS_CIPHER_KEY_SIZE_AES_256 ((size_t) 32U)
92
98 /**********************************************
99 * TYPEDEFS
100 **********************************************/
101
113 typedef union
114 {
115 struct
116 {
117 uint32_t value;
118 } word;
119 struct
120 {
121 uint32_t :1;
122 uint32_t dcrpt :1;
123 uint32_t cphmde :2;
124 uint32_t cphsoe :1;
125 uint32_t cphsie :1;
126 uint32_t :7;
127 uint32_t extkey :1;
128 uint32_t :18;
129 } bits;
130 } mcuxClCss_CipherOption_t;
135 /**********************************************
136 * FUNCTIONS
137 **********************************************/
205 MCUX_CSSL_FP_FUNCTION_DECL(mcuxClCss_Cipher_Async)
206 MCUXCLCSS_API mcuxClCss_Status_Protected_t mcuxClCss_Cipher_Async(
207 mcuxClCss_CipherOption_t options,
208 mcuxClCss_KeyIndex_t keyIdx,
209 uint8_t const * pKey,
210 size_t keyLength,
211 uint8_t const * pInput,
212 size_t inputLength,
213 uint8_t * pIV,
214 uint8_t * pOutput
215 );
216
220 #endif /* MCUXCLCSS_CIPHER_H_ */
221
MCUXCLCSS_API
#define MCUXCLCSS_API
Marks a function as a public API function of the mcuxClCss component.
Definition: mcuxClCss_Common.h:40
mcuxClCss_CipherOption_t::cphsoe
uint32_t cphsoe
Define whether the CSSv2 internal cipher state should be extracted to external memory or kept interna...
Definition: mcuxClCss_Cipher.h:124
mcuxClCss_KeyIndex_t
uint8_t mcuxClCss_KeyIndex_t
Type for CSS keystore indices.
Definition: mcuxClCss_Types.h:193
mcuxClCss_CipherOption_t::cphmde
uint32_t cphmde
Define cipher mode.
Definition: mcuxClCss_Cipher.h:123
mcuxClCss_Common.h
CSSv2 header for common functionality.
mcuxClCss_CipherOption_t::cphsie
uint32_t cphsie
Define whether an external provided cipher state should be imported from external memory.
Definition: mcuxClCss_Cipher.h:125
mcuxClCss_CipherOption_t
Command option bit field for mcuxClCss_Cipher_Async.
Definition: mcuxClCss_Cipher.h:113
mcuxClCss_CipherOption_t::value
uint32_t value
Accesses the bit field as a full word.
Definition: mcuxClCss_Cipher.h:117
mcuxClCss_CipherOption_t::extkey
uint32_t extkey
Define whether an external key from memory or CSSv2 internal key should be used.
Definition: mcuxClCss_Cipher.h:127
mcuxClCss_CipherOption_t::dcrpt
uint32_t dcrpt
Define operation mode.
Definition: mcuxClCss_Cipher.h:122
mcuxClCss_Cipher_Async
MCUXCLCSS_API mcuxClCss_Status_Protected_t mcuxClCss_Cipher_Async(mcuxClCss_CipherOption_t options, mcuxClCss_KeyIndex_t keyIdx, uint8_t const *pKey, size_t keyLength, uint8_t const *pInput, size_t inputLength, uint8_t *pIV, uint8_t *pOutput)
Performs AES encryption/decryption.
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