REDUCED COMPLEXITY MODULAR POLYNOMIAL MULTIPLICATION FOR R-LWE CRYPTOSYSTEMS
20230163944 · 2023-05-25
Inventors
Cpc classification
H04L9/3026
ELECTRICITY
H04L9/3093
ELECTRICITY
International classification
H04L9/00
ELECTRICITY
Abstract
A method includes receiving a first polynomial and a second polynomial, both of order n−1 and forming d polynomial segments from both the first polynomial and the second polynomial such that each polynomial segment is of order (n/d)−1. The polynomial segments of the first polynomial and the d polynomial segments of the second polynomial are used to form segment products. Each segment product is divided into a first polynomial substructure of order n/d and a second polynomial substructure of order (n/d)−1. A first polynomial substructure containing the first n/d coefficients of a product of the first polynomial and the second polynomial is summed with a second polynomial substructure to form a sum substructure. The sum substructure is used multiple times to determine coefficients of a polynomial representing the modulo x.sup.n+1 of the product of the first polynomial and the second polynomial.
Claims
1. A device-implemented method comprising: receiving a first polynomial and a second polynomial, both of order n−1; forming d polynomial segments from both the first polynomial and the second polynomial such that each polynomial segment is of order (n/d)−1; using the d polynomial segments of the first polynomial and the d polynomial segments of the second polynomial to form segment products; dividing each segment product into a first polynomial substructure of order n/d and a second polynomial substructure of order (n/d)−1; summing a first polynomial substructure containing the first n/d coefficients of a product of the first polynomial and the second polynomial with a second polynomial substructure to form a sum substructure, and using the sum substructure multiple times to determine coefficients of a polynomial representing the modulo x.sup.n+1 of the product of the first polynomial and the second polynomial.
2. The device-implemented method of claim 1 wherein the coefficients of the polynomial representing the modulo x.sup.n+1 of the product of the first polynomial and the second polynomial are determined by performing a number of addition operations after forming the segment products wherein the number of addition operations consists of one of at most an order of 3n addition operations for d equal 2; an order of 10n/3 addition operations for d equal 3; and an order of 27n/4 addition operations for d equal 4.
3. The device-implemented method of claim 2 wherein the number of addition operations is at most an order of 3n addition operations.
4. The device-implemented method of claim 3 wherein the number of addition operations is at most 3n−3 addition operations.
5. The device-implemented method of claim 2 wherein the number of addition operations is at most an order of 10n/3 addition operations.
6. The method of claim 5 wherein the number of addition operations is at most (10n/3)−5 addition operations.
7. The method of claim 2 wherein the number of addition operations is at most an order of 27n/4 addition operations.
8. The method of claim 7 wherein the number of addition operations is at most (27n/4)−12 addition operations.
9. A device-implemented method comprising: receiving a first polynomial and a second polynomial, both of order n−1; using a Karatsuba scheme on the first polynomial and second polynomial to form segment products; dividing each segment product into a first polynomial substructure and a second polynomial substructure; summing a second polynomial substructure, containing the last (n/d)−1 coefficients of a product of the first polynomial and the second polynomial, with a first polynomial substructure to form a sum substructure; and using the sum substructure multiple times to determine coefficients of a polynomial representing the modulo x.sup.n+1 of the product of the first polynomial and the second polynomial.
10. The device-implemented method of claim 9 wherein determining the coefficients of the polynomial representing the modulo x.sup.n+1 of the product of the first polynomial and the second polynomial comprises performing a number of addition operations after forming the segment products wherein the number of addition operations consists of at most one of an order of 3n addition operations; an order of 10n/3 addition operations; and an order of 27n/4 addition operations.
11. The device-implemented method of claim 10 wherein the number of addition operations is at most an order of 3n addition operations. (claims 11-16, seem conflict with each other and 19 is a duplication. The number of additions is 3n in this claim and 10n/3 in claim 13?)
12. The device-implemented method of claim 11 wherein the number of addition operations is at most 3n−3 addition operations.
13. The device-implemented method of claim 10 wherein the number of addition operations is at most an order of 10n/3 addition operations.
14. The device-implemented method of claim 13 wherein the number of addition operations is at most (10n/3)−5 addition operations.
15. The device-implemented method of claim 10 wherein the number of addition operations is at most an order of 27n/4 addition operations.
16. The device-implemented method of claim 15 wherein the number of addition operations is at most (27n/4)−12 addition operations.
17. A method comprising: performing a cryptographic operation based on a modulo x.sup.n+1 of a product of two polynomials each of order n−1 through steps comprising: using a Karatsuba scheme of forming a product of the two polynomials to form segment products; dividing each segment product into polynomial substructures; forming a sum substructure using a polynomial substructure containing coefficients of a polynomial representing the product of the two polynomials; using the sum substructure multiple times to determine coefficients for a polynomial representing a modulo x.sup.n+1 of the product of the two polynomials.
18. The method of claim 17 wherein determining the coefficients for the polynomial representing a modulo x.sup.n+1 of the product of the two polynomials comprises performing a number of addition operations using the polynomial substructures wherein the number of addition operations consists of at most one of an order of 3n addition operations; an order of 10n/3 addition operations; and an order of 27n/4 addition operations.
19. The method of claim 18 wherein the number of addition operations is at most 3n−3 addition operations.
20. The method of claim 17 wherein the polynomial substructure containing coefficients of the polynomial representing the product of the two polynomials contains a coefficient at an end of the polynomial representing the product.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
[0007]
[0008]
[0009]
[0010]
[0011]
[0012]
[0013]
[0014]
[0015]
DETAILED DESCRIPTION
[0016] In the embodiments described below, a new method is proposed to integrate a modular reduction into the Karatsuba polynomial multiplication. Modular reduction is applied to intermediate segment products instead of the final product. As a result, additional substructure sharing is enabled and the number of coefficient additions needed for assembling the segment products to get the final result is substantially reduced. For polynomial multiplications with decomposition factors 2, 3, and 4, the proposed scheme reduces the number of additions by 13-17%.
1. Introduction
[0017] Lattice-based ciphers utilizing the ring-learning with errors (R-LWE) problem are among the most promising and feasible candidates to resist quantum-computing attacks. Additionally, fully homomorphic encryption (FHE) allows computations to be carried out on encrypted data. It is a key enabler for secure and private cloud or distributed computing. The most popular FHE schemes, such as the BGV and BFV, are also based on the R-LWE problem.
[0018] The computations involved in the R-LWE problem can be broken down into polynomial multiplications and additions over the ring Z.sub.q[x]/(x.sup.n+1). The multiplication between two polynomials is followed by modulo reduction by x.sup.n+1 and the calculations on the coefficients are done modulo q. Large n and q are needed to achieve sufficient security level in Lattice-based ciphers and reduce the frequency of the expensive bootstrapping in FHE. For example, to allow four levels of multiplications between each bootstrapping, q has 180 bits and n=4096.
[0019] The embodiments described herein reduce the modular polynomial multiplication complexity by integrating the modular reduction into the Karatsuba multiplication process. Instead of waiting until after the segment products are assembled to get the final polynomial product, the modular reduction is applied to individual segment products. Since the modulus is in the format of x.sup.n+1, the reduction is carried out effectively as shifting the segment products. Due to the shifting, additional substructure sharing is enabled when the segment products are added up to derive the final result. Accordingly, the number of required coefficient additions is substantially reduced. For Karatsuba polynomial multiplications with decomposition factors of 2, 3, and 4, the proposed method leads to 13-17% reduction on the number of coefficient additions needed to assemble the segment products.
2. Polynomial Multiplication Over Ring and Karatsuba Formula
[0020] Over the ring Z.sub.q[x]/(x.sup.n+1), each element is a polynomial with degree lower than n and the coefficients are non-negative integers less than q. The product of A(x)=a.sub.0+a.sub.1x+ . . . +a.sub.n−1x.sup.n−1 and B(x)=b.sub.0+b.sub.1x+ . . . +b.sub.n−1x.sup.n−1 (0≤a.sub.i; b.sub.i<q) is A(x)B(x) mod (x.sup.n+1) and the computations over the coefficients, a.sub.i; b.sub.i, are carried out modulo q.
[0021] In the schoolbook multiplication of two polynomials of length n, n.sup.2 multiplications on the coefficients are needed. The Karatsuba algorithm was originally proposed to reduce the complexity of large integer multiplications. The same formula can be also used to reduce the number of coefficient multiplications in polynomial multiplication at the cost of larger number of coefficient additions. Decompose A(x) of degree n−1 into A.sub.0(x)+A.sub.1(x)x.sup.n/2, where A.sub.0(x)=a.sub.0+a.sub.1x+ . . . +a.sub.n/2−1x.sup.n/2−1 and A.sub.1(x)=a.sub.n/2+a.sub.n/2+1x+ . . . +a.sub.n−1x.sup.n2/2−1. Decompose B(x) in a similar way. Then, using the Karatsuba formula, P(x)=A(x)B(x) can be computed as P.sub.0(x)+P.sub.1(x)x.sup.n/2+P.sub.2(x)x.sup.n, where
P.sub.0=A.sub.0B.sub.0
P.sub.1=(A.sub.0=A.sub.1)(B.sub.0+B.sub.1)−A.sub.0B.sub.0−A.sub.1B.sub.1
P.sub.2=A.sub.1B.sub.1 (1)
[0022] For conciseness, ‘(x)’ is dropped from the notations if no ambiguity occurs as in the above equations. There are only three multiplications of polynomials of length n/2 in (1). Hence, the number of coefficient multiplications is reduced to 3(n/2).sup.2=3n.sup.2/4. The degree of P(x) is 2(n−1). Rewrite P(x) as P.sub.1(x)+x.sup.nP.sub.h(x), where P.sub.1(x)=p.sub.0+p.sub.1x+ . . . +p.sub.n−1x.sup.n−1 and P.sub.h(x)=p.sub.n+p.sub.n+1x+ . . . +p.sub.2n+2X.sup.n−2. Then
[0023] The number of coefficient multiplications can be further reduced by using larger decomposition factors. If A(x) and B(x) are each decomposed into three segments of length n/3, the product P(x)=P.sub.0(x)+P.sub.1(x)x.sup.n/3+P.sub.2(x)x.sup.2n/3+P.sub.3(x)x.sup.n+P.sub.4(x)x.sup.4n/3 can be calculated as
[0024] In total, 6 multiplications between polynomials of length n/3 are needed and the total number of coefficient multiplications is reduced to 6(n/3).sup.2=2n.sup.2/3. However, compared to (1) for 2-decomposition, the number of additions needed for assembling the segment products to get P(x) is increased a lot. For larger decomposition factors, the formulas in (1) and (3) can be applied in an iterative manner to further reduce the number of coefficient multiplications.
3. Karatsuba Polynomial Multiplication with Integrated Modular Reduction
[0025] Coefficient multipliers have larger silicon area than adders. Hence, the goal of the Karatsuba algorithm is to reduce the number of coefficient multiplications. More significant multiplication number reduction is achieved by using a larger decomposition factor. However, the number of additions needed to assemble the segment products increases fast with the decomposition factor as can be seen from (1) and (3). Since additions and subtractions have similar complexity, they are not differentiated in terms of complexity herein. Conventionally, the reduction by x.sup.n+1 is carried out after the final product is computed. As shown in (2), the modular reduction by such a polynomial can be implemented as negating and shifting the coefficients for the terms whose powers are at least x.sup.n. This paper proposes to carry out the modular reduction on the segment products in the Karatsuba multiplication before they are added up. This enables the sharing of many common terms in the segment product additions. As a result, the number of coefficient additions is substantially reduced without affecting the multiplication complexity.
[0026] In the discussion below, reference is made to “addition operations.” Such operations can implement adding two values together or subtracting one value from another. In order to subtract a value, the negative of the value is added to the other value in the addition operation. As such, the “sum” of an addition operation can either represent the sum of two values or the difference between two values. Thus, generic references to addition operations below should be read as including the determination of either a sum of two values or the difference between two values. The determination of whether an addition operation produces a sum or a difference of two values can be determined by examining the context in which the addition operation is implemented in the discussion below.
[0027] In 2-decomposed Karatsuba multiplication, let C.sub.0(x)=A.sub.0(x)B.sub.0(x), C.sub.1(x)=(A.sub.0(x)+A.sub.1(x))(B.sub.0(x)+B.sub.1(x)), and C.sub.2(x)=A.sub.1(x)B.sub.1(x). Each of these segment products has n−1 coefficients. In
[0028] To reduce the number of additions, embodiments carry out the modular reduction by x.sup.n+1 on the segment products before they are added up. According to (2), any term p.sub.ix.sup.i with i≥n becomes −p.sub.ix.sup.i-n after the modular reduction. As a result, the segment products can be added up as shown in
(C.sub.0,h−C.sub.2,l)−(C.sub.2,h+C.sub.0,l)+C.sub.1,l
(C.sub.0,h−C.sub.2,l)+(C.sub.2,h+C.sub.0,l)−C.sub.1,h.
Two terms instead of one common term are shared in the above calculations and no further modular reduction is needed. In total, 2(n/2−1)+4n/2−1/3n−3 coefficient additions are needed. The additional common term that is shared includes the first coefficients (C.sub.0,l) and the last coefficients (C.sub.2,h) of the product of the two polynomials P(x), where the first coefficients are for powers of x.sup.0 to x.sup.n/2−1 in the product and the last coefficients are for powers of X.sup.3n/2 to x.sup.2n−2 in the product. As shown in
(D.sub.0,h−D.sub.1,l)−(D.sub.0,l+C.sub.0,h+C.sub.2,h)+D.sub.2,l
(D.sub.0,l+C.sub.0,h+C.sub.2,h)−(D.sub.1,h+C.sub.0,l+(C.sub.2,l)
(D.sub.0,h−D.sub.1,l)+(D.sub.1,h+C.sub.0,l+C.sub.2,l)−D.sub.2,h
[0029] The shareable terms are enclosed in the parentheses above. Only (n/3−1)+2(n/3−1)+2(n/3−1)+1+5n/3−1=10n/3−5 coefficient additions are required. One of the common terms that is shared is (D.sub.1,h C.sub.0,l+C.sub.2,l), which contains the first coefficients (C.sub.0,l) of the product of the two polynomials P(x), where the first coefficients are for powers of x.sup.0 to X.sup.n/3−1 in the product. Another of the common terms that is shared is (D.sub.0,l+C.sub.0,h+C.sub.2,h), which contains the last coefficients (C.sub.2,h) of the product of the two polynomials P(x), where the last coefficients are for powers of X.sup.5n/3 to X.sup.2n−2 in the product. As shown in
[0030] The multiplication with a larger decomposition factor can be carried out by iteratively applying the formulas for small decomposition factors. For example, 4-decomposed polynomial multiplication can be implemented by applying the formulas in (1) for 2-decomposition in two layers. Let A(x)=A.sub.0(x)+A.sub.I(x)x.sup.n/4+A.sub.2(x)x.sup.n/2+A.sub.3(x)x.sup.3n/4, where each A.sub.i(x) has n/4 coefficients. Define A.sub.0′(x)=A.sub.0(x)+A.sub.2(x)X.sup.n/2 and A′.sub.1(x)=A.sub.1(x)+A.sub.3 (x)X.sup.n/2. Decompose B(x) and define B.sub.0′ and B.sub.1′(x) in a similar way. By applying the formulas in (1), P(x)=(A.sub.0′(x)+A.sub.1′(x)x.sup.n/4)(B.sub.0′(x)+B.sub.1(x)x.sup.n/4) can be rewritten as
[0031] Then the formulas in (1) can be applied again to each of the product term in (4). For example, A.sub.0′(x)B.sub.0′(x)=(A.sub.0(x)+A.sub.2 (x)X.sup.n/2)(B.sub.0(x)+B.sub.2 (x)X.sup.n/2) can be computed as
A.sub.0B.sub.0⇄((A.sub.0+A.sub.2)(B.sub.0+B.sub.2)−A.sub.0B.sub.0−A.sub.2B.sub.2)x.sup.n/2+A.sub.2B.sub.2x.sup.n. (5)
[0032] Using this 2-layer approach, the segment products need to be added up for P(x) calculation as shown in
[0033] By applying the polynomial modular reduction on the segment products, the coefficients that need to be added up are aligned as shown in
[0034] X.sub.1 includes the first coefficients (C.sub.00,l) of the product of the two polynomials P(x), where the first coefficients are for powers of x.sup.0 to x.sup.n/4−1 in the product and includes the last coefficients (C.sub.22,h) of the product of the two polynomials P(x), where the last coefficients are for powers of x.sup.7n/4 to X.sup.2n−2 in the product. As shown in
[0035] In the Karatsuba formulas, the same segment products are multiplied with different powers of x to compute the coefficients of the overall product. Hence, the same segment products appear at different columns in
4. Complexity Analyses and Comparisons
[0036] The number of segment products is minimized in Karatsuba multiplication. However, the number of coefficient additions needed for assembling the segment products to derive the modular multiplication result can be reduced by integrating the x.sup.n+1 reduction into the segment products as proposed in this paper. In this section, the number of coefficient additions needed for assembling the segment products in the proposed design is compared to that of the original Karatsuba multiplication for decomposition factors of 2, 3, and 4.
[0037] For 2-decomposition, considering that (n/2−1) additions are saved by sharing C.sub.2,l-C.sub.0,h, the number of coefficient additions needed for summing up the segment products in
[0038] Thus, the number of addition operations (both adding and subtracting values) for polynomials decomposed into 2 segments is on the order of 3n operations; the number of addition operations (both adding and subtracting values) for polynomials decomposed into 3 segments is on the order of 10n/3 operations; and the number of addition operations (both adding and subtracting values) for polynomials decomposed into 4 segments is on the order of 27n/4 operations.
TABLE-US-00001 TABLE 1 Number of additions needed for assembling segment products in modular multiplication using Karatsuba formula 2-decomp 3-decomp 4-decomp mod. + mod. 7n/2 − 4 4n − 6 31n/4 − 14 proposed 3n − 3 10n/3 − 5 27n/4 − 12
[0039]
[0040] In step 500 of
[0041] At step 504, the segments are used to compute segment products, such as C.sub.0, C.sub.1, and C.sub.2 in
[0042] Steps 502 and 504 implement portions of the Karatsuba scheme for polynomial multiplication.
[0043] At step 506, each of segment products C.sub.0, C.sub.1 and C.sub.2 are divided into substructures by dividing conductor groups 620, 622 and 624 into conductor subgroups 626, 628, 630, 632, 634 and 636 at step 506. Conductor subgroup 626 carries the C.sub.1,l coefficients and conductor subgroup 628 carries the C.sub.1,h coefficients of segment product C.sub.1. Conductor subgroup 630 carries the C.sub.0,l coefficient and conductor subgroup 632 carries the C.sub.0,h coefficients of product segment C.sub.0. Conductor subgroup 634 carries the C.sub.2,l coefficients and conductor subgroup 636 carries the C.sub.2,h coefficients of segment product C.sub.2.
[0044] At step 508, common terms, also referred to as sum substructures, are formed from the substructures of the segment products. Each sum substructure is formed by adding each coefficient of a segment substructure to a corresponding coefficient of another segment substructure. At least one of the sum substructures is formed using a segment substructure that contains the first n/d coefficients (for powers of x.sup.0 to x.sup.n/d−1) of the product of A(x) and B(x) and at least one of the sum substructures is formed using a segment substructure that contains the last (n/d)−1 coefficients (for powers X.sup.(2d−1)n/d to x.sup.2n−2) of the product of A(x) and B(x).
[0045] In
[0046] At step 510, the sum substructures are used multiple times to determine coefficients of a polynomial representing the modulo x.sup.n+1 of the product of A(x) and B(x). In
[0047] Dedicated subtraction circuit 650 and dedicate addition circuit 652 form a respective difference and sum that are used multiple times. In particular, the outputs of dedicated difference circuit 650 and dedicated addition circuit 652 are applied to both dedicated addition circuit 654 and dedicated difference circuit 656 and thus are determined once but are used twice. In addition the output of addition circuit 652 is used as part of implementing the modulo x.sup.n+1 operation. As shown in
[0048] Although the embodiment of
[0049] Although an embodiment is described above that uses dedicated hardware to optimize performance, the embodiments described above may also be applied to a software implementation on a computer. In such embodiments, a processor executes instructions stored in a memory to implement the steps described in
[0050] Although elements have been shown or described as separate embodiments above, portions of each embodiment may be combined with all or part of other embodiments described above.
[0051] Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms for implementing the claims.