Example for the mcuxClEcc component.
#include <mcuxClCore_Examples.h>
#include <mcuxClExample_Session_Helper.h>
static const uint8_t pPointP1[MCUXCLECC_WEIERECC_NIST_P224_SIZE_PRIMEP * 2u] =
{
0xEFu, 0x53u, 0xB6u, 0x29u, 0x4Au, 0xCAu, 0x43u, 0x1Fu,
0x0Fu, 0x3Cu, 0x22u, 0xDCu, 0x82u, 0xEBu, 0x90u, 0x50u,
0x32u, 0x4Fu, 0x1Du, 0x88u, 0xD3u, 0x77u, 0xE7u, 0x16u,
0x44u, 0x8Eu, 0x50u, 0x7Cu,
0x20u, 0xB5u, 0x10u, 0x00u, 0x40u, 0x92u, 0xE9u, 0x66u,
0x36u, 0xCFu, 0xB7u, 0xE3u, 0x2Eu, 0xFDu, 0xEDu, 0x82u,
0x65u, 0xC2u, 0x66u, 0xDFu, 0xB7u, 0x54u, 0xFAu, 0x6Du,
0x64u, 0x91u, 0xA6u, 0xDAu
};
static const uint8_t pPointP2[MCUXCLECC_WEIERECC_NIST_P224_SIZE_PRIMEP * 2u] =
{
0xAEu, 0x99u, 0xFEu, 0xEBu, 0xB5u, 0xD2u, 0x69u, 0x45u,
0xB5u, 0x48u, 0x92u, 0x09u, 0x2Au, 0x8Au, 0xEEu, 0x02u,
0x91u, 0x29u, 0x30u, 0xFAu, 0x41u, 0xCDu, 0x11u, 0x4Eu,
0x40u, 0x44u, 0x73u, 0x01u,
0x04u, 0x82u, 0x58u, 0x0Au, 0x0Eu, 0xC5u, 0xBCu, 0x47u,
0xE8u, 0x8Bu, 0xC8u, 0xC3u, 0x78u, 0x63u, 0x2Cu, 0xD1u,
0x96u, 0xCBu, 0x3Fu, 0xA0u, 0x58u, 0xA7u, 0x11u, 0x4Eu,
0xB0u, 0x30u, 0x54u, 0xC9u
};
static const uint8_t pRefResult[MCUXCLECC_WEIERECC_NIST_P224_SIZE_PRIMEP * 2u] =
{
0xDBu, 0x2Fu, 0x6Bu, 0xE6u, 0x30u, 0xE2u, 0x46u, 0xA5u,
0xCFu, 0x7Du, 0x99u, 0xB8u, 0x51u, 0x94u, 0xB1u, 0x23u,
0xD4u, 0x87u, 0xE2u, 0xD4u, 0x66u, 0xB9u, 0x4Bu, 0x24u,
0xA0u, 0x3Cu, 0x3Eu, 0x28u,
0x0Fu, 0x3Au, 0x30u, 0x08u, 0x54u, 0x97u, 0xF2u, 0xF6u,
0x11u, 0xEEu, 0x25u, 0x17u, 0xB1u, 0x63u, 0xEFu, 0x8Cu,
0x53u, 0xB7u, 0x15u, 0xD1u, 0x8Bu, 0xB4u, 0xE4u, 0x80u,
0x8Du, 0x02u, 0xB9u, 0x63u
};
#define MAX_CPUWA_SIZE MCUXCLECC_ARITHMETICOPERATION_POINTSUB_WACPU_SIZE
#define MAX_PKCWA_SIZE MCUXCLECC_ARITHMETICOPERATION_POINTSUB_WAPKC_SIZE_256
MCUXCLEXAMPLE_FUNCTION(mcuxClEcc_ArithmeticOperation_PointSub_NIST_P224_example)
{
mcuxClSession_Descriptor_t sessionDesc;
MCUXCLEXAMPLE_ALLOCATE_AND_INITIALIZE_SESSION(pSession, MAX_CPUWA_SIZE, MAX_PKCWA_SIZE);
uint8_t pResult[MCUXCLECC_WEIERECC_NIST_P224_SIZE_PRIMEP * 2u] = {0};
uint32_t resultSize = 0u;
buffPointP1,
sizeof(pPointP1),
buffPointP2,
sizeof(pPointP2),
buffResult,
&resultSize)
);
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
if(!mcuxClCore_assertEqual(pResult, pRefResult, MCUXCLECC_WEIERECC_NIST_P224_SIZE_PRIMEP * 2u))
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
if(!mcuxClExample_Session_Clean(pSession))
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
return MCUXCLEXAMPLE_STATUS_OK;
}
Top-level include file for the mcuxClBuffer component.
Definition of function identifiers for the flow protection mechanism.
Top level header of mcuxClEcc component.
Top-level include file for the mcuxClSession component.
Provides the API for the CSSL flow protection mechanism.
#define MCUXCLBUFFER_INIT(name, info, ptr, size)
Initialize an input/output buffer (mcuxCl_Buffer_t).
Definition mcuxClBuffer.h:88
#define MCUXCLBUFFER_INIT_RO(name, info, ptr, size)
Initialize an input buffer (mcuxCl_InputBuffer_t) with plain CPU handling.
Definition mcuxClBuffer.h:105
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.
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
mcuxClSession_Descriptor_t *const mcuxClSession_Handle_t
Type for mcuxClSession Handle.
Definition mcuxClSession_Types.h:133
#define MCUX_CSSL_FP_FUNCTION_CALL_BEGIN(...)
Call a flow protected function and check the protection token.
Definition mcuxCsslFlowProtection.h:601
#define MCUX_CSSL_FP_FUNCTION_CALLED(...)
Expectation of a called function.
Definition mcuxCsslFlowProtection.h:755
#define MCUX_CSSL_FP_FUNCTION_CALL_END(...)
End a function call section started by MCUX_CSSL_FP_FUNCTION_CALL_BEGIN.
Definition mcuxCsslFlowProtection.h:636
#define MCUXCLECC_STATUS_OK
Operation was successful.
Definition mcuxClEcc_Constants.h:66