MCUX CLNS
MCUX Crypto Library Normal Secure
Loading...
Searching...
No Matches
mcuxClEcc_Functions

Defines all functions of mcuxClEcc. More...

Functions

mcuxClEcc_Status_t mcuxClEcc_EdDSA_InitPrivKeyInputMode (mcuxClSession_Handle_t pSession, mcuxClKey_GenerationDescriptor_t *generationMode, const uint8_t *pPrivKey)
 This function initializes an EdDSA mode descriptor for EdDSA key pair generation with private key input.
mcuxClEcc_Status_t mcuxClEcc_EdDSA_GenerateSignatureModeDescriptor (mcuxClSession_Handle_t pSession, const mcuxClEcc_EdDSA_DomainParams_t *pDomainParams, mcuxClSignature_ModeDescriptor_t *pSignatureMode, uint32_t phflag, mcuxCl_InputBuffer_t pContext, uint32_t contextLen)
 This function implements the signature mode descriptor generation for Ed25519ctx, Ed25519ph, Ed448 and Ed448ph.
mcuxClEcc_Status_t mcuxClEcc_WeierECC_GenerateDomainParams (mcuxClSession_Handle_t pSession, mcuxClEcc_Weier_DomainParams_t *pEccWeierDomainParams, mcuxClEcc_Weier_BasicDomainParams_t *pEccWeierBasicDomainParams, uint32_t options)
 ECC Weierstrass custom domain parameter generation function.
mcuxClEcc_Status_t mcuxClEcc_WeierECC_GenerateCustomKeyType (mcuxClKey_CustomType_t customType, mcuxClKey_AlgorithmId_t algoId, mcuxClKey_Size_t size, void *pCustomParams, mcuxClKey_Encoding_t plainEncoding)
 Key type constructor.
mcuxClEcc_Status_t mcuxClEcc_WeierECC_DecodePoint (mcuxClSession_Handle_t pSession, mcuxCl_InputBuffer_t pEncodedPoint, mcuxCl_Buffer_t pDecodedPoint, mcuxClEcc_WeierECC_PointEncType_t pointEncType, mcuxClEcc_Weier_DomainParams_t *pEccWeierDomainParams)
 Point decoding function.

Detailed Description

Defines all functions of mcuxClEcc.

Function Documentation

◆ mcuxClEcc_EdDSA_InitPrivKeyInputMode()

mcuxClEcc_Status_t mcuxClEcc_EdDSA_InitPrivKeyInputMode ( mcuxClSession_Handle_t pSession,
mcuxClKey_GenerationDescriptor_t * generationMode,
const uint8_t * pPrivKey )

This function initializes an EdDSA mode descriptor for EdDSA key pair generation with private key input.

Parameters
[in]pSessionHandle for the current CL session
[in/out]generationMode Pointer to mode descriptor to be initialized for EdDSA key pair generation with private key input
[in]pPrivKeyPointer to private key input
Returns
A code-flow protected error code (see MCUXCLECC_STATUS_)
Return values
MCUXCLECC_STATUS_OKEdDSA mode descriptor has been initialized successfully
MCUXCLECC_STATUS_FAULT_ATTACKfault attack (unexpected behavior) is detected
Examples
mcuxClEcc_EdDSA_Ed25519ctx_example.c, mcuxClEcc_EdDSA_Ed25519ph_example.c, and mcuxClEcc_EdDSA_GenerateSignature_Ed25519_example.c.

◆ mcuxClEcc_EdDSA_GenerateSignatureModeDescriptor()

mcuxClEcc_Status_t mcuxClEcc_EdDSA_GenerateSignatureModeDescriptor ( mcuxClSession_Handle_t pSession,
const mcuxClEcc_EdDSA_DomainParams_t * pDomainParams,
mcuxClSignature_ModeDescriptor_t * pSignatureMode,
uint32_t phflag,
mcuxCl_InputBuffer_t pContext,
uint32_t contextLen )

This function implements the signature mode descriptor generation for Ed25519ctx, Ed25519ph, Ed448 and Ed448ph.

Parameters
[in]pSessionHandle for the current CL session
[in]pDomainParamsPointer to domain parameters of the used curve
[in]pSignatureModeMode descriptor specifying the EdDSA variant
[in]phflagOption whether pre-hashing is enabled
[in]pContextUser input context for the hash prefix
[in]contextLenLength of the context
Returns
A code-flow protected error code (see MCUXCLECC_STATUS_)
Return values
MCUXCLECC_STATUS_OKEdDSA signature mode descriptor generated successfully
MCUXCLECC_STATUS_FAULT_ATTACKfault attack (unexpected behavior) is detected
Examples
mcuxClEcc_EdDSA_Ed25519ctx_example.c, and mcuxClEcc_EdDSA_Ed25519ph_example.c.

◆ mcuxClEcc_WeierECC_GenerateDomainParams()

mcuxClEcc_Status_t mcuxClEcc_WeierECC_GenerateDomainParams ( mcuxClSession_Handle_t pSession,
mcuxClEcc_Weier_DomainParams_t * pEccWeierDomainParams,
mcuxClEcc_Weier_BasicDomainParams_t * pEccWeierBasicDomainParams,
uint32_t options )

ECC Weierstrass custom domain parameter generation function.

Given pointers and lengths specifying domain parameters of a custom (short) Weierstrass curve with cofactor 1, this function generates a corresponding optimized custom domain parameter struct.

Parameters
pSessionHandle for the current CL session.
[out]pEccWeierDomainParamsPointer to memory area in which the optimized domain parameters shall be stored.
[in]pEccWeierBasicDomainParamsPointer to struct containing pointers and lengths specifying the custom domain parameters.
[in]optionsParameter specifying whether or not the pre-computed point (2 ^ (byteLenN * 4)) * G corresponding to the base point G shall be calculated or not, If set to
  • MCUXCLECC_OPTION_GENERATEPRECPOINT_YES, the pre-computed point will be calculated
  • MCUXCLECC_OPTION_GENERATEPRECPOINT_NO, the pre-computed point will not be calculated
Attention
the generated optimized domain parameter cannot be copied or moved, but shall be used in the original memory address where it is generated.
Returns
A code-flow protected error code (see MCUXCLECC_STATUS_)
Return values
MCUXCLECC_STATUS_OKif optimized domain parameters are generated successfully;
MCUXCLECC_STATUS_INVALID_PARAMSif parameters are invalid;
MCUXCLECC_STATUS_FAULT_ATTACKif fault attack (unexpected behavior) is detected.
Examples
mcuxClEcc_WeierECC_CustomEccWeierType_BN256_example.c.

◆ mcuxClEcc_WeierECC_GenerateCustomKeyType()

mcuxClEcc_Status_t mcuxClEcc_WeierECC_GenerateCustomKeyType ( mcuxClKey_CustomType_t customType,
mcuxClKey_AlgorithmId_t algoId,
mcuxClKey_Size_t size,
void * pCustomParams,
mcuxClKey_Encoding_t plainEncoding )

Key type constructor.

This function allows to generate custom key types according to the passed algoId.

Parameters
[out]customTypeHandle for the custom key type.
[in]algoIdAlgorithm identifier specifying the key type descriptor to be generated. The supported algoIds are
  • MCUXCLKEY_ALGO_ID_ECC_SHWS_GFP_EPHEMERAL_CUSTOM | MCUXCLKEY_ALGO_ID_PUBLIC_KEY
  • MCUXCLKEY_ALGO_ID_ECC_SHWS_GFP_EPHEMERAL_CUSTOM | MCUXCLKEY_ALGO_ID_PRIVATE_KEY
  • MCUXCLKEY_ALGO_ID_ECC_SHWS_GFP_EPHEMERAL_CUSTOM | MCUXCLKEY_ALGO_ID_KEY_PAIR
  • MCUXCLKEY_ALGO_ID_ECC_SHWS_GFP_STATIC_CUSTOM | MCUXCLKEY_ALGO_ID_PUBLIC_KEY
  • MCUXCLKEY_ALGO_ID_ECC_SHWS_GFP_STATIC_CUSTOM | MCUXCLKEY_ALGO_ID_PRIVATE_KEY
  • MCUXCLKEY_ALGO_ID_ECC_SHWS_GFP_STATIC_CUSTOM | MCUXCLKEY_ALGO_ID_KEY_PAIR All other values will trigger an error.
[in]sizeAlgorithm based key size.
[in]pCustomParamsPointer to algorithm based custom parameters. If algoId & MCUXCLKEY_ALGO_ID_ALGO_MASK equals
  • MCUXCLKEY_ALGO_ID_ECC_SHWS_GFP_EPHEMERAL_CUSTOM, a pointer to an mcuxClEcc_Weier_BasicDomainParams_t struct specifying custom ECC Weierstrass domain parameters
  • MCUXCLKEY_ALGO_ID_ECC_SHWS_GFP_STATIC_CUSTOM, a pointer to an mcuxClEcc_Weier_DomainParams_t struct specifying optimized custom ECC Weierstrass domain parameters In all other cases, the pointer shall be set to NULL
[in]plainEncodingThe plain encoding function for the key.
Returns
status
Return values
MCUXCLECC_STATUS_OKif custom key type is generated successfully;
MCUXCLECC_STATUS_INVALID_PARAMSif Parameters are invalid.
MCUXCLECC_STATUS_FAULT_ATTACKif fault attack (unexpected behavior) is detected.
Examples
mcuxClEcc_WeierECC_CustomEccWeierType_BN256_example.c.

◆ mcuxClEcc_WeierECC_DecodePoint()

mcuxClEcc_Status_t mcuxClEcc_WeierECC_DecodePoint ( mcuxClSession_Handle_t pSession,
mcuxCl_InputBuffer_t pEncodedPoint,
mcuxCl_Buffer_t pDecodedPoint,
mcuxClEcc_WeierECC_PointEncType_t pointEncType,
mcuxClEcc_Weier_DomainParams_t * pEccWeierDomainParams )

Point decoding function.

Given a point on a short Weierstrass curve defined over the prime p in encoded form, this decoding function derives its plain format given by its x- and y-coordinates.

The following encoding variants are supported:

  • SEC encoding according to SEC 1: Elliptic Curve Cryptography

For each encoding variant dedicated point encoding type descriptors and buffer for the encoded points are available. Please refer to the definition of these descriptors for further information about the respective encoding.

Parameters
pSessionHandle for the current CL session.
[in]pEncodedPointPointer to buffer containing the encoded point. The size of the buffer depends on the encoding variant.
[out]pDecodedPointPointer to buffer to where the x- and y-coordinates, both elements of GF(p), of the decoded point (x,y) shall be written. The coordinates x and y are written one after another in big endian format with byte length equal to the byte length of p. If MCUXCLECC_STATUS_NEUTRAL_POINT is returned, nothing is written to this buffer.
[in]pointEncTypePoint encoding type specifying all information needed about the applied point encoding format.
[in]pEccWeierDomainParamsPointer to short Weierstrass curve custom parameters.
Returns
status
Return values
MCUXCLECC_STATUS_OKif the point decoding was successful;
MCUXCLECC_STATUS_NEUTRAL_POINTif the encoded point is the neutral point;
MCUXCLECC_STATUS_INVALID_PARAMSif Parameters are invalid.
MCUXCLECC_STATUS_FAULT_ATTACKif fault attack (unexpected behavior) is detected.
Examples
mcuxClEcc_WeierECC_DecodePoint_brainpoolP384r1_example.c, and mcuxClEcc_WeierECC_DecodePoint_secp224r1_example.c.