MCUX CLNS
MCUX Crypto Library Normal Secure
Loading...
Searching...
No Matches
mcuxClEcc_Types.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/* Copyright 2020-2024 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_TYPES_H_
41#define MCUXCLECC_TYPES_H_
42
43
44#include <mcuxClCore_Platform.h>
46#include <mcuxClEcc_Constants.h>
47#include <mcuxCsslAnalysis.h>
48#include <mcuxClBuffer.h>
49
50
51#ifdef __cplusplus
52extern "C" {
53#endif
54
61
65typedef uint32_t mcuxClEcc_Status_t;
66
71
72
74typedef struct mcuxClEcc_MontDH_DomainParams mcuxClEcc_MontDH_DomainParams_t;
75
76
78typedef struct mcuxClEcc_EdDSA_DomainParams mcuxClEcc_EdDSA_DomainParams_t;
79
83struct mcuxClEcc_EdDSA_GenerateKeyPairDescriptor;
84
88typedef struct mcuxClEcc_EdDSA_GenerateKeyPairDescriptor mcuxClEcc_EdDSA_GenerateKeyPairDescriptor_t;
89
93struct mcuxClEcc_EdDSA_SignatureProtocolDescriptor;
94
98typedef struct mcuxClEcc_EdDSA_SignatureProtocolDescriptor mcuxClEcc_EdDSA_SignatureProtocolDescriptor_t;
99
103struct mcuxClEcc_ArithmeticOperationDescriptor;
104
108typedef struct mcuxClEcc_ArithmeticOperationDescriptor mcuxClEcc_ArithmeticOperationDescriptor_t;
109
114
116typedef struct mcuxClEcc_Weier_DomainParams mcuxClEcc_Weier_DomainParams_t;
117
118
122struct mcuxClEcc_ECDSA_SignatureProtocolDescriptor;
123
127typedef struct mcuxClEcc_ECDSA_SignatureProtocolDescriptor mcuxClEcc_ECDSA_SignatureProtocolDescriptor_t;
128
129/**********************************************************/
130/* Parameter structure of mcuxClEcc APIs */
131/**********************************************************/
132
153
155#define mcuxClEcc_DomainParam_misc_Pack(byteLenN, byteLenP) MCUXCLPKC_PACKARGS4(0u, 0u, (uint8_t) byteLenN, (uint8_t) byteLenP)
156#define mcuxClEcc_DomainParam_misc_byteLenP_offset 0
157#define mcuxClEcc_DomainParam_misc_byteLenP_mask ((uint32_t) 0x000000FFu)
158#define mcuxClEcc_DomainParam_misc_byteLenN_offset 8
159#define mcuxClEcc_DomainParam_misc_byteLenN_mask ((uint32_t) 0x0000FF00u)
160
161
162
174
175
190
192#define mcuxClEcc_Sign_Param_optLen_Pack(byteLenHash) ((uint32_t) (byteLenHash) & 0xFFu)
193#define mcuxClEcc_Sign_Param_optLen_byteLenHash_offset 0
194#define mcuxClEcc_Sign_Param_optLen_byteLenHash_mask ((uint32_t) 0x000000FFu)
195
212
214#define mcuxClEcc_Verify_Param_optLen_Pack(byteLenHash) ((uint32_t) (byteLenHash) & 0xFFu)
215#define mcuxClEcc_Verify_Param_optLen_byteLenHash_offset 0
216#define mcuxClEcc_Verify_Param_optLen_byteLenHash_mask ((uint32_t) 0x000000FFu)
217
218
230
231 /* mcuxClEcc_Types */
235
236
237/**********************************************************/
238/* Descriptors of mcuxClEcc APIs */
239/**********************************************************/
246
247
251
252
253/**********************************************************/
254/* Key pair generation descriptors */
255/**********************************************************/
256
257/* EdDSA key pair generation descriptor to be used when the private key shall be generated by the
258 * EdDSA key pair generation function */
259extern const mcuxClEcc_EdDSA_GenerateKeyPairDescriptor_t mcuxClEcc_EdDsa_GeneratePrivKeyDescriptor;
260
261
262/**********************************************************/
263/* Signature ProtocolDescriptors and ModeDescriptors */
264/**********************************************************/
265
266
277
278 /* mcuxClEcc_EdDsaDescriptors */
280
281
282
286
287
288/* Standard ECDSA (according to FIPS 186-5) signature protocol descriptor */
289extern const mcuxClEcc_ECDSA_SignatureProtocolDescriptor_t mcuxClEcc_ECDSA_ProtocolDescriptor;
290
291 /* mcuxClEcc_ECDSADescriptors */
293 /* mcuxClEcc_Descriptors */
297
304
305/* secp160k1 domain parameters */
306extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_secp160k1;
307
308/* secp192k1 domain parameters */
309extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_secp192k1;
310
311/* sec224k1 domain parameters */
312extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_secp224k1;
313
314/* secp256k1 domain parameters */
315extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_secp256k1;
316
317/* secp192r1 (nistp192r1, ansix9p192r1) domain parameters */
318extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_secp192r1;
319#define mcuxClEcc_Weier_DomainParams_NIST_P192 mcuxClEcc_Weier_DomainParams_secp192r1
320#define mcuxClEcc_Weier_DomainParams_ansix9p192r1 mcuxClEcc_Weier_DomainParams_secp192r1
321
322/* secp224r1 (nistp224r1, ansix9p224r1) domain parameters */
323extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_secp224r1;
324#define mcuxClEcc_Weier_DomainParams_NIST_P224 mcuxClEcc_Weier_DomainParams_secp224r1
325#define mcuxClEcc_Weier_DomainParams_ansix9p224r1 mcuxClEcc_Weier_DomainParams_secp224r1
326
327/* secp256r1 (nistp256r1, ansix9p256r1) domain parameters */
328extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_secp256r1;
329#define mcuxClEcc_Weier_DomainParams_NIST_P256 mcuxClEcc_Weier_DomainParams_secp256r1
330#define mcuxClEcc_Weier_DomainParams_ansix9p256r1 mcuxClEcc_Weier_DomainParams_secp256r1
331
332/* secp384r1 (nistp384r1, ansix9p384r1) domain parameters */
333extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_secp384r1;
334#define mcuxClEcc_Weier_DomainParams_NIST_P384 mcuxClEcc_Weier_DomainParams_secp384r1
335#define mcuxClEcc_Weier_DomainParams_ansix9p384r1 mcuxClEcc_Weier_DomainParams_secp384r1
336
337/* secp521r1 (nistp521r1, ansix9p521r1) domain parameters */
338extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_secp521r1;
339#define mcuxClEcc_Weier_DomainParams_NIST_P521 mcuxClEcc_Weier_DomainParams_secp521r1
340#define mcuxClEcc_Weier_DomainParams_ansix9p521r1 mcuxClEcc_Weier_DomainParams_secp521r1
341
342/* brainpoolP160r1 domain parameters */
343extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP160r1;
344
345/* brainpoolP192r1 domain parameters */
346extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP192r1;
347
348/* brainpoolP224r1 domain parameters */
349extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP224r1;
350
351/* brainpoolP256r1 domain parameters */
352extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP256r1;
353
354/* brainpoolP320r1 domain parameters */
355extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP320r1;
356
357/* brainpoolP384r1 domain parameters */
358extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP384r1;
359
360/* brainpoolP512r1 domain parameters */
361extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP512r1;
362
363/* brainpoolP160t1 domain parameters */
364extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP160t1;
365
366/* brainpoolP192t1 domain parameters */
367extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP192t1;
368
369/* brainpoolP224t1 domain parameters */
370extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP224t1;
371
372/* brainpoolP256t1 domain parameters */
373extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP256t1;
374
375/* brainpoolP320t1 domain parameters */
376extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP320t1;
377
378/* brainpoolP384t1 domain parameters */
379extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP384t1;
380
381/* brainpoolP512t1 domain parameters */
382extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP512t1;
383
384
385/* Ed25519 domain parameters */
386extern const mcuxClEcc_EdDSA_DomainParams_t mcuxClEcc_EdDSA_DomainParams_Ed25519;
387 /* mcuxClEcc_DomainParamsDescriptor */
391
392
393
400
405
431MCUX_CSSL_ANALYSIS_START_PATTERN_EXTERNAL_API_DECLARATIONS()
432MCUX_CSSL_ANALYSIS_START_PATTERN_EXTERNAL_API_DEFINITIONS()
435MCUX_CSSL_ANALYSIS_STOP_PATTERN_EXTERNAL_API_DEFINITIONS()
436MCUX_CSSL_ANALYSIS_STOP_PATTERN_EXTERNAL_API_DECLARATIONS()
437
438
443
469MCUX_CSSL_ANALYSIS_START_PATTERN_EXTERNAL_API_DECLARATIONS()
470MCUX_CSSL_ANALYSIS_START_PATTERN_EXTERNAL_API_DEFINITIONS()
473MCUX_CSSL_ANALYSIS_STOP_PATTERN_EXTERNAL_API_DEFINITIONS()
474MCUX_CSSL_ANALYSIS_STOP_PATTERN_EXTERNAL_API_DECLARATIONS()
475
476
477
478
479 /* mcuxClEcc_ArithmeticOperation */
481
482
483#ifdef __cplusplus
484} /* extern "C" */
485#endif
486
487#endif /* MCUXCLECC_TYPES_H_ */
Top-level include file for the mcuxClBuffer component.
Constant definitions of mcuxClEcc 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
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
mcuxClEcc_Status_t mcuxClEcc_Status_Protected_t
Deprecated type for mcuxClEcc component return codes.
Definition mcuxClEcc_Types.h:70
struct mcuxClEcc_MontDH_DomainParams mcuxClEcc_MontDH_DomainParams_t
Type for MontDH domain parameters.
Definition mcuxClEcc_Types.h:74
struct mcuxClEcc_ECDSA_SignatureProtocolDescriptor mcuxClEcc_ECDSA_SignatureProtocolDescriptor_t
ECDSA SignatureProtocol variant descriptor type.
Definition mcuxClEcc_Types.h:127
struct mcuxClEcc_ArithmeticOperationDescriptor mcuxClEcc_ArithmeticOperationDescriptor_t
ECC arithmetic operation descriptor type.
Definition mcuxClEcc_Types.h:108
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
static mcuxClEcc_ArithmeticOperation_t mcuxClEcc_ArithmeticOperation_PointSub
ECC Arithmetic operation type for full point subtraction on a short Weierstrass curve not secured aga...
Definition mcuxClEcc_Types.h:471
const mcuxClEcc_ArithmeticOperationDescriptor_t mcuxClEcc_ArithOpDesc_PointSub
ECC Arithmetic operation descriptor for full point subtraction on a short Weierstrass curve not secur...
const mcuxClEcc_ArithmeticOperationDescriptor_t mcuxClEcc_ArithOpDesc_PointAdd
ECC Arithmetic operation descriptor for full point addition on a short Weierstrass curve not secured ...
static mcuxClEcc_ArithmeticOperation_t mcuxClEcc_ArithmeticOperation_PointAdd
ECC Arithmetic operation type for full point addition on a short Weierstrass curve not secured agains...
Definition mcuxClEcc_Types.h:433
#define MCUX_CSSL_FP_PROTECTED_TYPE(resultType)
Based on a given base type, builds a return type with flow protection.
Definition mcuxCsslFlowProtection.h:101
const mcuxClEcc_EdDSA_SignatureProtocolDescriptor_t mcuxClEcc_EdDsa_Ed25519ProtocolDescriptor
Ed25519 signature protocol descriptor.
Parameter structure of elliptic curve of the form, y^2 = x^3 + a*x + b modulo prime p.
Definition mcuxClEcc_Types.h:139
mcuxCl_InputBuffer_t pG
[in] InputBuffer for octet string of base point G.
Definition mcuxClEcc_Types.h:144
uint32_t misc
[in] packed lengths, via mcuxClEcc_DomainParam_misc_Pack: bits 0~ 7: byteLenP: length of the octet st...
Definition mcuxClEcc_Types.h:148
mcuxCl_InputBuffer_t pB
[in] InputBuffer for octet string of curve parameter b (< p), of which the length is byteLenP.
Definition mcuxClEcc_Types.h:141
mcuxCl_InputBuffer_t pP
[in] InputBuffer for octet string of prime modulus p, of which the length is byteLenP.
Definition mcuxClEcc_Types.h:142
mcuxCl_InputBuffer_t pN
[in] InputBuffer for octet string of base point order n, of which the length is byteLenN.
Definition mcuxClEcc_Types.h:146
mcuxCl_InputBuffer_t pA
[in] InputBuffer for octet string of curve parameter a (< p), of which the length is byteLenP.
Definition mcuxClEcc_Types.h:140
Parameter structure for function mcuxClEcc_KeyGen.
Definition mcuxClEcc_Types.h:165
mcuxClEcc_DomainParam_t curveParam
[in] structure of InputBuffers for curve parameters and length of parameters.
Definition mcuxClEcc_Types.h:166
uint8_t * pPrivateKey
[out] pointer to memory area, where the private key will be exported if KeyGen is executed successful...
Definition mcuxClEcc_Types.h:167
uint32_t optLen
[in] packed options (reserved): bits 0~31: reserved.
Definition mcuxClEcc_Types.h:171
uint8_t * pPublicKey
[out] pointer to memory area, where the public key will be exported if KeyGen is executed successfull...
Definition mcuxClEcc_Types.h:169
Parameter structure for function mcuxClEcc_Sign.
Definition mcuxClEcc_Types.h:178
mcuxCl_InputBuffer_t pHash
[in] InputBuffer for string of message digest (hash), of which the length is byteLenHash (in optLen).
Definition mcuxClEcc_Types.h:180
const mcuxClEcc_ECDSA_SignatureProtocolDescriptor_t * pMode
[in] pointer to ECDSA protocol descriptor.
Definition mcuxClEcc_Types.h:188
const uint8_t * pPrivateKey
[in] pointer to octet string of private key, which is of the same format as base point order n.
Definition mcuxClEcc_Types.h:181
mcuxClEcc_DomainParam_t curveParam
[in] structure of InputBuffers for curve parameters and length of parameters.
Definition mcuxClEcc_Types.h:179
mcuxCl_Buffer_t pSignature
[out] Buffer for memory area in which signature R and S will be exported if signature is generated su...
Definition mcuxClEcc_Types.h:182
uint32_t optLen
[in] packed options (reserved) and lengths: bits 0~7: byteLenHash: length of the string of message di...
Definition mcuxClEcc_Types.h:185
Parameter structure for function mcuxClEcc_Verify.
Definition mcuxClEcc_Types.h:198
mcuxCl_InputBuffer_t pPrecG
[in] InputBuffer for octet string of pre-computed point of base point G, which is of the same format ...
Definition mcuxClEcc_Types.h:200
const uint8_t * pPublicKey
[in] pointer to octet string of public key, which is of the same format as base point G.
Definition mcuxClEcc_Types.h:205
mcuxCl_InputBuffer_t pHash
[in] InputBuffer for string of message digest (hash), of which the length is byteLenHash (in optLen).
Definition mcuxClEcc_Types.h:202
mcuxClEcc_DomainParam_t curveParam
[in] structure of InputBuffers for curve parameters and length of parameters.
Definition mcuxClEcc_Types.h:199
mcuxCl_InputBuffer_t pSignature
[in] InputBuffer for to octet string of signature R and S.
Definition mcuxClEcc_Types.h:203
mcuxCl_Buffer_t pOutputR
[out] Buffer for memory area in which signature R calculated by verify function will be exported if s...
Definition mcuxClEcc_Types.h:206
uint32_t optLen
[in] packed options (reserved) and lengths: bits 0~7: byteLenHash: length of the string of message di...
Definition mcuxClEcc_Types.h:208
Parameter structure for function mcuxClEcc_PointMult.
Definition mcuxClEcc_Types.h:221
uint32_t optLen
[in] packed options (reserved): bits 0~31: reserved.
Definition mcuxClEcc_Types.h:227
mcuxClEcc_DomainParam_t curveParam
[in] structure of InputBuffers for curve parameters and length of parameters.
Definition mcuxClEcc_Types.h:222
mcuxCl_InputBuffer_t pScalar
[in] InputBuffer for octet string of scalar d, which is of the same format as base point order n.
Definition mcuxClEcc_Types.h:223
mcuxCl_Buffer_t pResult
[out] Buffer for memory area, where the result R = dQ will be exported if PointMult is executed succe...
Definition mcuxClEcc_Types.h:225
mcuxCl_InputBuffer_t pPoint
[in] InputBuffer for octet string of EC point Q, which is of the same format as base point G.
Definition mcuxClEcc_Types.h:224