Difference between revisions of "GSW"

From certFHE Community KB
Jump to navigation Jump to search
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
Around 2013, Gentry, Sahai and Waters <ref name = "GSW"> C. Gentry, A. Sahai, and B. Waters. Homomorphic Encryption from Learning with Errors: Conceptually-Simpler, Asymptotically-Faster, Attribute-Based. In CRYPTO 2013 (Springer). https://eprint.iacr.org/2013/340</ref> proposed a new way of building FHE schemes whose homomorphic multiplication algorithms are more natural than those presented in [[BFV]] or [[BGV]]. A distinguished feature of the scheme we are about to present is an asymmetric formula for the <b>growth of the noise</b> when multiplying two ciphertexts. Due to this feature, certain types of circuits have a very slow noise growth rate. Based on this asymmetry, Alperin-Sheriff and Peikert <ref> J. Alperin-Sheriff and C. Peikert. Faster Bootstrapping with Polynomial Error. In CRYPTO 2014 (Springer). https://eprint.iacr.org/2014/094</ref> found a very efficient bootstrapping technique for the [[GSW]] scheme.
 
Around 2013, Gentry, Sahai and Waters <ref name = "GSW"> C. Gentry, A. Sahai, and B. Waters. Homomorphic Encryption from Learning with Errors: Conceptually-Simpler, Asymptotically-Faster, Attribute-Based. In CRYPTO 2013 (Springer). https://eprint.iacr.org/2013/340</ref> proposed a new way of building FHE schemes whose homomorphic multiplication algorithms are more natural than those presented in [[BFV]] or [[BGV]]. A distinguished feature of the scheme we are about to present is an asymmetric formula for the <b>growth of the noise</b> when multiplying two ciphertexts. Due to this feature, certain types of circuits have a very slow noise growth rate. Based on this asymmetry, Alperin-Sheriff and Peikert <ref> J. Alperin-Sheriff and C. Peikert. Faster Bootstrapping with Polynomial Error. In CRYPTO 2014 (Springer). https://eprint.iacr.org/2014/094</ref> found a very efficient bootstrapping technique for the [[GSW]] scheme.
  
More efficient FHE schemes based on ring variants of [[GSW]] have been proposed since then. These achieve very fast bootstrapping via various optimisation techniques, such as "refreshing the ciphertexts" after every single homomorphic operation. To our knowledge, among the schemes based on [[GSW]] (and not only), TFHE <ref> I. Chillotti, N. Gama, M. Georgieva, and M. Izabachène. TFHE: Fast Fully Homomorphic Encryptionover the Torus. In Journal of Cryptology, volume 33, pages 34–91 (2020). https://eprint.iacr.org/2018/421 </ref> holds the record for fastest bootstrapping. In the literature, the schemes based on the aformentioned work of Gentry, Sahai and Waters are commonly referred to as "third generation FHE". Their security is based on the so-called [[approximate eigenvector problem]]. The authors also provide a reduction from the approximate eigenvector problem to the [[LWE]] problem (see Section 1.3.4) of GSW <ref name = "GSW"/>.
+
More efficient FHE schemes based on ring variants of [[GSW]] have been proposed since then. These achieve very fast bootstrapping via various optimisation techniques, such as "refreshing the ciphertexts" after every single homomorphic operation. To our knowledge, among the schemes based on [[GSW]] (and not only), TFHE <ref> I. Chillotti, N. Gama, M. Georgieva, and M. Izabachène. TFHE: Fast Fully Homomorphic Encryptionover the Torus. In Journal of Cryptology, volume 33, pages 34–91 (2020). https://eprint.iacr.org/2018/421 </ref> holds the record for fastest bootstrapping. In the literature, the schemes based on the aformentioned work of Gentry, Sahai and Waters are commonly referred to as "third generation FHE". The authors provide a reduction to the [https://en.wikipedia.org/wiki/Learning_with_errors LWE] problem (see Section 1.3.4) of GSW <ref name = "GSW"/>, basic the security of their scheme only on the LWE problem.
  
 
== Overview of the GSW scheme ==
 
== Overview of the GSW scheme ==
Line 8: Line 8:
 
Conceptually-Simpler, Asymptotically-Faster, Attribute-Based" <ref name = "GSW" /> by Gentry, Sahai and Waters.
 
Conceptually-Simpler, Asymptotically-Faster, Attribute-Based" <ref name = "GSW" /> by Gentry, Sahai and Waters.
  
The description of this scheme is strikingly simple. In GSW, homomorphic encryption based on [[LWE]] is achieved while the homomorphic addition and multiplications correspond to matrix addition and multiplication, respectively.
+
The description of this scheme is strikingly simple. In GSW, homomorphic encryption based on [https://en.wikipedia.org/wiki/Learning_with_errors LWE] is achieved while the homomorphic addition and multiplications correspond to matrix addition and multiplication, respectively.
  
 
Let <math> q </math> be a natural number, representing some modulus and <math> N </math> a dimension parameter. A ciphertext is a matrix <math>  C </math> of dimension <math> N \times N </math> with "small" entries from <math> \mathbb Z_q </math>. A secret key <math> \vec{v} </math> is a <math> N</math>-dimensional vector over <math>\mathbb Z_q </math> with one big coefficient <math> v_i</math>. We can intuitively think of "small" as meaning much smaller (in order of magnitude) than <math> q</math> and "big" meaning the same order of magnitude as <math>q </math>. In fact, we will make use of the case when the entries of <math>C </math> belong to <math>\{0,1 \} </math>. We also restrict the message <math> \mu </math> to be a "small" integer.  
 
Let <math> q </math> be a natural number, representing some modulus and <math> N </math> a dimension parameter. A ciphertext is a matrix <math>  C </math> of dimension <math> N \times N </math> with "small" entries from <math> \mathbb Z_q </math>. A secret key <math> \vec{v} </math> is a <math> N</math>-dimensional vector over <math>\mathbb Z_q </math> with one big coefficient <math> v_i</math>. We can intuitively think of "small" as meaning much smaller (in order of magnitude) than <math> q</math> and "big" meaning the same order of magnitude as <math>q </math>. In fact, we will make use of the case when the entries of <math>C </math> belong to <math>\{0,1 \} </math>. We also restrict the message <math> \mu </math> to be a "small" integer.  
Line 63: Line 63:
 
Some obvious properties of these definitions are
 
Some obvious properties of these definitions are
  
*<math> \langle BitDecomp(\vec{a}), Powersof2(\vec{b}) \rangle = \langle a,b \rangle \rangle </math>;
+
*<math> \langle BitDecomp(\vec{a}), Powersof2(\vec{b}) \rangle = \langle a,b \rangle </math>;
  
 
* For any <math>N</math>-dimensional <math>\vec{a'} </math>, we have that
 
* For any <math>N</math>-dimensional <math>\vec{a'} </math>, we have that
Line 84: Line 84:
 
Let <math> \lambda </math> be the security parameter and <math>L</math> a natural number representing the multiplicative level of homomorphic operations this scheme can achieve. If we know the maximal level <math> L </math>  that we want to evaluate, we can choose parameters such that the scheme can handle circuits of depth <math>L</math>.  Thus, the scheme described here is a priori a Somewhat Homomorphic Encryption scheme and can be made fully homomorphic after applying Gentry's bootstrapping theorem.  
 
Let <math> \lambda </math> be the security parameter and <math>L</math> a natural number representing the multiplicative level of homomorphic operations this scheme can achieve. If we know the maximal level <math> L </math>  that we want to evaluate, we can choose parameters such that the scheme can handle circuits of depth <math>L</math>.  Thus, the scheme described here is a priori a Somewhat Homomorphic Encryption scheme and can be made fully homomorphic after applying Gentry's bootstrapping theorem.  
  
* Setup(<math>1^{\lambda}, 1^L </math>): We choose a modulus <math> q=q(\lambda, L)</math>, depending of <math>\lambda, L </math>, a lattice dimension parameter <math>n=n(\lambda, L)</math> and an error distribution <math>\chi = \chi(\lambda, L) </math> such that the scheme achieves at least <math>2^{\lambda}</math> security against known attacks. We also choose a parameter <math> m= (\lambda, L) = O(n \log_{q}) </math>. We set the paramaters of the scheme <math>params = (n , q, \chi,m) </math> and let <math> l = \lfloor \log_{2}q  \rfloor +1 </math> and <math>N = (n+1)\cdot l</math>.
+
* Setup(<math>1^{\lambda}, 1^L </math>): We choose a modulus <math> q=q(\lambda, L)</math>, depending of <math>\lambda, L </math>, a lattice dimension parameter <math>n=n(\lambda, L)</math> and an error distribution <math>\chi = \chi(\lambda, L) </math> such that the scheme achieves at least <math>2^{\lambda}</math> security against known attacks. We also choose a parameter <math> m= m(\lambda, L) = O(n \log_{q}) </math>. We set the paramaters of the scheme <math>params = (n , q, \chi,m) </math> and let <math> l = \lfloor \log_{2}q  \rfloor +1 </math> and <math>N = (n+1)\cdot l</math>.
  
 
* SecretKeyGen(<math>params</math>): Sample <math>\vec{t} \leftarrow \mathbb Z_{q}^n </math> uniformly. Output <math> sk = \vec{s} \leftarrow (1, -t_1, \dots, -t_n) \in \mathbb \Z_q^{n+1}</math>. Let <math>\vec{v} = Powersof2(\vec{s}) </math>.   
 
* SecretKeyGen(<math>params</math>): Sample <math>\vec{t} \leftarrow \mathbb Z_{q}^n </math> uniformly. Output <math> sk = \vec{s} \leftarrow (1, -t_1, \dots, -t_n) \in \mathbb \Z_q^{n+1}</math>. Let <math>\vec{v} = Powersof2(\vec{s}) </math>.   
  
* PublicKeyGen(<math>params</math>): Generate a matrix <math> B = \mathbb Z_q^{m \times n} </math> and a vector with small entries (noise) <math>\vec{e} \leftarrow \chi^m </math>. Set <math>\vec{b} = B \cdot \vec{t} + \vec{e}</math> and <math>A </math> to be the <math>(n+1) </math> column matrix which is obtained by the placing <math> \vec b </math> on the first column, fllowed by the <math> n</math> columns of <math> B </math>. Set the public key <math> pk = </math>. We observe that <math>A \cdot \vec{s} = \vec{e}.</math>
+
* PublicKeyGen(<math>params</math>): Generate a matrix <math> B = \mathbb Z_q^{m \times n} </math> and a vector with small entries (noise) <math>\vec{e} \leftarrow \chi^m </math>. Set <math>\vec{b} = B \cdot \vec{t} + \vec{e}</math> and <math>A </math> to be the <math>(n+1) </math> column matrix which is obtained by the placing <math> \vec b </math> on the first column, fllowed by the <math> n</math> columns of <math> B </math>. Set the public key <math> pk = A </math>. We observe that <math>A \cdot \vec{s} = \vec{e}.</math>
  
 
* Enc(<math>params,pk,\mu </math>): To encrypt a message <math>\mu \in \mathbb Z_q </math>, sample a uniform matrix <math>R \in \{0,1 \}^{N \times m} </math> and output the ciphertext
 
* Enc(<math>params,pk,\mu </math>): To encrypt a message <math>\mu \in \mathbb Z_q </math>, sample a uniform matrix <math>R \in \{0,1 \}^{N \times m} </math> and output the ciphertext
Line 112: Line 112:
 
* Mult(<math>C_1, C_2 </math>): To multiply ciphertexts <math>C_1, C_2 \in \mathbb Z_q^{N \times N} </math>, output <math>Flatten(C_1\cdot C_2) </math>.
 
* Mult(<math>C_1, C_2 </math>): To multiply ciphertexts <math>C_1, C_2 \in \mathbb Z_q^{N \times N} </math>, output <math>Flatten(C_1\cdot C_2) </math>.
  
* MultConst(C, \alpha): To multiply a ciphertext <math>C \in \mathbb Z_q^{N \times N} </math> by a known constant <math> \alpha \in \mathbb Z_q</math>, given in the clear, we set <math>M_{\alpha} \leftarrow \alpha \cdot I_N </math> and output <math>M_{\alpha} \cdot C </math>.
+
* MultConst(C, <math>\alpha</math>): To multiply a ciphertext <math>C \in \mathbb Z_q^{N \times N} </math> by a known constant <math> \alpha \in \mathbb Z_q</math>, given in the clear, we set <math>M_{\alpha} \leftarrow \alpha \cdot I_N </math> and output <math>Flatten(M_{\alpha} \cdot C) </math>.
  
 
One could compute multiplication by <math>\alpha </math> by repeating additions. However, by repeating additions, the error of the resulting ciphertext will be linear in <math> \alpha </math>. On the other hand, if one uses MultConst(), the error term depends only on the dimension <math>N</math> and not on <math>\alpha </math>. This turns out to be extremely convenient for when <math>\alpha </math> is very large (possible applications of this includes homomorphic fast Fourier transforms).
 
One could compute multiplication by <math>\alpha </math> by repeating additions. However, by repeating additions, the error of the resulting ciphertext will be linear in <math> \alpha </math>. On the other hand, if one uses MultConst(), the error term depends only on the dimension <math>N</math> and not on <math>\alpha </math>. This turns out to be extremely convenient for when <math>\alpha </math> is very large (possible applications of this includes homomorphic fast Fourier transforms).

Latest revision as of 10:10, 30 December 2020

Around 2013, Gentry, Sahai and Waters [1] proposed a new way of building FHE schemes whose homomorphic multiplication algorithms are more natural than those presented in BFV or BGV. A distinguished feature of the scheme we are about to present is an asymmetric formula for the growth of the noise when multiplying two ciphertexts. Due to this feature, certain types of circuits have a very slow noise growth rate. Based on this asymmetry, Alperin-Sheriff and Peikert [2] found a very efficient bootstrapping technique for the GSW scheme.

More efficient FHE schemes based on ring variants of GSW have been proposed since then. These achieve very fast bootstrapping via various optimisation techniques, such as "refreshing the ciphertexts" after every single homomorphic operation. To our knowledge, among the schemes based on GSW (and not only), TFHE [3] holds the record for fastest bootstrapping. In the literature, the schemes based on the aformentioned work of Gentry, Sahai and Waters are commonly referred to as "third generation FHE". The authors provide a reduction to the LWE problem (see Section 1.3.4) of GSW [1], basic the security of their scheme only on the LWE problem.

Overview of the GSW scheme

We follow the exposition in the paper "Homomorphic Encryption from Learning with Errors: Conceptually-Simpler, Asymptotically-Faster, Attribute-Based" [1] by Gentry, Sahai and Waters.

The description of this scheme is strikingly simple. In GSW, homomorphic encryption based on LWE is achieved while the homomorphic addition and multiplications correspond to matrix addition and multiplication, respectively.

Let be a natural number, representing some modulus and a dimension parameter. A ciphertext is a matrix of dimension with "small" entries from . A secret key is a -dimensional vector over with one big coefficient . We can intuitively think of "small" as meaning much smaller (in order of magnitude) than and "big" meaning the same order of magnitude as . In fact, we will make use of the case when the entries of belong to . We also restrict the message to be a "small" integer.

encrypts under if , where is a small error vector.

To decrypt, one first exacts the -th row of . Compute . Now, as is large and small, we have

.

Basically, is almost an eigenvector for corresponding to the eigenvalue . This is commonly referred to being an approximate eigenvector.


Observe that if and encrypt and respectively under the same key vector , then

,

where represents the error vector of , for . As long as the sum is small, the sum matrix is an encryption of .

Looking at the equality

,

we observe that is an encryption of the product , which can be decrypted correctly if the -th component of the vector is smaller than .

Remark that is also an encryption of , even though matrix multiplication is not commutative. The essence of the previously anticipated asymmetry is captured by the fact that the noises of and are very different.

Flattening ciphertexts and keeping the noise small

We can decrypt homomorphically evaluated ciphertext as long as the -th component of the error vector is small enough. As we saw in the overview section, the noise might grow quickly with each multiplication. To mitigate this and to perform homomorphically evaluations of deep circuits (in the sense of multiplication depth), observing that the noise growth depends of the size of the coefficients of the ciphertexts, the size of the messages and the fresh error size (in an asymmetric way), we can try to restrict the message space and the entries of the ciphertexts to . We also impose a bound for the entries of the fresh fresh error vectors .

Such ciphertexts will be further called -strongly bounded, terminology that is used throughout the paper GSW [1].

The homomorphic operations performed on ciphertexts should correspond to operations "in the clear" that keep the message within the set . To achieve this, we will use only NAND gates to evaluate any circuit.

Notice that if are two -strongly bounded ciphertexts, the ciphertext obtained by evaluating a NAND gate has underlying message in , but the coefficients of 's error vector have magnitude at most . If one could ensure that the coefficients of have magnitude at most , then the noise after evaluating a NAND gate will remain quite small, allowing us to evaluate deeper circuits.

The authors introduce an operation on ciphertexts called flattening, inspired by ideas in second generation FHE schemes such as BGV. Flattening is basically an operation that modify vectors without affecting their dot product.

Let , where and is a positive integer. We will consider , two -dimensional vector spaces.

where is the -th bit in the binary decomposition of , so a -dimensional vector.

For any -dimensional vector , define

, now a dimensional vector,

and

.

The authors also introduce

, an -dimensional vector.

Some obvious properties of these definitions are

  • ;
  • For any -dimensional , we have that

The latter is showing us an interesting feature of , i.e. it makes the coefficients of a vector "small", without changing its inner product with

We will have to "flatten" ciphertexts, which are matrices. When is applied to a matrix , this will be done by applying to each row of . Recall that a step in the decryption process is multiplying the ciphertext matrix with a secret key vector . We will always use , a vector of this special form in order for flattening to preserve the product between and required for decryption.

Now, for any ciphertext matrix , we have

After computing a ciphertext for the NAND gate, we will immediately flatten it, namely we will set

.

The basic algorithms of the encryption scheme

Let be the security parameter and a natural number representing the multiplicative level of homomorphic operations this scheme can achieve. If we know the maximal level that we want to evaluate, we can choose parameters such that the scheme can handle circuits of depth . Thus, the scheme described here is a priori a Somewhat Homomorphic Encryption scheme and can be made fully homomorphic after applying Gentry's bootstrapping theorem.

  • Setup(): We choose a modulus , depending of , a lattice dimension parameter and an error distribution such that the scheme achieves at least security against known attacks. We also choose a parameter . We set the paramaters of the scheme and let and .
  • SecretKeyGen(): Sample uniformly. Output . Let .
  • PublicKeyGen(): Generate a matrix and a vector with small entries (noise) . Set and to be the column matrix which is obtained by the placing on the first column, fllowed by the columns of . Set the public key . We observe that
  • Enc(): To encrypt a message , sample a uniform matrix and output the ciphertext

Disclaimer: The decryption algorithm we describe below decrypts correctly only messages in . This can be easily generalised to recover any , bit by bit, starting with the least significant one. The interested reader should consult for example the paper of Micciano and Peikert. [4]

  • Dec(): Observe that the first coefficients of are . Let us choose, among these coefficients, the unique . Let be the -th row of . We output
.

We remark that is only applied to one row of the ciphertext, however extra rows will play a role in the homomorphic operations. If is properly generated (fresh), then by the properties of described above, we have

The -th coefficient of the above expression is . In the encryption scheme, we set to ensure that the error is -bounded with very high probability.

Homomorphic operations

  • Add(): To add ciphertexts , output .
  • Mult(): To multiply ciphertexts , output .
  • MultConst(C, ): To multiply a ciphertext by a known constant , given in the clear, we set and output .

One could compute multiplication by by repeating additions. However, by repeating additions, the error of the resulting ciphertext will be linear in . On the other hand, if one uses MultConst(), the error term depends only on the dimension and not on . This turns out to be extremely convenient for when is very large (possible applications of this includes homomorphic fast Fourier transforms).

  • NAND(): To NAND ciphertexts that are known to encrypt messages , output .

The NAND homomorphic operation increases the error by a factor of at most .

By iteratively applying the homomorphic operations above, different types of (boundeddepth) circuits may be homomorphically computed while maintaining correctness of decryption. The simplest ones to analyse are Boolean circuits computed over encryptions of values. Here the circuit can be converted to use only NAND gates, and the final ciphertext’s error will be bounded by , where L is the NAND-depth of the circuit, and is the original bound on the error of a fresh encryption of .

References

  1. 1.0 1.1 1.2 1.3 C. Gentry, A. Sahai, and B. Waters. Homomorphic Encryption from Learning with Errors: Conceptually-Simpler, Asymptotically-Faster, Attribute-Based. In CRYPTO 2013 (Springer). https://eprint.iacr.org/2013/340
  2. J. Alperin-Sheriff and C. Peikert. Faster Bootstrapping with Polynomial Error. In CRYPTO 2014 (Springer). https://eprint.iacr.org/2014/094
  3. I. Chillotti, N. Gama, M. Georgieva, and M. Izabachène. TFHE: Fast Fully Homomorphic Encryptionover the Torus. In Journal of Cryptology, volume 33, pages 34–91 (2020). https://eprint.iacr.org/2018/421
  4. D. Micciancio and C. Peikert. Trapdoors for lattices: Simpler, tighter, faster, smaller. In EUROCRYPT, pages 700–718, 2012. https://eprint.iacr.org/2011/501