GD32W51x User Manual
978
Montgomery multiplication
Suppose A, B and C are in natural domain.
“
x
”
function is Montgomery multiplication operation.
The two main uses of this opreation are as follows:
1.
Mutual mapping between Montgomery domain and natural domain.
As is shown in
Figure 29-13. Mutual mapping between Montgomery domain and natural
, if A is an integer in natural domain, the Montgomery parameter mont_para is
R
2
mod n, the result AR = A x mont_para mod n is A in Montgomery domain. In turn, If BR is
an integer in Montgomery domain, the calculation result B = BRx1 mod n is in natural
domain.
Figure 29-13. Mutual mapping between Montgomery domain and natural domain
BR
B = BRx1 mod n
Natural domain
Montgomery domain
AR = A x mont_para mod n
A
2.
Perform a modular multiplication operation A x B mod n.
(1)
Calculate Montgomery parameter mont_para = R
2
mod n.
(2)
Calculate AR = A x mont_para mod n, the output is in Montgomery domain.
(3)
Calculate AB = AR x B mod n, the output is in natural domain.
Multiple modular multiplication A x B x C mod n.
(1)
Calculate Montgomery parameter mont_para = R
2
mod n.
(2)
Calculate AR = A x mont_para mod n, the output is in Montgomery domain.
(3)
Calculate BR = B x mont_para mod n, the output is in Montgomery domain.
(4)
Calculate ABR = AR x BR mod n, the output is in Montgomery domain.
(5)
Calculate CR = C x mont_para mod n, the output is in Montgomery domain.
(6)
Calculate ABCR = ABR x CR mod n, the output is in Montgomery domain.
(7)
Calculate ABC= ABCR x 1 mod n, the output is in natural domain.
The Montgomery multiplication operation is selected by configuring MODSEL[5:0] in
PKCAU_CTL register as "010000". The operation declaration is shown in
.