GD32W51x User Manual
977
Figure 29-11. Modular subtraction
Modulus length M
Operand A
PKCAU RAM
0x404
Operand B
0x408
...
0x400
...
0x8B4
0xA44
0xD5C
Modulus n
...
0xBD0
...
A-B mod n
/ A-B+n mod n
Offset address
input
output
Offset address
0xBD0
0≤A<n, 0≤B<n, 0≤result<n, 0<n<2
M
, 0<M≤3136.
Montgomery parameter calculation
PKCAU needs to use the Montgomery parameter (R
2
mod n) to convert the operands to
Montgomery residue system representation.
The Montgomery parameter calculation operation is selected by configuring MODSEL[5:0] in
PKCAU_CTL register as "000001". The operation declaration is shown in
Montgomery parameter calculation
.
Figure 29-12. Montgomery parameter calculation
Modulus length M
PKCAU RAM
0x404
...
0x400
0xD5C
Modulus n
...
0x594
...
R
2
mod n
0x408
...
Offset address
input
output
Offset address
0x594
0<M≤3136
,
1<n<2
M
(n must be odd integer).