(19)
(11) EP 1 459 167 B1

(12) EUROPEAN PATENT SPECIFICATION

(45) Mention of the grant of the patent:
25.01.2006 Bulletin 2006/04

(21) Application number: 02788303.2

(22) Date of filing: 05.12.2002
(51) International Patent Classification (IPC): 
G06F 7/72(2006.01)
(86) International application number:
PCT/IB2002/005210
(87) International publication number:
WO 2003/052584 (26.06.2003 Gazette 2003/26)

(54)

PIPELINED CORE IN MONTGOMERY MULTIPLIER

FLIESSBANDKERN IN EINEM MONTGOMERY-MULTIPLIZIERER

NOYAU PIPELINE DANS UN MULTIPLICATEUR DE MONTGOMERY


(84) Designated Contracting States:
AT BE BG CH CY CZ DE DK EE ES FI FR GB GR IE IT LI LU MC NL PT SE SI SK TR

(30) Priority: 14.12.2001 EP 01204908

(43) Date of publication of application:
22.09.2004 Bulletin 2004/39

(73) Proprietor: Koninklijke Philips Electronics N.V.
5621 BA Eindhoven (NL)

(72) Inventor:
  • HUBERT, Gerardus, T., M.
    NL-5656 AA Eindhoven (NL)

(74) Representative: Williamson, Paul Lewis 
Philips Intellectual Property & Standards Cross Oak Lane
Redhill, Surrey RH1 5HA
Redhill, Surrey RH1 5HA (GB)


(56) References cited: : 
WO-A-00/38047
WO-A-01/76132
   
  • JYE-JONG LEU ET AL: "A scalable low-complexity digit-serial VLSI architecture for RSA cryptosystem" SIGNAL PROCESSING SYSTEMS, 1999. SIPS 99. 1999 IEEE WORKSHOP ON TAIPEI, TAIWAN 20-22 OCT. 1999, PISCATAWAY, NJ, USA,IEEE, US, 20 October 1999 (1999-10-20), pages 586-595, XP010370883 ISBN: 0-7803-5650-0
  • JYE-JONG LEU ET AL: "Design methodology for booth-encoded montgomery module design for RSA cryptosystem" ISCAS 2000 - IEEEE INTERNATIONAL SYMPOSIUM ON CIRCUITS AND SYSTEMS, MAY 28-31, 2000, GENEVA, SWITZERLAND, vol. 5, 28 May 2000 (2000-05-28), pages 357-360, XP010504207
   
Note: Within nine months from the publication of the mention of the grant of the European patent, any person may give notice to the European Patent Office of opposition to the European patent granted. Notice of opposition shall be filed in a written reasoned statement. It shall not be deemed to have been filed until the opposition fee has been paid. (Art. 99(1) European Patent Convention).


Description


[0001] The invention relates to a multiplier apparatus for multiplying a first long integer entity with a second long integer entity modulo a prime number, comprising a pipelined multiplier core, and being arranged for executing the overall multiplication in Montgomery fashion.

BACKGROUND OF THE INVENTION



[0002] Multiplication of long integers modulo a prime number is a basic and repetitive operation that is used for so-called public key systems and various other applications. For an efficient usage of such applications, the execution time of the multiplication should be minimum. In consequence, the invention relates in particular to an apparatus as recited in the preamble of Claim 1. Various methods and apparatuses have been proposed for the above through using a combination of multiplication and reduction operations. In particular, often the most significant part of the result has been used to actually effect the reduction. However, the present inventor has recognized that the developing of such most significant part will substantially delay the overall operation, especially, when the available hardware should be used at the highest possible duty cycle, in that a sequence of such multiplications must be executed in a contiguous manner.

[0003] There are several known examples of multiplier architectures and multiplication algorithms known in the art, one such example is described in the document "A scalable low-complexity digit-serial VLSI architecture for RSA cryptosystem", Jye-Jong Leu et al., Signal Processing Systems 1999, SIPS 99, pgs. 586-595. This document provides details of a Booth-encoded Montgomery multiplication algorithm designed to reduce the number of iterations in a typical Montgomery operation. The algorithm may be implemented in a pipelined architecture comprising a Montgomery module having a Booth-encoder, multiplicand selector and modular selector. The iterations may be reduced by about half using small table and simple logic processing, involving shift operations.

SUMMARY TO THE INVENTION



[0004] In consequence, amongst other things, it is an object of the present invention to provide a multiplier apparatus as recited in the preamble, wherein the contradistinction to the prior art, the least significant part of the actual result is used for effecting the reduction, whilst furthermore raising the fraction of time that the hardware is actually used in order to be able to cope with substantial and long sequences of such multiplications.

[0005] Now therefore, according to one of its aspects the invention is characterized according to the characterizing part of Claim 1. In fact, the combination according to the present invention renders it more easy to keep the pipeline filled, and in consequence, to shorten the average calculation times in the overlaid operation. The multiplier apparatus is applicable for operating in GF (p), wherein p is a prime number, as well as in GF (2n).

[0006] Further advantageous aspects of the invention are recited in dependent Claims that define advantageous extensions to, or rather fields of application of, the principal element of the invention.

BRIEF DESCRIPTION OF THE DRAWING



[0007] These and further aspects and advantages of the invention will be discussed more in detail hereinafter with reference to the disclosure of preferred embodiments, and in particular with reference to the appended Figures that show:

Figure 1, a block diagram of a pipelined multiplier;

Figure 2, a block diagram for a long integer multiplication X * Y + W;

Figure 3, a block diagram for a long integer multiplication Xi .Y+ W;

Figure 4, a pipelined multiplier for a Galois field GF (2n);

Figure 5, an arrangement of a carry-propagation-free adder;

Figure 6, a diagram illustrating intermediate carry and sum quantities.


DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS


1. PIPELINED MULTIPLIER



[0008] The Pipelined multiplier is designed to accept in every clock cycle two new numbers to be multiplied. The product of both is calculated in a number of stages and is ready when all stages have been run through. E.g. for a 32*32-bit multiplication, the number of stages can be 17 (16 for multiplication and 1 for the final addition). Every clock cycle a next product is calculated, but the outcome is only ready after 17 clock cycles. So at most 17 products are being processed at the same clock cycle.

[0009] For an efficient pipelined multiplier, the long-integer calculations have been designed such that the pipeline is kept filled. One has to avoid the situation that a new calculation depends on a result that is still under way. In such situation wait states would have to be inserted. This is the reason for designing the Montgomery Multiplications for Elliptic Curve Calculations differently from RSA-like calculations.

[0010] Next to the multiplication, the multiplier executes two additions P = X.Y + A + B. One of the additions is necessary for the multiplication of two long-integers, where the multiplication must be split in a number of elementary 32*32-bit multiplications.

[0011] Pipelined multipliers can be designed for different numbers of bits, e.g. 8*8 or 16*16.

2. MONTGOMERY MULTIPLICATION



[0012] The Montgomery Multiplication calculates the product P = x.y.R-1 mod p. Here, x and y are the inputs to be multiplied and p is the modulus of the multiplication. Furthermore, R= 2n, where n is the number of bits of the system, e.g. 1024 for RSA-like systems and 160 for Elliptic Curves. As an example a 32*32-bit multiplier is chosen, with 17 stages.

3. MONTGOMERY MULTIPLICATION WITH BASE B



[0013] This method is suitable for large values of Nw as well as for RSA.
  • B = 232, assuming a word size of the processor of 32-bit.
  • R = BNw, Nw being the number of 32-bit words of the long-integers.
  • a[i] is the ith 32-bit Word of the number a.
  • T[0] is the least significant 32-bit part of the temporary variable T.

Prestored constants:



[0014] 
  • m' = - (p-1) mod B (32-bit wide)
  • prime p

Inputs: a mod p, b mod p

Output: Montgomery Product: MonPro(a,b) = a.b.R-1 mod p

The operation is as follows:


4. CALCULATION FOR 512-BIT OPERANDS



[0015] In our example a and b consist of sixteen 32-bit words. First T = T +a[i].b is calculated, starting with i=0.

[0016] The first calculation starts at timeslot 0 and the last one at timeslot 15. At timeslot 16 a wait cycle is added.

[0017] The first result T[0] is ready at time 17. Then we calculate from that timeslot the product Ui = T[0].m', which is output at timeslot 34.

[0018] The next series of calculations is (T + Ui.p)/B, which starts at timeslot 34 and ends at timeslot 49. The first result thereof is output at timeslot 51, but is discarded because its outcome is always zero. The second result is at timeslot 52.

[0019] From timeslot 52 on, the loop starts anew. It uses the results of the previous round, immediately when they are ready.

[0020] There are 16 rounds, so the total number of timeslots is 16*52 = 832.

[0021] The complete result is ready at timeslot 848.

5. CALCULATION FOR 1024 OPERANDS



[0022] First T = T +a[i].b is calculated, starting with i=0.

[0023] We start with calculating the first 17 products.

[0024] The first result T[0] is ready at timeslot 17. At that timeslot we calculate the product Ui =T[0].m', which is output at timeslot 34. From timeslot 18 up to 32 we calculate the remaining products of T = T +a[i].b

[0025] The next series of calculations is (T + Ui.p)/B, which starts at timeslot 34 and ends at timeslot 65. The first results are ready, when at timeslot 66 a new round starts.

[0026] There are 32 rounds, so the total number of timeslots is 32*66 = 2112.

[0027] The complete result is ready at timeslot 2128.

6. CALCULATION FOR 2048-BIT OPERANDS



[0028] First T = T +a'[i].b' is calculated, starting with i=0.

[0029] We start with calculating the first 17 products.

[0030] The first result T[0] is ready at timeslot 17. At that timeslot we calculate the product Ui = T[0].m', which is outputted at timeslot 34. From timeslot 18 up to Nw, we calculate the remaining products.

[0031] The next series of calculations is (T + Ui.p)/B, which starts at timeslot Nw and ends at timeslot 2Nw-1.

[0032] The first results are ready, when at timeslot 2Nw a new round starts.

[0033] There are Nw rounds, so the total number of timeslots is Nw.(2Nw+1).

[0034] The complete result is ready at timeslot Nw.(2Nw+1) +17 (=8273 for 2048 bit).

7. MONTGOMERY MULTIPLICATION WITH BASE R



[0035] The algorithm is suitable for small values of Nw and also for Elliptic Curves.
  • B = 232 (assumed is a word size of the processor of 32-bit)
  • R = BNw (Nw is the number of 32-bit words of the long-integers)

Prestored constants:



[0036] 
  • m' = -(p-1) mod R (m' is Nw 32-bit wide)
  • prime p

Inputs: a mod p, b mod p

Output: MonPro(a,b) = a.b.R-1 mod p

T=a.b
U = T.m' mod R
T' = T + U.p
T = T/R
if T > p then T=T-p
For systems over GF(2n) all additions are modulo 2. Herein, m' is the inverse of the polynomial B = α32.

8. CALCULATION METHOD



[0037] First, the complete product T = a.b is calculated. This takes Nw2 multiplications. The first results of T are then already there, so we can start immediately thereafter. Of the product T.m' we need only to calculate the products that are smaller than R.
  • The product T[0] is ready at timeslot 17. The calculation of T[0]*(m[0]..m[Nw-1]) starts at timeslot Nw2 and takes Nw multiplications.
  • The product T[1] is ready at timeslot 17+Nw. The calculation of T[1]*(m[0]..m[Nw-2]) starts at Nw2+ Nw and takes Nw -1 multiplications
  • The product T[2] is ready at timeslot 17+2Nw. The calculation of T[2]*(m[0]..m[Nw-3]) starts at Nw2 + 2Nw-1 and takes Nw -2 multiplications, etcetera.
  • The product T[j] is ready at timeslot 17+j.Nw. The calculation of T[j]*(m[0]..m[Nw-j-1]) starts at Nw2 + (2Nw-j+1).j/2 and takes Nw -j multiplications, etcetera.
  • The product T[Nw-1] is ready at timeslot 17+(Nw-1).Nw. The calculation of T[Nw-1]* m[0] starts at Nw2 + (Nw+2). (Nw-1)/2 and takes one multiplication.


[0038] One can prove that for Nw≥ 5 the product T[j] is always ready before the new product T[j]*m[0] starts. Therefore, no wait cycles are required.
  • U[0] is ready at timeslot Nw2+17. From that moment on, the product U.p is calculated.
  • The last multiplication starts at timeslot Nw2 + (Nw+2). (Nw-1)/2 +1. For Nw=5 this is at timeslot 40 and U[0] is started at timeslot 42. So there are two wait cycles required. For larger values of Nw, no wait cycles are required.
  • The calculation of U.p takes Nw2 timeslots.
  • The total number of timeslots is 2.Nw2 + (Nw+2). (Nw-1)/2 +1 for Nw>5
  • The total number of timeslots is 67 timeslots for Nw=5
  • The complete result is ready at 2.Nw2 + (Nw+2). (Nw-1)/2 +18.

9. MODIFIED BOOTH ALGORITHM



[0039] The modified Booth algorithm is designed to take two bits of the multiplicand to do a partial multiplication. This halves the number of partial multiplications.

[0040] First the multiplier Y is recoded, where y'i may have the values -2, -1, 0, +1 and +2 (signed digit notation).

(only defined for even values of i)







To get the right result, we must subtract from the product y0.X

10. SUBTRACTION DONE IN PARALLEL



[0041] 









[0042] In this respect, Figure 1 is a block diagram of a pipelined multiplier embodiment. Herein, circles with an asterisk execute a multiplication, whereas circles with an addition sign will execute an addition, such as one including a carry-save operation. The various blocks will temporarily hold the quantity indicated therein. For better clarity, various interconnections show the bit rankings of the bits being transferred there along. At the right hand side, a column of blocks is used for introducing the necessary correction term.

[0043] The left part calculates Z=X.Y+W +y0.X. This last term is an artifact of the algorithm. The right part subtracts the last term in parallel to the other calculations. This is the invention.

[0044] The following embodiment discloses how the multiplication is set up, but the implementation may deviate in details.

[0045] In the first timeslot Z0 = X.Y(1:0) + W0 is calculated and stored in register Z0. X is transferred to the second X-register and Y(31:2) to the second Y-register.

[0046] In the second timeslot Z1 = X.Y(3:2) + Z0 is calculated and stored in register Z1. Further, X is transferred to the third X-register and Y(31:2) to the third Y-register .

[0047] Moreover, -y0*X(1:0) is calculated and added to Z(1:0), etcetera.

[0048] In the 16th timeslot Z15 = X.Y(31:30) + Z15 is calculated and stored in register Z15.

[0049] Moreover, -y0*X(31:30) is calculated and added to Z(31:30).

[0050] Now, Z15 contains 64 bits.

[0051] In the last timeslot (#17), the upper 32 bits are transferred to Z16 and Z15 and the two correction bits are added to the previous value of Z16, which is outputted.

[0052] When doing long-integer multiplication Yi is inputted Nw times combined with X0, X1,..., XNw-1. At the beginning of a long-integer calculation, Z16 is set to 0. Only when X0.Yi +W reaches the output Z, then Z16= 0 is added.

11. MONTGOMERY MULTIPLICATION FOR GF(2n)



[0053] Elliptic Curve calculations can also be defined over the field GF(2n).

[0054] All additions (denoted here by a "+") in this field are modulo 2 (exclusive or).

[0055] Polynomials in this field have a degree of at most degree n-1.

[0056] So when n=32, then the polynomials X and Y are defined by (all co-efficients are either 0 or 1)



There is also an irreducible polynomial p, which is defined as:

The product P = X.Y mod p is calculated by:

The product X.Y is then divided by the polynomial p and the remainder is the outcome. The degree of the remainder is always less than that of p.

[0057] Both X,Y and p can be represented by long integers.

[0058] The calculation of the reduced product can be done by a normal product calculation, with the modifications that the internal additions are done modulo 2. Then the division is done as normal except for the addition being modulo 2 and keeping the remainder.

[0059] However, one can also do a Montgomery multiplication, which is much faster.

12. MONTGOMERY MULTIPLICATION



[0060] The Montgomery Multiplication adds a multiple of the prime (irreducible polynomial) to the (partial) product, such that the product is divisible by a suitable factor R e.g. α32 or α160. For the given binary representation of the polynomials, one might also think of 232 or 2160 instead. Herein, m' is defined as m' = p-1 mod R, where p-1 is defined as p.p-1 mod R = 1.

[0061] Now, the same algorithm can be applied, with the following adaptations:
  • the addition within the multiplication is modulo 2
  • the final subtraction is omitted.


[0062] Further details of the arrangements. In addition to the foregoing, various further details, embodiments, and explanations are being presented by way of supplement hereinafter.

13. LONG-INTEGER MULTIPLIER AND ADDER



[0063] Definitions:
  • X = xNw-1.BNw-1 + ... + x2.B2 + x1.B1 + x0.B0
  • Y = yNw-1.BNw-1 + ... + y2.B2 + y1.B1 + y0.B0
  • Pi = piNw.BNw-1 + ... + pi2.B2 + pi1.B1 + pi0.B0
  • P = p2Nw-1.B2Nw-1 + ... + p2.B2 + p1.B1 + p0.B0
  • B = 232
  • m = Nw-1


[0064] Long-integer multiplication involves many multiplications of two 32-bit words. The embodiment uses a pipelined 32-bit multiplier (see Figures 1 and 4), which accepts in every timeslot three new 32-bit operands (X*Y+Z). Such multiplier is extremely fast. However, the output of the multiplication is only ready after 17 timeslots. So at most 17 multiplications may be calculated at the same time. However, when one wants to do a multiplication with the result of an ongoing multiplication, one has to wait for the result being ready. This can introduce wait cycles, which will decrease the performance.





[0065] Z, X and W have a size of Nw-1 32-bit words. Y; has a width of 32 bit.

Intermediate results Wi=Wi1.B0+ Wi2.B1 + .. Wi,m+1Bm
  • P0 = X.Y0 + W is calculated. The result is split up in P0 = W0.B + Z0
  • P1 = X.Y1 + W0 is calculated. The result is split up in P1 = W1.B + Z1.
  • P2 = X.Y2 + W1 is calculated. The result is split up in P2 = W2.B + Z2
  • ...
  • Pm = X.Ym + Wm-1 is calculated.
  • Zj = Pm,j for j ≥ m.


[0066] So we need a function which calculates Pi = X.Yi + Wi.

[0067] In this respect, Figure 2 is a block diagram of an arrangement for calculating (X * Y + W).



[0068] This calculation is part of the foregoing calculation.

[0069] X and W have a size of m=(Nw-1) 32-bit words.

[0070] Yi has a width of 32 bit.
  • S1 = x0.yi+ w0 is calculated. S1 is split up in Z1.B + P0.
  • S2 = x1.yi + w1 + Z1 is calculated. S2 is split up in Z2.B + P1, etcetera.
  • Sm = xm.yi + wm + Zm-1 is calculated. Sm is split up in Pm+1.B + Pm.
    A pertinent embodiment has been shown in Figure 3, which is a block diagram of an arrangement for executing a long integer multiplication according to (X * Y + W).
    The calculation S = x.y + w + z is done by the pipelined multiplier of Figure 1, discussed in part supra.
  • For calculations over GF(2n) the additions are modulo 2. So there are no carries.

14. PIPELINED MULTIPLIER



[0071] 









[0072] The left part calculates Z=X.Y+W +y0.X. This last term is an artifact of the used algorithm. The right part subtracts the last term.

[0073] The following gives an idea, how the multiplication is set up, but the implementation may deviate in details.

[0074] In the first timeslot Z0 = X.Y(1:0) + W0 is calculated and stored in register Z0. X is transferred to the second X-register and Y(31:2) to the second Y-register.

[0075] In the second timeslot Z1 = X.Y(3:2) + Z0 is calculated and stored in register Z1. X is transferred to the third X-register and Y(31:2) to the third Y-register. Moreover, -y0*X(1:0) is calculated and added to Z(1:0).

[0076] In the 16th timeslot Z15 = X.Y(31:30) + Z15 is calculated and stored in register Z15.

[0077] Moreover, -y0*X(31:30) is calculated and added to Z(31:30). Z15 contains now 64 bit.

[0078] In the last timeslot (#17), the upper 32 bits are transferred to Z16 and Z15 and the two correction bits are added to the previous value of Z16, which is output.

[0079] Doing long-integer multiplication as described in paragraph 13 then Yi is input Nw times combined with X0, X1,..., XNw-1. When X0.Yi +W reaches the output Z, then instead of adding the contents of Z16 nothing is added. Z16 has the function of Zi in paragraph 13: the part that is transferred from one multiplication to the next one.

15. MODIFIED BOOTH ALGORITHM



[0080] First the multiplier Y is recoded, where y'i may only have the values -2, -1, 0, +1 and +2 (signed digit notation).

(only defmed for even values of i)

e.g. when y=29dec = 011101bin then y' = (2 1 1)sd = 2.24 -1.22 + 1 = 29dec where 1 denotes -1

[0081] The formula used are those disclosed in the earlier paragraph on the Modified Booth Algorithm (paragraph 9).
To get the right result, we must subtract from the product y0.X.
Multiplying by 2 is left-shifting the multiplicand over 1 bit.
The partial products are coded in a radix-2 notation, where every product can have the value -1, 0 or +1.
Now the product is calculated in 16 stages. In every stage the partial product y'i.X.2i is calculated and added to the previous result, e.g. when x=53dec = 110101bin and y=29 (y' = (2 1 1)sd) then

[0082] For a 32-bit operand there are 15 additions to be done. With a normal full adder, this takes too much time because the carry has to ripple through. To prevent this we will use a carry-propagation-free adder. In this respect, Figure 5 illustrates an arrangement of a carry-propagation free adder.

16. REDUNDANT BINARY NOTATION



[0083] The Augend and the Addend of the adder are in a Redundant Binary Notation, which is also a Signed Digit notation. It has a fixed radix 2 and a digit set {1, 0, 1}, where 1 denotes -1. An n-digit redundant binary integer Y has the value yn-12n-1 + yn-22n-2 + ... + y1.21 + y0.20 where yi may have the value -1, 0 or 1.

[0084] There are several ways to represent an integer in the redundant binary notation, e.g. [0101]SD2 = [0111]SD2 =[1101]SD2 = [1111]SD2 =[1011]SD2 = 5dec. Only '0' has a unique representation: [00...0].

[0085] Conversion from normal binary notation to redundant binary notation is simple: both are the same.

[0086] Conversion from redundant binary notation to the normal one is done by the following subtraction: Xbin = X+ - X-, where X+ is got from Xsd2 by replacing all '1' by '0' and X- is got from Xsd2 by replacing all '1's by '0' and all '1's by '1'.
For example, when X= [1011]SD2 = 5dec, then X+= [1000]bin= 8dec and X- = [0011]bin= 3dec.

[0087] Negating a variable is done by replacing all '1's by '1' and '1's by '1'.

[0088] For example, when X= [1011]SD2 = 5dec, then -X = [1011]SD2 = -5dec
We will encode a variable as follows (see Table 1)
Table 1 Encoding of X for GF(p) in redundant binary notation (x= don't care).
X Output x+x- Input x+x-
0 00 00
1 10 1x
1 01 x1
The combination 11 is never used.

[0089] Therefore, when X is input and X=1, than the condition x+=1 is sufficient. Likewise, when X=1, than x-=1 suffices.

17. CARRY-PROPAGATION-FREE ADDER



[0090] The representation is chosen such, that a possible carry is absorbed in the next digit and does not influence the next carry. Therefore, the speed of such an adder is much higher than that of a 32-bit full adder.

[0091] As for the 32*32-bit multiplier, there are 16 additions (inclusive the upper most significant word of the previous multiplication). Then only at the end, the redundant binary notation is converted to the normal binary notation. This conversion is not propagation free.

[0092] The addition is done in *(conceptually) 2 steps. First an Intermediate Sum si and an Intermediate Carry ci are calculated. In the second step, both are converted to the final sum (sumi). This intermediate carry may depend utmost on the value of the present and the previous digits, but not on still earlier ones.

[0093] ci and si satisfy the following equation: 2ci + si = xi + yi. Furthermore, ci-1 and si are chosen such that both are never 1 nor 1.

[0094] In this respect, Figure 6 is a diagram illustrating the generating of intermediate carry and sumquantities.

[0095] The sum Si = ci + si-1 will not give a new carry:
  • type 1,3,4 and 6:    ci-1 + si = ci-1
  • type 2a,5a:    ci-11, i.e. 0 or 1, so ci-1 + si is either 1 or 0.
  • type 2b,5b:    ci-1 ≠ 1, i.e. 0 or 1, so ci-1 + si is either 1 or 0.
This is illustrated by the following example:


18. CONVERSION TO NORMAL BINARY NOTATION



[0096] In the last stage, the result is converted to normal binary notation. X = X+ - X- where X+ is formed by all xi+ and X- is by all xi-.

[0097] Because xi+ and xi- are never 1 at the same time, we do not need a full subtractor. Therefore, we try a different way.

[0098] We will remove all 1's going from the right to the left.

[0099] When there is no borrow from the right:
  • When the next digit is a '1' then the digit is kept and there is no borrow to the left.
  • When the next digit is a '0' then the digit is kept and there is no borrow to the left.
  • When the next digit is a '1', then the '1' is replaced by a '1' and there is a borrow to the left.


[0100] When there is a borrow from the right:
  • When the next digit is a '1' then the '1' is replaced by a '0' and there is no borrow to the left.
  • When the next digit is a '0', then the '0' is replaced by a '1' and there is a borrow to the left.
  • When the next digit is a '1', then the '1' is replaced by a '0' and there is a borrow to the left.


[0101] However, when the most left digit is a '1' and the most right digit is a '1' and all digits in between are '0' (10...01), this will cause a too big delay.

[0102] To decrease the delay, we split the 32 bits into 8 groups of 4 bits.
  • When the most left non-zero digit is a '1', then a borrow to the next left group is generated.
  • When there is at least one '1' in this group, a borrow form the right group is not propagated to the next group.

19. MULTIPLIER LOGIC FOR GF(2N)



[0103] 







[0104] For the representation of those vectors, one can read '2' in stead of 'α' in the above formulae.





There is no equivalent in GF(2n) for Booth coding.

[0105] In the first timeslot (see Figure 4) X.Y(1:0) ⊕ W is calculated and stored in register Z0. X is transferred to the second X-register and Y(31:2) to the second Y-register (Y).

[0106] In the second timeslot X.Y(3:2) ⊕ Z0 is calculated and stored in register Z0. X is transferred to the second X-register and Y(31:4) to the third Y-register (Y).

[0107] In the 16th timeslot Z15 = X.Y(31:30) ⊕ Z15 is calculated and stored in register Z15.

[0108] Z15 contains now 64 bit.

[0109] In the last timeslot (#17), the upper 32 bit are transferred to Z16 and Z15 are added to the previous value of Z16, which is output.

[0110] Doing long-integer multiplication as described in paragraph 13 then Yi is input Nw times combined with X0, X1,..., XNw-1. When X0.Yi ⊕ W reaches the output Z, then instead of adding the contents of Z16 nothing is added. Z16 has the function of Zi in paragraph 13: the part that is transferred from one multiplication to the next one.

[0111] In particular, Figure 4 illustrates an arrangement for a pipelined multiplier embodiment operating in GF 2n.

Adding



[0112] Adding is the exor of 2 variables. There is no carry.

Coding



[0113] Because we want to combine the logic with that of GF(p), we shall use the following redundant coding. So X = x+^ x-, wherein ^ indicates a logical "OR" function.
Table 2 Encoding of X for GF(2n) in redundant binary notation (x= don't care).
X Output x+x- Input x+x-
0 00 0x
1 10 1x
1 01 x1

20. LOGIC FOR BOTH GF(p) AND GF(2n)



[0114] Both multiplier stages will use the following structure zj = ai.xj-1 ⊕ bi.xj

GF(p)



[0115] GFp=1

(only for odd i, see Table 3 hereinafter)
Table 3 Encoding for GF(p)
yi+1 yi yi-1 y'i ai bi signi
0 0 0 0 0 0 1
0 0 1 1 0 1 1
0 1 0 1 0 1 1
0 1 1 2 1 0 1
1 0 0 -2 1 0 0
1 0 1 -1 0 1 0
1 1 0 -1 0 1 0
1 1 1 0 0 0 0

GF(2n)



[0116] GFp=0
ai = yi-1
bi = yi
zj+=zj=ai.xj-1 ⊕ bi.xj
zj- = 0

Combined



[0117] 








21. CARRY-PROPAGATION-FREE ADDITION



[0118] 
Table 4 Intermediate Carry and Sum.
Type xi yi xi-1 yi-1 f2 f5 h Intermediate Carry ci Intermediate Sum si
1 1x 1x xx xx 0 0 x 10 00
2a 1x 00 x0 x0 1 0 1 10 01
  00 1x x0 x0 1 0 1    
2b 1x 00 x1 xx 1 0 0 00 10
  1x 00 xx x1 1 0 0    
  00 1x x1 xx 1 0 0    
  00 1x xx x1 1 0 0    
3 00 00 xx xx 0 0 x 00 00
4 1x x1 xx xx 0 0 x 00 00
  x1 1x xx xx 0 0 x    
5a 00 x1 x0 x0 0 1 1 00 01
  x1 00 x0 x0 0 1 1    
5b 00 x1 x1 xx 0 1 0 01 10
  00 x1 xx x1 0 1 0    
  x1 00 x1 xx 0 1 0    
  x1 00 xx x1 0 1 0    
6 x1 x1 xx xx 0 0 x 01 00


[0119] Table 4 is identical to Figure 6 with the encoding according to Table 1.















Table 5 Final sum Si
ci-1+ ci-1- si+ si- Si+ Si-
00 00 00
00 1x 10
00 x1 01
1x 00 10
1x 1x -
1x x1 00
x1 00 01
x1 1x 00
x1 x1 -

22. GF(2n)



[0120] 



[0121] It appears that if we suppress the carries in the GF(p)-system, Si, generated according to the rules of GF(p) gives the right answer, that is coded according to Table 2.

Combined logic



[0122] 


















23. CONVERSION FROM REDUNDANT BINARY TO BINARY



[0123] Input is a vector X with xi = {1,0,1} . Output is a vector Y with yi = {0,1}.

[0124] The vector X is divided in 8 groups of 4 bit, with i = 4m+n (n=0..3, m=0..7).

Between groups:



[0125] 
  • The group borrow gm is generated when the most-left non-zero digit in this group is a '1'.
  • The group borrow gm-1 is propagated, when the group does not have any '1' (gm = gm-1).

Within groups:



[0126] 
  • a borrow bi is generated when the digit is a '1'
  • a borrow bi-1 is propagated when the digit is no '1': bi= bi-1
Table 6 Output and Borrow within a group
bi-1 xi+ xi- yi bi
0 00 0 0
0 1x 1 0
0 x1 1 1
1 00 1 1
1 1x 0 0
1 x1 0 1




for i ≠ 0,4,8,...,28

for i = 0,4,8,...,28


24. GF(2n)



[0127] The conversion is simple, because there are no borrows. If we suppress all borrows, then the circuitry of GF(p) gives the correct answer.

Combined logic



[0128] 



for i ≠ 0,4,8,...,28

for i = 0,4,8,...,28


Pipelined multiplier



[0129] The pipelined multiplier as given in Figure 1 can also be used for GF(2n), but -Y[0] is to be set to '0' in the right part. All other adaptations were described above.


Claims

1. A multiplier apparatus for multiplying a first long integer entity (X) with a second long integer entity (Y) modulo a prime number (p), the apparatus comprising a pipeline multiplier core, operable to execute the overall multiplication in Montgomery fashion using a modified Booth algorithm, characterised in that the multiplier apparatus is operable to execute a reduction step which subtracts the product of (i) the least significant part (y0) of the second entity (Y), and (ii) the first entity (X), from the result of the algorithm.
 
2. The apparatus as claimed in Claim 1, wherein the result of the algorithm is the sum of the product X*Y and product y0*X.
 
3. The apparatus as claimed in Claim 1 or Claim 2, wherein the apparatus is operable to subtract the product y0*X in a parallel construction.
 
4. The apparatus as claimed in any preceding claim, further comprising a carry-propagation free adder.
 


Ansprüche

1. Multipliziergerät zum Multiplizieren einer ersten Long-Integer-Entität (X) mit einer zweiten Long-Integer-Entität (Y) modulo einer Primzahl (p), wobei das Gerät einen Pipeline-Multipliziererkern umfasst, ausgebildet zum Ausführen der Totalmultiplikation nach Montgomery unter Verwendung eines abgewandelten Booth-Algorithmus, dadurch gekennzeichnet, dass das Multipliziergerät ausgebildet ist, einen Reduktionsschritt auszuführen, bei dem das Produkt aus (i) dem niedrigstwertigen Teil (y0) der zweiten Entität (Y) und (ii) der ersten Entität (X) vom Ergebnis des Algorithmus abgezogen wird.
 
2. Gerät nach Anspruch 1, bei dem das Ergebnis des Algorithmus die Summe des Produkts X-Y und des Produkts y0·X ist.
 
3. Gerät nach Anspruch 1 oder Anspruch 2, bei dem das Gerät ausgebildet ist, das Produkt y0*X in parallelem Aufbau zu subtrahieren.
 
4. Gerät nach einem der vorhergehenden Ansprüche, außerdem mit einem Addierer, der frei von Übertragsfortpflanzung ist.
 


Revendications

1. Appareil multiplieur pour multiplier une première entité entière longue (X) par une seconde entité entière longue (Y) modulo un nombre premier (p), l'appareil comprenant un noyau multiplieur pipeline pouvant être mis en fonctionnement pour exécuter la multiplication globale par une méthode de Montgomery en utilisant un algorithme de Booth modifié, caractérisé en ce que l'appareil multiplieur peut être mis en fonctionnement pour exécuter une étape de réduction qui soustrait le produit (i) de la partie de poids faible (y0) de la seconde entité (Y) par (ii) la première entité (X), au résultat de l'algorithme.
 
2. Appareil selon la revendication 1, caractérisé en ce que le résultat de l'algorithme est la somme du produit X*Y et du produit y0*X.
 
3. Appareil selon la revendication 1 ou 2, caractérisé en ce que l'appareil peut être mis en fonctionnement pour soustraire le produit y0*X dans une structure parallèle.
 
4. Appareil selon l'une quelconque des revendications précédentes, comprenant en outre un additionneur sans propagation du report.<texte>
 




Drawing