summaryrefslogtreecommitdiff
path: root/crypto/bn/old/info
blob: 5ac99c3b2377c794fb4e514dc68bdba81a6a73e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Given A1A0 * B1B0 == S3S2S1S0

S0=     low(A0*B0)
S1=     low( (A1-A0)*(B0-B1)) +low( A1*B1) +high(A0*B0)
S2=     high((A1-A0)*(B0-B1)) +high(A1*B1) +low( A1*B1)
S3=     high(A1*B1);

Assume we know S1 and S0, and can calulate A1*B1 and high((A1-A0)*(B0-B1))

k0=	S0 == low(A0*B0)
k1=	S1
k2=	low( A1*B1)
k3=	high(A1*B1)
k4=	high((A1-A0)*(B0-B1))

k1=	low((A1-A0)*(B0-B1)) +k2 +high(A0*B0)
S2=	k4 +k3 +k2
S3=	k3

S1-k2= low((A1-A0)*(B0-B1)) +high(A0*B0)

We potentially have a carry or a borrow from S1