7-32
MPC180E Security Processor User’s Manual
PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE
Miscellaneous Routines
7.5.2 R
2
mod N Calculation
The PKEU has the capability to calculate R
2
mod N, where R = 2
16D
and D is the number
of digits of the modulus vector (1, where Modsize is specified independently).
This function is used to assist in placing operands into the Montgomery residue system.
When possible, this value should be pre-computed. If this value is not available, then the
host processor may invoke this function to determine the value before the operation. This
function takes a non-trivial amount of time (see Table 7-26) so if at all possible, this value
should be stored for future use.
Note that this operation primarily exists to support RSA operations since R
2
mod N may
not always be known prior to the execution of certain protocols. For ECC applications, the
modulus is a system-wide parameter, which means that the R
2
mod N value may be
pre-computed before any real-time operations by any other system entity and stored for
future use. For this reason, R
2
mod N only supports integer-modulo-n computations (i.e.
the control register bit F
2
M must be 0).
This function operates with a minimum of 4 digits (Modsize = 3) and with the most
significant digit (16-bits) of the modulus being non-zero. The complete set of I/O
conditions is shown below:
Table 7-24. R
2
mod N
R
2
mod N
Computation
R
2
mod N, where R = 2
16D
and D is the number of digits of the modulus vector
Entry name
r2
Entry address
0x00c(r2)
Pre-conditions
Modsize = number of digits of the modulus vector - 1
N0-3 = modulus
Post-conditions
B1 = R
2
mod N
N0-3 = modulus
Unless explicitly noted, all other registers are not guaranteed to be any particular value.
Special
conditions
—
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
.
..