Co6GC: Introduction to Lattice-based Cryptography (Part 1)

This is a post in COSIC’s Guide to Crypto! In this series, researchers from COSIC will be informally writing about different concepts in cryptography. Our aim is to introduce the reader to these concepts with explanations, illustrations and examples; so let’s get started!

Lattice-based cryptography. You’ve probably heard the term a lot, and for good reason. Lattices are perhaps the best tool we have to build cryptosystems which are secure against quantum adversaries. In the current effort to standardise post-quantum cryptosystems organised by NIST there were more submissions based on lattices than on any other branch of public-key cryptography and almost half of those candidates which made it through to the second round were lattice-based.

On top of being post-quantum, lattices are very flexible and have enabled many advanced cryptographic constructions such as obfuscation, functional encryption and fully homomorphic encryption, some of which we only know how to build using lattices. In this post we won’t be talking about any of these applications but focus on the foundations.

So what is a lattice?

In mathematics there are, rather unfortunately, two entirely distinct objects which are called lattices, we are talking about lattices as defined to be a discrete subspace of the vector space \(\mathbb{R}^n\). Here, discrete means that there cannot be two vectors in the lattice which are arbitrarily close to each other. In other words, there is a positive real number \(\lambda\) such that no two vectors in the lattice can be closer than a distance \(\lambda\). The word subspace tells us that if you have two vectors in your lattice then you can geometrically subtract one from the other and where you end up will be another vector in the lattice. This means the zero vector is always in the lattice.

Visually, a lattice in 2 dimensions looks something like this:

Lattices are nice mathematical objects as they can be described by a relatively small amount of data. The description usually used is to give a basis of the lattice, this is a list of vectors which generate all the other points by adding integer linear combinations of these basis vectors, further, no set with fewer elements has this property.

Every lattice has a basis but it is far from being unique, in fact every lattice has an infinite number of them, and not all of them are as equally nice to work with. Going back to our example lattice, we can add some bases, in this case pairs of vectors:

Intuitively, we can notice that the blue and green bases look nicer than the yellow or purple bases. Indeed, using short vectors in a basis means using less storage to describe the lattice. In 2 dimensions it is not difficult to find a basis whose vectors are as short as possible, one can use the Lagrange algorithm (often incorrectly attributed to Gauss) [1], however as the dimension increases it quickly becomes hard even to find any reasonably short vector in a lattice if given a random basis for the lattice.

Fundamental problems on lattices

This brings us to the first fundamentally hard problem in lattices, the shortest vector problem (SVP). Given a basis for a lattice, the problem is to find a non-zero vector in the lattice whose length is minimal over all non-zero lattice vectors. Restated, one must find a vector of length \(\lambda_1\) where \(\lambda_1\) is the largest possible value for \(\lambda\) one can take in the explanation of discreteness given above. It is known that this problem is NP-hard for randomised reductions [2].

Since this problem is so hard, it is natural to consider a relaxation of this problem known as the approximate shortest vector problem. Here, you are also given an approximation factor \(\gamma\) and are only required to find a non-zero vector in the lattice of length at most \(\gamma\lambda_1\). In cryptography one often considers this problem with \(\gamma\) polynomially bounded in the dimension of the lattice. The best known algorithms that run in time polynomial in the dimension of the lattice can solve the approximate SVP for an approximation factor which is slightly sub-exponential in the dimension. Also of interest to cryptographers are decision problems; turning the SVP problem into a decisional problem gives us the GapSVP problem. Given a parameter \(\beta\) and a basis for a lattice, one must decide whether the lattice contains a non-zero vector of length at most 1 or if the shortest non-zero vector has length larger than \(\beta\), assuming that one of the two situations are true.

The second fundamental problem in lattices is the closest vector problem (CVP). In this problem one is given a lattice defined by some basis as well as a target vector in the ambient vector space in which the lattice lies, the task is to determine a vector in the lattice which is closest to the target vector. This problem would be easy if we could find a basis of the lattice which is orthogonal; unfortunately, it is easy to show that the majority of lattices do not possess an orthogonal basis.  However, it is possible to define a notation of a basis being nearly orthogonal which is useful. We can now informally define what a nice basis is: one which consists of relatively short nearly orthogonal vectors. It is the aim of lattice reduction algorithms such as the celebrated LLL and BKZ algorithms to compute such a nice basis.

As with SVP, we can define the approximate closest vector problem as well as GapCVP in an analogous manner.  Finally, the bounded distance decoding (BDD) problem is the same as CVP except now we are promised that the target vector is at most a distance \(d\) away from the lattice, for some known \(d < \lambda_1/2\).

As examples, we show an instance of the CVP with a yellow target vector and an instance of the BDD by the purple target vector, the distance \(d\) here is just smaller than \(\lambda_1/2\) and is shown by the green circles. We can see that the yellow target vector would not be a valid target vector in the BDD problem (for any \(d\)).

Cryptographic problems on lattices

So far, the problems we have discussed are not easily applied to construct cryptographic protocols. However, in ground-breaking work [3], Ajtai introduced the short integer solution (SIS) problem. Here, you are given a uniformly random matrix \(A\in\mathbb{Z}_q^{n\times m}\) and a bound \(\beta\) and must find a non-zero integer vector \(\mathbf{z}\) such that \(A\mathbf{z}\equiv\mathbf{0}\bmod{q}\) and \(\|\mathbf{z}\|\le\beta\). The SIS problem is an average-case problem as the matrix \(A\) is chosen uniformly at random, the breakthrough of Ajtai was to give the first worst-case to average-case reduction for lattice problems and hence that the security of the SIS problem is based on standard worst-case complexity assumptions. It is straightforward to show that the solutions to \(A\mathbf{z}\equiv\mathbf{0}\bmod{q}\) form an integer lattice and the problem is to find a short vector in this lattice, an instance of approximate SVP for some unknown approximation factor.

While the SIS problem has been used to construct one-way and collision-resistant hash functions, digital signatures and identification schemes its applications are somewhat limited. For example, there are currently no public-key encryption schemes based on SIS. The next problem we describe on the other hand has a vast number of applications; that problem is the learning with errors (LWE) problem.

Introduced in 2005 by Regev [4], the LWE problem can be informally stated as solving a system of noisy linear equations. More precisely, given a secret vector \(\mathbf{s}\in\mathbb{Z}_q^n\) and a noise distribution \(\chi\) over the integers, the LWE distribution \(A_{\mathbf{s},\chi}\) is defined by sampling \(\mathbf{a}\in\mathbb{Z}_q^n\) uniformly at random, sampling \(e\leftarrow\chi\) and outputting the pair \((\mathbf{a},b=\langle\mathbf{a},\mathbf{s}\rangle+e\bmod{q})\). The distribution \(\chi\) is typically taken to be a discretised Gaussian.

The LWE problem comes in two  variants, the search problem and the decision problem. In the search problem, you are given samples \((\mathbf{a}_i,b_i)\leftarrow A_{\mathbf{s},\chi}\) and must determine the secret vector \(\mathbf{s}\). In the decision variant, you are again given samples \((\mathbf{a}_i,b_i)\in\mathbf{Z}_q^n\times\mathbf{Z}_q\) but this time the samples are either all sampled from the LWE distribution \(A_{\mathbf{s},\chi}\) or all sampled uniformly at random from \(\mathbf{Z}_q^n\times\mathbf{Z}_q\); now you must decide which is the case.

We can see that the LWE problems are closely related to CVP style problems, or more accurately BDD for the search version; if one has \(m\) samples then the lattice under consideration here is \[\{\mathbf{v}\in\mathbb{Z}^m~:~\mathbf{v}_i\equiv\langle\mathbf{a}_i,\mathbf{u}\rangle\bmod{q}\text{ for all }i,\text{ for some vector }\mathbf{u}\in\mathbf{Z}_q^n\},\] with target vector \(\mathbf{b}=(b_1,\dotsc,b_m)\). Regev showed that if \(\log q\) and  the number of samples are polynomially bounded in \(n\) and the noise distribution \(\chi\) is a discrete Gaussian with parameter \(\alpha q\ge 2\sqrt{n}\) for some \(0<\alpha<1\), then the corresponding LWE problem is at least as hard as (quantumly) solving GapSVP for approximation factor \(\beta \in \tilde{O}(n/\alpha)\).

The fact that both the LWE and SIS problems have been shown to reduce to standard problems on lattices which have been studied for many years gives lattice-based cryptography a solid foundation for security. In practice however, applications often use parameters for which these security reductions do not hold, usually because the noise distribution is too narrow or the secret in the LWE distribution is taken from a very small subset of possible secrets. Further, for efficiency it is common to use the ring variants of these problems which lead to structured lattice problems which could potentially be easier. We leave these topics for a future post in this series.

To learn more about the best known methods to solve fundamental lattice problems we recommend the book “The LLL Algorithm” edited by Nguyen and Vallée [5]. For a survey of the LWE and SIS problems and their applications to cryptography we recommend the article “A Decade of Lattice Cryptography” by Peikert [6].

[1] Lagrange, L. (1773). Recherches d’arithmétique. Nouv. M´em. Acad. pp. 695-795.

[2] Ajtai, M. (1998). “The shortest vector problem in L2 is NP-hard for randomized reductions”. Proceedings of the thirtieth annual ACM symposium on Theory of computing. Dallas, Texas, United States: ACM. pp. 10–19.

[3] Ajtai, M. (1996). “Generating hard instances of lattice problems”. Proceedings of the twenty-eighth annual ACM symposium on Theory of computing. Philadelphia, Pennsylvania, United States: ACM. pp. 99–108.

[4] Regev, O. (2005). “On lattices, learning with errors, random linear codes, and cryptography”. Proceedings of the thirty-seventh annual ACM symposium on Theory of computing (STOC ’05). Association for Computing Machinery, New York, NY, USA,. pp. 84–93.

[5] Nguyen, P. Q. and Vallée, B. “The LLL Algorithm: Survey and Applications”. Springer Berlin Heidelberg, 2010.

[6] Peikert, C. (2016). “A Decade of Lattice Cryptography”. Foundations and Trends® in Theoretical Computer Science, 10(4), pp 283-424.