MCUX CLNS MCUX Crypto Library Normal Secure |

mcuxClCss_Types.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
26 #ifndef MCUXCLCSS_TYPES_H_
27 #define MCUXCLCSS_TYPES_H_
28
29 #include <stdint.h>
30 #include <stddef.h>
31
32 /**********************************************
33 * MACROS
34 **********************************************/
42 #define MCUXCLCSS_KEY_SLOTS (20U)
43
44
49 #define MCUXCLCSS_KEYPROPERTY_VALUE_KEY_SIZE_128 ((uint32_t) 0u<< 0u)
50 #define MCUXCLCSS_KEYPROPERTY_VALUE_KEY_SIZE_256 ((uint32_t) 1u<< 0u)
51 #define MCUXCLCSS_KEYPROPERTY_VALUE_ACTIVE ((uint32_t) 1u<< 5u)
52 #define MCUXCLCSS_KEYPROPERTY_VALUE_BASE_SLOT ((uint32_t) 1u<< 6u)
53 #define MCUXCLCSS_KEYPROPERTY_VALUE_GENERAL_PURPOSE_SLOT ((uint32_t) 1u<< 7u)
54 #define MCUXCLCSS_KEYPROPERTY_VALUE_RETENTION_SLOT ((uint32_t) 1u<< 8u)
55 #define MCUXCLCSS_KEYPROPERTY_VALUE_HW_OUT_SLOT ((uint32_t) 1u<< 9u)
56 #define MCUXCLCSS_KEYPROPERTY_VALUE_CMAC ((uint32_t) 1u<<13u)
57 #define MCUXCLCSS_KEYPROPERTY_VALUE_KSK ((uint32_t) 1u<<14u)
58 #define MCUXCLCSS_KEYPROPERTY_VALUE_RTF ((uint32_t) 1u<<15u)
59 #define MCUXCLCSS_KEYPROPERTY_VALUE_CKDF ((uint32_t) 1u<<16u)
60 #define MCUXCLCSS_KEYPROPERTY_VALUE_HKDF ((uint32_t) 1u<<17u)
61 #define MCUXCLCSS_KEYPROPERTY_VALUE_ECSGN ((uint32_t) 1u<<18u)
62 #define MCUXCLCSS_KEYPROPERTY_VALUE_ECDH ((uint32_t) 1u<<19u)
63 #define MCUXCLCSS_KEYPROPERTY_VALUE_AES ((uint32_t) 1u<<20u)
64 #define MCUXCLCSS_KEYPROPERTY_VALUE_HMAC ((uint32_t) 1u<<21u)
65 #define MCUXCLCSS_KEYPROPERTY_VALUE_KWK ((uint32_t) 1u<<22u)
66 #define MCUXCLCSS_KEYPROPERTY_VALUE_KUOK ((uint32_t) 1u<<23u)
67 #define MCUXCLCSS_KEYPROPERTY_VALUE_TLS_PREMASTER_SECRET ((uint32_t) 1u<<24u)
68 #define MCUXCLCSS_KEYPROPERTY_VALUE_TLS_MASTER_SECRET ((uint32_t) 1u<<25u)
69 #define MCUXCLCSS_KEYPROPERTY_VALUE_KGSRC ((uint32_t) 1u<<26u)
70 #define MCUXCLCSS_KEYPROPERTY_VALUE_HW_OUT ((uint32_t) 1u<<27u)
71 #define MCUXCLCSS_KEYPROPERTY_VALUE_WRPOK ((uint32_t) 1u<<28u)
72 #define MCUXCLCSS_KEYPROPERTY_VALUE_DUK ((uint32_t) 1u<<29u)
73 #define MCUXCLCSS_KEYPROPERTY_VALUE_PRIVILEGED ((uint32_t) 1u<<30u)
74 #define MCUXCLCSS_KEYPROPERTY_VALUE_NOTPRIVILEGED ((uint32_t) 0u<<30u)
75 #define MCUXCLCSS_KEYPROPERTY_VALUE_SECURE ((uint32_t) 0u<<31u)
76 #define MCUXCLCSS_KEYPROPERTY_VALUE_NOTSECURE ((uint32_t) 1u<<31u)
77
86 #define MCUXCLCSS_KEYPROPERTY_KEY_SIZE_128 0U
87 #define MCUXCLCSS_KEYPROPERTY_KEY_SIZE_256 1U
88 #define MCUXCLCSS_KEYPROPERTY_ACTIVE_TRUE 1U
89 #define MCUXCLCSS_KEYPROPERTY_ACTIVE_FALSE 0U
90 #define MCUXCLCSS_KEYPROPERTY_BASE_SLOT 1U
91 #define MCUXCLCSS_KEYPROPERTY_SECOND_SLOT 0U
92 #define MCUXCLCSS_KEYPROPERTY_GENERAL_PURPOSE_SLOT_TRUE 1U
93 #define MCUXCLCSS_KEYPROPERTY_GENERAL_PURPOSE_SLOT_FALSE 0U
94 #define MCUXCLCSS_KEYPROPERTY_RETENTION_SLOT_TRUE 1U
95 #define MCUXCLCSS_KEYPROPERTY_RETENTION_SLOT_FALSE 0U
96 #define MCUXCLCSS_KEYPROPERTY_HW_OUT_SLOT_TRUE 1U
97 #define MCUXCLCSS_KEYPROPERTY_HW_OUT_SLOT_FALSE 0U
98 #define MCUXCLCSS_KEYPROPERTY_CMAC_TRUE 1U
99 #define MCUXCLCSS_KEYPROPERTY_CMAC_FALSE 0U
100 #define MCUXCLCSS_KEYPROPERTY_KSK_TRUE 1U
101 #define MCUXCLCSS_KEYPROPERTY_KSK_FALSE 0U
102 #define MCUXCLCSS_KEYPROPERTY_RTF_TRUE 1U
103 #define MCUXCLCSS_KEYPROPERTY_RTF_FALSE 0U
104 #define MCUXCLCSS_KEYPROPERTY_CKDF_TRUE 1U
105 #define MCUXCLCSS_KEYPROPERTY_CKDF_FALSE 0U
106 #define MCUXCLCSS_KEYPROPERTY_HKDF_TRUE 1U
107 #define MCUXCLCSS_KEYPROPERTY_HKDF_FALSE 0U
108 #define MCUXCLCSS_KEYPROPERTY_ECC_TRUE 1U
109 #define MCUXCLCSS_KEYPROPERTY_ECC_FALSE 0U
110 #define MCUXCLCSS_KEYPROPERTY_ECC_DH_PRIVATE_TRUE 1U
111 #define MCUXCLCSS_KEYPROPERTY_ECC_DH_PRIVATE_FALSE 0U
112 #define MCUXCLCSS_KEYPROPERTY_AES_TRUE 1U
113 #define MCUXCLCSS_KEYPROPERTY_AES_FALSE 0U
114 #define MCUXCLCSS_KEYPROPERTY_HMAC_TRUE 1U
115 #define MCUXCLCSS_KEYPROPERTY_HMAC_FALSE 0U
116 #define MCUXCLCSS_KEYPROPERTY_KWK_TRUE 1U
117 #define MCUXCLCSS_KEYPROPERTY_KWK_FALSE 0U
118 #define MCUXCLCSS_KEYPROPERTY_KUOK_TRUE 1U
119 #define MCUXCLCSS_KEYPROPERTY_KUOK_FALSE 0U
120 #define MCUXCLCSS_KEYPROPERTY_TLS_PREMASTER_SECRET_TRUE 1U
121 #define MCUXCLCSS_KEYPROPERTY_TLS_PREMASTER_SECRET_FALSE 0U
122 #define MCUXCLCSS_KEYPROPERTY_TLS_MASTER_SECRET_TRUE 1U
123 #define MCUXCLCSS_KEYPROPERTY_TLS_MASTER_SECRET_FALSE 0U
124 #define MCUXCLCSS_KEYPROPERTY_INPUT_FOR_ECC_TRUE 1U
125 #define MCUXCLCSS_KEYPROPERTY_INPUT_FOR_ECC_FALSE 0U
126 #define MCUXCLCSS_KEYPROPERTY_HW_OUT_TRUE 1U
127 #define MCUXCLCSS_KEYPROPERTY_HW_OUT_FALSE 0U
128 #define MCUXCLCSS_KEYPROPERTY_WRAP_TRUE 1U
129 #define MCUXCLCSS_KEYPROPERTY_WRAP_FALSE 0U
130 #define MCUXCLCSS_KEYPROPERTY_DEVICE_UNIQUE_TRUE 1U
131 #define MCUXCLCSS_KEYPROPERTY_DEVICE_UNIQUE_FALSE 0U
132 #define MCUXCLCSS_KEYPROPERTY_PRIVILEGED_TRUE 1U
133 #define MCUXCLCSS_KEYPROPERTY_PRIVILEGED_FALSE 0U
134 #define MCUXCLCSS_KEYPROPERTY_SECURE_TRUE 0U
135 #define MCUXCLCSS_KEYPROPERTY_SECURE_FALSE 1U
136
146 #define MCUXCLCSS_STATUS_OK ((mcuxClCss_Status_t) 0xF0F0F0F0U)
147 #define MCUXCLCSS_STATUS_OK_WAIT ((mcuxClCss_Status_t) 0xF0F0F0E1U)
148 #define MCUXCLCSS_STATUS_HW_FAULT ((mcuxClCss_Status_t) 0xF0F0E1E1U)
149 #define MCUXCLCSS_STATUS_HW_ALGORITHM ((mcuxClCss_Status_t) 0xF0F0E1E2U)
150 #define MCUXCLCSS_STATUS_HW_OPERATIONAL ((mcuxClCss_Status_t) 0xF0F0E1E4U)
151 #define MCUXCLCSS_STATUS_HW_BUS ((mcuxClCss_Status_t) 0xF0F0E1E8U)
152 #define MCUXCLCSS_STATUS_HW_INTEGRITY ((mcuxClCss_Status_t) 0xF0F0E1D1U)
153 #define MCUXCLCSS_STATUS_HW_PRNG ((mcuxClCss_Status_t) 0xF0F0E1D2U)
154 #define MCUXCLCSS_STATUS_HW_DTRNG ((mcuxClCss_Status_t) 0xF0F0E1D4U)
155 #define MCUXCLCSS_STATUS_SW_FAULT ((mcuxClCss_Status_t) 0xF0F0F0E2U)
156 #define MCUXCLCSS_STATUS_SW_CANNOT_INTERRUPT ((mcuxClCss_Status_t) 0xF0F0F0E4U)
157 #define MCUXCLCSS_STATUS_SW_INVALID_PARAM ((mcuxClCss_Status_t) 0xF0F0F0E8U)
158 #define MCUXCLCSS_STATUS_SW_INVALID_STATE ((mcuxClCss_Status_t) 0xF0F0F0D1U)
159 #define MCUXCLCSS_STATUS_SW_COUNTER_EXPIRED ((mcuxClCss_Status_t) 0xF0F0F0D2U)
160 #define MCUXCLCSS_STATUS_SW_COMPARISON_FAILED ((mcuxClCss_Status_t) 0xF0F0F0D4U)
161
163 #define MCUXCLCSS_STATUS_IS_HW_ERROR(x) ((((mcuxClCss_Status_t) (x)) & 0x0000FF00U) == 0x0000E100U)
164
165 #define MCUXCLCSS_STATUS_IS_SW_ERROR(x) ((((mcuxClCss_Status_t) (x)) & 0x0000FF00U) == 0x0000F000U)
166
167
171 /**********************************************
172 * TYPEDEFS
173 **********************************************/
183 typedef uint64_t mcuxClCss_Status_Protected_t;
184
188 typedef uint32_t mcuxClCss_Status_t;
189
193 typedef uint8_t mcuxClCss_KeyIndex_t;
194
196 typedef union
197 {
198 struct
199 {
200 uint32_t value;
201 } word;
202 struct
203 {
204 uint32_t ksize :2;
205 uint32_t :3;
206 uint32_t kactv :1;
207 uint32_t kbase :1;
208 uint32_t fgp :1;
209 uint32_t frtn :1;
210 uint32_t fhwo :1;
211 uint32_t :3;
212 uint32_t ucmac :1;
213 uint32_t uksk :1;
214 uint32_t urtf :1;
215 uint32_t uckdf :1;
216 uint32_t uhkdf :1;
217 uint32_t uecsg :1;
218 uint32_t uecdh :1;
219 uint32_t uaes :1;
220 uint32_t uhmac :1;
221 uint32_t ukwk :1;
222 uint32_t ukuok :1;
223 uint32_t utlspms :1;
224 uint32_t utlsms :1;
225 uint32_t ukgsrc :1;
226 uint32_t uhwo :1;
227 uint32_t wrpok :1;
228 uint32_t duk :1;
229 uint32_t upprot_priv :1;
230 uint32_t upprot_sec :1;
231 } bits;
232 } mcuxClCss_KeyProp_t;
233
234
235 #define utlpsms utlspms
236
237
250 typedef mcuxClCss_Status_t (*mcuxClCss_TransferToRegisterFunction_t)(
251 uint32_t volatile * destRegister,
252 uint8_t const * source,
253 size_t size,
254 void * pCallerData);
255
256 #endif /* MCUXCLCSS_TYPES_H_ */
257
mcuxClCss_KeyProp_t::duk
uint32_t duk
Device-unique key flag.
Definition: mcuxClCss_Types.h:228
mcuxClCss_KeyProp_t::kactv
uint32_t kactv
Status flag to indicate whether the key slot contains an active key or not.
Definition: mcuxClCss_Types.h:206
mcuxClCss_KeyProp_t
Type for CSS key store key properties.
Definition: mcuxClCss_Types.h:196
mcuxClCss_KeyIndex_t
uint8_t mcuxClCss_KeyIndex_t
Type for CSS keystore indices.
Definition: mcuxClCss_Types.h:193
mcuxClCss_KeyProp_t::fhwo
uint32_t fhwo
Hardware feature flag: Hardware-out key slot.
Definition: mcuxClCss_Types.h:210
mcuxClCss_KeyProp_t::kbase
uint32_t kbase
Status flag to indicate whether the key slot is a base slot or the second slot of a 256-bit key.
Definition: mcuxClCss_Types.h:207
mcuxClCss_KeyProp_t::uhkdf
uint32_t uhkdf
Usage permission for HKDF.
Definition: mcuxClCss_Types.h:216
mcuxClCss_KeyProp_t::fgp
uint32_t fgp
Hardware feature flag: General purpose key slot.
Definition: mcuxClCss_Types.h:208
mcuxClCss_KeyProp_t::uckdf
uint32_t uckdf
Usage permission for CKDF.
Definition: mcuxClCss_Types.h:215
mcuxClCss_KeyProp_t::urtf
uint32_t urtf
Usage permission for RTF signing.
Definition: mcuxClCss_Types.h:214
mcuxClCss_KeyProp_t::ucmac
uint32_t ucmac
Usage permission for CMAC.
Definition: mcuxClCss_Types.h:212
mcuxClCss_KeyProp_t::uaes
uint32_t uaes
Usage permission for AES.
Definition: mcuxClCss_Types.h:219
mcuxClCss_KeyProp_t::ukwk
uint32_t ukwk
Usage permission for key wrapping.
Definition: mcuxClCss_Types.h:221
mcuxClCss_TransferToRegisterFunction_t
mcuxClCss_Status_t(* mcuxClCss_TransferToRegisterFunction_t)(uint32_t volatile *destRegister, uint8_t const *source, size_t size, void *pCallerData)
Function type for transfer of data to a memory-mapped register.
Definition: mcuxClCss_Types.h:250
mcuxClCss_KeyProp_t::uecsg
uint32_t uecsg
Usage permission for ECDSA signing.
Definition: mcuxClCss_Types.h:217
mcuxClCss_KeyProp_t::uecdh
uint32_t uecdh
Usage permission for Elliptic Curve Diffie-Hellman.
Definition: mcuxClCss_Types.h:218
mcuxClCss_KeyProp_t::ukgsrc
uint32_t ukgsrc
Usage permission as input for ECC key generation.
Definition: mcuxClCss_Types.h:225
mcuxClCss_KeyProp_t::ksize
uint32_t ksize
Key size.
Definition: mcuxClCss_Types.h:204
mcuxClCss_KeyProp_t::value
uint32_t value
Accesses the bit field as a full word; initialize with a combination of constants from MCUXCLCSS_KEYP...
Definition: mcuxClCss_Types.h:200
mcuxClCss_KeyProp_t::ukuok
uint32_t ukuok
Usage permission for key unwrapping, but not for key wrapping.
Definition: mcuxClCss_Types.h:222
mcuxClCss_KeyProp_t::uksk
uint32_t uksk
Usage permission for key signing.
Definition: mcuxClCss_Types.h:213
mcuxClCss_KeyProp_t::utlsms
uint32_t utlsms
Usage permission as a TLS master secret.
Definition: mcuxClCss_Types.h:224
mcuxClCss_KeyProp_t::upprot_sec
uint32_t upprot_sec
Access restriction to TrustZone secure mode.
Definition: mcuxClCss_Types.h:230
mcuxClCss_Status_t
uint32_t mcuxClCss_Status_t
Type for CSS driver status codes.
Definition: mcuxClCss_Types.h:188
mcuxClCss_KeyProp_t::uhmac
uint32_t uhmac
Usage permission for HMAC.
Definition: mcuxClCss_Types.h:220
mcuxClCss_KeyProp_t::utlspms
uint32_t utlspms
Usage permission as a TLS premaster secret.
Definition: mcuxClCss_Types.h:223
mcuxClCss_KeyProp_t::wrpok
uint32_t wrpok
Usage permission to wrap.
Definition: mcuxClCss_Types.h:227
mcuxClCss_KeyProp_t::upprot_priv
uint32_t upprot_priv
Access restriction to privileged mode.
Definition: mcuxClCss_Types.h:229
mcuxClCss_KeyProp_t::frtn
uint32_t frtn
Hardware feature flag: Retention key slot.
Definition: mcuxClCss_Types.h:209
mcuxClCss_Status_Protected_t
uint64_t mcuxClCss_Status_Protected_t
Type for CSS driver protected status codes.
Definition: mcuxClCss_Types.h:183
mcuxClCss_KeyProp_t::uhwo
uint32_t uhwo
Usage permission in a hardware-out key slot.
Definition: mcuxClCss_Types.h:226