MCUX CLNS
MCUX Crypto Library Normal Secure
 
Loading...
Searching...
No Matches
mcuxClEls_Kdf.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
37#ifndef MCUXCLELS_KDF_H_
38#define MCUXCLELS_KDF_H_
39
40#include <mcuxClConfig.h> // Exported features flags header
41
42
43
44
45
46#include <mcuxClEls_Common.h> // Common functionality
47
48#ifdef __cplusplus
49extern "C" {
50#endif
51
52/**********************************************
53 * CONSTANTS
54 **********************************************/
55
64#define MCUXCLELS_CKDF_DERIVATIONDATA_SIZE 12u
65#define MCUXCLELS_CKDF_ALGO_SP800108 0x0u
66
67
68
69
70#define MCUXCLELS_HKDF_RFC5869_DERIVATIONDATA_SIZE 32u
71#define MCUXCLELS_HKDF_SP80056C_TARGETKEY_SIZE 32u
72
73#define MCUXCLELS_HKDF_VALUE_RTF_DERIV ((uint32_t) 1u<< 0u)
74#define MCUXCLELS_HKDF_VALUE_MEMORY_DERIV ((uint32_t) 0u<< 0u)
75
76#define MCUXCLELS_HKDF_ALGO_RFC5869 0x0u
77#define MCUXCLELS_HKDF_ALGO_SP80056C 0x1u
78
79#define MCUXCLELS_HKDF_RTF_DERIV 1U
80#define MCUXCLELS_HKDF_SYSTEM_MEMORY_DERIV 0U
81
82#define MCUXCLELS_TLS_DERIVATIONDATA_SIZE ((size_t) 80u)
83#define MCUXCLELS_TLS_RANDOM_SIZE ((size_t) 32u)
84
85#define MCUXCLELS_TLS_INIT 0u
86#define MCUXCLELS_TLS_FINALIZE 1u
87 /* mcuxClEls_Kdf_Define */
91
92/**********************************************
93 * TYPEDEFS
94 **********************************************/
95
104typedef union
105{
106 struct
107 {
108 uint32_t value;
109 } word;
110 struct
111 {
112 uint32_t :12;
113 uint32_t ckdf_algo :2;
115 uint32_t :18;
116 } bits;
118
120typedef union
121{
122 struct
123 {
124 uint32_t value;
125 } word;
126 struct
127 {
128 uint32_t rtfdrvdat :1;
129 uint32_t hkdf_algo :1;
132 uint32_t :30;
133 } bits;
135
137typedef union
138{
139 struct
140 {
141 uint32_t value;
142 } word;
143 struct
144 {
145 uint32_t :10;
146 uint32_t mode :1;
149 uint32_t :21;
150 } bits;
152 /* mcuxClEls_Kdf_Types */
156 /* mcuxClEls_Kdf_Macros */
160
161
162/**********************************************
163 * FUNCTIONS
164 **********************************************/
198 mcuxClEls_KeyIndex_t derivationKeyIdx,
199 mcuxClEls_KeyIndex_t targetKeyIdx,
200 mcuxClEls_KeyProp_t targetKeyProperties,
201 uint8_t const * pDerivationData
202 );
203
226 mcuxClEls_KeyIndex_t derivationKeyIdx,
227 uint8_t * pTagetKey,
228 uint8_t const * pDerivationData,
229 size_t derivationDataLength
230 );
231
232
256 mcuxClEls_KeyIndex_t derivationKeyIdx,
257 mcuxClEls_KeyIndex_t targetKeyIdx,
258 mcuxClEls_KeyProp_t targetKeyProperties,
259 uint8_t const * pDerivationData
260 );
261
262
263
286 uint8_t const * pDerivationData,
287 mcuxClEls_KeyProp_t keyProperties,
289 );
290
321 uint8_t const * pDerivationData,
322 mcuxClEls_KeyProp_t keyProperties,
324 );
325 /* mcuxClEls_Kdf_Functions */
329 /* mcuxClEls_Kdf */
333
334#ifdef __cplusplus
335} /* extern "C" */
336#endif
337
338#endif /* MCUXCLELS_KDF_H_ */
ELS header for common functionality.
#define MCUXCLELS_API
Marks a function as a public API function of the mcuxClEls component.
Definition mcuxClEls_Common.h:46
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_Ckdf_Sp800108_Async(mcuxClEls_KeyIndex_t derivationKeyIdx, mcuxClEls_KeyIndex_t targetKeyIdx, mcuxClEls_KeyProp_t targetKeyProperties, uint8_t const *pDerivationData)
Derives a key using the NIST SP 800-108 CMAC-based Extract-and-Expand Key Derivation Function.
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_TlsGenerateSessionKeysFromMasterKey_Async(uint8_t const *pDerivationData, mcuxClEls_KeyProp_t keyProperties, mcuxClEls_KeyIndex_t keyIdx)
Generates TLS session keys based on a master key and derivation data, according to the TLS 1....
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_Hkdf_Sp80056c_Async(mcuxClEls_KeyIndex_t derivationKeyIdx, uint8_t *pTagetKey, uint8_t const *pDerivationData, size_t derivationDataLength)
Derives a key using the HKDF (HMAC-based key derivation function) according to SP800-56C one-step app...
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_Hkdf_Rfc5869_Async(mcuxClEls_HkdfOption_t options, mcuxClEls_KeyIndex_t derivationKeyIdx, mcuxClEls_KeyIndex_t targetKeyIdx, mcuxClEls_KeyProp_t targetKeyProperties, uint8_t const *pDerivationData)
Derives a key using the HKDF (HMAC-based key derivation function) according to RFC5869.
MCUXCLELS_API mcuxClEls_Status_t mcuxClEls_TlsGenerateMasterKeyFromPreMasterKey_Async(uint8_t const *pDerivationData, mcuxClEls_KeyProp_t keyProperties, mcuxClEls_KeyIndex_t keyIdx)
Generates a TLS master key based on a pre-master key and derivation data, according to the TLS 1....
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
Internal command option bit field for CKDF functions.
Definition mcuxClEls_Kdf.h:105
uint32_t value
Accesses the bit field as a full word; initialize with a combination of constants from MCUXCLELS_HKDF...
Definition mcuxClEls_Kdf.h:108
uint32_t ckdf_algo
Defines which algorithm and mode shall be used.
Definition mcuxClEls_Kdf.h:113
Command option bit field for mcuxClEls_Hkdf_Rfc5869_Async.
Definition mcuxClEls_Kdf.h:121
uint32_t rtfdrvdat
MCUXCLELS_HKDF_SYSTEM_MEMORY_DERIV=use derivation input from system memory, MCUXCLELS_HKDF_RTF_DERIV=...
Definition mcuxClEls_Kdf.h:128
uint32_t value
Accesses the bit field as a full word; initialize with a combination of constants from MCUXCLELS_HKDF...
Definition mcuxClEls_Kdf.h:124
uint32_t hkdf_algo
Defines which algorithm shall be used.
Definition mcuxClEls_Kdf.h:129
Internal command option bit field for mcuxClEls_TlsGenerateMasterKeyFromPreMasterKey_Async,...
Definition mcuxClEls_Kdf.h:138
uint32_t mode
Defines which phase of the key generation is performed.
Definition mcuxClEls_Kdf.h:146
uint32_t value
Accesses the bit field as a full word; initialize with a combination of constants from MCUXCLELS_HKDF...
Definition mcuxClEls_Kdf.h:141
Type for ELS key store key properties.
Definition mcuxClEls_Types.h:226