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-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
20#ifndef MCUXCLECC_TYPES_H_
21#define MCUXCLECC_TYPES_H_
22
23
24#include <mcuxClCore_Platform.h>
26#include <mcuxClEcc_Constants.h>
27#include <mcuxCsslAnalysis.h>
28#include <mcuxClBuffer.h>
29
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
45typedef uint32_t mcuxClEcc_Status_t;
46
51
52
54typedef struct mcuxClEcc_MontDH_DomainParams mcuxClEcc_MontDH_DomainParams_t;
55
56
58typedef struct mcuxClEcc_EdDSA_DomainParams mcuxClEcc_EdDSA_DomainParams_t;
59
63struct mcuxClEcc_EdDSA_GenerateKeyPairDescriptor;
64
68typedef struct mcuxClEcc_EdDSA_GenerateKeyPairDescriptor mcuxClEcc_EdDSA_GenerateKeyPairDescriptor_t;
69
73struct mcuxClEcc_EdDSA_SignatureProtocolDescriptor;
74
78typedef struct mcuxClEcc_EdDSA_SignatureProtocolDescriptor mcuxClEcc_EdDSA_SignatureProtocolDescriptor_t;
79
80
82typedef struct mcuxClEcc_Weier_DomainParams mcuxClEcc_Weier_DomainParams_t;
83
84
88struct mcuxClEcc_ECDSA_SignatureProtocolDescriptor;
89
93typedef struct mcuxClEcc_ECDSA_SignatureProtocolDescriptor mcuxClEcc_ECDSA_SignatureProtocolDescriptor_t;
94
95/**********************************************************/
96/* Parameter structure of mcuxClEcc APIs */
97/**********************************************************/
98
104typedef struct
105{
114 uint32_t misc;
119
121#define mcuxClEcc_DomainParam_misc_Pack(byteLenN, byteLenP) MCUXCLPKC_PACKARGS4(0u, 0u, (uint8_t) byteLenN, (uint8_t) byteLenP)
122#define mcuxClEcc_DomainParam_misc_byteLenP_offset 0
123#define mcuxClEcc_DomainParam_misc_byteLenP_mask ((uint32_t) 0x000000FFu)
124#define mcuxClEcc_DomainParam_misc_byteLenN_offset 8
125#define mcuxClEcc_DomainParam_misc_byteLenN_mask ((uint32_t) 0x0000FF00u)
126
127
128
130typedef struct
131{
133 uint8_t * pPrivateKey;
135 uint8_t * pPublicKey;
137 uint32_t optLen;
140
141
143typedef struct
144{
147 const uint8_t * pPrivateKey;
151 uint32_t optLen;
156
158#define mcuxClEcc_Sign_Param_optLen_Pack(byteLenHash) ((uint32_t) (byteLenHash) & 0xFFu)
159#define mcuxClEcc_Sign_Param_optLen_byteLenHash_offset 0
160#define mcuxClEcc_Sign_Param_optLen_byteLenHash_mask ((uint32_t) 0x000000FFu)
161
163typedef struct
164{
171 const uint8_t * pPublicKey;
174 uint32_t optLen;
178
180#define mcuxClEcc_Verify_Param_optLen_Pack(byteLenHash) ((uint32_t) (byteLenHash) & 0xFFu)
181#define mcuxClEcc_Verify_Param_optLen_byteLenHash_offset 0
182#define mcuxClEcc_Verify_Param_optLen_byteLenHash_mask ((uint32_t) 0x000000FFu)
183
184
186typedef struct
187{
193 uint32_t optLen;
196
197 /* mcuxClEcc_Types */
201
202
203/**********************************************************/
204/* Descriptors of mcuxClEcc APIs */
205/**********************************************************/
219/**********************************************************/
220/* Key pair generation descriptors */
221/**********************************************************/
222
223/* EdDSA key pair generation descriptor to be used when the private key shall be generated by the
224 * EdDSA key pair generation function */
225extern const mcuxClEcc_EdDSA_GenerateKeyPairDescriptor_t mcuxClEcc_EdDsa_GeneratePrivKeyDescriptor;
226
227
228/**********************************************************/
229/* Signature ProtocolDescriptors and ModeDescriptors */
230/**********************************************************/
231
232
243
244 /* mcuxClEcc_EdDsaDescriptors */
246
247
248
254/* Standard ECDSA (according to FIPS 186-5) signature protocol descriptor */
255extern const mcuxClEcc_ECDSA_SignatureProtocolDescriptor_t mcuxClEcc_ECDSA_ProtocolDescriptor;
256
257 /* mcuxClEcc_ECDSADescriptors */
259 /* mcuxClEcc_Descriptors */
263
271/* secp160k1 domain parameters */
272extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_secp160k1;
273
274/* secp192k1 domain parameters */
275extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_secp192k1;
276
277/* sec224k1 domain parameters */
278extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_secp224k1;
279
280/* secp256k1 domain parameters */
281extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_secp256k1;
282
283/* secp192r1 (nistp192r1, ansix9p192r1) domain parameters */
284extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_secp192r1;
285#define mcuxClEcc_Weier_DomainParams_NIST_P192 mcuxClEcc_Weier_DomainParams_secp192r1
286#define mcuxClEcc_Weier_DomainParams_ansix9p192r1 mcuxClEcc_Weier_DomainParams_secp192r1
287
288/* secp224r1 (nistp224r1, ansix9p224r1) domain parameters */
289extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_secp224r1;
290#define mcuxClEcc_Weier_DomainParams_NIST_P224 mcuxClEcc_Weier_DomainParams_secp224r1
291#define mcuxClEcc_Weier_DomainParams_ansix9p224r1 mcuxClEcc_Weier_DomainParams_secp224r1
292
293/* secp256r1 (nistp256r1, ansix9p256r1) domain parameters */
294extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_secp256r1;
295#define mcuxClEcc_Weier_DomainParams_NIST_P256 mcuxClEcc_Weier_DomainParams_secp256r1
296#define mcuxClEcc_Weier_DomainParams_ansix9p256r1 mcuxClEcc_Weier_DomainParams_secp256r1
297
298/* secp384r1 (nistp384r1, ansix9p384r1) domain parameters */
299extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_secp384r1;
300#define mcuxClEcc_Weier_DomainParams_NIST_P384 mcuxClEcc_Weier_DomainParams_secp384r1
301#define mcuxClEcc_Weier_DomainParams_ansix9p384r1 mcuxClEcc_Weier_DomainParams_secp384r1
302
303/* secp521r1 (nistp521r1, ansix9p521r1) domain parameters */
304extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_secp521r1;
305#define mcuxClEcc_Weier_DomainParams_NIST_P521 mcuxClEcc_Weier_DomainParams_secp521r1
306#define mcuxClEcc_Weier_DomainParams_ansix9p521r1 mcuxClEcc_Weier_DomainParams_secp521r1
307
308/* brainpoolP160r1 domain parameters */
309extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP160r1;
310
311/* brainpoolP192r1 domain parameters */
312extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP192r1;
313
314/* brainpoolP224r1 domain parameters */
315extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP224r1;
316
317/* brainpoolP256r1 domain parameters */
318extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP256r1;
319
320/* brainpoolP320r1 domain parameters */
321extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP320r1;
322
323/* brainpoolP384r1 domain parameters */
324extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP384r1;
325
326/* brainpoolP512r1 domain parameters */
327extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP512r1;
328
329/* brainpoolP160t1 domain parameters */
330extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP160t1;
331
332/* brainpoolP192t1 domain parameters */
333extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP192t1;
334
335/* brainpoolP224t1 domain parameters */
336extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP224t1;
337
338/* brainpoolP256t1 domain parameters */
339extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP256t1;
340
341/* brainpoolP320t1 domain parameters */
342extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP320t1;
343
344/* brainpoolP384t1 domain parameters */
345extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP384t1;
346
347/* brainpoolP512t1 domain parameters */
348extern const mcuxClEcc_Weier_DomainParams_t mcuxClEcc_Weier_DomainParams_brainpoolP512t1;
349
350
351/* Ed25519 domain parameters */
352extern const mcuxClEcc_EdDSA_DomainParams_t mcuxClEcc_EdDSA_DomainParams_Ed25519;
353 /* mcuxClEcc_DomainParamsDescriptor */
357
358
359 /* mcuxClEcc_ArithmeticOperation */
375
376
377#ifdef __cplusplus
378} /* extern "C" */
379#endif
380
381#endif /* MCUXCLECC_TYPES_H_ */
Provides the API for the CL buffer types.
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:46
uint8_t * mcuxCl_Buffer_t
Input/output buffer type.
Definition mcuxClBuffer_Pointer.h:55
struct mcuxClEcc_EdDSA_DomainParams mcuxClEcc_EdDSA_DomainParams_t
Type for EdDSA domain parameters.
Definition mcuxClEcc_Types.h:58
mcuxClEcc_Status_t mcuxClEcc_Status_Protected_t
Deprecated type for mcuxClEcc component return codes.
Definition mcuxClEcc_Types.h:50
struct mcuxClEcc_MontDH_DomainParams mcuxClEcc_MontDH_DomainParams_t
Type for MontDH domain parameters.
Definition mcuxClEcc_Types.h:54
struct mcuxClEcc_ECDSA_SignatureProtocolDescriptor mcuxClEcc_ECDSA_SignatureProtocolDescriptor_t
ECDSA SignatureProtocol variant descriptor type.
Definition mcuxClEcc_Types.h:93
struct mcuxClEcc_EdDSA_GenerateKeyPairDescriptor mcuxClEcc_EdDSA_GenerateKeyPairDescriptor_t
EdDSA GenerateKeyPair variant descriptor type.
Definition mcuxClEcc_Types.h:68
struct mcuxClEcc_EdDSA_SignatureProtocolDescriptor mcuxClEcc_EdDSA_SignatureProtocolDescriptor_t
EdDSA SignatureProtocol variant descriptor type.
Definition mcuxClEcc_Types.h:78
uint32_t mcuxClEcc_Status_t
Type for mcuxClEcc component return codes.
Definition mcuxClEcc_Types.h:45
struct mcuxClEcc_Weier_DomainParams mcuxClEcc_Weier_DomainParams_t
Type for Weierstrass ECC domain parameters.
Definition mcuxClEcc_Types.h:82
#define MCUX_CSSL_FP_PROTECTED_TYPE(resultType)
Based on a given base type, builds a return type with flow protection.
Definition mcuxCsslFlowProtection.h:81
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:105
mcuxCl_InputBuffer_t pG
[in] InputBuffer for octet string of base point G.
Definition mcuxClEcc_Types.h:110
uint32_t misc
[in] packed lengths, via mcuxClEcc_DomainParam_misc_Pack: bits 0~ 7: byteLenP: length of the octet st...
Definition mcuxClEcc_Types.h:114
mcuxCl_InputBuffer_t pB
[in] InputBuffer for octet string of curve parameter b (< p), of which the length is byteLenP.
Definition mcuxClEcc_Types.h:107
mcuxCl_InputBuffer_t pP
[in] InputBuffer for octet string of prime modulus p, of which the length is byteLenP.
Definition mcuxClEcc_Types.h:108
mcuxCl_InputBuffer_t pN
[in] InputBuffer for octet string of base point order n, of which the length is byteLenN.
Definition mcuxClEcc_Types.h:112
mcuxCl_InputBuffer_t pA
[in] InputBuffer for octet string of curve parameter a (< p), of which the length is byteLenP.
Definition mcuxClEcc_Types.h:106
Parameter structure for function mcuxClEcc_KeyGen.
Definition mcuxClEcc_Types.h:131
mcuxClEcc_DomainParam_t curveParam
[in] structure of InputBuffers for curve parameters and length of parameters.
Definition mcuxClEcc_Types.h:132
uint8_t * pPrivateKey
[out] pointer to memory area, where the private key will be exported if KeyGen is executed successful...
Definition mcuxClEcc_Types.h:133
uint32_t optLen
[in] packed options (reserved): bits 0~31: reserved.
Definition mcuxClEcc_Types.h:137
uint8_t * pPublicKey
[out] pointer to memory area, where the public key will be exported if KeyGen is executed successfull...
Definition mcuxClEcc_Types.h:135
Parameter structure for function mcuxClEcc_Sign.
Definition mcuxClEcc_Types.h:144
mcuxCl_InputBuffer_t pHash
[in] InputBuffer for string of message digest (hash), of which the length is byteLenHash (in optLen).
Definition mcuxClEcc_Types.h:146
const mcuxClEcc_ECDSA_SignatureProtocolDescriptor_t * pMode
[in] pointer to ECDSA protocol descriptor.
Definition mcuxClEcc_Types.h:154
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:147
mcuxClEcc_DomainParam_t curveParam
[in] structure of InputBuffers for curve parameters and length of parameters.
Definition mcuxClEcc_Types.h:145
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:148
uint32_t optLen
[in] packed options (reserved) and lengths: bits 0~7: byteLenHash: length of the string of message di...
Definition mcuxClEcc_Types.h:151
Parameter structure for function mcuxClEcc_Verify.
Definition mcuxClEcc_Types.h:164
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:166
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:171
mcuxCl_InputBuffer_t pHash
[in] InputBuffer for string of message digest (hash), of which the length is byteLenHash (in optLen).
Definition mcuxClEcc_Types.h:168
mcuxClEcc_DomainParam_t curveParam
[in] structure of InputBuffers for curve parameters and length of parameters.
Definition mcuxClEcc_Types.h:165
mcuxCl_InputBuffer_t pSignature
[in] InputBuffer for to octet string of signature R and S.
Definition mcuxClEcc_Types.h:169
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:172
uint32_t optLen
[in] packed options (reserved) and lengths: bits 0~7: byteLenHash: length of the string of message di...
Definition mcuxClEcc_Types.h:174
Parameter structure for function mcuxClEcc_PointMult.
Definition mcuxClEcc_Types.h:187
uint32_t optLen
[in] packed options (reserved): bits 0~31: reserved.
Definition mcuxClEcc_Types.h:193
mcuxClEcc_DomainParam_t curveParam
[in] structure of InputBuffers for curve parameters and length of parameters.
Definition mcuxClEcc_Types.h:188
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:189
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:191
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:190