SPRUJ17H March 2022 – October 2024 AM2631 , AM2631-Q1 , AM2632 , AM2632-Q1 , AM2634 , AM2634-Q1
The PKCP engine performs basic mathematical operations with/on big number vectors stored in PKA RAM (in little-endian format, that is, LS-word first).
Table 7-101 lists the arguments and results for each Public Key Co-Processor (PKCP) operation.
Function | Mathematical Operation | Vector A | Vector B | Vector C | Vector D |
---|---|---|---|---|---|
Multiply | A x B —> C | Multiplicand | Multiplier | Product | N/A |
Add | A + B —> C | Addend | Addend | Sum | N/A |
Subtract | A – B —> C | Minuend | Subtrahend | Difference | N/A |
AddSub | A + C - B —> D | Addend | Subtrahend | Addend | Result |
Right Shift | A >> Shift —> C | Input | N/A | Result | N/A |
Left Shift | A << Shift —> C | Input | N/A | Result | N/A |
Divide | A mod B —> C, A div B —> D | Dividend | Divisor | Remainder | Quotient |
Modulo | A mod B —> C | Dividend | Divisor | Remainder | N/A |
Compare | A = B, A < B, A > B | Input1 | Input2 | N/A | N/A |
Copy | A —> C | Input | N/A | Result | N/A |
To obtain correct results, the input vectors must meet the requirements presented in Table 7-102 below. Note that:
Operational Restrictions | |
---|---|
Function | Requirements |
Multiply | 0 < A_Len, B_Len <= Max_Len |
Add | 0 < A_Len, B_Len <= Max_Len |
Subtract | 0 < A_Len, B_Len <= Max_Len Result must be positive (A >= B) |
AddSub | 0 < A_Len <= Max_Len (B and C operands have A_Len as
length, B_Len ignored) Result must be positive ((A + C) >= B) |
Right Shift | 0 < A_Len <= Max_Len |
Left Shift | 0 < A_Len <= Max_Len |
Divide, Modulo | 1 < B_Len <= A_Len <= Max_Len Most significant 32-bit word of B operand cannot be zero |
Compare | 0 < A_Len <= Max_Len (B operand has A_Len as length, B_Len ignored) |
Copy | 0 < A_Len <= Max_Len |
The Host is responsible for allocating a block of contiguous memory in PKA RAM for the result vector(s). Table 7-103 below indicates how much memory should be allocated for the result vector(s).
Result Vector Memory Allocation | ||
---|---|---|
Function | Result Vector | Result Vector Length (in 32-bit Words) |
Multiply | C | A_Len + B_Len + 6 (the 6 'scratchpad' words should be discarded) |
Add | C | Max(A_Len, B_Len) + 1 |
Subtract | C | Max(A_Len, B_Len) |
AddSub | D | A_Len + 1 |
Right Shift | C | A_Len |
Left Shift | C | A_Len + 1 (when Shift Value is non-zero) A_Len (when Shift Value is zero) |
Divide | C | Remainder —> B_Len + 1 (one 'scratchpad' word should be discarded) |
D | Quotient —> A_Len — B_Len + 1 | |
Modulo | C | Remainder —> B_Len + 1 (one 'scratchpad' word should be discarded) |
Compare | None | Compare updates the PKA_COMPARE register |
Copy | C | A_Len |
Input vectors for an operation are always allowed to overlap in memory (partially or completely). Table 7-104 below gives restrictions for the overlap of output and input vectors of the operations.
Result Vector / Input Vector Overlap Restrictions | ||
---|---|---|
Function | Result Vector | Restrictions |
Multiply | C | No overlap with A or B vectors allowed |
Add, Subtract | C | May overlap with A and/or B vector, provided the start address of the C vector does not lie above the start address of the vector(s) with which it overlaps |
AddSub | D | May overlap with A, B and/or C vector, provided the start address of the D vector does not lie above the start address of the vector(s) with which it overlaps |
Right Shift, Left Shift | C | May overlap with A vector, provided the start address of the C vector does not lie above the start address of the A vector |
Divide | C | No overlap with A, B or D vectors allowed |
D | No overlap with A, B or C vectors allowed | |
Modulo | C | No overlap with A or B vectors allowed |
Compare | None | Compare does not write a result vector |
Copy | C | Same restrictions as for Right/Left Shift, copy of a vector to a lower addressis always allowed even if source and destination overlap (see (1)) |