Datasheet

Table Of Contents
Note:  The parameter Num must have its most significant 32-bit word cleared to zero. The length
u2NumLength is the length of Num including this zero word.
One additional word is used on the LSB side of the Num parameter, this word is restored at the end of the
calculus. As a consequence the parameter nu1NumBase must never been at the beginning of the Crypto
RAM, i.e., ensure that nu1NumBase ≥ <Crypto RAM Base> + 4 bytes.
One additional word is used on the MSB side of the Num parameter, this word is not corrupted. As a
consequence the Area {nu1NumBase, u2NumLength} must not be at the end of the Crypto RAM, i.e., en
sure that nu1NumBase+u2NumLength ≤ <Crypto RAM End> - 4.
u2ModLength must be the true length of the Modulus, i.e., the MSB word of the area {nu1ModBase,
u2ModLength} must be different from zero.
The minimum value for u2ModLength is 8 bytes, so the significant length of Num must be at least 8 bytes.
To divide by a 32-bit value, the divider and numerator shall be multiplied by 232. The resulting remainder
will have to be divided by 2
32
, the quotient will be exact.
43.3.4.11.5 Code Example
PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
// Fill all the fields
// In that case, the quotient will be computed
// If it was not needed, set nu1QuoBase to NULL
PUKCL_Div(nu1NumBase) = <Base of the ram location of Num>;
PUKCL_Div(nu1ModBase) = <Base of the ram location of Mod>;
PUKCL_Div(nu1QuoBase) = <Base of the ram location of Quo>;
PUKCL_Div(nu1WorkSpace) = <Base of the workspace>;
PUKCL_Div(nu1RBase) = <Base of the ram location of R>;
PUKCL_Div(u2NumLength) = <Length of Num>;
PUKCL_Div(u2ModLength) = <Length of Mod>;
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library...
vPUKCL_Process(Div,pvPUKCLParam);
if (PUKCL(u2Status) == PUKCL_OK)
{
// The Division has been executed correctly
...
}
else // Manage the error
43.3.4.11.6 Constraints
The following conditions must be avoided to ensure the service works correctly:
nu1ModBase, nu1RBase, nu1QuoBase, nu1WorkSpace or nu1NumBase are not aligned on 32-bit
boundaries
{nu1ModBase, u2ModLength}, {nu1RBase, u2ModLength}, {nu1WorkSpace, 64} or{nu1NumBase,
u2NumLength} are not in Crypto RAM
u2ModLength, u2NumLength is either: < 4, > 0xffc or not a 32-bit length
One or more overlaps exist between two of the areas: {nu1ModBase,u2ModLength},{nu1RBase,
u2ModLength} {nu1NumBase, u2NumLength}(1) or {nu1WorkSpace,64}
If nu1QuoBase is different from zero and: {nu1QuoBase, u2NumLength - u2ModLength + 4} are not
in Crypto RAM
If nu1QuoBase is different from zero and one or more overlaps exist between two of the areas:
{nu1QuoBase, u2NumLength - u2ModLength + 4}, {nu1ModBase, u2ModLength}, {nu1RBase,
u2ModLength}, {nu1NumBase, u2NumLength} or {nu1WorkSpace, 64}
Overlaps between {nu1RBase, u2ModLength} and {nu1NumBase, u2NumLength} are forbidden, but the
equality between nu1RBase and nu1NumBase is authorized
SAM D5x/E5x Family Data Sheet
Public Key Cryptography Controller (PUKCC)
© 2019 Microchip Technology Inc.
Datasheet
DS60001507E-page 1476