Example for the mcuxClEcc component EdDsa key pair generation using the test vectors from "TEST SHA(abc)" from Section 7.1 of IRTF rfc 8032
#include <mcuxClExample_ELS_Helper.h>
#include <mcuxClExample_Session_Helper.h>
#include <mcuxClExample_RNG_Helper.h>
#include <mcuxClCore_Examples.h>
#define RAM_START_ADDRESS MCUXCLPKC_RAM_START_ADDRESS
#define MAX_CPUWA_SIZE MCUXCLECC_EDDSA_GENERATEKEYPAIR_ED25519_WACPU_SIZE
#define MAX_PKCWA_SIZE MCUXCLECC_EDDSA_GENERATEKEYPAIR_ED25519_WAPKC_SIZE
{
0x83u, 0x3fu, 0xe6u, 0x24u, 0x09u, 0x23u, 0x7bu, 0x9du,
0x62u, 0xecu, 0x77u, 0x58u, 0x75u, 0x20u, 0x91u, 0x1eu,
0x9au, 0x75u, 0x9cu, 0xecu, 0x1du, 0x19u, 0x75u, 0x5bu,
0x7du, 0xa9u, 0x01u, 0xb9u, 0x6du, 0xcau, 0x3du, 0x42u
};
{
0xecu, 0x17u, 0x2bu, 0x93u, 0xadu, 0x5eu, 0x56u, 0x3bu,
0xf4u, 0x93u, 0x2cu, 0x70u, 0xe1u, 0x24u, 0x50u, 0x34u,
0xc3u, 0x54u, 0x67u, 0xefu, 0x2eu, 0xfdu, 0x4du, 0x64u,
0xebu, 0xf8u, 0x19u, 0x68u, 0x34u, 0x67u, 0xe2u, 0xbfu
};
{
{
return MCUXCLEXAMPLE_ERROR;
}
MCUXCLEXAMPLE_ALLOCATE_AND_INITIALIZE_SESSION(&session, MAX_CPUWA_SIZE, MAX_PKCWA_SIZE);
MCUXCLEXAMPLE_ALLOCATE_AND_INITIALIZE_RNG(&session, 0u, mcuxClRandomModes_Mode_ELS_Drbg);
uint8_t privKeyDesc[MCUXCLKEY_DESCRIPTOR_SIZE];
&session,
privKey,
sizeof(pPrivKeyData)));
{
return MCUXCLEXAMPLE_ERROR;
}
uint8_t pubKeyDesc[MCUXCLKEY_DESCRIPTOR_SIZE];
&session,
pubKey,
sizeof(pPubKeyData)));
{
return MCUXCLEXAMPLE_ERROR;
}
&session,
pPrivKeyInput));
{
return MCUXCLEXAMPLE_ERROR;
}
&session,
privKey,
pubKey));
{
return MCUXCLEXAMPLE_ERROR;
}
if(!mcuxClExample_Session_Clean(&session))
{
return MCUXCLEXAMPLE_ERROR;
}
if(!mcuxClExample_Els_Disable())
{
return MCUXCLEXAMPLE_ERROR;
}
return MCUXCLEXAMPLE_OK;
}