MCUX CLNS
MCUX Crypto Library Normal Secure
Loading...
Searching...
No Matches
mcuxClEcc_Functions.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/* Copyright 2020-2025 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
38
39
40#ifndef MCUXCLECC_FUNCTIONS_H_
41#define MCUXCLECC_FUNCTIONS_H_
42
43
44#include <mcuxClCore_Platform.h>
45#include <mcuxClSession.h>
46#include <mcuxClBuffer.h>
49#include <mcuxCsslAnalysis.h>
50#ifdef MCUXCL_FEATURE_ECC_ECDSA_DETERMINISTIC
51#include <mcuxClMac.h>
52#endif /* MCUXCL_FEATURE_ECC_ECDSA_DETERMINISTIC */
53
54#include <mcuxClEcc_Types.h>
55
56#include <mcuxClKey.h>
57
58
59#ifdef __cplusplus
60extern "C" {
61#endif
62
63/**********************************************************/
64/* Public APIs of mcuxClEcc */
65/**********************************************************/
72
73
83 mcuxClSession_Handle_t pSession,
84 const mcuxClEcc_KeyGen_Param_t * pParam
85 );
86
87
97 mcuxClSession_Handle_t pSession,
98 const mcuxClEcc_Sign_Param_t * pParam
99 );
100
101
110 mcuxClSession_Handle_t pSession,
111 const mcuxClEcc_Verify_Param_t * pParam
112 );
113
114
145 mcuxClSession_Handle_t pSession,
146 const mcuxClEcc_PointMult_Param_t * pParam
147 );
148
149
173 mcuxClSession_Handle_t pSession,
174 mcuxClKey_Handle_t privKey,
175 mcuxClKey_Handle_t pubKey
176 );
177
204 mcuxClSession_Handle_t pSession,
206 mcuxClKey_Handle_t otherKey,
207 uint8_t * pOut,
208 uint32_t * const pOutLength
209 );
210
211
212MCUX_CSSL_ANALYSIS_START_PATTERN_HYPERLINK_IN_COMMENTS()
237MCUX_CSSL_ANALYSIS_STOP_PATTERN_HYPERLINK_IN_COMMENTS()
240 mcuxClSession_Handle_t pSession,
242 mcuxClKey_Handle_t privKey,
243 mcuxClKey_Handle_t pubKey
244 );
245
246MCUX_CSSL_ANALYSIS_START_PATTERN_HYPERLINK_IN_COMMENTS()
277MCUX_CSSL_ANALYSIS_STOP_PATTERN_HYPERLINK_IN_COMMENTS()
280 mcuxClSession_Handle_t pSession,
284 uint32_t inSize,
285 mcuxCl_Buffer_t pSignature,
286 uint32_t * const pSignatureSize
287 );
288
289MCUX_CSSL_ANALYSIS_START_PATTERN_HYPERLINK_IN_COMMENTS()
319MCUX_CSSL_ANALYSIS_STOP_PATTERN_HYPERLINK_IN_COMMENTS()
326 uint32_t inSize,
327 mcuxCl_InputBuffer_t pSignature,
328 uint32_t signatureSize
329 );
330
344 mcuxClSession_Handle_t pSession,
346 const uint8_t *pPrivKey
347 );
348
365 mcuxClSession_Handle_t pSession,
366 const mcuxClEcc_EdDSA_DomainParams_t *pDomainParams,
368 uint32_t phflag,
369 mcuxCl_InputBuffer_t pContext,
370 uint32_t contextLen
371 );
372
373
374
404 mcuxClSession_Handle_t pSession,
405 mcuxClEcc_ArithmeticOperation_t arithmeticOperation,
406 mcuxClEcc_Weier_DomainParams_t *pEccWeierDomainParams,
408 uint32_t op1Size,
410 uint32_t op2Size,
411 mcuxCl_Buffer_t pResult,
412 uint32_t * const pResultSize
413 );
414
415
416#ifdef MCUXCL_FEATURE_ECC_ECDSA_DETERMINISTIC
417
438MCUX_CSSL_ANALYSIS_START_SUPPRESS_DECLARED_BUT_NEVER_DEFINED("Definition is provided assuming library is built properly")
439MCUX_CSSL_FP_FUNCTION_DECL(mcuxClEcc_ECDSA_GenerateProtocolDescriptor_Deterministic)
440MCUX_CSSL_FP_PROTECTED_TYPE(mcuxClEcc_Status_t) mcuxClEcc_ECDSA_GenerateProtocolDescriptor_Deterministic(
442 mcuxClEcc_ECDSA_SignatureProtocolDescriptor_t * const pProtocolDescriptor,
443 mcuxClMac_Mode_t hmacMode
444 );
445MCUX_CSSL_ANALYSIS_STOP_SUPPRESS_DECLARED_BUT_NEVER_DEFINED()
446#define mcuxClEcc_DeterministicECDSA_GenerateProtocolDescriptor mcuxClEcc_ECDSA_GenerateProtocolDescriptor_Deterministic
447#endif /* MCUXCL_FEATURE_ECC_ECDSA_DETERMINISTIC */
448
449
455 mcuxClSession_Handle_t pSession,
457
458 /* mcuxClEcc_Functions */
462
463
464#ifdef __cplusplus
465} /* extern "C" */
466#endif
467
468#endif /* MCUXCLECC_FUNCTIONS_H_ */
Top-level include file for the mcuxClBuffer component.
Definition of function identifiers for the flow protection mechanism.
Type definitions and descriptors of mcuxClEcc component.
Top-level include file for the mcuxClKey component.
Top-level include file for the mcuxClMac component.
Top-level include file for the mcuxClSession component.
Provides the API for the CSSL flow protection mechanism.
const uint8_t * mcuxCl_InputBuffer_t
Input buffer type.
Definition mcuxClBuffer_Pointer.h:58
uint8_t * mcuxCl_Buffer_t
Input/output buffer type.
Definition mcuxClBuffer_Pointer.h:67
mcuxClEcc_Status_t mcuxClEcc_MontDH_KeyAgreement(mcuxClSession_Handle_t pSession, mcuxClKey_Handle_t key, mcuxClKey_Handle_t otherKey, uint8_t *pOut, uint32_t *const pOutLength)
Implements the MontDH key agreement according to rfc7748.
mcuxClEcc_Status_t mcuxClEcc_EdDSA_GenerateKeyPair(mcuxClSession_Handle_t pSession, const mcuxClEcc_EdDSA_GenerateKeyPairDescriptor_t *mode, mcuxClKey_Handle_t privKey, mcuxClKey_Handle_t pubKey)
This function implements the EdDSA key pair generation for Ed25519 and Ed448 as specified in rfc8032 ...
mcuxClEcc_Status_t mcuxClEcc_Sign(mcuxClSession_Handle_t pSession, const mcuxClEcc_Sign_Param_t *pParam)
implements ECDSA signature generation.
mcuxClEcc_Status_t mcuxClEcc_EdDSA_GenerateProtocolDescriptor(mcuxClSession_Handle_t pSession, const mcuxClEcc_EdDSA_DomainParams_t *pDomainParams, mcuxClEcc_EdDSA_SignatureProtocolDescriptor_t *pProtocolDescriptor, uint32_t phflag, mcuxCl_InputBuffer_t pContext, uint32_t contextLen)
This function implements the protocol descriptor generation for Ed25519ctx, Ed25519ph,...
mcuxClEcc_Status_t mcuxClEcc_MontDH_GenerateKeyPair(mcuxClSession_Handle_t pSession, mcuxClKey_Handle_t privKey, mcuxClKey_Handle_t pubKey)
implements ECC key pair generation step for a MontDH key agreement according to rfc7748.
mcuxClKey_Status_t mcuxClEcc_WeierECC_PublicKeyValidation(mcuxClSession_Handle_t pSession, mcuxClKey_Handle_t key)
ECC public key validation function.
mcuxClEcc_Status_t mcuxClEcc_EdDSA_InitPrivKeyInputMode(mcuxClSession_Handle_t pSession, mcuxClEcc_EdDSA_GenerateKeyPairDescriptor_t *mode, const uint8_t *pPrivKey)
This function initializes an EdDSA mode descriptor for EdDSA key pair generation with private key inp...
mcuxClEcc_Status_t mcuxClEcc_Verify(mcuxClSession_Handle_t pSession, const mcuxClEcc_Verify_Param_t *pParam)
implements ECDSA signature verification.
mcuxClEcc_Status_t mcuxClEcc_ArithmeticOperation(mcuxClSession_Handle_t pSession, mcuxClEcc_ArithmeticOperation_t arithmeticOperation, mcuxClEcc_Weier_DomainParams_t *pEccWeierDomainParams, mcuxCl_InputBuffer_t pOp1, uint32_t op1Size, mcuxCl_InputBuffer_t pOp2, uint32_t op2Size, mcuxCl_Buffer_t pResult, uint32_t *const pResultSize)
Function to perform ECC arithmetic operations.
mcuxClEcc_Status_t mcuxClEcc_PointMult(mcuxClSession_Handle_t pSession, const mcuxClEcc_PointMult_Param_t *pParam)
implements ECC point multiplication.
mcuxClEcc_Status_t mcuxClEcc_KeyGen(mcuxClSession_Handle_t pSession, const mcuxClEcc_KeyGen_Param_t *pParam)
implements ECDSA key generation.
mcuxClEcc_Status_t mcuxClEcc_EdDSA_VerifySignature(mcuxClSession_Handle_t session, mcuxClKey_Handle_t key, const mcuxClEcc_EdDSA_SignatureProtocolDescriptor_t *mode, mcuxCl_InputBuffer_t pIn, uint32_t inSize, mcuxCl_InputBuffer_t pSignature, uint32_t signatureSize)
This function implements the EdDSA signature verification for Ed25519 and Ed448 as specified in rfc80...
mcuxClEcc_Status_t mcuxClEcc_EdDSA_GenerateSignature(mcuxClSession_Handle_t pSession, mcuxClKey_Handle_t key, const mcuxClEcc_EdDSA_SignatureProtocolDescriptor_t *mode, mcuxCl_InputBuffer_t pIn, uint32_t inSize, mcuxCl_Buffer_t pSignature, uint32_t *const pSignatureSize)
This function implements the EdDSA signature generation for Ed25519 and Ed448 as specified in rfc8032...
const mcuxClEcc_ArithmeticOperationDescriptor_t * mcuxClEcc_ArithmeticOperation_t
ECC arithmetic operation type.
Definition mcuxClEcc_Types.h:113
struct mcuxClEcc_EdDSA_DomainParams mcuxClEcc_EdDSA_DomainParams_t
Type for EdDSA domain parameters.
Definition mcuxClEcc_Types.h:78
struct mcuxClEcc_ECDSA_SignatureProtocolDescriptor mcuxClEcc_ECDSA_SignatureProtocolDescriptor_t
ECDSA SignatureProtocol variant descriptor type.
Definition mcuxClEcc_Types.h:127
struct mcuxClEcc_EdDSA_GenerateKeyPairDescriptor mcuxClEcc_EdDSA_GenerateKeyPairDescriptor_t
EdDSA GenerateKeyPair variant descriptor type.
Definition mcuxClEcc_Types.h:88
struct mcuxClEcc_EdDSA_SignatureProtocolDescriptor mcuxClEcc_EdDSA_SignatureProtocolDescriptor_t
EdDSA SignatureProtocol variant descriptor type.
Definition mcuxClEcc_Types.h:98
uint32_t mcuxClEcc_Status_t
Type for mcuxClEcc component return codes.
Definition mcuxClEcc_Types.h:65
struct mcuxClEcc_Weier_DomainParams mcuxClEcc_Weier_DomainParams_t
Type for Weierstrass ECC domain parameters.
Definition mcuxClEcc_Types.h:116
uint32_t mcuxClKey_Status_t
Type for Key component error codes.
Definition mcuxClKey_Types.h:67
mcuxClKey_Descriptor_t *const mcuxClKey_Handle_t
Key handle type.
Definition mcuxClKey_Types.h:108
const mcuxClMac_ModeDescriptor_t *const mcuxClMac_Mode_t
MAC mode/algorithm type.
Definition mcuxClMac_Types.h:87
mcuxClSession_Descriptor_t *const mcuxClSession_Handle_t
Type for mcuxClSession Handle.
Definition mcuxClSession_Types.h:133
#define MCUX_CSSL_FP_FUNCTION_DECL(...)
Declaration of a flow protected function.
Definition mcuxCsslFlowProtection.h:145
#define MCUX_CSSL_FP_PROTECTED_TYPE(resultType)
Based on a given base type, builds a return type with flow protection.
Definition mcuxCsslFlowProtection.h:101
Parameter structure for function mcuxClEcc_KeyGen.
Definition mcuxClEcc_Types.h:165
Parameter structure for function mcuxClEcc_Sign.
Definition mcuxClEcc_Types.h:178
Parameter structure for function mcuxClEcc_Verify.
Definition mcuxClEcc_Types.h:198
Parameter structure for function mcuxClEcc_PointMult.
Definition mcuxClEcc_Types.h:221