MCUX CLNS
MCUX Crypto Library Normal Secure
mcuxClCss_KeyManagement.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 
36 #ifndef MCUXCLCSS_KEYMANAGEMENT_H_
37 #define MCUXCLCSS_KEYMANAGEMENT_H_
38 
39 #include <mcuxClCss_Common.h> // Common functionality
40 
41 /**********************************************
42  * CONSTANTS
43  **********************************************/
59 #define MCUXCLCSS_KEYIMPORT_VALUE_KFMT_UDF ((uint32_t) 0u<< 6u)
60 #define MCUXCLCSS_KEYIMPORT_VALUE_KFMT_RFC3394 ((uint32_t) 1u<< 6u)
61 #define MCUXCLCSS_KEYIMPORT_VALUE_KFMT_PUF ((uint32_t) 2u<< 6u)
62 
63 
74 #define MCUXCLCSS_KEYIMPORT_KFMT_UDF ((uint32_t) 0x00u)
75 #define MCUXCLCSS_KEYIMPORT_KFMT_RFC3394 ((uint32_t) 0x01u)
76 #define MCUXCLCSS_KEYIMPORT_KFMT_PUF ((uint32_t) 0x02u)
77 
78 #define MCUXCLCSS_RFC3394_OVERHEAD ((size_t) 16u)
79 
90 #define MCUXCLCSS_RFC3394_CONTAINER_SIZE_128 ((size_t) 256u/8u)
91 #define MCUXCLCSS_RFC3394_CONTAINER_SIZE_256 ((size_t) 384u/8u)
92 
100 /**********************************************
101  * TYPEDEFS
102  **********************************************/
103 
117 typedef union
118 {
119  struct
120  {
121  uint32_t value;
122  } word;
123  struct
124  {
125  uint32_t :4;
126  uint32_t revf :1;
127  uint32_t :1;
128  uint32_t kfmt :2;
129  uint32_t :24;
130  } bits;
132 
137 /**********************************************
138  * FUNCTIONS
139  **********************************************/
166  mcuxClCss_KeyIndex_t keyIdx
167 );
168 
169 
170 
210  uint8_t const * pImportKey,
211  size_t importKeyLength,
212  mcuxClCss_KeyIndex_t wrappingKeyIdx,
213  mcuxClCss_KeyIndex_t targetKeyIdx
214  );
215 
216 
239  mcuxClCss_KeyIndex_t wrappingKeyIdx,
240  mcuxClCss_KeyIndex_t exportKeyIdx,
241  uint8_t * pOutput
242  );
243 
260  mcuxClCss_KeyIndex_t keyIdx,
261  mcuxClCss_KeyProp_t * pKeyProp
262  );
263 
267 #endif /* MCUXCLCSS_KEYMANAGEMENT_H_ */
268 
#define MCUXCLCSS_API
Marks a function as a public API function of the mcuxClCss component.
Definition: mcuxClCss_Common.h:40
uint32_t value
Accesses the bit field as a full word; initialize with a combination of constants from MCUXCLCSS_KEYI...
Definition: mcuxClCss_KeyManagement.h:121
Type for CSS key store key properties.
Definition: mcuxClCss_Types.h:196
uint8_t mcuxClCss_KeyIndex_t
Type for CSS keystore indices.
Definition: mcuxClCss_Types.h:193
MCUXCLCSS_API mcuxClCss_Status_Protected_t mcuxClCss_KeyDelete_Async(mcuxClCss_KeyIndex_t keyIdx)
Deletes a key from keystore at the given index.
CSSv2 header for common functionality.
uint32_t revf
This field is managed internally.
Definition: mcuxClCss_KeyManagement.h:126
MCUXCLCSS_API mcuxClCss_Status_Protected_t mcuxClCss_KeyImport_Async(mcuxClCss_KeyImportOption_t options, uint8_t const *pImportKey, size_t importKeyLength, mcuxClCss_KeyIndex_t wrappingKeyIdx, mcuxClCss_KeyIndex_t targetKeyIdx)
Imports a key from external storage to an internal key register.
MCUXCLCSS_API mcuxClCss_Status_Protected_t mcuxClCss_GetKeyProperties(mcuxClCss_KeyIndex_t keyIdx, mcuxClCss_KeyProp_t *pKeyProp)
Exports the properties of the keys stored in the CSS internal keystore.
Command option bit field for mcuxClCss_KeyImport_Async.
Definition: mcuxClCss_KeyManagement.h:117
uint32_t kfmt
Defines the key import format, one of MCUXCLCSS_KEYIMPORT_KFMT_.
Definition: mcuxClCss_KeyManagement.h:128
#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
MCUXCLCSS_API mcuxClCss_Status_Protected_t mcuxClCss_KeyExport_Async(mcuxClCss_KeyIndex_t wrappingKeyIdx, mcuxClCss_KeyIndex_t exportKeyIdx, uint8_t *pOutput)
Exports a key from an internal key register to external storage, using a wrapping key.