1. Introduction
Montgomery reduction is an efficient method that performs modulo reduction after an integer multiplication. The reduction algorithm uses multiplication and simple bit-wise operations instead of an expensive division [
1]. Public-key cryptography based on the Rivest-Shamir-Adleman (RSA) system benefits from the efficient Montgomery modulo reduction [
2,
3]. Similarly, elliptic curve cryptography (ECC) systems over prime fields apply Montgomery reduction to support arbitrary prime curves [
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14].
In this work, we consider the modulo reduction for Gaussian integers. Gaussian integers are complex numbers such that the real and imaginary parts are integers. Arithmetic over Gaussian integers for the RSA system was proposed in [
15,
16,
17,
18]. In [
17,
18], it was shown for the RSA system that a significant complexity reduction can be achieved with Gaussian integers. Due to the isomorphism between Gaussian integer rings and ordinary integer rings, this arithmetic is suitable for many cryptography systems. The Rabin cryptography system and elliptic curve cryptography over Gaussian integers were considered in [
19,
20,
21,
22]. Moreover, coding applications over Gaussian integers use Gaussian integer arithmetic [
23,
24,
25,
26,
27,
28].
To reduce the complexity of the modular reduction, we investigate Montgomery reduction algorithms for finite Gaussian integer rings. However, it is not trivial to generalize Montgomery reduction to Gaussian integers. The final step of the reduction algorithm is based on the total order of integers which does not exist for complex numbers. In [
29], a Montgomery reduction algorithm was proposed that utilizes the absolute value to measure the size of a Gaussian integer. This study is an extension of our paper [
29]. In this work, we present a new approach that aims on reducing the complexity of the reduction presented in [
29]. In this algorithm, the absolute value is replaced by the Manhattan weight. The calculation of the Manhattan weight requires only a single addition, whereas the calculation of the absolute value requires addition and two squaring operations. On the other hand, the reduction using the Manhattan weight may not always obtain a unique solution. There are at most two possible solutions that are congruent. For many applications uniqueness is not an issue for the intermediate results in calculations, which require many subsequent reduction steps. For the final result, the correct representative can be calculated using absolute values.
The proposed concept of Montgomery reduction was applied in [
22] for the efficient calculation of the elliptic curve point multiplication. In particular, an area-efficient coprocessor was designed in [
22]. This processor uses the proposed Montgomery modular arithmetic over Gaussian integers. It is shown in [
21,
22] that a key representation with a Gaussian integer expansion is beneficial for the calculation of the point multiplication. This key representation reduces the computational complexity and the memory requirements of a secure hardware implementation, which is protected against side-channel attacks [
30,
31,
32,
33,
34,
35,
36,
37]. In this work, we provide the theoretical justification for the reduction algorithms applied in [
22]. Furthermore, we present new results for protected implementations of the point multiplication. In particular, we consider the randomized initial point method proposed in [
38]. This method is protected against several side-channel attacks, i.e., differential power analysis (DPA), zero-value point attacks (ZPA), and refined power analysis (RPA) [
32,
38]. We present synthesis results for a field-programmable gate array (FPGA) based on the architecture proposed in [
22]. The protected implementation of the point multiplication is significantly faster with Gaussian integers. Moreover, it requires less memory and fewer flip-flops than the PM algorithms over ordinary prime fields reported in [
39,
40].
This publication is organized as follows. We review the Montgomery multiplication of ordinary integers and discuss some properties of Gaussian integers in
Section 2. In
Section 3, Montgomery reduction based on the absolute value is investigated. We present a low-complexity reduction algorithm based on the Manhattan weight in
Section 4. To demonstrate that the arithmetic over Gaussian integers is useful, we consider the complexity for the elliptic curve point multiplication according to the randomized initial point method in
Section 5. In
Section 6, we discuss the results and conclude our work.
3. Montgomery Reduction for Gaussian Integers
In this section, we consider some important properties of Gaussian integers and derive Montgomery reduction for Gaussian integers using the absolute value. First, we show that the set is symmetric and that the absolute value of any element of this ring is bounded.
Lemma 1. For any we have the following symmetry The absolute value is bounded by Moreover, for any with we have Proof. Consider the quotient
, where
c and
d are the real part and the imaginary part of
. For
we have
. Hence, the rounded quotient satisfies
This implies
and
,
. Hence, we can bound the absolute value of the quotient
as
Multiplying both sides by
results in (
9). Note that
, or
have the same absolute value. Hence, (
8) holds.
Finally, consider a Gaussian integer
which is congruent to
x, i.e.,
. We use the notation
. Note that
implies
and
. Moreover, at least one rounded value
or
is nonzero because
, where
results in
. Similarly,
implies
. Hence, we have (
10). □
The next example demonstrates that is not a sufficient condition for .
Example 2. We consider the finite field for the Gaussian integer . All elements of this field are depicted in Figure 1. Consider with , i.e., and . Both Gaussian integers satisfy and . Hence, it is not possible to determine the representative based on the bound (9). The representative follows from (10), as . Next, we consider now Montgomery reduction. The reduction for Gaussian integers can be performed according to Algorithm 2, where
Steps 1 and 2 in Algorithm 2 are applied separately for the real- and imaginary part. We demonstrate that Algorithm 2 always obtains a precision reduction resulting in the correct representative.
Algorithm 2 Montgomery reduction for Gaussian integers |
input:, , |
output: |
- 1:
// bitwise AND of , with - 2:
// shift , right by l - 3:
if () then - 4:
- 5:
else if () then - 6:
determine according to ( 11) - 7:
- 8:
else - 9:
determine according to ( 12) - 10:
- 11:
end if
|
Proposition 1. For M and Z according to Algorithm 2, we have Proof. We consider the sum
in step 2 of Algorithm 2, where
implies that
R divides
. Considering the corresponding quotient
, we have
This shows that
q is congruent to
or
. The absolute value of
is bounded, i.e.,
As shown in Example 2, the quotient
q may not be the correct representative
even for
. The congruent values
with
are also possible candidates. However, for any
and
, the lower bound
follows from the triangle inequality and Lemma 1. Consequently, the quotient
q is the unique solution for
. Furthermore, for any
the condition
implies
Hence, only the candidates according to (
11) are possible for
. Using Lemma 1, it follows that the correct candidate can be found by minimizing the absolute value among all candidates according to (
11).
If
, the result
M is calculated as
with
according to (
12). To demonstrate that (
12) is correct, we derive the bound
. Consider again the quotient
. We aim to compensate the offset
by
, where the absolute values are bounded by
This follows from due to the reduction and implies the bound . □
Example 3. As an example for Montgomery reduction, we consider the product of two numbers and from or the corresponding field of Gaussian integers with . The two integers x and y are mapped to the Gaussian integers and with in the Montgomery domain. The product corresponds to in the Montgomery domain.
With Algorithm 2, we can reduce the product as follows. With , we first calculate . Note that the modulo reduction is a simple bitwise AND operation with .
Next, we calculate the quotient . For , the division by R without remainder is a simple right-shift by three bits. The quotient is the final result without further reduction steps because .
The product corresponds to in the field . To obtain this result, we apply Montgomery reduction for the inverse mapping . With , we have and the result . Again, no reduction is required because the condition is satisfied.
We illustrate the final reduction procedure of Algorithm 2 in the following example. There are up to eight possible values
according to (
11) and (
12). However, not all potential values have to be considered for the reduction. The number of valid candidates
can be reduced based on the signs of the real and imaginary part of
q.
Example 4. We consider again the finite field of Gaussian integers with . Figure 2 depicts all possible quotients q in the Montgomery domain after the first two steps of Algorithm 2. For we have . Thus, should be determined according to (11). However, there are only two possible values for α, i.e., , as q is in the first quadrant. Calculating and leads to . Consequently, we obtain the representative . Algorithm 2 achieves the desired precision reduction, where the final reduction step always results in the correct representative
. This result satisfies the bound
. The number of possible candidates
is restricted depending on the absolute value of
q, as illustrated in (
11) and (
12).
Nonetheless, the reduction according to Algorithm 2 can be rather complex due to the squaring to determine the absolute values. This complexity may not be required in all applications of the Montgomery multiplication. For applications in cryptography, it is adequate to find the unique representative only in the last calculation step, whereas for intermediates results a reduction that achieves is sufficient. This motivates a low complexity Montgomery reduction based on the Manhattan weight, which is considered in the next section.
4. Precision Reduction for Gaussian Integers Using the Manhattan Weight
In this section, we present a low complexity precision reduction for Gaussian integers based on the Manhattan weight, i.e., the absolute value in the reduction algorithm is replaced by the Manhattan weight. The calculation of the absolute value requires squaring, whereas the Manhattan weight requires only addition. On the other hand, this algorithm may not obtain a unique solution. However, there are at most two possible solutions that are congruent. In ECC or RSA systems that require many reduction steps, this algorithm can be used for the intermediate results.
Without loss of generality we consider
with
. The precision reduction is described in Algorithm 3, where
and
. We demonstrated that this algorithm always obtains
, where
.
Algorithm 3 Precision reduction for Gaussian integers |
input:, , |
output: |
- 1:
// bitwise AND of , with - 2:
// shift and right by l - 3:
if () then - 4:
- 5:
else - 6:
determine according to ( 14) - 7:
- 8:
end if
|
First, we note that using the symmetry according to Lemma 1, we can restrict the following derivations to the elements of the first quadrant. Next, we consider some important properties of the Manhattan weight.
Lemma 2. For the Manhattan weight is upper bounded by Proof. Let
c and
d be the real part and the imaginary part of
. For
we have
and consequently
This implies
and
,
. Hence, we consider
to upper bound the real and imaginary parts of
x as
Note that either
a is odd and
b is even or vice versa because
p is an odd prime. Furthermore, the real- and imaginary parts of
x are integers. Consequently, we have
We can bound the Manhattan weight of
x as
With
, the Manhattan weight of
x is upper bounded by
Next, we consider bounds on the Manhattan weight for the sum and product of two elements . Note that we consider arithmetic without modulo reduction.
Lemma 3. For we have the upper boundsfor arithmetic without modulo reduction. Proof. The bound on the sum follows from the triangle inequality and (
15), i.e.,
Without loss of generality we consider two elements
and
from the first quadrant for the product in (19). This implies
or
. Similarly, we have
. For the product
we have
First, consider the absolute value of the imaginary part
To determine the maximum value, we consider the bivariate function
and its partial derivatives
This results in a maximum for
and the bound
. Due to symmetry this bound also holds for the absolute value of the real part. Hence, we have
□
The following proposition demonstrates that Algorithm 3 results in the desired reduction.
Proposition 2. For M and Z according to Algorithm 3, we have Proof. The first two steps are identical in Algorithm 3 and Algorithm 2. Hence, the first statement (
25) follows from the same arguments as in the proof of Proposition 1.
For
, we immediately have (
26). For
, we consider again the corresponding quotient
. The Manhattan weight of
is bounded by
where we have used (
24) and the assumption
.
Similar to the proof of Proposition 1, we aim to compensate
with
. From Proposition 1 follows that
. Hence, the minimization in (
14) over
is sufficient. From (
27) follows that there is at least one solution with
. Consequently, the minimization in (
14) will find a solution satisfying (
26). □
Finally, we can now describe the final reduction step of Algorithm 3. Note that there are eight possible values for
according to (
14), but not all potential values have to be considered. The reduction procedure is demonstrated in the following example.
Example 5. Again, we consider the finite field of Gaussian integers with , where all possible values of q after the first two steps of Algorithm 3 are depicted in Figure 2. For instance, consider the product of and from . The two integers x and y are mapped to the Gaussian integers and with in the Montgomery domain. The product corresponds to in the Montgomery domain.
With Algorithm 2, we can reduce the product as follows. We calculate and the quotient . A valid solution of the reduction is a Gaussian integer M with . We have . Hence, further reduction is required. As q is in the first quadrant, we have three possible values for α, i.e., . Calculating results in , where only the solution satisfies the condition . Hence, we choose as the final result.
The final reduction step results in a Gaussian integer x with . Hence, Algorithm 3 achieves the desired precision reduction using the Manhattan weight. However, the result may not always be an element of the ring. For instance, for some the value is a ring element. Alternatively, the point can be a ring element. Both values are congruent and can satisfy , depending on . The ring element is the value with the smallest absolute value. There exist at most two congruent values with Manhattan weight less or equal N. Consequently, the correct representation can be selected by minimizing the absolute value of these two congruent values. Depending on the application this step might be required once to obtain the final result .
5. Elliptic Curve Point Multiplication
In this section, we consider the elliptic curve point multiplication to demonstrate that the arithmetic over Gaussian integers enables an efficient calculation. Calculations of the elliptic curve point multiplication are prone to side-channel attacks. For example, an attacker can estimate the secret key based on the required power consumption of the different arithmetic operations over time. There are many known attacks on the point multiplication like timing attacks, simple power analysis, differential power analysis, refined power analysis, and zero-value point attacks [
32,
38].
The concept for the point multiplication over Gaussian integers was introduced in [
22], where an area-efficient coprocessor design was proposed with an arithmetic unit that enables Montgomery modular arithmetic over Gaussian integers. It is shown in [
22] that a key representation with a Gaussian integer expansion is beneficial to reduce the computational complexity and the memory requirements of a secure hardware implementation considering timing attacks and simple power analysis. This architecture supports different point multiplication algorithms. In contrast to [
22], we consider the randomized initial point method which is additionally protected against differential power analysis, refined power analysis, and zero-value point attacks [
32,
38]. We refer to [
22] for the architecture and the implementation details.
In the following, we consider the elliptic curve
which is recommended for prime fields
[
32,
42]. The parameters
and
are constant coefficients. The pair
x and
y defines the coordinates of a point
on the curve. The one-way function of elliptic-curve cryptography is the point multiplication, i.e.,
, where
P is a point on the elliptic curve and
k is an integer. The point multiplication is typically implemented based on the binary expansion
of the integer
k with binary digits
, where
r is the length in bits and
is the binary representation of the key (the integer
k). This method requires two different point operations, the point addition (ADD) and the point doubling operation (DBL) [
32]. Let
and
be two distinct points on an elliptic curve (
28), then the sum
is calculated as
Similarly, the point doubling operation
is defined as
The calculations in (
29) and (
30) are typically performed using arithmetic over prime fields. However, we consider arithmetic over Gaussian integer fields, where
.
As an alternative to the binary expansion key representation,
-adic expansions of the integer
k with a non-binary basis
were proposed to speed up the point multiplication (PM) and to improve the resistance against attacks [
38,
43,
44,
45,
46,
47]. The
-adic expansion results in the point multiplication
where we consider digits
from a Gaussian integer field.
To demonstrate that a
-adic expansion with arithmetic over Gaussian integers can reduce the computational complexity, we consider an example based on the curve (
28) with
. For the products
we use the endomorphism
for prime fields [
32,
48]. Note that
is a point on the curve (
28) if
is a valid point. The negation of any point
is
according to [
32]. Hence, for the products
with
we have
Using this endomorphism, we can calculate other products
, e.g.,
requires a DBL, the mapping
, and an ADD operation. Several other endomorphisms for different curves over prime fields can be fund in [
32,
48].
For the point multiplication, we consider the randomized initial point method according to Algorithm 4. This method introduces a random point
R into the calculation of the point multiplication. Consequently, all intermediate results in the calculation of the point multiplication become randomized. The algorithm starts with a precomputation phase, where the points
are computed in steps 1 to 4 and stored in a memory. The point addition in step 5 results in the point
. This point is multiplied with
and then added to the corresponding precomputed point
in the loop in steps 6 to 9 of this algorithm. Due to the second product of the precomputations
, we obtain the point
after each iteration of this loop. Correspondingly, the final result is the point
. Hence, we obtain the correct result of the point multiplication
by subtracting
R from
Q in step 10. The point addition in step 8 is computed in each iteration since the
-adic expansion of the key according to [
22] excludes all zero elements. This prevents SPA and timing attacks. Furthermore, all stored points
are randomized due to the subtracting the random point
. Thus, the resistance against DPA, RPA, and ZPA is increased.
We can use the reduction based on the Manhattan weight in Algorithm 3 for all interim results in the point multiplication. The aim of the reduction of interim results is finding a Gaussian integer
that has a Manhattan weight satisfying
and is congruent to the actual representative
x. The reduction algorithm can be stopped once a value
with
is found. Hence, not all offsets in (
14) have to be considered in every reduction.
Table 2 presents numerical results on the number of required reduction steps for different field sizes. The four columns on the right in
Table 2 provide the percentage for the number of required offset reduction steps after an arithmetic operation, where no reduction is required if the result
q already satisfies
. These results illustrate that sequential processing of the offset reduction is suitable for the point multiplication because
of all operations require no reduction since
is satisfied. About
of all operations require a single reduction step. Two or three calculation steps were required in approximately
of all cases.
Algorithm 4 Point multiplication according to the randomized initial point method from [38]. |
input:P, |
output: |
- 1:
// randomized initial point - 2:
for ( down to 0) do - 3:
// store all precomputed points in memory - 4:
end for - 5:
; // ADD and - 6:
for ( down to 0) do - 7:
// use DBL and ADD operations since - 8:
// ADD Q and that is read from the memory - 9:
end for - 10:
return
|
On the other hand, the different execution times of the reduction steps may cause concerns about side-channel vulnerabilities. However, the probability for additional reduction steps is relativity low. Moreover, the randomized initial point method also randomizes the occurrence of these additional steps.
Next, we demonstrate that determining the point multiplication using Gaussian integers reduces the computational complexity. The number of required point operations per iteration of the point multiplication is similar to the results in [
22]. However, some additional computations are required to subtract the random point. As in [
22], we estimate the computational complexity for the point multiplication in terms of multiplication equivalent operations
M.
Table 3 illustrates two examples for the complexity with different bases
. The parameter
r denotes the maximum key length in bits and the value
l is the number of iterations per point multiplication. A larger value of
reduces the number of iterations and speeds up the computation compared with a conventional binary PM, but requires more storage for the precomputed points.
The results are compared with the point multiplication according to randomized initial point but using ordinary integer expansions as proposed in [
38] for comparable base values
w. For instance, we can compare the complex base
with
digits and the base
with
digits from [
38]. For these values, the number
M of multiplications is reduced by
. This reduction results mainly from the simpler calculation of
for Gaussian integers due to the used endomorphism. In [
21], a similar PM with
-adic expansions over Gaussian integers was proposed. This algorithm additionally reduces the number of precomputed and stored points. However, this method considers only timing and simple power analysis attacks. It is more vulnerable to statistical attacks than the randomized initial point method.
To illustrate the efficiency of Gaussian integer arithmetic, we consider latencies for the point multiplication according to Algorithm 4 using both norms in
Table 4. The table provides results for a Xilinx Virtex-7 field-programmable gate array (FPGA) based on the architecture from [
22]. The hardware requirements are represented by the number of look-up tables (LUT), flip-flops (FF), slices, and digital signal processor (DSP) units, as well as by the RAM size. The maximum clock frequency is denoted by
. These point multiplications are significantly faster than the results from [
39,
40]. For instance, the design in [
40] considers key lengths up to
and the unprotected PM. This design is optimized for the use of DSP units which reduces the number of LUT. The number 1990 of LUT is similar to the proposed design with key length
using DSP units. It employs much more flip-flops (1786) and memory (234 kbit). An unprotected PM of length
requires 23.5ms whereas the proposed protected PM requires only 6.87ms for
.
Note that the latency values for the reduction algorithms depend on the hardware architecture. The calculation of the Manhattan weight requires one addition which is performed in a single clock cycle with the architecture from [
22]. For the absolute value, two additional multiplications are required which need four clock cycles each. Hence, the latency for calculating the Manhattan weight is only 11% of the time for the absolute value. The results in
Table 4 illustrate the impact of this complexity reduction on the total latency of a point multiplication. Applying the Manhattan weight reduces the latency of a PM by 13% compared with the reduction algorithm from [
29].
6. Conclusions
Gaussian integers are suitable for RSA [
17,
18] and ECC applications [
22]. Furthermore, Gaussian integers have applications in coding theory [
23,
26]. The Montgomery multiplication for Gaussian integers was previously proposed in [
17,
18]. However, no reduction algorithm was advised.
The generalization of Montgomery reduction to Gaussian integers is not trivial, because complex numbers cannot be totally ordered. In this work, we have presented two algorithms for Montgomery reduction for Gaussian integers which use different norms. The first algorithm utilizes the absolute value to measure the size of a Gaussian integer. This algorithm can uniquely determine the correct representative. The second algorithm is based on the Manhattan weight of Gaussian integers, which reduces the computational complexity for the modulo reduction. However, two congruent solutions may occur. It is not possible to determine the correct candidate based on the Manhattan weight. The correct representative is the candidate with the smaller absolute value. Hence, the first algorithm is required to determine the final result, e.g., for the inverse mapping from the Montgomery domain to the original field representation.
It is shown in [
21,
22] that a key representation with a Gaussian integer expansion is beneficial to reduce the computational complexity and the memory requirements of elliptic curve point multiplication algorithms that are protected against side-channel attacks. However, only timing and simple power analysis attacks were considered. This PM is vulnerable to statistical attacks [
38]. As an alternative, we have shown that Gaussian integer expansions can be used with the randomized initial point method. This method is protected against statistical attacks like DPA, RPA, and ZPA. The FPGA implementation of this protected PM with Gaussian integer expansions is significantly faster than the PM algorithms over ordinary prime fields reported in [
39,
40].
However, Gaussian integer fields can only be constructed for primes of the form
, hence a generalization of this work to Eisenstein integers could be beneficial. Eisenstein integers are complex numbers of the form
, where
, and Eisenstein integer fields can be constructed for primes of the form
. An elliptic curve point multiplication using Eisenstein integers was considered in [
49] showing similar properties as the point multiplication over Gaussian integers. Up to now no efficient modulo operation for Eisenstein integers is known. We believe that a generalization of the Montgomery modular multiplication to Eisenstein integers would be a promising direction for further research.