
Public key accelerator (PKA)
RM0453
706/1454
RM0453 Rev 2
24.4.7 Modular
inversion
Modular inversion operation consists in the computation of multiplicative inverse A
-1
mod
n
.
If the modulus
n
is prime, for all values of A (1
≤
A <
n
) modular inversion output is valid. If
the modulus
n
is not prime, A has an inverse only if the largest common divisor between A
and
n
is 1.
If the operand A is a divisor of the modulus
n,
the result is a multiple of a factor of
n
.
Operation instructions for modular inversion are summarized in
Table 150. Modular exponentiation (normal mode)
Parameters with direction
Value (Note)
Storage
Size
IN
MODE
0x00
PKA_CR
6 bits
IN
Exponent length
(in bits, not null)
RAM@0x400
32 bits
Operand length
(in bits, not null)
RAM@0x404
IN/OUT
Operand A (base of
exponentiation)
(0
≤
A < n)
RAM@0xA44
ROS
IN
Exponent e
(0
≤
e < n)
RAM@0xBD0
Modulus value n
(Odd integer only, n < 2
3136
)
RAM@0xD5C
OUT
Result: A
e
mod n
(0
≤
result < n)
RAM@0x724
Table 151. Modular exponentiation (fast mode)
Parameters with direction
Value (Note)
Storage
Size
IN
MODE
0x02
PKA_CR
6 bits
IN
Exponent length
(in bits, not null)
RAM@0x400
32 bits
Operand length
(in bits, not null)
RAM@0x404
IN/OUT
Operand A (base of
exponentiation)
(0
≤
A < n)
RAM@0xA44
ROS
IN
Exponent e
(0
≤
e < n)
RAM@0xBD0
Modulus value n
(Odd integer only, n < 2
3136
)
RAM@0xD5C
IN/OUT
Montgomery param
R2 mod n
(mandatory)
RAM@0x594
OUT
Result: A
e
mod n
(0
≤
result < n)
RAM@0x724
Table 152. Modular inversion
Parameters with direction
Value (Note)
Storage
Size
IN
MODE
0x08
PKA_CR
6 bits
Operand length
(In bits, not null)
RAM@0x404
32 bits
Operand A
(0
≤
A < n)
RAM@0x8B4
ROS
Modulus value n
(Odd integer only, n < 2
3136
)
RAM@0xA44
OUT
Result: A
-1
mod n
0 < result < n
RAM@0xBD0