Chapter 7. Public Key Execution Unit
7-29
PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE
RSA Routines
7.4.4 RSA Modular Add
Modular addition may be performed on any two vectors loaded into A (A0-A3) and B
(B0-B3), where both of these vectors are less than the value stored in the modulus register
N (N0-N3). The results are stored in the respective B register. This function is particularly
helpful when using the Chinese Remainder Theorem. This function operates with a
minimum of 4 digits (Modsize = 3).
Prior to initiating this function, the A and B register pointers must be set in the control
register which indicate which sub-registers (e.g A0, B0, A1, B1, etc.) are the targeted
operands. See Table 7-2 for a detailed description. Once this is performed, the host
processor may successfully initiate this function.
Figure 7-20. Modular Add Register Usage
Table 7-21. Modular Add
Modular Add
Computation
C = D + E mod N, where D, E, and C are integers and are less than N
Entry name
modularadd
Entry address
0x008(modularadd)
Pre-conditions
A0-3 = D
B0-3 = E
N0-3 = modulus
Post-conditions
B0-3 = results of modular addition stored where the B operand was located
Unless explicitly noted, all other registers are not guaranteed to be any particular value.
Special
conditions
The function operates the same regardless of whether or not the operands are in the Montgomery
residue system.
N1
N2
N3
A0
A1
A2
A3
B0
B1
B2
B3
Initial Condition
Final Condition
N0
C(
⇑
)
E(
⇑
)
modulus N(
⇑
)
modulus N(
⇑
)
D(
⇑
)
XYZ
F2M
EXP(k)
regAsel
regBsel
regNsel
‘0’ - integer-modulo-n enabled
same
set (00)
set (00)
set (00)
same
same
same
Modsize
EXP(k)_SIZE
set
same
ECC
same
‘0’ - ECC disabled
F
re
e
sc
a
le
S
e
m
ic
o
n
d
u
c
to
r,
I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
c
.
..
F
re
e
sc
a
le
S
e
m
ic
o
n
d
u
c
to
r,
I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
c
.
..