1. Introduction
A finite group is defined as a finite set of group elements together with an associative group operation and the corresponding inverse operation. We introduce secure groups as an oblivious data structure implementing finite groups in a privacy-preserving manner. Both the representation of group elements and the implementation of the group operations should be oblivious, meaning that no information can be inferred about the values of the group elements involved. Secure groups aim to significantly simplify implementations of threshold cryptography, providing efficient primitives for typical cryptographic operations such as secure exponentiation, random sampling, and encoding/decoding. This paper is an extended version of our paper published in CSCML 2023 [
1].
We develop the underlying protocols in the setting of secure multiparty computation (MPC) based on Shamir secret sharing over a finite field. We will distinguish between generic constructions and specific constructions for finite groups used in cryptography, particularly the group of quadratic residues, elliptic curve groups, and class groups.
Generic constructions include the application of secure table lookup to the multiplication table of the group. Also, if a faithful linear representation over a finite field is available from representation theory, it directly permits an oblivious representation of the group elements (as square matrices over a finite field) and an oblivious implementation of the group operation (as matrix multiplication). We note that Bar-Ilan and Beaver already considered a generic protocol for secure inversion of group elements as a natural generalization of secure matrix multiplication ([
2] Lemma 6). In general, the implementation of basic tasks such as the group operation and en/decoding depends on the representation of the secure group. Where practical, we may look for generic implementations first. Therefore, we present generic protocols for the following tasks: conditional (if–else), random sampling, inversion, and exponentiation.
We also define specific oblivious representations and operations for a set of frequently used finite groups. The multiplicative group
and any of its subgroups (quadratic residues and, more generally, Schnorr groups) directly permit an oblivious representation and group operation using secret shares over
. Encoding and decoding for these groups is in general hard, so we present several techniques and trade-offs focusing on quadratic residues. Groups defined on elliptic curves over finite fields directly permit an oblivious representation. To facilitate the implementation of such groups, we employ complete formulas known for Weierstrass and Edwards curves. We employ a result from [
3] for parallel architectures, which yields a secure group operation of particularly low multiplicative depth. Ideal class groups of imaginary quadratic fields have been studied extensively for use in cryptography by Buchmann et al. (see [
4] and references therein) and recently received renewed interest (see, e.g., [
5,
6,
7]). For the implementation of the class group operation, we present efficient protocols for the composition and reduction of binary quadratic forms.
A key step in our protocol for the composition of binary quadratic forms is the secure computation of the extended greatest common divisor. We start from the constant-time algorithms proposed by Bernstein and Yang [
8]. Their approach relies on the use of 2-adic arithmetic, but we will work purely over the integers for an efficient solution in an MPC setting. The core of the protocol centers around Bernstein and Yang’s divsteps2 algorithm, which takes a fixed number of roughly
iterations when run on numbers of bit length at most
ℓ. The work for each iteration is dominated by secure comparisons with numbers of bit length at most
, requiring
secure multiplications each. We develop a novel analysis showing that the Bézout coefficients are bounded above by
in absolute value when computing the extended greatest common divisor of numbers
a and
b. The total number of
secure multiplications compares favorably to, e.g., a basic binary gcd algorithm ([
9] Algorithm 14.61), which requires
secure multiplications. Other binary gcd algorithms such as Bojanczyk and Brent [
10] (and related algorithms as considered by [
8]) as well as the algorithm attributed to Penk ([
11] Vol. 2, Exercise 4.5.2.39) also lead to
secure multiplications due to the use of either full-size
ℓ-bit secure comparisons or inner loops requiring
secure multiplications in the worst case.
To obtain an efficient protocol for the reduction of forms, we start from the algorithm proposed by Agarwal and Frandsen [
12]. A key property of their approach is that the use of full integer divisions is avoided in the main loop of the form reduction algorithm. We show how to adapt their algorithm to an MPC setting such that the work for each iteration of the main loop is limited to a small constant number of secure comparisons and operations of similar complexity requiring
secure multiplications each. For discriminant
of bit length
ℓ and forms with coefficients all of bit length at most
ℓ, we show that
iterations suffice for the reduction, which leads to
secure multiplications overall.
Finally, as related work in the area of threshold cryptography, we note that several papers on threshold signatures [
13,
14], threshold
-proofs [
15], and verifiable (or auditable) MPC [
16,
17] implicitly implement some form of secure groups for
or elliptic curves, but these papers do not treat secure groups in general terms.
The paper is organized as follows. Above, we have elaborated on our contributions and related work regarding secure groups. In
Section 2, we present preliminaries on secure multiparty computation.
Section 3 presents our efficient protocol for the extended greatest common divisor, including a careful analysis establishing a nontrivial bound on the growth of the Bézout coefficients.
Section 4 introduces our cryptographic scheme for secure groups. In
Section 5, we present generic constructions for secure groups, and, in
Section 6, we present generic protocols for the following tasks: conditional (if–else), random sampling, inversion, and exponentiation.
Section 7 presents specific constructions and protocols for groups used in cryptography, particularly quadratic residues, elliptic curve groups, and class groups. As an example application in threshold cryptography,
Section 8 presents a simple threshold cryptosystem built from secure groups. We conclude in
Section 9 with remarks about implementations and applications.
3. Secure Extended GCD
This section presents a new protocol for the secure computation of the extended greatest common divisor (xgcd) of secret-shared integers. In
Section 7.3, we use this protocol for the composition of binary quadratic forms in secure class groups.
We first present Algorithm 1, which can be viewed as an alternative to the divsteps2 algorithm by Bernstein and Yang [
8], on which it is based, but without the use of any 2-adic arithmetic. Algorithm 1 works purely over the integers. To compute, for instance, a modular inverse, we do not need any (potentially costly) pre- or post-processing (in contrast to Bernstein and Yang’s algorithm recip2), which would complicate the conversion to an MPC protocol. Hence, our xgcd algorithm may also be of independent interest for other settings in which the use of 2-adic arithmetic is not straightforward. (Using precomputation for modular inverses can be beneficial, particularly in applications that reuse the modulus. In settings where inputs are not reusable, the precomputation cannot be reused. This is the case in our application of the xgcd to compute class group operations).
Algorithm 1 () , a odd |
- 1:
▹ , - 2:
for to n do - 3:
- 4:
if then - 5:
- 6:
if then - 8:
- 8:
if then - 9:
- 10:
- 11:
if then - 12:
- 13:
return
|
As a starting point, we take the constant-time extended gcd algorithm divsteps2 by Bernstein and Yang ([
8] Figure 10.1). Our protocol xgcd, see Protocol 1, retains the algorithmic flow of their divsteps2 algorithm, which is controlled by the following step function ([
8] Section 8):
Throughout, variable
f is ensured to be an odd integer, and therefore the divisions by 2 are without remainder in both cases of the step function. Bernstein and Yang argue that this step function compares favorably with alternatives from the literature, e.g., the Brent–Kung step function [
26] and the Stehlé–Zimmermann step function [
27]. The computational overhead of function divstep is small, and the required number of iterations
n as a function of the bit lengths of the inputs
a and
b compares favorably with the alternatives. Concretely, with
for odd
a, Bernstein and Yang prove that
and
holds for
, where
and
Hence, .
The first major change compared to Bernstein and Yang’s divsteps2 algorithm is that we entirely drop the use of truncation for
f and
g. In our MPC setting,
f and
g are secret-shared values (over a prime field of large order) and, therefore, limiting the sizes of
f and
g is not useful. The second major change is that we will avoid the use of 2-adic arithmetic entirely by ensuring that the Bézout coefficients will remain integral throughout all iterations. Concretely, this means that we will make sure that coefficients
q and
r are even before the division by 2 at the end of each iteration: if
q and
r are odd, we use
and
instead, which will then be even because
a is odd by assumption. We thus obtain Algorithm 1 as an alternative to Bernstein–Yang’s constant-time algorithm.
Protocol 1 () , a odd |
- 1:
- 2:
for to n do - 3:
- 4:
if then - 5:
- 6:
if then - 7:
- 8:
if then - 9:
- 10:
- 11:
if then - 12:
- 13:
- 14:
return ▹
|
We turn Algorithm 1 into a secure protocol operating on secret-shared values as follows. We drop variables q and u from the main loop and instead set at the end. Overall, this saves secure multiplications for q and n secure multiplications for u, which are otherwise needed to implement the if–then statements obliviously. See Protocol 1 for the result.
All operations on the remaining variables are completed securely. The secure computations of and are completed by using a secure protocol for computing the least significant bit. The secure computation of is the most expensive part of each iteration. However, by taking into account that is bounded above by , we can further reduce the cost of this secure comparison.
The result is a secure protocol with a single loop of
iterations, where
ℓ denotes the maximum bit length for
a and
b. Per iteration, the work is proportional to
secure multiplications as the comparison for
bit numbers determines the complexity of the adapted divstep. The resulting
compares favorably to, e.g., the binary extended gcd from ([
9] Algorithm 14.61), which would require
secure multiplications.
For the general case, where
a is not known to be odd, we use an auxiliary protocol to securely count the number of trailing zeros of a given secret-shared integer. We have designed and implemented a novel approach requiring
secure multiplications in
rounds for this task. Moreover, we have designed and implemented protocols for the secure modular inverse of
a modulo
b (provided
), and for computing
and
securely. See also
Section 9.
We conclude this section with a result on the bounds for the Bézout coefficients computed by our xgcd algorithm (and protocol). The novelty of this result is due to the fact that the bounds are explicit (avoiding big-O notation), while the xgcd algorithm avoids full-sized comparisons to control the size of intermediate variables. To this end, we analyze Algorithm 1 and show in Theorem 1 below that the Bézout coefficients are bounded by .
For the analysis, we partition an execution of Algorithm 1 into k consecutive runs as follows. A new run starts with each assignment to variable v: the first run starts with the initialization in the first line and each next run starts with an update in line 5.
By , we denote the value assigned to v at the start of the jth run, . Hence, and will be the final value of v. We define .
Let denote the length of the jth run, which is defined as the number of times is incremented (in line 13) during the run. Hence, . Note that is possible, but for .
Let be the value of at the end of the jth run. We define . Then, for . Note that is possible, but this will be irrelevant for the analysis. Also, for .
We want to show by induction on j that all are bounded.
At the start of the jth run, r is set to . At the end of each loop iteration, the value of r, which is ensured to be even at that point, is halved. This will limit the growth of . On the other hand, may grow because of the additions of v and/or a. Since precisely during the last iterations of the jth run, however, it follows that g must then be even, and therefore can only grow because of the addition of a.
To analyze the extreme values for
r at the end of each run, we introduce the following three auxiliary functions:
The relevant monotonicity properties of these functions are stated as follows.
Lemma 1. Functions , , and are increasing in r and nondecreasing in v.
The next two lemmas establish the basic bounds for , which follow almost directly from the way we have defined and .
Lemma 2. We have , , and for : Lemma 3. for .
Proof. From Lemma 2, we know that . Since function is nondecreasing in v, we obtain the claimed bound for because we also have (using that ). □
Finally, we prove our main result, establishing a nontrivial bound for the Bézout coefficients .
Theorem 1. for .
Proof. The proof is by induction on
j. Since
and
, the bound clearly holds for
as
. For
, we have the following bounds from Lemma 2:
Since and , the bound also holds for .
For
, we first prove the lower bound
. From Lemma 2, we have
Since
is increasing in
r and nondecreasing in
v, we then obtain
as
and
follow from the induction hypothesis.
Hence, the lower bound for
holds as
Next, we prove the upper bound
. From Lemma 3, we have
Since
is increasing in
r and nondecreasing in
v, we obtain
as
on account of the induction hypothesis.
To complete the proof, we distinguish the cases and .
If
, we see that
which is independent of
and is bounded above by
.
Since
is nondecreasing in
v, we therefore have
Further, as
is increasing in
r, we conclude
as
on account of the induction hypothesis. This leads to
If
, we see that
still depends on
. To prove the upper bound for
in this case, we therefore introduce
for
, hence
.
For the derivative of
f with respect to
v, we obtain, for
hence, we set
at its maximal value.
Finally, we have that
is increasing in
and decreasing both in
and in
for
:
Therefore, the maximum value of
f is
which is the desired upper bound for
. □
4. Secure Groups
Let denote an arbitrary finite group, written multiplicatively. To define secure group schemes, we use to denote a secure representation of a group element . In general, such a secure representation will be constructed from one or more secret-shared finite field elements. Also, we may compose secure representations; e.g., we may put as secure representation of for a direct product group .
A secure group scheme should allow us to apply the group operation ∗ to given and , and obtain as a result. We will refer to this as a secure application of the group operation, or as a secure group operation, for short. Similarly, a secure group scheme may allow us to perform a secure inversion, which lets us obtain for a given . Another common task is to generate a random sample with and hence to obtain a secure representation of a group element a drawn from the uniform distribution on .
To cover a representative set of tasks, we define secure groups as follows.
Definition 1. A secure group scheme for comprises protocols for the following tasks, where .
Group operation. Given and , compute .
Inversion. Given , compute .
Equality test. Given and , compute .
Conditional. Given and with , compute .
Exponentiation. Given and with , compute .
Random sampling. Compute with (or close to uniform).
En/decoding. For a set S and an injective map :
Encoding.Given , compute .
Decoding.Given with , compute .
By default, all inputs and outputs to these protocols are secret-shared. In addition, the scheme also comprises variants of default protocols where some of the inputs and outputs are public and/or private.
By definition, a secure group scheme thus includes an ordinary group scheme where all protocols operate on public values. Also note that there may be multiple encodings/decodings for a group , each defined on a specific set S.
To illustrate what we mean by variants of default protocols, consider the following cases for secure exponentiation (which are covered in
Section 6.4): (i) given public
a and secret
, compute secret
; (ii) given secret
and public
x, compute secret
. Similarly, variants of the trivial secure encoding/decoding protocols with
and
the identity map on
will allow us to support private input and output of group elements: (i) given private input
a, compute secret
, and (ii) given secret
, compute private output
a. The private inputs and outputs may even belong to external parties not taking part in the MPC protocol.
We have included a representative range of tasks in our definition of secure groups. Even though some of the tasks are redundant, they are included nevertheless because these tasks cannot necessarily be implemented without loss of efficiency in terms of the other tasks. For instance, secure random sampling can be implemented by letting each party generate a random group element as private input, for , and then computing the product securely. Depending on the implementation, however, this may be completed more efficiently for particular groups.
A class of tasks that we have not (yet) incorporated in the definition of secure groups includes higher-order versions of basic tasks. An important example is multi-exponentiation . Similarly, the n-ary group operation may be included as a basic task, for which there may be more efficient solutions compared to applications of the secure group operation.
5. Generic Constructions of Secure Groups
In this section, we present two generic constructions for secure groups. The first construction relies on secure (oblivious) table lookup and performs best for groups of limited size and without much structure. The second construction relies on linear representations, which may result in compact and efficient implementations for particular groups (like for Rubik’s Cube group of order 43,252,003,274,489,856,000). In
Section 7, we will complement these results with specific constructions for number-theoretic groups used in cryptography.
5.1. Secure Groups from Table Lookup
For our first generic construction of secure group schemes for arbitrary groups , we apply secure table lookup to the multiplication table of . This construction works best for relatively small groups because the performance is polynomial in .
Let be an arbitrary encoding for such that is the identity element of . The multiplication table for is then represented by a public matrix with for all .
For the secure representation of any , we set for a fixed prime . Thus, each group element is represented by a secret-shared integer in the range , and, in particular, we have . To implement the group operation securely, we take , where and are secret-shared unit vectors of length n corresponding to and , respectively. A unit vector has one entry equal to 1 and all its other entries equal to 0. There are efficient protocols for converting , to the corresponding unit vector and back.
The secure equality test between and reduces to a secure equality test .
The secure conditional can also be implemented efficiently given with . Given and , we have ; hence, the result is obtained with a single secure multiplication modulo p.
To generate a random group element, we generate a uniform random integer with . This requires about secure random bits (modulo p).
For the remaining tasks, we can use the generic protocols presented later in this paper. If desired, these protocols can also be optimized.
5.2. Secure Groups from Faithful Linear Representations
Our second generic construction of secure group schemes builds on the existence of faithful linear representations for arbitrary groups . A faithful linear representation of is an injective homomorphism for some finite field . The general existence of such linear representations can be inferred from Cayley’s theorem, which states that every group is isomorphic to a subgroup of the symmetric group acting on ; clearly, every permutation can be represented by a unique permutation matrix over .
The basic idea is to use encoding , defined for any . Hence, we set such that group element a is represented by a secret-shared matrix with entries in . The secure group operation for and is implemented as a secure matrix product , which can be computed efficiently by performing secure dot products in parallel using one round of communication. The secure inverse of can be computed efficiently by generating a matrix with and opening , inverting this matrix in the clear to obtain , and multiplying this with to obtain the result. Here, R can be any matrix in ; hence, R does not have to lie in .
The secure equality test reduces to securely testing if is the all-zero matrix. The secure conditional is implemented efficiently, provided with , by setting ; hence, the result is obtained with a single secure multiplication of a scalar with a matrix over .
The representation theory of finite groups [
28] helps us to find not just any linear representation but rather (faithful) linear representations
of low degree
d, preferably over a small finite field
. As a simple example, we consider the representation of an arbitrary cyclic group of prime order
p. These groups are all isomorphic to
, the group of integers modulo
p with addition. To obtain a linear representation of degree 2 for this group, one takes
The essential property is that for all . However, a linear representation of degree 1 is also possible: in fact, for a cyclic group of any order n, , let g be an element of order n in for some prime power q. Then, we simply take for .
As a more advanced example, we illustrate the use of a linear representation of
minimum degree for the well-known Rubik’s Cube group. The Rubik’s Cube group
is a subgroup of
generated by the six permutations corresponding to a clockwise turn of each side (keeping the center pieces at rest). The smallest faithful linear representation of the Rubik’s Cube group turns out to be of degree 20 [
29].
Concretely, linear representation can be used, where for corresponds with a generalized permutation matrix that encodes all 20 movable cubies as positions (12 edge and 8 corner cubies). Each position encodes an edge flip or a corner twist as elements in of multiplicative order 2 and 3, respectively. We can define as a block diagonal matrix over with two blocks: a generalized permutation matrix with its nonzero entries in and an generalized permutation matrix with its nonzero entries in . Moreover, the following conditions should be satisfied: for each block, the product of its nonzero entries is equal to 1 (modulo 7), and the permutations corresponding to the two blocks are of equal parity (i.e., both permutations are even, or both are odd). This results in possible representations, matching the order of the Rubik’s Cube group. As a “toy example” of an application of secure groups, one can replace the trusted shuffler in a Rubik’s Cube competition by using secure random sampling in the Rubik’s Cube group.
Note that cryptographic applications often require hardness of the discrete logarithm problem for the particular group, making linear representations unsuitable for these applications. However, in non-cryptographic applications of secure groups, linear representations can help the construction of an efficient secure group representation, as illustrated above for the Rubik’s Cube group.
6. Generic Protocols for Secure Groups
In
Section 5, we have shown several representations for secure groups and discussed protocols for implementing the tasks listed in Definition 1. In general, the implementation of basic tasks such as the group operation itself and en/decoding strongly depends on the representation of the secure group. For other tasks, however, we may look for generic implementations. This section presents generic protocols for the following four tasks from Definition 1: conditional (if–else), random sampling, inversion, and exponentiation.
6.1. Secure Conditional
It is usually best to implement the secure conditional directly in terms of the underlying representation of a secure group, as we have shown in
Section 5.1 and
Section 5.2. Alternatively, the secure conditional can be evaluated in terms of secure exponentiation in either of these two generic ways, if applicable: as
, or as
, where
. This way, it suffices to implement the basic operation
with
. Moreover, if base
a is publicly known, it even suffices to implement
(with Protocol 7 as a good option to implement this operation).
In pseudocode, the secure conditional will be denoted as with the obvious variations if a and/or b are publicly known. The condition should always be secret.
6.2. Secure Random Sampling
The task of secure random sampling from a group corresponds to generating with (or close to uniform); see Definition 1. In this section, we present several methods for secure random sampling.
A generic protocol is obtained by letting party generate a random group element privately and then using t (threshold) secure group operations to form for a subset of parties. A potential drawback of this generic method is the cost of t secure group operations, which may be avoided if we use more direct methods, e.g., through efficient encodings for the group or direct use of the underlying representation of the group. For instance, to sample a point on an elliptic curve, we may first generate at random and then solve for , rejecting x if no solutions exist. Another potential drawback is the lack of public verifiability if parties generate random group elements privately. A common way to achieve verifiability is to start from publicly verifiable random bits and use these bits to deterministically generate random samples.
Given the structure of , we may reduce generating with to generating a random with in case is a cyclic group of order n, say. This extends to arbitrary abelian groups if we are given a generating set.
When we do not know the structure of the group, we adopt a different approach referred to as sampling in the black box group model. Dixon’s algorithm (Theorem 2 below) is the state of the art for provable complexity bounds, particularly for nonabelian groups.
We apply Theorem 2 in the clear to construct a public array of group elements, referred to as a random cube. The number of group operations to construct such a random element generator is proportional to
; see ([
30] Remark 2). Then, given
, Protocol 2 is then used to securely generate
uniformly distributed random elements, meaning that each group element has probability
to appear as output. This technique reduces secure random sampling to secure generation of random bits. If these bits are generated in a publicly verifiable random way, it follows that the entire protocol for random sampling in a group can be made verifiable.
Define probability distribution , referred to as a random cube of length j, for . Given a generating set of , Dixon’s theorem shows how to construct a random cube of length proportional to that is -uniform with a given probability.
Theorem 2 ([
30] Theorem 1)
. Let be a generating set of . Let be a sequence of cubes, where, for , is chosen at random from . Then, for each , there is a constant , independent of d or , such that, with probability at least , distribution is -uniform when . Constant
in Theorem 2 may still make the implementation impractical. The following theorem states that we can avoid the constant
and reduce the cube length if we start from a distribution
W that is close to the uniform distribution
U on
w.r.t. to the statistical (or variational) distance
. Ref. [
30] (Lemma 13(b), page 11) describes the procedure in detail.
Theorem 3 ([
30] Theorem 3(c))
. Let U be the uniform distribution on and suppose W is a distribution with . Let be chosen independently according to distribution W. If , then, with probability at least , is -uniform when To illustrate this approach, we apply this result to the Rubik’s Cube group of order ≈. Assume that we have generated a -uniform random cube W using Theorem 2. In practice, this means that we construct a long random cube W and apply a statistical test to see if W is sufficiently large. Once this pre-processing step is completed, we can apply Theorem 3 with , to generate, with probability at least , a new -uniform cube of length group elements. Choosing requires a random cube of length group elements.
Taking advantage of the particular structure of the Rubik’s Cube group as reflected by the linear representation of
Section 5.2, a more efficient for uniformly random sampling runs as follows. A random element is constructed by first generating a random permutation of the 12 edge cubies, along with 12 binary edge orientation indicators, with values of +1 or −1 such that the product of all 12 indicators is +1. Similarly, a permutation for the 8 corner cubies is randomly generated, with their orientations selected from 1, 2, 4 modulo 7 subject to the condition that the product of all 8 orientations is 1 modulo 7. Both permutations must also have the same parity.
Given a random cube
of length
j that is sufficiently close to uniform random, Protocol 2 is a general protocol for secure random sampling from a group
. The protocol requires
j secure random bits and
secure group operations. The result is raised to the power
x, where
is intended as the default case, and this can be extended to several powers.
Protocol 2 random cube for |
- 1:
- 2:
, for - 3:
- 4:
return ▹ random -element to the power x,
|
To conclude this section, we compare Dixon’s technique with two heuristics used in practice: the product replacement algorithm [
31] and Prospector [
32]. In the product replacement algorithm, the state is an array
a of length
n elements that generate the group. The product replacement algorithm repeatedly replaces the
ith coefficient
by
or
for random
and
. After a given number of steps, a random element of
a is then returned. Similar to Protocol 2 and given a pre-processed public array
a, returning a random coefficient in MPC requires securely sampling a random unit vector of length
n,
r, and performing
. The required length of
a is polynomial in
[
33], but precise bounds on the length of the array and corresponding probability of uniformly random elements is an open problem.
The Prospector algorithm is an extension of product replacement and produces elements that have a close to uniform distribution when testing for a predetermined property of the group element. Heuristically, Prospector is shown to output public arrays of very short length. Outputs are represented by so-called straight line programs (SLPs), a sequence of elements of , a, such that, given a generating set , every new element either belongs to , which is the inverse of a preceding element, or the product of two preceding elements. The aim is to produce small SLPs (trading off algorithm efficiency).
Prospector tests newly produced elements for randomness. This is completed by producing batches of test data using a map
and applying the
test. The Prospector paper ([
32] Tables 1–6) demonstrates that it can produce SLPs of length
for large groups such as
and
.
Using Prospector to create SLPs in MPC requires implementing secure protocols for the map t to produce test data. Their efficiency depends on the group property used for the statistical test. We leave the potential of this approach as further research.
6.3. Secure Inversion
The sampling protocols from
Section 6.2 allow us to invert secure group elements for groups with known or unknown order. This requires (close to) uniform sampling of random elements in the secure group. Protocol 3 implements this functionality following the classical approach from [
2].
Protocol 3 |
- 1:
- 2:
- 3:
- 4:
return
|
6.4. Secure Exponentiation
We start this section with a generally applicable protocol for secure exponentiation
based on the binary representation of
; see Protocol 4. The computational complexity is dominated by about
group operations and
ℓ calls to
. For the round complexity, we see that the
ℓ iterations of the loop are completed sequentially. The protocol can be optimized in many ways. For instance, it is more efficient to compute the bits of
all at once, including the sign bit, using a standard solution.
Protocol 4 |
- 1:
▹ skip if ensured - 2:
- 3:
for to do ▹ assumed - 4:
- 5:
- 6:
- 7:
- 8:
return
|
For abelian groups, the linear dependency on
ℓ for the round complexity can be removed, as we show in Protocol 5. The improvement is that the
ℓ iterations of the loop can now be completed in parallel. Using standard techniques for constant rounds protocols (see, e.g., [
2,
22]), the overall round complexity can be established independent of
ℓ.
Protocol 5 abelian |
- 1:
▹ assumed for two’s complement - 2:
- 3:
▹ - 4:
for to do - 5:
▹ in parallel - 6:
return
|
These protocols can be optimized if either
a or
x is public. For instance, if
a is public, the list of powers
can be computed locally, and, if
x is public, one can use techniques such as addition chains. We can also obtain more efficient protocols by securely randomizing the other input. Protocol 6 solves the case that
x is public, assuming that the group is abelian. The protocol uses secure random sampling from
to obtain both a random group element and its
th power.
Protocol 6 public exponent x, abelian |
- 1:
- 2:
- 3:
- 4:
return
|
Protocol 7 solves the case that
a is public. The protocol
outputs a random exponent
together with
for public input
. For public output
, we can also use public
in the first step of the protocol. Finally, in the special case that
a is an element of large order, parties may directly use their Shamir secret shares and perform Lagrange interpolation in the exponent to raise
a to the power
.
Protocol 7 public base a |
- 1:
- 2:
▹ should be sufficiently random - 3:
- 4:
return
|
7. Specific Constructions of Secure Groups
In this section, we present specific constructions for three types of number-theoretic groups commonly used in cryptography. The first type are quadratic residue groups (more generally, Schnorr groups), allowing for a direct secure representation with secret shares in the surrounding finite field. The second type are elliptic curve groups, where we will apply secret-sharing coordinatewise over the curve’s field of definition. The third type are class groups, where we will apply secret-sharing to the components of binary quadratic forms in combination with secure integer arithmetic.
7.1. Secure Quadratic Residue Groups
The first specific type of group that we consider is , the group of quadratic residues modulo an odd prime p. Quadratic residue groups, and, more generally, subgroups of (Schnorr groups), are used widely in cryptography, where is chosen sufficiently large to ensure that the discrete log problem is hard. Often, n is assumed to be prime as well.
Secure group schemes for and all its subgroups are easily obtained using as secure representation for . Protocols for all tasks listed in Definition 1 can be obtained with standard techniques, except for the task of secure en/decoding. To enable integer-valued inputs and outputs for applications of secure groups, we often need encoding functions with . Efficient en/decoding is hard for arbitrary subgroups of , but, for , efficient solutions are possible.
Many encodings (or embeddings) for
have been proposed in the cryptographic literature. For our purposes, we consider the following four encodings for
:
where
and
H is a cryptographic hash function with codomain
.
Encoding is the natural encoding for . Since squaring is a 2-to-1 mapping on as , it follows that is a bijective encoding on . Decoding of amounts to taking the unique modular square root of .
For
,
is another bijective encoding for
, generalizing the encoding defined for safe primes
p in ([
34] Section 4.2, Example 2). We see that
for
is indeed a quadratic residue modulo
p because
is the product of two quadratic nonresidues. Decoding of
amounts to
if
and
otherwise.
Encoding
resembles an encoding introduced by Koblitz in the context of elliptic curve cryptosystems ([
35] Section 3.2). The value of
is well-defined as long as each interval
contains a quadratic residue. This can be ensured by picking
k sufficiently large as a function of
p. The classical result by Burgess [
36] implies that
ensures successful encoding for sufficiently large
p (see also [
37]). Under the extended Riemann Hypothesis, Ankeny [
38] proved that the least quadratic nonresidue for prime
p equals
.
In practice, we may set parameter
or a small multiple thereof. Probabilistic heuristics for small primes (<20 bits) suggest that the greatest number of consecutive quadratic nonresidues in the average case is fit by
. Buell and Hudson [
39] computed the lengths of the longest sequences of consecutive residues and nonresidues. By numerical analysis, the authors find that the longest sequence of residues and nonresidues for a given prime
p is fitted very closely by
with
slightly larger than 1, which suggests a choice of
k for an average-case selection of modulus
p. A small dataset from [
37] using smaller primes (
http://www.math.caltech.edu/people/hummel.html, accessed on 20 September 2023) shows sequences of length
in the worst case. Heuristics for larger primes (say
-bit) are computationally heavy and beyond the scope of this paper.
In general, encoding is not bijective. Decoding of any a in the range of is simple as . Note that encoding is not constant time and may leak sensitive information in certain applications.
Finally, encoding
corresponds to a hash function used in certain elliptic curve signature schemes ([
40] Section 3.2). Since
in the random oracle model, computing
requires two hashes and two Legendre symbols on average. The collision resistance of
H implies that the encoding will be “computationally injective” in the sense that it is infeasible to find
for which
. Due the one-wayness of
H, however, decoding of any
a in the range
amounts to an exhaustive search.
For our purposes, we are interested in secure computation of these encodings and decodings. We briefly compare the performance for the four encodings. A secure encoding amounts to a secure squaring of , which is very efficient. Secure decoding requires taking the modular square root of a quadratic residue . This can be completed efficiently by multiplying with a uniformly random square , opening the result , taking a square root (in the clear) and dividing this by . Finally, we need one secure comparison to make sure that the result is in .
Similarly, a secure encoding amounts to securely evaluating the Legendre symbol . Since s is known to be nonzero, we simply multiply with a uniformly random square and also with for a uniformly random bit b, opening the result , for which we compute the Legendre symbol in the clear. Then, . Secure decoding boils down to a secure comparison with public , which is quite efficient.
A secure encoding amounts to the secure evaluation of k Legendre symbols and finding the first among these. With k of the order , this represents a considerable amount of work. However, secure decoding is much more efficient, especially if k is a power of two.
Finally, is not practical to compute obliviously. To obliviously select the smallest i such that requires computing for , which is not practical. Also, does not allow efficient decoding due to the one-wayness of H. However, this encoding is still useful to map private inputs to (unique) secret-shared group elements .
7.2. Secure Elliptic Curve Groups
Let denote the finite group of points on an elliptic curve group E over . For cryptographic purposes, we often use a subgroup of large prime order, such that the discrete log problem and the (decisional) Diffie–Hellman problem are hard in .
As secure representation of an affine point
, we take
, where it is left understood that
x and
y are secret-shared over
. For efficient implementation of the secure group operation, it is advantageous to use complete formulas, that is, group law formulas without any exceptions. Complete formulas are known for groups of prime-order Weierstrass curves [
41] and Edwards curves [
3,
42].
As an example, the complete formula for the group operation
on a twisted Edwards curve is provided by
where
and
are arbitrary points on the curve. In particular, one can see that
acts as the identity element. This way, it is straightforward to compute
given
and
. The number of secure operations over
is low, like at most 7 secure multiplications (and 2 secure inversions). The multiplicative depth is, however, at least 3.
Using twisted Edwards curves with extended coordinates (and
), the result from Hisil et al. ([
3] Section 4.2) yields a multiplicative depth of 2 for secure curve point addition, performing four multiplications in parallel in each round. Protocol 8 is based on their complete formula. For secure point doubling, this protocol can be optimized, essentially replacing the four multiplications in the first round by four squarings.
Protocol 8 add() |
- 1:
- 2:
- 3:
- 4:
▹ 4M - 5:
- 6:
▹ 4M - 7:
- 8:
return
|
We illustrate en/decoding for secure elliptic curve groups with an example similar to encoding
of
Section 7.1. (The equivalent of
of
Section 7.1 for elliptic curves is often referred to as hash to curve; see the IETF draft for Hashing to Elliptic Curves [
43] for detailed specifications.) We conclude this section with an alternative en/decoding based on [
44], which mitigates some of the concerns of
and
for elliptic curves at the cost of performance loss in MPC.
Consider a twisted Edwards curve with curve equation for given . For encoding input s given parameter k, we repeatedly set for varying i and test if x corresponds to a valid point , which amounts to testing if is a quadratic residue modulo p. Then, we define , where y is a square root of u modulo p.
Secure decoding amounts to recovering . In general, secure decoding can be optimized if k is a power of 2. Moreover, if increment i is also available as an auxiliary secret-shared input , secure decoding may be implemented basically for free as .
Testing times for quadratic residuosity may become a bottleneck. Note that, if the application requires constant-time encoding, one should test the full range of size k. Also note that many modern elliptic curve implementations with simple formulas do not provide a prime-order group but a group with a small cofactor h, usually or 8. This introduces the risk that this encoding leaks information, e.g., when an attacker creates a point whose order divides h. A defense is to multiply points by h and abort the protocol if the result is the identity.
For odd-characteristic elliptic curves with a point of order 2, Elligator [
44] presents a bijective map that is constant-time and avoids
quadratic residuosity tests. The cost in MPC of the forward map
is dominated by the Legendre symbol and the modular square root. The reverse map requires a comparison and two modular square roots. Choosing between naive hash to curve or Elligator is a security and efficiency trade-off that depends on the application.
7.3. Secure Class Groups
We now focus on ideal class groups of imaginary quadratic fields, using to denote the class group with discriminant . We also use to denote the isomorphic form class group of integral binary quadratic forms with discriminant . These forms are written as with , where it is implied that f is primitive, that is, , and f is positive definite, that is, .
For the composition of two forms
, we will use the algorithm due to Shanks [
45], as presented by Cohen ([
46] Algorithm 5.4.7). We slightly adapt the algorithm, skipping some case distinctions that were introduced for efficiency; see Algorithm 2. Apart from the computationally nontrivial reduction performed in the final step of the algorithm, the resulting algorithm only requires two xgcds and one integer division. This compares favorably with alternatives such as the classical composition algorithm by Dirichlet [
47] (see also ([
48] Lemma 3.2) and ([
49] Algorithm 6.1.1)).
Algorithm 2 compose() primitive, positive definite, reduced |
Input: and
- 1:
- 2:
▹ - 3:
▹ - 4:
- 5:
▹ integer division - 6:
- 7:
- 8:
- 9:
- 10:
return
|
As secure representation of a form , we define for a sufficiently large prime p. The prime p should be sufficiently large such that the intermediate forms computed by Algorithm 2 do not cause any overflow modulo p (also accounting for the “headroom” needed for secure comparison and secure integer division). Using Protocol 1 for secure xgcd and a protocol for secure integer division, Algorithm 2 is then easily transformed into a protocol for the secure composition of forms.
To reduce a form
, the classical reduction algorithm by Lagrange (see ([
4] Algorithm 5.3)) runs in at most
steps ([
4] Theorem 5.5.4), each step requiring an integer division. Our goal is to avoid the expensive (secure) integer divisions where possible.
To this end, we take the binary reduction algorithm by ([
12] Algorithm 3) as our starting point. (Recently, Ref. [
50] arrived at an equivalent algorithm to design a quantum circuit to reduce binary quadratic forms.) We minimize the number of comparisons by exploiting the invariant
and
. The algorithm reduces forms by the following transformations in
:
The total number of iterations of the main loop required to achieve is at most if is the given form. This follows from the fact that, if does not hold yet, an iteration of the main loop will reduce by at least 1. We will ensure that , such that it suffices to run the main loop for iterations, independent of the input. Note that we need to test in each iteration as well.
As an important optimization, we limit the number of iterations to by noting that it suffices to reduce b until . This ensures that after the main loop. If does not hold yet, then it follows that , and we only need one “normalization” step to ensure .
The result is presented as Algorithm 3. This algorithm avoids the integer division and multiple comparisons in the main loop of Lagrange’s reduction algorithm, at the cost of three secure comparisons and two secure bit length computations in the main loop. To compute the bit length securely we use a novel protocol avoiding the use of a full bit decomposition.
Algorithm 3 reduce(f) primitive, positive definite |
- 1:
for to do ▹ invariant and - 2:
if then else ▹ using - 3:
- 4:
▹ compute together with and at no extra cost - 5:
if then ▹ - 6:
▹ - 7:
if then - 8:
▹ - 9:
▹ integer division - 10:
- 11:
if then - 12:
- 13:
if then ▹ ensure if or - 14:
▹ - 15:
return f
|
For secure encoding to class groups, a given integer
s will be mapped to a form
by computing
a as a simple function of
s and setting
b as the square root of
modulo
; see Algorithm 4. We note that this encoding improves upon the encoding proposed by [
51] (compare to [
52] as well), which relies on using prime numbers for
a. Our algorithm avoids the need for primality tests, which are dominating the computational cost for the encoding algorithm.
Let
k be our parameter as above. Given a worst-case prime gap for an
ℓ-bit discriminant,
, we avoid the need to return the distance by setting parameter
and mapping input
a to a prime
for some
. Algorithm 4 is similar to searching for candidates by incrementing
i in encoding
of
Section 7.1. After a successful encoding of
per Algorithm 12 to a so-called prime form
, we can discard the distance knowing that
.
Algorithm 4 encode() s sufficiently small w.r.t. |
- 1:
- 2:
- 3:
repeat - 4:
▹ - 5:
- 6:
until and - 7:
if then - 8:
- 9:
▹ - 10:
- 11:
return f, d
|
We improve upon the encoding suggested by [
51]. We do not search for a prime
a, which requires a costly primality test. Instead, we take
and simply test whether
for
. This condition will certainly hold if
a is prime and
is a quadratic residue modulo
a because then we have
. Hence, the success rate will be no worse than for [
51].
For
, an odd prime, the frequency of prime forms
approximately corresponds to the quadratic residuosity of
modulo
. We refer to ([
4] Proposition 3.4.5) for the exact frequency of prime forms.
Finally, we briefly discuss random sampling. Even though class groups are abelian, random sampling using a generating set is inefficient due to the complexity of computing the generating set for
. Given a (sufficiently complete) generating set
of the relevant (sub)group
, without knowledge of the order
, the general idea is for
and random
, for
, to compute a random element
, e.g., using techniques from Lenstra and Pomerance [
53].