Datasheet

Table Of Contents
// Clear contents of PUKCLParam
memset(&PUKCLParam, 0, sizeof(PUKCL_PARAM));
pvPUKCLParam = &PUKCLParam;
vPUKCL_Process(SelfTest, pvPUKCLParam);
// In case of error, loop here
while (PUKCL(u2Status) != PUKCL_OK) {
;
}
while (pvPUKCLParam->P.PUKCL_SelfTest.u4Version != PUKCL_VERSION) {
;
}
while (pvPUKCLParam->P.PUKCL_SelfTest.u4CheckNum1 != 0x6E70DDD2) {
;
}
while (pvPUKCLParam->P.PUKCL_SelfTest.u4CheckNum2 != 0x25C8D64F) {
;
}
}
int main(void)
{
/* Initializes MCU, drivers and middleware */
atmel_start_init();
// Wait for Crypto RAM clear process
while ((PUKCCSR & BIT_PUKCCSR_CLRRAM_BUSY) != 0);
// Initialize PUKCC and perform self test
PUKCC_self_test();
while(1)
{
}
}
Note:  It may also be necessary to initialize the Random Number Generator (RNG) on the
microcontroller, as some services in the library use the peripheral. Before calling such services, be sure to
follow the directives given for random number generation on the selected microcontroller (particularly
initialization and seeding) and compulsorily start the RNG. For details refer to each service.
43.3.3.2 Accessing Different Library Services
All cryptographic services in the library are accessed by the macro vPUKCL_Process. All of these
services use the same process for receiving and returning parameters. PUKCL receives two arguments:
the requested service and a pointer to a structure called the parameter block. The parameter block
contains two structures, a common parameter structure for all commands and specific parameter
structure for each service. A specific service is accessed with vPUKCL_Process by passing the service
name as the first argument. For example, to perform SelfTest, use vPUKCL_Process(SelfTest,
pvPUKCLParam).
Example 43-2. PUKCL Parameter Block
typedef struct _PUKCL_param {
PUKCL_HEADER PUKCL_Header;
union {
_PUKCL_CLEARFLAGS PUKCL_ClearFlags;
_PUKCL_COMP PUKCL_Comp;
_PUKCL_CONDCOPY PUKCL_CondCopy;
_PUKCL_CRT PUKCL_CRT;
_PUKCL_DIV PUKCL_Div;
_PUKCL_EXPMOD PUKCL_ExpMod;
_PUKCL_FASTCOPY PUKCL_FastCopy;
_PUKCL_FILL PUKCL_Fill;
_PUKCL_FMULT PUKCL_Fmult;
_PUKCL_GCD PUKCL_GCD;
_PUKCL_PRIMEGEN PUKCL_PrimeGen;
_PUKCL_REDMOD PUKCL_RedMod;
_PUKCL_RNG PUKCL_Rng;
SAM D5x/E5x Family Data Sheet
Public Key Cryptography Controller (PUKCC)
© 2019 Microchip Technology Inc.
Datasheet
DS60001507E-page 1445