7-14
MPC180E Security Processor User’s Manual
PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE
ECC Routines
7.3.5 ECC F
p
Modular Subtract
Modular subtraction 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). This is accomplished by computing A-B if A > B or A-B+N if A < B. The
results are stored in the respective B register. For ECC functionality, this function is used
by the point add and point double routines but is available to the host interface. This
function operates with a minimum of four digits (Modsize = 3).
Before this function is initialized, the A, B and N register pointers must be set in the control
register which indicate which sub-registers (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-8. Modular Subtract Register Usage
Table 7-9. Modular Subtract
Modular Subtract
Computation
C = D - E mod N, where D, E, and C are integers and are less than N
Entry name
modularsubtract;
Entry address
009h(modularsubtract)
Pre-conditions
A0-3 = D (integer, exact A-location pre-selected in Control Register)
B0-3 = E (integer, exact B-location pre-selected in Control Register)
N0-3 = prime p (modulus) of the ECC system
Post-conditions
B0-3 = results of modular subtraction 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 (if B0 selected)
E (if B0 selected)
modulus N (if N0 selected)
modulus N (if N0 selected)
D (if A0 selected)
?
?
?
XYZ
F2M
EXP(k)
regAsel
regBsel
regNsel
‘0’ - F
p
enabled
same
set (00, 01, 10, 11)
set (00, 01, 10, 11)
set (00, 01, 10, 11)
same
same
same
Modsize
EXP(k)_SIZE
set
same
ECC
same
‘1’ - ECC enabled
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
.
..