# Efficient FHE from (Standard) LWE

As anounced in the title, Brakerski and Vaikuntanathan [1] introduced a fully homomorphic encryption scheme which is based only on the LWE assumption. The authors show that the security of the scheme can be reduced to the worst-case hardness of short vector problem on arbitrary latices.

They start by introducing a somewhat homomorphic encryption scheme SH, which is then transformed into a bootstrappable scheme BTS. In doing so, the authors deviate from previously known techniques of “squashing” the decryption algorithm of SH that has been used by Dijk, Gentry, Halevi and Vaikuntanathan in FHE over the Integers and instead introduce a new “dimension-modulus reduction” technique, which shortens the ciphertexts and simplifies the decryption circuit of SH. This is all achieved without introducing additional assumptions, such as the hardness of the sparse subset-sum problem.

This scheme has particularly short ciphertexts and for this reasons the authors managed to use it for constructing an efficient single-server private information retrieval (PIR) protocol.

## A Somewhat Homomorphic encryption Scheme SH

Let us start by presenting a somewhat homomorphic encryption scheme. Denote by ${\displaystyle \lambda }$ the security parameter. The scheme is parameterized by a dimension ${\displaystyle n\in \mathbb {N} }$, a positive integer ${\displaystyle m\in \mathbb {N} }$ , an odd modulus ${\displaystyle q}$ (which does not have to be prime) and a noise distribution ${\displaystyle \chi }$ over ${\displaystyle \mathbb {Z} _{q}}$. An additional parameter of the scheme ${\displaystyle L\in \mathbb {N} }$ is an upper bound on the maximal multiplicative depth that the scheme can homomorphically evaluate.

We are not going to elaborate on the appropriate choice of the size for the parameters, but we invite the curious reader to look at the paper. However, for brevity, we mention that the dimension ${\displaystyle n}$ is polynomial in the security parameter ${\displaystyle \lambda }$, ${\displaystyle m\geq n\log(q)+2\lambda }$ is a polynomial in ${\displaystyle n}$, the modulus is an odd number ${\displaystyle q\in [2^{n^{\epsilon }},2\cdot 2^{n^{\epsilon }})}$ is sub-exponential in ${\displaystyle n}$, i.e. ${\displaystyle \epsilon }$ is a positive constant which is strictly smaller than ${\displaystyle 1}$. The noise distribution ${\displaystyle \chi }$ produces small samples, of magnitude at most ${\displaystyle n}$ in ${\displaystyle \mathbb {Z} _{\mathfrak {q}}}$. The depth bound ${\displaystyle L}$ is approximately of the size ${\displaystyle \epsilon \cdot \log(n)}$.

SH.Keygen: sample ${\displaystyle L+1}$ vectors ${\displaystyle s_{0},\dots ,s_{L}}$ uniformly from ${\displaystyle \mathbb {Z} _{q}^{n}}$ and compute, for all ${\displaystyle l\in [L]}$, ${\displaystyle 0\leq I\leq j\leq n}$ and ${\displaystyle \tau \in \{0,\dots ,\lfloor \log {q}\rfloor \}}$, the value

${\displaystyle \psi _{l,i,j,\tau }:=\left(a_{l,i,j,\tau },b_{l,i,j,\tau }:=\langle a_{l,i,j,\tau },s_{l}\rangle +2\cdot e_{l,i,j,\tau }+2^{\tau }\cdot s_{l-1}\cdot s_{l-1}[j]\right)\in \mathbb {Z} _{q}^{n}\times \mathbb {Z} _{q}}$

where ${\displaystyle a_{l,i,j,\tau }}$ and ${\displaystyle e_{l,i,j,\tau }}$ are chosen uniformly at from ${\displaystyle \mathbb {Z} _{q}^{n}}$ and from the distribution ${\displaystyle \chi }$, respectively.

Let ${\displaystyle \Psi :=\{\psi _{l,i,j,\tau }\}_{l,i,j,\tau }}$ be the set of all these values. Notice that these seem like encryptions of ${\displaystyle 2^{\tau }\cdot s_{l-1}[i]\cdot s_{l-1}[j]}$ (mod ${\displaystyle q}$), except these “ciphertexts” can’t be decrypted since the underlying message ${\displaystyle 2^{\tau }\cdot s_{l-1}[i]\cdot s_{l-1}[j]}$ is not a single bit value.

The key generation might seem rather strange now, but publishing these “encryptions” of the quadratic terms in the secret keys ${\displaystyle s_{l}}$ is very important and we will explain this when we describe homomorphic multiplication.

The key-generation algorithm proceeds to choose a uniformly random matrix ${\displaystyle A}$ from ${\displaystyle \mathbb {Z} _{q}^{m\times n}}$ and an ${\displaystyle m}$-dimensional vector ${\displaystyle e}$ from the distribution ${\displaystyle \chi ^{m}}$. Set ${\displaystyle b:=As_{0}+2e}$.

The algorithm outputs the secret key ${\displaystyle sk=s_{L}}$, the evaluation key ${\displaystyle evk:=\Psi }$ and the public key ${\displaystyle pk:=(A,b)}$.

Encryption(${\displaystyle \mu }$): We recall that the public key is ${\displaystyle pk=(A,b)}$. To encrypt a message ${\displaystyle \mu \in GF(2)}$, we sample a random vector ${\displaystyle r\in \{0,1\}^{m}}$ and set:

${\displaystyle v:=A^{T}\cdot r}$ and ${\displaystyle w:=b^{T}\cdot r+\mu }$.

The output ciphertext contains the pair ${\displaystyle (v,w)\in \mathbb {Z} _{q}^{n}\times \mathbb {Z} _{q}}$, together with a "level tag" which is used during homomorphic evaluation and indicates the multiplicative depth of the ciphertexts. Fresh ciphertexts, i.e. ciphertexts that are obtained straight from the encryption of messages and that did not suffer any homomorphic evaluation, will have this tag level zero. The encryption algorithm outputs ${\displaystyle c:=((v,w),0)}$.

Homomorphic evaluation: We now present the algorithm ${\displaystyle SH.Eval_{evk}(f,c_{1},\dots ,c_{t})}$, where ${\displaystyle f:\{0,1\}^{t}\to \{0,1\}}$. We require that ${\displaystyle f}$ is represented by a binary arithmetic circuit with '${\displaystyle +}$' gates of arbitrary fan-in and '${\displaystyle \times }$' gates with fan-in equal to ${\displaystyle 2}$. Furthermore, it is required that every circuit is layered, namely that it is composed of layers containing having either all '${\displaystyle +}$' gates or all '${\displaystyle \times }$' gates. Every binary circuit can be represented in this way. It is also required that the multiplicative depth of the circuit ${\displaystyle f}$ is exactly ${\displaystyle L}$.

The algorithm homomorphically evaluates the circuit ${\displaystyle f}$ gate by gate. We present how to perform homomorphic addition for arbitrarily many ciphertexts and homomorphic multiplication for two ciphertexts. Combining the two, any circuit ${\displaystyle f}$ can be evaluated.

Homomorphic evaluation will generate ciphertexts of the form ${\displaystyle c=((v,w),l)}$, where the tag ${\displaystyle l}$ indicates the multiplicative level at which the ciphertext has been generated. Here the fact that ${\displaystyle f}$ is layered plays an important role, as it makes sure that all inputs to a gate have the same tag. Throughout the evaluation, it is important that the output of each gate evaluation ${\displaystyle c=((v,w),l)}$ is such that

${\displaystyle w-\langle v,s_{l}\rangle =\mu +2\cdot e}$,

where ${\displaystyle \mu }$ is the output of the gate in plaintext, i.e. the correct output, and ${\displaystyle e}$ is a noise term that depends on the ciphertexts that went into the gate. We always have ${\displaystyle l\leq L}$ due to the bound on the multiplicative depth and the output of the homomorphic evaluation of the entire circuit must have ${\displaystyle l=L}$.

Addition gates: Let ${\displaystyle c_{,}\dots ,c_{t}}$, where ${\displaystyle c_{i}=((v_{i},w_{i}),l)}$ be ciphertexts. The homomorphic evaluation of their sum is performed by outputting

${\displaystyle c_{add}=((v_{add},w_{add}),l)=\left(\left(\sum _{i}v_{i},\sum _{i}w_{i}\right),l\right)}$

One can see that

${\displaystyle w_{add}-\langle v_{add},s_{l}\rangle =\sum _{i}\left(w_{i}-\langle v_{i},s_{l}\rangle \right)\sum _{i}\mu _{i}+2\sum _{i}e_{i}.}$

Here ${\displaystyle \mu _{i}}$ is the plaintext corresponding to ${\displaystyle c_{i}}$, so the homomorphic evaluation outputs a ciphertexts that corresponds to the sum of the inputs with a noise term that is equal to the sum of the noises of ${\displaystyle c_{i}}$'s.

Multiplication of two ciphertexts . Let ${\displaystyle c=((v,w),l),c'=((v',w'),l')}$ be two ciphertexts of level ${\displaystyle l}$. The output of the multiplication will be a ciphertext of the form ${\displaystyle c_{mult}=((v_{mult},w_{mult}),l+1)}$, since the level of multiplication is increased by ${\displaystyle 1}$.

Let us first consider the ${\displaystyle n}$-variable symbolic polynomial in the vector ${\displaystyle x}$:

${\displaystyle \phi (x)=\phi _{(v,w),(v',w')}(x):=(w-\langle v,x\rangle )\cdot (w'-\langle v',x\rangle )}$.

Notice that when evaluated at the secret key vector ${\displaystyle x=s_{l}}$, the above expression should give the plaintext ${\displaystyle \mu \cdot \mu '}$ (underlying message of the product of the ciphertexts) plus some additional noise term.

If we symbolically open the parenthesis of the (quadratic in ${\displaystyle x}$) polynomial above, we get something of the form

${\displaystyle \phi (x)=\sum _{0\leq i\leq j\leq n}h_{i,j}\cdot x[i]\cdot x[j]}$,

where ${\displaystyle h_{i_{j}}\in \mathbb {Z} _{q}}$ are known coefficients. For managing the growth of the noise term, it is essential to express ${\displaystyle \phi }$ as a polynomial with small coefficients. This can be achieved by considering the binary representations ${\displaystyle h_{i,j}=\sum _{\tau =0}^{\lfloor \log q\rfloor }h_{i,j,\tau }\cdot 2^{\tau }}$, where ${\displaystyle h_{i,j,\tau }\in \{0,1\}}$.

Then we have ${\displaystyle \phi (x)=\sum h_{i,j,\tau }\cdot \left(2^{\tau }\cdot x[i]\cdot x[j]\right)}$, where the sum is over ${\displaystyle 0\leq i\leq j\leq n}$ and ${\displaystyle 0\leq \tau \leq \lfloor \log q\rfloor }$.

Now recall that the evaluation key ${\displaystyle evk=\Psi }$ produced by ${\displaystyle SH.Keygen}$ contains elements of the form ${\displaystyle \psi _{l,i,j,\tau }=(a_{l,i,j,\tau },b_{l,i,j,\tau })}$ such that ${\displaystyle 2^{\tau }s_{l}[i]s_{l}[j]\approx b_{l+1,i,j,\tau }-\langle a_{l+1,i,j,\tau },s_{l+1}\rangle }$. The homomorphic multiplication algorithm will thus set

${\displaystyle v_{mult}:=\sum h_{i,j,\tau }\cdot a_{l+1,i,j,\tau }}$ and ${\displaystyle w_{mult}=\sum h_{i,j,\tau }\cdot b_{l+1,i,j,\tau }}$ and the final output will be ${\displaystyle c_{mult}:=((v_{mult},w_{mult}),l+1)}$.

By computing ${\displaystyle w_{mult}-\langle v_{mult},s_{l+1}\rangle }$ one will see that indeed this will be equal to the plaintext output ${\displaystyle \mu \mu '}$ plus some noise term that depends on the input ciphertexts ${\displaystyle c,c'}$ and also on the evaluation key ${\displaystyle \Psi }$.

The advantages of using this re-liniarisation technique for multiplications are detailed in Section 1.1 of [1].

Decryption : In this scheme, we only want to decrypt ciphertexts of the form ${\displaystyle c=((v,w),L)}$, which are the ones that are ${\displaystyle SH.Eval(\dots )}$ outputs. The algorithm ${\displaystyle SH.Dec_{s_{L}}(c)}$ computes and outputs :

(${\displaystyle (w-\langle v,s_{L}\rangle )}$ mod ${\displaystyle q}$) mod 2.

## The Bootstrappable Scheme BTS

Although the scheme ${\displaystyle SH}$ presented in the previous section is not bootstrappable, the authors introduce a new "dimension-modulus reduction" technique which allows them to transform ${\displaystyle SH}$ into a scheme which has much shorter ciphertexts and lower decryption complexity.

The new scheme inherits the parameters ${\displaystyle (n,m,q,\chi ,L)}$ from ${\displaystyle SH}$ and has additional parameters ${\displaystyle (k,p,{\hat {\chi }})}$, to which the authors refer as "small parameters".

The parameters ${\displaystyle n,q\in \mathbb {N} }$ are the "long" dimension and the "long" modulus. while ${\displaystyle k,p}$ are the "short" dimension and modulus, respectively. ${\displaystyle \chi ,{\hat {\chi }}}$ are the long and short noise distributions taken over ${\displaystyle \mathbb {Z} _{q}}$ and ${\displaystyle \mathbb {Z} _{p}}$. The parameter ${\displaystyle m}$ is used just for key generation and the parameter ${\displaystyle L}$ is an upper bound on the multiplicative depth of the evaluated function.

For details concerning this new scheme ${\displaystyle \mathrm {BTS} }$ as well as the proof that this is boostrappable, hence can (at least in theory) evaluate any circuit, we refer to the article listed below.

## References

1. Z. Brakerski, F. Vaikuntanathan, Efficient Fully Homomorphic Encryption from (Standard) LWE, SIAM J. Comput., 43(2), 831–871.