Background: Lattices and the Learning-with

Background: Lattices and the
Learning-with-Errors problem
China Summer School on Lattices and Cryptography, June 2014
Starting Point: Linear Equations
ο‚— Easy to solve a linear system of equations
A
s = b (π‘šπ‘œπ‘‘ π‘ž)
ο‚— Given A, b, find s
ο‚— Solved using Gaussian elimination, Cramer rule, etc.
ο‚— [Regev 2005] Hard if we add a little noise
A
s + e = b (π‘šπ‘œπ‘‘ π‘ž)
ο‚— 𝒆 is a noise vector, |𝒆| β‰ͺ π‘ž
ο‚— Given A, b, find s and/or e
Learning with Errors (LWE) [R’05]
ο‚— Parameters:
ο‚— q (modulus), n (dimension), m>n (# of samples)
ο‚— Secret: uniformly random vector 𝒔 ∈ π‘π‘žπ‘›
ο‚— Input: random matrix 𝑨 ∈ π‘π‘žπ‘š×𝑛 , vector 𝒃 ∈ π‘π‘žπ‘š
ο‚— Computed as b = A × s + e (π‘šπ‘œπ‘‘ π‘ž)
ο‚— 𝒆 chosen from some distribution s.t. |𝒆| β‰ͺ π‘ž whp
ο‚— 𝒃 is close to the columns space of 𝑨
ο‚— Goal: discover 𝒔
Learning with Errors (LWE) [R’05]
1. Is it really hard to solve LWE?
ο‚— How hard?
ο‚— For what range of parameters?
2. Is it useful?
ο‚— Can we design cryptosystems with security based on
the hardness of LWE
ο‚— We’ll do #2 first, then #1
Using LWE in Cryptography
The Decision-LWE Problem
ο‚— A more useful variant of LWE:
ο‚— Same parameters q, n, m
ο‚— Input: same A and b
ο‚— A is still a uniform random matrix in π‘π‘žπ‘š×𝑛
ο‚— Either 𝒃 = 𝑨 × π’” + 𝒆 (π‘šπ‘œπ‘‘ π‘ž), or 𝒃 is uniform in π‘π‘žπ‘š×𝑛
ο‚— Goal: distinguish 𝑨 × π’” + 𝒆 from uniform
ο‚— I.e., given A,b, decide if b is β€œunusually close” to
the column space of A
Search vs. Decision LWE
ο‚— Clearly, if we can solve the search problem
then we can also solve the decision problem
ο‚— Try to solve the search problem on A,b
ο‚— If successful then b is close to the column space of A,
otherwise b is random
ο‚— More interesting: If we can solve decision,
then we can also solve the search problem
ο‚— But the complexity grows by a factor of π‘ž β‹… 𝑛
ο‚— So this reduction only works for small (polynomial) π‘ž
Reducing Search to Decision LWE
ο‚— Assume that we have a distinguisher D that
can tell if 𝒃 = 𝐀𝒔 + 𝑒 (π‘šπ‘œπ‘‘ π‘ž) or 𝒃 is random
ο‚— Say for now that D succeeds with probability close to 1
ο‚— We construct a solver S that finds s
ο‚— For every index 𝑖 ∈ {1. . 𝑛} and every value 𝑣 ∈ π‘π‘ž ,
S will use D to determine if 𝒔𝑖 = 𝑣
Reducing Search to Decision LWE
Given 𝑨 and 𝒃 = 𝑨𝒔 + 𝒆, test if 𝒔𝑖 = 𝑣:
ο‚— Choose 𝒓 = (π‘Ÿ1 , π‘Ÿ2 , … , π‘Ÿπ‘š ) ∈ π‘π‘žπ‘š uniformly at random
ο‚— Add 𝒓 to the 𝑖’th column of 𝑨, this gives a matrix 𝑨′
ο‚— 𝑨′ is uniformly random because 𝑨 is
𝑨′ = 𝑨 +
𝟎. . π’“πŸ . . 𝟎
𝟎. . π’“πŸ . . 𝟎
𝟎. . π’“π’Ž . . 𝟎
ο‚— Note that 𝑨′ 𝒔 = 𝑨𝒔 + 𝒔𝑖 β‹… 𝒓
Reducing Search to Decision LWE
Given 𝑨 and 𝒃 = 𝑨𝒔 + 𝒆, test if 𝒔𝑖 = 𝑣:
ο‚— Choose 𝒓 = (π‘Ÿ1 , π‘Ÿ2 , … , π‘Ÿπ‘š ) ∈ π‘π‘žπ‘š uniformly at random
ο‚— Add 𝒓 to the 𝑖’th column of 𝑨, this gives a matrix 𝑨′
ο‚— 𝑨′ is uniformly random because 𝑨 is
ο‚— Add 𝑣 β‹… 𝒓 to 𝒃, this gives the vector 𝒃′
𝒃′ = 𝒃 + 𝑣 β‹…
π’“πŸ
π’“πŸ
π’“π’Ž
Reducing Search to Decision LWE
Given 𝑨 and 𝒃 = 𝑨𝒔 + 𝒆, test if 𝒔𝑖 = 𝑣:
ο‚— Choose 𝒓 = (π‘Ÿ1 , π‘Ÿ2 , … , π‘Ÿπ‘š ) ∈ π‘π‘žπ‘š uniformly at random
ο‚— Add 𝒓 to the 𝑖’th column of 𝑨, this gives a matrix 𝑨′
ο‚— 𝑨′ is uniformly random because 𝑨 is
ο‚— Add 𝑣 β‹… 𝒓 to 𝒃, this gives the vector 𝒃′
ο‚— 𝒃′ = 𝒃 + 𝑣 β‹… 𝒓
= 𝑨𝒔 + 𝒆 + 𝑣 β‹… 𝒓 = 𝑨′ 𝒔 βˆ’ 𝒔𝑖 β‹… 𝒓 + 𝒆 + 𝑣 β‹… 𝒓
= 𝑨′ 𝒔 + 𝒆 + 𝑣 βˆ’ 𝒔𝑖 β‹… 𝒓
Reducing Search to Decision LWE
Given 𝑨 and 𝒃 = 𝑨𝒔 + 𝒆, test if 𝒔𝑖 = 𝑣:
ο‚— Choose random 𝒓, compute 𝑨′ , 𝒃′
ο‚— Such that 𝒃′ = 𝑨′ 𝒔 + 𝒆 + 𝑣 βˆ’ 𝒔𝑖 β‹… 𝒓
ο‚— If 𝒔𝑖 = 𝑣 then we get 𝒃′ = 𝑨′ 𝒔 + 𝒆
ο‚— Otherwise 𝒃′ is uniform (because 𝒓 is uniform)
ο‚— Use the distinguisher 𝐷(𝑨′ , 𝒃′ ) to tell which case it is
ο‚— This will tell us if 𝒔𝑖 = 𝑣
Reducing Search to Decision LWE
ο‚— The reduction assumes that D is always right
ο‚— Can be extended to distinguisher D with polynomially
small advantage
ο‚— The reduction works in time linear in 𝑛 β‹… π‘ž
ο‚— Can be refined to work in time 𝑛 β‹… βˆ‘π‘π‘–
ο‚— The 𝑝𝑖 ’s are the prime factors of π‘ž
ο‚— So the reduction can be efficient even for large π‘ž,
as long as it is smooth
A Useful Variant of LWE
ο‚— Instead of choosing the secret 𝒔 uniformly,
choose it from the same distribution as 𝒆
ο‚— So 𝒔 is small
Theorem [ACPS’09]: Uniform-secret LWE is
equivalent to small-secret LWE
ο‚— Solving one
solving the other
Uniform- vs. Small-secret LWE
Easy direction: If we can solve uniform-secret LWE
then we can solve small-secret LWE
ο‚— We are given 𝑨 and 𝒃 = 𝑨𝒔 + 𝒆
ο‚— 𝒔 is a small secret
ο‚— Choose a uniform random 𝒓
ο‚— Set 𝒃′ = 𝑨𝒓 + 𝒃 = 𝑨 𝒓 + 𝒔 + 𝒆 (π‘šπ‘œπ‘‘ π‘ž)
ο‚— 𝒔′ = 𝒓 + 𝒔 is uniform (because 𝒓 is uniform)
ο‚— 𝑨, 𝒃′ = 𝑨𝒔′ + 𝒆 is instance of uniform-secret LWE
ο‚— Solving it, we get 𝒔′ and can compute 𝒔 = 𝒔′ βˆ’ 𝒓
Uniform- vs. Small-secret LWE
Hard direction: If we can solve small-secret
LWE then we can solve uniform-secret LWE
ο‚— But the parameter π‘š changes
ο‚— For solving π‘š × π‘› uniform-secret LWE, we would need
to solve π‘šβ€² × π‘› small-secret LWE with π‘šβ€² = π‘š βˆ’ 𝑛
ο‚— We are given 𝑨 and 𝒃 = 𝑨𝒔 + 𝒆
ο‚— 𝒔 is a uniform secret
ο‚— Find 𝑛 linearly-independent rows of 𝑨
ο‚— Such rows exist with high probability
ο‚— Assume that these are the first n rows
Uniform- vs. Small-secret LWE
𝑛
𝑛
π‘¨πŸ
π‘š
𝑨 =
π‘¨πŸ
π’ƒπŸ = π‘¨πŸ 𝒔 + π’†πŸ
𝑛
π‘šβ€²
𝒃=
π’ƒπŸ = π‘¨πŸ 𝒔 + π’†πŸ
ο‚— Set 𝑨′ = βˆ’π‘¨2 𝑨1βˆ’1 and 𝒃′ = 𝒃2 + 𝑨′ π’ƒπŸ
ο‚— 𝒃′ = 𝑨2 𝒔 + 𝒆2 + 𝑨′ 𝑨1 𝒔 + 𝒆1
= 𝑨2 𝒔 + 𝑨′ 𝑨1 𝒔 + 𝑨′ 𝒆1 + 𝒆2 = 𝑨′ 𝒆1 + 𝒆2
ο‚— Because 𝑨′ 𝑨1 = βˆ’π‘¨2 𝑨1βˆ’1 𝑨1 = βˆ’π‘¨2
ο‚— So (𝑨′ , 𝒃′ = 𝑨′ 𝒆1 + 𝒆2 ) is instance of short-secret LWE
ο‚— The secret is 𝒆1 , drawn from the error distribution
ο‚— Solving it we get 𝒆1
ο‚— Then compute 𝒔 = π‘¨βˆ’πŸ
𝟏 (π’ƒπŸ βˆ’ π’†πŸ )
Regev’s Cryptosystem [R’05]
Secret key: vector 𝒔′
Public key: Matrix 𝑨′, vector 𝒃 = 𝑨′𝒔′ + 𝒆
ο‚— Denote 𝑨 = (𝒃|𝑨′ )
ο‚— If decision-LWE is hard then A is pseudorandom
ο‚— Denote
𝒔 = 𝟏, βˆ’π’”β€² , then 𝑨𝒔 = 𝒃 βˆ’ 𝑨′ 𝒔′ = 𝒆
Encrypt𝑨 𝜎 ∈ {0,1}
ο‚— Choose a random small vector 𝒓 ∈ 0,1 π‘š
ο‚— Output the ciphertext 𝒄 = 𝒓𝑨
π‘ž
+
2
β‹… 𝜎, 0, … , 0 ∈ π‘π‘žπ‘›
𝜎
Decrypt𝒔(𝒄)
ο‚— Compute the inner product 𝑦 = 𝒄, 𝐬 (mod q)
ο‚— Output 0 if |𝑦| < π‘ž/4, else output 1
Regev’s Cryptosystem [R’05]
ο‚— Correctness:
ο‚— 𝑦 = 𝒄, 𝐬 =
𝒓𝑨𝒔 +
ο‚—
π‘ž
2
𝒓, 𝒆 <
𝒓𝑨 +
π‘ž
𝜎
2
,𝒔 =
𝜎0 … 0 , 1, βˆ’π’”
π‘ž
4
β€²
π‘ž
2
= 𝒓, 𝒆 + β‹… 𝜎
(since 𝒓 is 0-1 vector and 𝒆
π‘ž
4
If 𝜎 = 0 then 𝑦 < , if 𝜎 = 1 then 𝑦
∞ <
π‘ž
>
4
π‘ž
)
4
ο‚— Security:
ο‚— Recall that A is pseudo-random
ο‚— We show that if A was random then 𝒄 was statistically
close to uniform, regardless of 𝜎
Regev’s Cryptosystem [R’05]
The Leftover Hash Lemma [HILL’99] implies the
following corollary:
ο‚— If π‘š > 3𝑛 log π‘ž then the two distributions
< 𝑨, 𝒓𝑨 : 𝐴 βˆˆπ‘ˆ π‘π‘žπ‘š×𝑛 , 𝒓 βˆˆπ‘ˆ 0,1 π‘š >
< 𝑨, 𝒖 ∢ 𝐴 βˆˆπ‘ˆ π‘π‘žπ‘š×𝑛 ,
𝒖 βˆˆπ‘ˆ π‘π‘žπ‘› >
are statistically close (upto π‘ž βˆ’Ξ©(π‘š) )
For a random 𝐴, 𝒓𝐴 is close to uniform
ο‚— Even conditioned on A
ο‚— And therefore so is 𝒓𝐴
π‘ž
+ 𝜎
2
If 𝐴 is pseudorandom, so is 𝒓𝐴 +
π‘ž
𝜎
2
A Useful Variant of the Cryptosystem
Encrypt: 𝒄 = 2𝒓𝑨 + 𝜎
ο‚— instead of 𝒄 =
π‘ž
𝒓𝑨 + 𝜎
2
from before
ο‚— Plaintext encoded in the LSB rather than MSB
Decrypt: y = 𝒄, 𝐬 (π‘šπ‘œπ‘‘ π‘ž), then 𝜎 = 𝑦 π‘šπ‘œπ‘‘ 2
ο‚— 𝑦 = 2 𝒓, 𝒆 + 𝜎 (π‘šπ‘œπ‘‘ π‘ž)
ο‚— 2 𝒓, 𝒆 < π‘ž/2, so no mod-π‘ž reduction
 𝑦 π‘šπ‘œπ‘‘ 2 = 𝜎
The Hardness of LWE
Lattices and Hard Problems
0
A lattice is just an additive subgroup of Rn.
Lattices
v2’
v2
0
v1’
v1
Lattice of rank n = set of all integer linear combinations of n
linearly independent basis vectors.
Lattices
ο‚— A Lattice has infinitely many bases
ο‚— They are related by unimodular matrices, 𝐡 β€² = π΅π‘ˆ
ο‚— π‘ˆ is an integer matrix with det π‘ˆ = ±1
All bases have the same determinant (upto sign)
ο‚— This quantity is the determinant of the lattice
ο‚— Given any set of vectors that span the lattice,
can compute a canonical basis
ο‚— Hermite normal form (HNF)
Lattices
ο‚— A β€œgood basis” has all small vectors
ο‚— β€œclose to orthogonal” to each other
ο‚— Typically the HNF is a β€œbad” basis
ο‚— Minkowsky’s theorems:
A rank-𝑛 lattice with determinant 𝑑 has
ο‚— A non-zero vector of length |𝑣| ≀ 𝑛 β‹… 𝑑1/𝑛
𝑛/2 β‹… 𝑑
ο‚— 𝑛 linearly independent 𝑣𝑖 β€˜s s.t. 𝑛
|𝑣
|
≀
𝑛
𝑖=1 𝑖
ο‚— Also a basis of vectors of similar sizes
ο‚— Lattice reduction: Given a β€œbad” basis,
find a β€œgood” one for the same lattice
Lattices and Hard Problems
v2’
v2
0
v1’
v1
Given some basis of L, may be hard to find good basis of L.
Hard to solve the (approx) shortest/closest vector problems.
Hard Problems
Given a basis 𝐡 for a lattice 𝐿(𝐡):
ο‚— Shortest-Vector Problem (SVP)
ο‚— Find the shortest nonzero vector in L(B)
ο‚— Or maybe just compute the size of such vector (πœ†1 𝐿 )
ο‚— Shortest Independent-Set Problem (SIVP)
ο‚— Find 𝑛 linearly independent 𝑣1 , … , 𝑣𝑛 minimize max |𝑣𝑖 |
𝑖
𝑛
ο‚— Or maybe just the quantity πœ†π‘› 𝐿 = max𝑖=1
|𝑣𝑖 |
ο‚— Also approximation versions
ο‚— Find 𝑣 such that 𝑣 ≀ 𝛾 β‹… shortest
ο‚— Find 𝑣𝑖 ’s such that max |𝑣𝑖 | ≀ 𝛾 β‹… smallest-possible
𝑖
Hard Problems: What’s Known?
ο‚— The [LLL’82] algorithm and its variants can
approximate SVP upto 𝛾 = 2O(𝑛)
log1βˆ’πœ– 𝑛
ο‚— NP-hard to approx. SVP upto 𝛾 = 2
ο‚— 𝛾 = πœ”(1) but 𝛾 < π‘›πœ– for any πœ–
ο‚— Roughly: approximate upto 2𝑛/π‘˜ takes time 2𝑂(π‘˜)
ο‚— Practically we can perhaps approximate SVP upto 𝛾 =
2𝑛/100 but not upto 𝛾 = 2𝑛/200
ο‚— At least for moderate 𝑛’s (say 𝑛 < 500)
ο‚— Similar for SIVP
LWE and Lattices
ο‚— Consider the matrix 𝑨 = π’‚πŸ … 𝒂𝒏
ο‚— The column space mod-π‘ž is a rank-π‘š lattice,
spanned by the columns of 𝐡 =
ο‚— A discrete additive subgroup of 𝑅 π‘š
ο‚— Can compute its HNF basis
π‘ž 0
π’‚πŸ … 𝒂𝒏 0 π‘ž
0
0
β‹±
0 0
ο‚— 𝒃 = 𝑨𝒔 + 𝒆 (π‘šπ‘œπ‘‘ π‘ž) is close to this lattice
ο‚— 𝒗 = 𝒃 βˆ’ 𝒆 is in the lattice, at distance |𝒆| from 𝒃
ο‚— We have a bound 𝛽 β‰ͺ π‘ž on |𝒆| whp (say 𝛽 =
ο‚— If we find 𝒗, we can solve for 𝒔
π‘ž)
π‘ž
Bounded Distance Decoding (BDD)
ο‚— Input: a basis B, another point π‘₯, a bound 𝛽
ο‚— Goal: find 𝑣 ∈ 𝐿(𝐡) such that π‘₯ βˆ’ 𝑣 ≀ 𝛽
ο‚— Solving BDD  Solving LWE
Thm [Babai’86,GPV’08]:
ο‚— Solving SIVP  Solving BDD
ο‚— Given a basis for 𝐿 with max |𝑣𝑖 | = 𝛼,
𝑖
can solve BDD upto distance 𝛽 β‰ˆ 𝛼 β‹… poly(𝑛)
LWE and Lattices
Thm [Reg’05, Pei’09]:
ο‚— Solving LWE  Solving SIVP, SVP
ο‚— LWE-solver with error-bound 𝛽 < π‘ž/𝑂( 𝑛)
implies quantum approximation of SIVP
upto a factor poly(𝑛)
ο‚— Or a classical algorithm for approximating
πœ†1 𝐿 upto a factor poly(𝑛)
Summary
ο‚— Learning with Errors: 𝒃 = 𝑨𝒔 + 𝒆
ο‚— This is a hard problem
ο‚— For some parameters, can be shown to be
as hard as some well-known lattice problems
ο‚— Even for other settings, we don’t know how to solve it
ο‚— Only known attacks use lattice reduction
ο‚— These only work when π‘ž/|𝒆| = exp(𝑛)
ο‚— LWE is useful for cryptography
ο‚— For example for public-key encryption
ο‚— Decryption formula 𝑠, 𝑐 π‘šπ‘œπ‘‘ π‘ž π‘šπ‘œπ‘‘ 2