MCUX CLNS
MCUX Crypto Library Normal Secure
Loading...
Searching...
No Matches
mcuxClKey_Functions.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/* Copyright 2020-2026 NXP */
3/* */
4/* SPDX-License-Identifier: BSD-3-Clause */
5/* */
6/* Redistribution and use in source and binary forms, with or without */
7/* modification, are permitted provided that the following conditions are */
8/* met: */
9/* */
10/* 1. Redistributions of source code must retain the above copyright */
11/* notice, this list of conditions and the following disclaimer. */
12/* */
13/* 2. Redistributions in binary form must reproduce the above copyright */
14/* notice, this list of conditions and the following disclaimer in the */
15/* documentation and/or other materials provided with the distribution. */
16/* */
17/* 3. Neither the name of the copyright holder nor the names of its */
18/* contributors may be used to endorse or promote products derived from */
19/* this software without specific prior written permission. */
20/* */
21/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS */
22/* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED */
23/* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A */
24/* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
25/* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
26/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
27/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR */
28/* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
29/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
30/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
31/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
32/*--------------------------------------------------------------------------*/
33
39
40#ifndef MCUXCLKEY_FUNCTIONS_H_
41#define MCUXCLKEY_FUNCTIONS_H_
42
43#include <mcuxClConfig.h> // Exported features flags header
44#include <mcuxClSession.h>
45#include <mcuxClSession_Types.h>
46
47#include <mcuxClKey_Types.h>
48#ifdef MCUXCL_FEATURE_KEY_DERIVATION
49#include <mcuxClMac_Types.h>
50#endif /* MCUXCL_FEATURE_KEY_DERIVATION */
51
54
55#ifdef __cplusplus
56extern "C" {
57#endif
58
59/**********************************************
60 * FUNCTIONS
61 **********************************************/
62
69
97 const uint8_t * pKeyData,
98 uint32_t keyDataLength
99);
100
101
114 mcuxClKey_Handle_t privKey,
115 mcuxClKey_Handle_t pubKey
116);
117
143 mcuxClKey_Encoding_t encoding,
144 const uint8_t * pAuxData,
145 uint32_t auxDataLength
146);
147
183 uint32_t loadOptions
184);
185
205);
206
207#ifdef MCUXCL_FEATURE_KEY_DERIVATION
208
229MCUX_CSSL_FP_FUNCTION_DECL(mcuxClKey_derivation)
232 mcuxClKey_Derivation_t derivationMode,
233 mcuxClKey_Handle_t derivationKey,
234 mcuxClKey_DerivationInput_t inputs[],
235 uint32_t numberOfInputs,
236 mcuxClKey_Handle_t derivedKey
237);
238#endif /* MCUXCL_FEATURE_KEY_DERIVATION */
239
270 mcuxClKey_Generation_t generation,
271 mcuxClKey_Handle_t privKey,
272 mcuxClKey_Handle_t pubKey
273); /* generate a fresh new key (pair) */
274
296 mcuxClKey_Agreement_t agreement,
298 mcuxClKey_Handle_t otherKey,
299 mcuxClKey_Agreement_AdditionalInput_t additionalInputs[],
300 uint32_t numberOfInputs,
301 uint8_t * pOut,
302 uint32_t * const pOutLength
303); /* determine a shared key on based on public and private inputs */
304
305#ifdef MCUXCL_FEATURE_KEY_SELFTEST
306MCUX_CSSL_FP_FUNCTION_DECL(mcuxClKey_agreement_selftest)
307MCUX_CSSL_FP_PROTECTED_TYPE(mcuxClKey_Status_t) mcuxClKey_agreement_selftest(
309 mcuxClKey_Agreement_t agreement,
310 mcuxClKey_Test_t test
311);
312#endif /* MCUXCL_FEATURE_KEY_SELFTEST */
313
340 mcuxClKey_Encoding_t encoding,
341 mcuxClKey_Handle_t encodedKey,
342 mcuxClKey_Type_t type,
343 const uint8_t * pPlainKeyData,
344 uint32_t plainKeyDataLength,
345 const uint8_t * pAuxData,
346 uint32_t auxDataLength,
347 uint8_t * pEncodedKeyData,
348 uint32_t * const pEncodedKeyDataLength
349);
350
380 mcuxClKey_Handle_t encodedKey,
381 mcuxClKey_Encoding_t encoding,
382 mcuxClKey_Handle_t recodedKey,
383 const uint8_t * pAuxData,
384 uint32_t auxDataLength,
385 uint8_t * pEncodedKeyData,
386 uint32_t * const pEncodedKeyDataLength
387);
388
405 mcuxClKey_Validation_t validation,
407);
408
409
410 /* mcuxClKey_Functions */
414
415#ifdef __cplusplus
416} /* extern "C" */
417#endif
418
419#endif /* MCUXCLKEY_FUNCTIONS_H_ */
Definition of function identifiers for the flow protection mechanism.
Type definitions for the mcuxClKey component.
Type definitions for the mcuxClMac component.
Top-level include file for the mcuxClSession component.
Type definitions for the mcuxClSession component.
Provides the API for the CSSL flow protection mechanism.
mcuxClKey_Status_t mcuxClKey_recode(mcuxClSession_Handle_t session, mcuxClKey_Handle_t encodedKey, mcuxClKey_Encoding_t encoding, mcuxClKey_Handle_t recodedKey, const uint8_t *pAuxData, uint32_t auxDataLength, uint8_t *pEncodedKeyData, uint32_t *const pEncodedKeyDataLength)
Key recoding (re-encoding) function to apply a new encoding to key material.
void mcuxClKey_linkKeyPair(mcuxClSession_Handle_t session, mcuxClKey_Handle_t privKey, mcuxClKey_Handle_t pubKey)
Establishes a key pair link between a private and public key handle.
mcuxClKey_Status_t mcuxClKey_init(mcuxClSession_Handle_t session, mcuxClKey_Handle_t key, mcuxClKey_Type_t type, const uint8_t *pKeyData, uint32_t keyDataLength)
Initializes a key handle.
mcuxClKey_Status_t mcuxClKey_flush(mcuxClSession_Handle_t session, mcuxClKey_Handle_t key)
Flush key from destination which can be a key slot of coprocessor or memory buffer.
mcuxClKey_Status_t mcuxClKey_loadCopro(mcuxClSession_Handle_t session, mcuxClKey_Handle_t key, uint32_t loadOptions)
Load key into destination key slot of a coprocessor.
mcuxClKey_Status_t mcuxClKey_validate(mcuxClSession_Handle_t session, mcuxClKey_Validation_t validation, mcuxClKey_Handle_t key)
Key validation function.
mcuxClKey_Status_t mcuxClKey_setEncoding(mcuxClSession_Handle_t session, mcuxClKey_Handle_t key, mcuxClKey_Encoding_t encoding, const uint8_t *pAuxData, uint32_t auxDataLength)
Configures the encoding mechanism for the given key handle.
mcuxClKey_Status_t mcuxClKey_generate_keypair(mcuxClSession_Handle_t session, mcuxClKey_Generation_t generation, mcuxClKey_Handle_t privKey, mcuxClKey_Handle_t pubKey)
Key-pair generation function.
mcuxClKey_Status_t mcuxClKey_encode(mcuxClSession_Handle_t session, mcuxClKey_Encoding_t encoding, mcuxClKey_Handle_t encodedKey, mcuxClKey_Type_t type, const uint8_t *pPlainKeyData, uint32_t plainKeyDataLength, const uint8_t *pAuxData, uint32_t auxDataLength, uint8_t *pEncodedKeyData, uint32_t *const pEncodedKeyDataLength)
Key descriptor initialization function including applying a encoding mechanism.
mcuxClKey_Status_t mcuxClKey_agreement(mcuxClSession_Handle_t session, mcuxClKey_Agreement_t agreement, mcuxClKey_Handle_t key, mcuxClKey_Handle_t otherKey, mcuxClKey_Agreement_AdditionalInput_t additionalInputs[], uint32_t numberOfInputs, uint8_t *pOut, uint32_t *const pOutLength)
Key agreement function.
const mcuxClKey_ValidationDescriptor_t *const mcuxClKey_Validation_t
Generic key validation type.
Definition mcuxClKey_Types.h:329
const mcuxClKey_EncodingDescriptor_t * mcuxClKey_Encoding_t
Key encoding mechanism type.
Definition mcuxClKey_Types.h:164
const mcuxClKey_TypeDescriptor_t * mcuxClKey_Type_t
Key type handle type.
Definition mcuxClKey_Types.h:134
uint32_t mcuxClKey_Status_t
Type for Key component error codes.
Definition mcuxClKey_Types.h:65
const mcuxClKey_GenerationDescriptor_t *const mcuxClKey_Generation_t
Key generation type.
Definition mcuxClKey_Types.h:246
const mcuxClKey_AgreementDescriptor_t *const mcuxClKey_Agreement_t
Key agreement type.
Definition mcuxClKey_Types.h:197
mcuxClKey_Descriptor_t *const mcuxClKey_Handle_t
Key handle type.
Definition mcuxClKey_Types.h:111
mcuxClSession_Descriptor_t *const mcuxClSession_Handle_t
Type for mcuxClSession Handle.
Definition mcuxClSession_Types.h:118
#define MCUX_CSSL_FP_FUNCTION_DECL(...)
Declaration of a flow protected function.
Definition mcuxCsslFlowProtection.h:186
#define MCUX_CSSL_FP_PROTECTED_TYPE(resultType)
Based on a given base type, builds a return type with flow protection.
Definition mcuxCsslFlowProtection.h:158