Datasheet

Table Of Contents
...........continued
Option Specified Size of the PrecompBase
Workspace (bytes)
Content of the
Workspace
PUKCL_EXPMOD_WINDOWSIZE_4 max( 10*(u2NLength + 4) u2NLength
+ 72) + 8
x x
3
x
5
x
7
x
9
x
11
x
13
x
15
The following table provides the maximum sizes for the Prime Generation depending on the window size.
Table 43-60. PrimeGen Service Maximum Sizes
Characteristics of the Operation Maximum Prime Sizes (bits)
1 bit window 4608
2 bits window 4032
3 bits window 3200
4 bits window 2272
43.3.5.3.7 Code Example
PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
// ! The Random Number Generator must be initialized and started
// ! following the directives given for the RNG on the chip PUKCL(u2Option) =...;
// Depending on the option specified, not all fields should be filled
PUKCL_PrimeGen(nu1NBase) = <Base of the ram location of N>;
PUKCL_PrimeGen(u2NLength) = <Length of N>;
PUKCL_PrimeGen(nu1CnsBase) = <Base of the ram location of Cns>;
PUKCL_PrimeGen(nu1PrecompBase) = <Base of the ram location of Precomp>;
PUKCL_PrimeGen(pfu1ExpBase) = <Base of the location of Exp>;
PUKCL_PrimeGen(u2ExpLength) = <Length of Exp>;
PUKCL_PrimeGen(u1MillerRabinIterations) = <Number of iterations>;
PUKCL_PrimeGen(u2MaxIncrement) = <Maximum Increment>;
...
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library...
vPUKCL_Process(PrimeGen, pvPUKCLParam);
if (PUKCL_Param.Status == PUKCL_NUMBER_IS_PRIME)
{
// The number is probably prime
...
}
else if (PUKCL_Param.Status == PUKCL_NUMBER_IS_NOT_PRIME)
{
// The number is not prime
...
}
else // Manage the error
43.3.5.3.8 Constraints
The following combinations of input values should be avoided in the case of a modular reduction ‘alone’,
meaning that it has not been requested as an option of any other service:
nu1NBase,nu1CnsBase, nu1RndBase,nu1PrecompBase,nu1ExpBase are not aligned on 32-bit
boundaries
{nu1NBase, u2NLength + 4}, {nu1CnsBase, u2NLength + 12}, {nu1RndBase, u2NLength +12},
{nu1PrecompBase, <PrecompLength>} are not in Crypto RAM
u2NLength is either: < 12, > 0xffc or not a 32-bit length
Both PUKCL_EXPMOD_REGULARRSA and PUKCL_EXPMOD_FASTRSA are specified.
SAM D5x/E5x Family Data Sheet
Public Key Cryptography Controller (PUKCC)
© 2019 Microchip Technology Inc.
Datasheet
DS60001507E-page 1500