Fully Key-Homomorphic Encryption, Arithmetic Circuit ABE, and Compact Garbled Circuits∗

Dan Boneh† Craig Gentry‡ Sergey Gorbunov§ Shai Halevi¶ Valeria Nikolaenkok Gil Segev∗∗ Vinod Vaikuntanathan†† Dhinakaran Vinayagamurthy‡‡

May 20, 2014

Abstract We construct the first (key-policy) attribute-based encryption (ABE) system with short secret keys: the size of keys in our system depends only on the depth of the policy circuit, not its size. Our constructions extend naturally to arithmetic circuits with arbitrary fan-in gates thereby further reducing the circuit depth. Building on this ABE system we obtain the first reusable circuit garbling scheme that produces garbled circuits whose size is the same as the original circuit plus an additive poly(λ, d) bits, where λ is the security parameter and d is the circuit depth. Save the additive poly(λ, d) factor, this is the best one could hope for. All previous constructions incurred a multiplicative poly(λ) blowup. As another application, we obtain (single key secure) functional encryption with short secret keys. We construct our attribute-based system using a mechanism we call fully key-homomorphic encryption which is a public-key system that lets anyone translate a ciphertext encrypted under a public-key x into a ciphertext encrypted under the public-key (f(x), f) of the same plaintext, for any efficiently computable f. We show that this mechanism gives an ABE with short keys. Security is based on the subexponential hardness of the learning with errors problem. We also present a second (key-policy) ABE, using multilinear maps, with short ciphertexts: an encryption to an attribute vector x is the size of x plus poly(λ, d) additional bits. This gives a reusable circuit garbling scheme where the size of the garbled input is short, namely the same as that of the original input, plus a poly(λ, d) factor.

∗This is the full version of a paper that appeared in Eurocrypt 2014 [BGG+14]. This work is a merge of two closely related papers [GGH+13d, BNS13]. †, Stanford, CA, USA. Email: [email protected]. ‡IBM Research, Yorktown, NY, USA. Email: [email protected]. §MIT, Cambridge, MA, USA. Email: [email protected]. This work was partially done while visiting IBM T. J. Watson Research Center. ¶IBM Research, Yorktown, NY, USA. Email: [email protected]. kStanford University, Stanford, CA, USA. Email: [email protected]. ∗∗Hebrew University, Jerusalem, . Email: [email protected]. This work was partially done while the author was visiting Stanford University. ††MIT, Cambridge, MA, USA. Email: [email protected]. ‡‡University of Toronto, Toronto, Ontario, Canada. Email: [email protected].

1 1 Introduction

(Key-policy) attribute-based encryption [SW05, GPSW06] is a public-key encryption mechanism where every secret key skf is associated with some function f : X → Y and an encryption of a message µ is labeled with a public attribute vector x ∈ X . The encryption of µ can be decrypted using skf only if f(x) = 0 ∈ Y. Intuitively, the security requirement is collusion resistance: a coalition of users learns nothing about the plaintext message µ if none of their individual keys are authorized to decrypt the ciphertext. Attribute-based encryption (ABE) is a powerful generalization of identity-based encryption [Sha84, BF03, Coc01] and fuzzy IBE [SW05, ABV+12] and is a special case of functional encryption [BSW11]. It is used as a building-block in applications that demand complex access control to encrypted data [PTMW06], in designing protocols for verifiably outsourcing computations [PRV12], and for single-use functional encryption [GKP+13b]. Here we focus on key-policy ABE where the access policy is embedded in the secret key. The dual notion called ciphertext-policy ABE can be realized from this using universal circuits, as explained in [GPSW06, GGH+13c]. The past few years have seen much progress in constructing secure and efficient ABE schemes from different assumptions and for different settings. The first constructions [GPSW06, LOS+10, OT10, LW12, Wat12, Boy13, HW13] apply to predicates computable by Boolean formulas which are a subclass of log-space computations. More recently, important progress has been made on con- structions for the set of all polynomial-size circuits: Gorbunov, Vaikuntanathan, and Wee [GVW13] gave a construction from the Learning With Errors (LWE) problem and Garg, Gentry, Halevi, Sa- hai, and Waters [GGH+13c] gave a construction using multilinear maps. In both constructions the policy functions are represented as Boolean circuits composed of fan-in 2 gates and the secret key size is proportional to the size of the circuit.

Our results. We present two new key-policy ABE systems. Our first system, which is the centerpiece of this paper, is an ABE based on the learning with errors problem [Reg05] that supports functions f represented as arithmetic circuits with large fan-in gates. It has secret keys whose size is proportional to depth of the circuit for f, not its size. Secret keys in previous ABE constructions contained an element (such as a matrix) for every gate or wire in the circuit. In our scheme the secret key is a single matrix corresponding only to the final output wire from the circuit. We prove selective security of the system and observe that by a standard complexity leveraging argument (as in [BB11]) the system can be made adaptively secure.

Theorem 1.1 (Informal). Let λ be the security parameter. Assuming subexponential LWE, there is an ABE scheme for the class of functions with depth-d circuits where the size of the secret key for a circuit C is poly(λ, d).

Our second ABE system, based on multilinear maps ([BS02],[GGH13a]), optimizes the cipher- text size rather than the secret key size. The construction here relies on a generalization of broad- cast encryption [FN93, BGW05, BW13] and the attribute-based encryption scheme of [GGH+13c]. Previously, ABE schemes with short ciphertexts were known only for the class of Boolean formu- las [ALdP11].

Theorem 1.2 (Informal). Let λ be the security parameter. Assuming that d-level multilinear maps exist, there is an ABE scheme for the class of functions with depth-d circuits where the size of the encryption of an attribute vector x is |x| + poly(λ, d).

2 Our ABE schemes result in a number of applications and have many desirable features, which we describe next.

Applications to reusable garbled circuits. Over the years, garbled circuits and variants have found many uses: in two party [Yao86] and multi-party secure protocols [GMW87, BMR90], one- time programs [GKR08], key-dependent message security [BHHI10], verifiable computation [GGP10], homomorphic computations [GHV10] and many others. Classical circuit garbling schemes produced single-use garbled circuits which could only be used in conjunction with one garbled input. Gold- wasser et al. [GKP+13b] recently showed the first fully reusable circuit garbling schemes and used them to construct token-based program obfuscation schemes and k-time programs [GKP+13b]. Most known constructions of both single-use and reusable garbled circuits proceed by garbling each gate to produce a garbled truth table, resulting in a multiplicative size blowup of poly(λ). A fundamental question regarding garbling schemes is: How small can the garbled circuit be? There are three exceptions to the gate-by-gate garbling method that we are aware of. The first is the “free XOR” optimization for single-use garbling schemes introduced by Kolesnikov and Schneider [KS08] where one produces garbled tables only for the AND gates in the circuit C. This still results in a multiplicative poly(λ) overhead but proportional to the number of AND gates (as opposed to the total number of gates). Secondly, Lu and Ostrovsky [LO13] recently showed a single-use garbling scheme for RAM programs, where the size of the garbled program grows as poly(λ) times its running time. Finally, Goldwasser et al. [GKP+13a] show how to (reusably) garble non-uniform Turing machines under a non-standard and non-falsifiable assumption and incurring a multiplicative poly(λ) overhead in the size of the non-uniformity of the machine. In short, all known garbling schemes (even in the single-use setting) suffer from a multiplicative overhead of poly(λ) in the circuit size or the running time. Using our first ABE scheme (based on LWE) in conjunction with the techniques of Goldwasser et al. [GKP+13b], we obtain the first reusable garbled circuits whose size is |C| + poly(λ, d). For large and shallow circuits, such as those that arise from database lookup, search and some machine learning applications, this gives significant bandwidth savings over previous methods (even in the single use setting). Theorem 1.3 (Informal). Assuming subexponential LWE, there is a reusable circuit garbling scheme that garbles a depth-d circuit C into a circuit Cˆ such that |Cˆ| = |C| + poly(λ, d), and garbles an input x into an encoded input xˆ such that |xˆ| = |x| · poly(λ, d). We next ask if we can obtain short garbled inputs of size |xˆ| = |x|+poly(λ, d), analogous to what we achieved for the garbled circuit. In a beautiful recent work, Applebaum, Ishai, Kushilevitz and Waters [AIKW13] showed constructions of single-use garbled circuits with short garbled inputs of size |xˆ| = |x| + poly(λ). We remark that while their garbled inputs are short, their garbled circuits still incur a multiplicative poly(λ) overhead. Using our second ABE scheme (based on multilinear maps) in conjunction with the techniques of Goldwasser et al. [GKP+13b], we obtain the first reusable garbling scheme with garbled inputs of size |x| + poly(λ, d). Theorem 1.4 (Informal). Assuming subexponential LWE and the existence of d-level multilinear maps, there is a reusable circuit garbling scheme that garbles a depth-d circuit C into a circuit Cˆ such that |Cˆ| = |C| · poly(λ, d), and garbles an input x into an encoded input xˆ such that |xˆ| = |x| + poly(λ, d).

3 A natural open question is to construct a scheme which produces both short garbled circuits and short garbled inputs. We first focus on describing the ABE schemes and then give details of the garbling scheme.

ABE for arithmetic circuits. For a prime q, our first ABE system (based on LWE) directly handles arithmetic circuits with weighted addition and multiplication gates over Zq, namely gates of the form

g+(x1, . . . , xk) = α1x1 + ... + αkxk and g×(x1, . . . , xk) = α · x1 ··· xk where the weights αi can be arbitrary elements in Zq. Previous ABE constructions worked with Boolean circuits. Addition gates g+ take arbitrary inputs x1, . . . , xk ∈ Zq. However, for multiplication gates g×, we require that the inputs are somewhat smaller than q, namely in the range [−p, p] for some p < q. (In fact, our construction allows for one of the inputs to g× to be arbitrarily large in Zq). Hence, ` while f : Zq → Zq can be an arbitrary polynomial-size arithmetic circuit, decryption will succeed only for attribute vectors x for which f(x) = 0 and the inputs to all multiplication gates in the circuit are in [−p, p]. We discuss the relation between p and q at the end of the section. We can in turn apply our arithmetic ABE construction to Boolean circuits with large fan-in resulting in potentially large savings over constructions restricted to fan-in two gates. An AND gate can be implemented as ∧(x1, . . . , xk) = x1 ··· xk and an OR gate as ∨(x1, . . . , xk) = 1 − (1 − x1) ··· (1 − xk). In this setting, the inputs to the gates g+ and g× are naturally small, namely in {0, 1}. Thus, unbounded fan-in allows us to consider circuits with smaller size and depth, and results in smaller overall parameters.

ABE with key delegation. Our first ABE system also supports key delegation. That is, using the master secret key, user Alice can be given a secret key skf for a function f that lets her decrypt whenever the attribute vector x satisfies f(x) = 0. In our system, for any function g, Alice can then issue a delegated secret key skf∧g to Bob that lets Bob decrypt if and only if the attribute vector x satisfies f(x) = g(x) = 0. Bob can further delegate to Charlie, and so on. The size of the secret key increases quadratically with the number of delegations. We note that Gorbunov et al. [GVW13] showed that their ABE system for Boolean circuits supports a somewhat restricted form of delegation. Specifically, they demonstrated that using a secret key skf for a function f, and a secret key skg for a function g, it is possible to issue a secret key skf∧g for the function f ∧ g. In this light, our work resolves the naturally arising open problem of providing full delegation capabilities (i.e., issuing skf∧g using only skf ).

1.1 Building an ABE for arithmetic circuits with short keys Key-homomorphic public-key encryption. We obtain our ABE by constructing a public-key encryption scheme that supports computations on public keys. Basic public keys in our system ` ` ` are vectors x in Zq for some `. Now, let x be a tuple in Zq and let f : Zq → Zq be a function represented as a polynomial-size arithmetic circuit. Key-homomorphism means that:

anyone can transform an encryption under key x into an encryption under key f(x).

4 ` More precisely, suppose c is an encryption of message µ under public-key x ∈ Zq. There is a public algorithm Evalct(f, x, c) −→ cf that outputs a ciphertext cf that is an encryption of µ under the public-key f(x) ∈ Zq. In our constructions Evalct is deterministic and its running time is proportional to the size of the arithmetic circuit for f. If we give user Alice the secret-key for the public-key 0 ∈ Zq then Alice can use Evalct to decrypt c whenever f(x) = 0, as required for ABE. Unfortunately, this ABE is completely insecure! This is because the secret key is not bound to the function f: Alice could decrypt any ciphertext encrypted under x by simply finding some function g such that g(x) = 0. To construct a secure ABE we slightly extend the basic key-homomorphism idea. A base ` encryption public-key is a tuple x ∈ Zq as before, however Evalct produces ciphertexts encrypted under the public key (f(x), hfi) where f(x) ∈ Zq and hfi is an encoding of the circuit computing f. Transforming a ciphertext c from the public key x to (f(x), hfi) is done using algorithm Evalct(f, x, c) −→ cf as before. To simplify the notation we write a public-key (y, hfi) as simply (y, f). The precise syntax and security requirements for key-homomorphic public-key encryption are provided in Section3. To build an ABE we simply publish the parameters of the key-homomorphic PKE system. A ` message µ is encrypted with attribute vector x = (x1, . . . , x`) ∈ Zq that serves as the public key. Let c be the resulting ciphertext. Given an arithmetic circuit f, the key-homomorphic property lets anyone transform c into an encryption of µ under key (f(x), f). The point is that now the secret key for the function f can simply be the decryption key for the public-key (0, f). This key enables the decryption of c when f(x) = 0 as follows: the decryptor first uses Evalct(f, x, c) −→ cf to transform the ciphertext to the public key (f(x), f). It can then decrypt cf using the decryption key it was given whenever f(x) = 0. We show that this results in a secure ABE.

+ A construction from learning with errors. Fix some n ∈ Z , prime q, and m = Θ(n log q). n×m Let A, G and B1,..., B` be matrices in Zq that will be part of the system parameters. To ` encrypt a message µ under the public key x = (x1, . . . , x`) ∈ Zq we use a variant of dual Regev encryption [Reg05, GPV08] using the following matrix as the public key:

 n×(`+1)m A | x1G + B1 | · · · | x`G + B` ∈ Zq (1)

We obtain a ciphertext cx. We note that this encryption algorithm is the same as encryption in the hierarchical IBE system of [ABB10] and encryption in the predicate encryption for inner-products of [AFV11]. ` We show that, remarkably, this system is key-homomorphic: given a function f : Zq → Zq computed by a poly-size arithmetic circuit, anyone can transform the ciphertext cx into a dual Regev encryption for the public-key matrix

 n×2m A | f(x) · G + Bf ∈ Zq

n×m where the matrix Bf ∈ Zq serves as the encoding of the circuit for the function f. This Bf is uniquely determined by f and B1,..., B`. The work needed to compute Bf is proportional to the size of the arithmetic circuit for f. To illustrate the idea, assume that we have the ciphertext under the public key (x, y): cx = T T T (c0 | cx | cy). Here c0 = A s + e, cx = (xG + B1) s + e1 and cy = (yG + B2) s + e2. To compute the ciphertext under the public key (x + y, B+) one takes the sum of the ciphertexts cx and cy.

5 The result is the encryption under the matrix

n×m (x + y)G + (B1 + B2) ∈ Zq where B+ = B1 + B2. One of the main contributions of this work is a novel method of multiplying the public keys. Together with addition, described above, this gives full key-homomorphism. To construct the ciphertext under the public key (xy, B×), we first compute a small-norm matrix m×m R ∈ Zq , s.t. GR = −B1. With this in mind we compute

T T  T  T R cy = R · (yG + B2) s + e2 ≈ (−yB1 + B2R) s, and  T  T y · cx = y (xG + B1) s + e1 ≈ (xyG + yB1) s Adding the two expressions above gives us

T (xyG + B2R) s + noise which is a ciphertext under the public key (xy, B×) where B× = B2R. Note that performing this operation requires that we know y. This is the reason why this method gives an ABE and not (private index) predicate encryption. In Section 4.1 we show how to generalize this mechanism to arithmetic circuits with arbitrary fan-in gates. As explained above, this key-homomorphism gives us an ABE for arithmetic circuits: the public n×m parameters contain random matrices B1,..., B` ∈ Zq and encryption to an attribute vector x in ` Zq is done using dual Regev encryption to the matrix (1). A decryption key skf for an arithmetic ` circuit f : Zq → Zq is a decryption key for the public-key matrix (A | 0 · G + Bf ) = (A|Bf ). This key enables decryption whenever f(x) = 0. The key skf can be easily generated using a short basis ⊥ for the lattice Λq (A) which serves as the master secret key. We prove selective security from the learning with errors problem (LWE) by using another homomorphic property of the system implemented in an algorithm called Evalsim. Using Evalsim the simulator responds to the adversary’s private key queries and then solves the given LWE challenge.

Parameters and performance. Applying algorithm Evalct(f, x, c) to a ciphertext c increases the magnitude of the noise in the ciphertext by a factor that depends on the depth of the circuit for f.A k-way addition gate (g+) increases the norm of the noise by a factor of O(km). A k-way multiplication gate (g×) where all (but one) of the inputs are in [−p, p] increases the norm of the noise by a factor of O(pk−1m). Therefore, if the circuit for f has depth d, the noise in c grows in k−1 d the worst case by a factor of O((p m) ). Note that the weights αi used in the gates g+ and g× have no effect on the amount of noise added. For decryption to work correctly the modulus q should be slightly larger than the noise in the ciphertext. Hence, we need q on the order of Ω(B · (pk−1m)d) where B is the maximum magnitude of the noise added to the ciphertext during encryption. For security we rely on the hardness of the learning with errors (LWE) problem, which requires that the ratio q/B is not too large. In particular, the underlying problem is believed to be hard even when q/B is 2(n) for some fixed 0 <  < 1/2. In our settings q/B = Ω(pk−1m)d. Then to support circuits of depth t(λ) for (1/) 1/ (n) some polynomial t(·) we choose n such that n ≥ t(λ) · (2 log2 n + k log p) , set q = 2 , m = Θ(n log q), and the LWE noise bound to B = O(n). This ensures correctness of decryption and hardness of LWE since we have Ω((pkm)t(λ)) < q ≤ 2(n), as required. The ABE system of [GVW13] uses similar parameters due to a similar growth in noise as a function of circuit depth.

6 Secret key size. A decryption key in our system is a single 2m × m low-norm matrix, namely the trapdoor for the matrix (A|Bf ). Since m = Θ(n log q) and log2 q grows linearly with the circuit depth d, the overall secret key size grows as O(d2) with the depth. In previous ABE systems for circuits [GVW13, GGH+13c] secret keys grew as O(d2s) where s is the number of boolean gates or wires in the circuit.

Other related work. Predicate encryption [BW07, KSW08] provides a stronger privacy guaran- tee than ABE by additionally hiding the attribute vector x. Predicate encryption systems for inner product functionalities can be built from bilinear maps [KSW08] and LWE [AFV11]. More recently, Garg et al. [GGH+13b] constructed functional encryption (which implies predicate encryption) for all polynomial-size functionalities using indistinguishability obfuscation. The encryption algorithm in our system is similar to that in the hierarchical-IBE of Agrawal, Boneh, and Boyen [ABB10]. We show that this system is key-homomorphic for polynomial-size arithmetic circuits which gives us an ABE for such circuits. The first hint of the key homo- morphic properties of the [ABB10] system was presented by Agrawal, Freeman, and Vaikun- tanathan [AFV11] who showed that the system is key-homomorphic with respect to low-weight linear transformations and used this fact to construct a (private index) predicate encryption system for inner-products. To handle high-weight linear transformations [AFV11] used bit decomposition to represent the large weights as bits. This expands the ciphertext by a factor of log2 q, but adds more functionality to the system. Our ABE, when presented with a circuit containing only lin- ear gates (i.e. only g+ gates), also provides a predicate encryption system for inner products in the same security model as [AFV11], but can handle high-weight linear transformations directly, without bit decomposition, thereby obtaining shorter ciphertexts and public-keys. A completely different approach to building circuit ABE was presented by Garg, Gentry, Sahai, and Waters [GGSW13] who showed that a general primitive they named witness encryption implies circuit ABE when combined with witness indistinguishable proofs.

2 Preliminaries

For a random variable X we denote by x ← X the process of sampling a value x according to the distribution of X. Similarly, for a finite set S we denote by x ← S the process of sampling a value x according to the uniform distribution over S. A non-negative function ν(λ) is negligible if for every polynomial p(λ) it holds that ν(λ) ≤ 1/p(λ) for all sufficiently large λ ∈ N. The statistical distance between two random variables X and Y over a finite domain Ω is defined as 1 X SD(X,Y ) = | Pr[X = ω] − Pr[Y = ω] |. 2 ω∈Ω

Two random variables X and Y are δ-close if SD(X,Y ) ≤ δ. Two distribution ensembles {Xλ}λ∈N and {Yλ}λ∈N are statistically indistinguishable if it holds that SD(Xλ,Yλ) is negligible in λ. Such random variables are computationally indistinguishable if for every probabilistic polynomial-time algorithm A it holds that

h λ i h λ i Pr A(1 , x) = 1 − Pr A(1 , y) = 1 x←Xλ y←Yλ is negligible in λ.

7 2.1 Attribute-Based Encryption

An attribute-based encryption (ABE) scheme for a class of functions Fλ = {f : Xλ → Yλ} is a quadruple Π = (Setup, Keygen, Enc, Dec) of probabilistic polynomial-time algorithms. Setup takes a unary representation of the security parameter λ and outputs public parameters mpk and a master secret key msk; Keygen(msk, f ∈ Fλ) output a decryption key skf ; Enc(mpk, x ∈ Xλ, µ) outputs a ciphertext c, the encryption of message µ labeled with attribute vector x; Dec(skf , c) outputs a message µ or the special symbol ⊥. (When clear from the context, we drop the subscript λ from Xλ, Yλ and Fλ.)

Correctness. We require that for every circuit f ∈ F, attribute vector x ∈ X where f(x) = 0, and message µ, it holds that Dec(skf , c) = µ with an overwhelming probability over the choice of (mpk, msk) ← Setup(λ), c ← Enc(mpk, x, µ), and skf ← Keygen(msk, f).

Security. For the most part, we consider the standard notion of selective security for ABE schemes [GPSW06]. Specifically, we consider adversaries that first announce a challenge attribute vector x∗, and then receive the public parameters mpk of the scheme and oracle access to a key- ∗ ∗ generation oracle KG(msk, x , f) that returns the secret key skf for f ∈ F if f(x ) 6= 0 and returns ⊥ otherwise. We require that any such efficient adversary has only a negligible probability in distin- guishing between the ciphertexts of two different messages encrypted under the challenge attribute x∗. Formally, security is captured by the following definition. Definition 2.1 (Selectively-secure ABE). An ABE scheme Π = (Setup, Keygen, Enc, Dec) for a class of functions Fλ = {f : Xλ → Yλ} is selectively secure if for all probabilistic polynomial-time adversaries A where A = (A1, A2, A3), there is a negligible function ν(λ) such that h i h i AdvselABE(λ) def= Pr EXP(0) (λ) = 1 − Pr EXP(1) (λ) = 1 ≤ ν(λ), Π,A ABE,Π,A ABE,Π,A (b) where for each b ∈ {0, 1} and λ ∈ N the experiment EXPABE,Π,A(λ) is defined as follows: ∗ ∗ ∗ 1.( x , state1) ← A1(λ), where x ∈ Xλ // A commits to challenge index x 2.( mpk, msk) ← Setup(λ)

KG(msk,x∗,·) 3.( µ0, µ1, state2) ← A2 (mpk, state1) // A outputs messages µ0, µ1 ∗ ∗ 4. c ← Enc(mpk, x , µb)

∗ 0 KG(msk,x ,·) ∗ 0 5. b ← A3 (c , state2) // A outputs a guess b for b 6. Output b0 ∈ {0, 1} ∗ ∗ where KG(msk, x , f) returns a secret key skf = Keygen(msk, f) if f(x ) 6= 0 and ⊥ otherwise. A fully secure ABE scheme is defined similarly, except that the adversary can choose the chal- lenge attribute x∗ after seeing the master public key and making polynomially many secret key queries. The following lemma, attributed to [BB11], says that any selectively secure ABE scheme is also fully secure with an exponential loss in parameters. Lemma 2.2. For any selectively secure ABE scheme with attribute vectors of length ` = `(λ), there fullABE `(λ) is a negligible function ν(λ) such that AdvΠ,A (λ) ≤ 2 · ν(λ).

8 2.2 Background on Lattices n×m ⊥ Lattices. Let q, n, m be positive integers. For a matrix A ∈ Zq we let Λq (A) denote the m n u lattice {x ∈ Z : Ax = 0 in Zq}. More generally, for u ∈ Zq we let Λq (A) denote the coset m {x ∈ Z : Ax = u in Zq}. m×m We note the following elementary fact: if the columns of TA ∈ Z are a basis of the lattice ⊥ ⊥ Λq (A), then they are also a basis for the lattice Λq (xA) for any nonzero x ∈ Zq.

Learning with errors (LWE) [Reg05]. Fix integers n, m, a prime integer q and a noise dis- tribution χ over Z. The (n, m, q, χ)-LWE problem is to distinguish the following two distributions:

(A, ATs + e) and (A, u)

n×m n m m where A ← Zq , s ← Zq , e ← χ , u ← Zq are independently sampled. Throughout the paper we always set m = Θ(n log q) and simply refer to the (n, q, χ)-LWE problem. We say that a noise distribution χ is B-bounded if its support is in [−B,B]. For any fixed d > 0 and sufficiently large q, Regev [Reg05] (through a quantum reduction) and Peikert [Pei09] (through a classical reduction) show that taking χ as a certain q/nd-bounded distribution, the (n, q, χ)-LWE problem is as hard as approximating the worst-case GapSVP to nO(d) factors, which is believed to be intractable. More generally, let χmax < q be the bound on the noise distribution. The difficulty of the LWE problem is measured by the ratio q/χmax. This ratio is always bigger than 1 and the n smaller it is the harder the problem. The problem appears to remain hard even when q/χmax < 2 for some fixed  ∈ (0, 1/2).

k×m ˜ Matrix norms. For a vector u we let kuk denote its `2 norm. For a matrix R ∈ Z , let R be the result of applying Gram-Schmidt (GS) orthogonalization to the columns of R. We define three matrix norms:

•k Rk denotes the `2 length of the longest column of R. ˜ ˜ •k RkGS = kRk where R is the GS orthogonalization of R.

•k Rk2 is the operator norm of R defined as kRk2 = supkxk=1 kRxk. √ Note that kRkGS ≤ kRk ≤ kRk2 ≤ kkRk and that kR · Sk2 ≤ kRk2 · kSk2.

We will use the following algorithm, throughout our paper:

n×m BD(A) −→ R where m = ndlog qe: a deterministic algorithm that takes in a matrix A ∈ Zq m×m and outputs a matrix R ∈ Zq , where each element a ∈ Zq that belongs to the matrix A dlog qe T gets transformed into a column vector r ∈ Zq , r = [a0, ..., adlog qe−1] . Here ai is the i-th bit of the binary decomposition of a ordered from LSB to MSB.

n×m T Claim 2.3. For any matrix A ∈ Zq , matrix R = BD(A) has the norm kRk2 ≤ m and kR k2 ≤ m.

9 Trapdoor generators. The following lemma states properties of algorithms for generating short basis of lattices.

Lemma 2.4. Let n, m, q > 0 be integers with q prime. There are polynomial time algorithms with the properties below:

n m • TrapGen(1 , 1 , q) −→ (A, TA) ([Ajt99, AP09, MP12]): a randomized algorithm that, when n×m m×m ⊥ m = Θ(n log q), outputs a full-rank matrix A ∈ Zq √ and basis TA ∈ Z for Λq (A) such that A is negl(n)-close to uniform and kTkGS = O( n log q), with all but negligible probability in n.

• ExtendRight(A, TA, B) −→ T(A|B) ([CHKP10]): a deterministic algorithm that given full- n×m ⊥ ⊥ rank matrices A, B ∈ Zq and a basis TA of Λq (A) outputs a basis T(A|B) of Λq (A|B) such that kTAkGS = kT(A|B)kGS.

• ExtendLeft(A, G, TG, S) −→ TH where H = (A | G + AS) ([ABB10]): a deterministic n×m ⊥ algorithm that given full-rank matrices A, G ∈ Zq and a basis TG of Λq (G) outputs a ⊥ basis TH of Λq (H) such that kTHkGS ≤ kTGkGS · (1 + kSk2). • For m = ndlog qe there is a fixed full-rank matrix G ∈ n×m s.t. the lattice Λ⊥(G) has a √ Zq q m×m publicly known basis TG ∈ Z with kTGkGS ≤ 5. The matrix G is such that for any n×m matrix A ∈ Zq , G · BD(A) = A. To simplify the notation we will always assume that the matrix G from part 4 of Lemma 2.4 has the same width m as the matrix A output by algorithm TrapGen from part 1 of the lemma. We do so without loss of generality since G can always be extended to the size of A by adding zero columns on the right of G.

u Discrete Gaussians. Regev [Reg05] defined a natural distribution on Λq (A) called a discrete Gaussian parameterized by a scalar σ > 0. We use D (Λu(A)) to denote this distribution. For a √ σ q random matrix A ∈ n×m and σ = Ω(˜ n), a vector x sampled from D (Λu(A)) has ` norm less √ Zq σ q 2 than σ m with probability at least 1 − negl(m). n×k U m×k For a matrix U = (u1| · · · |uk) ∈ Zq we let Dσ(Λq (A)) be a distribution on matrices in Z ui where the i-th column is sampled from Dσ(Λq (A)) independently for i = 1, . . . , k. Clearly if R is U sampled from Dσ(Λq (A)) then AR = U in Zq.

n×m n×k m×k Lemma 2.5. For integers n, m, k, q, σ > 0, matrices A ∈ Zq and U ∈ Zq , if R ∈ Z is U m×m sampled from Dσ(Λq (A)) and S is sampled uniformly in {±1} then √ √ T √ kR k2 ≤ σ mk , kRk2 ≤ σ mk , kSk2 ≤ 20 m with overwhelming probability in m.

Proof. For the {±1} matrix S the lemma follows from Litvak√ et al. [LPRTJ05√ ] (Fact 2.4). For the T √ matrix R the lemma follow from the fact that kR k2 ≤ k · kRk < k(σ m).

10 m×k Solving AX = U. We review algorithms for finding a low-norm matrix X ∈ Z such that AX = U.

n×m m×m ⊥ n×k Lemma 2.6. Let A ∈ Zq and TA ∈ Z be a basis for Λq (A). Let U ∈ Zq . There are m×k polynomial time algorithms that output X ∈ Z satisfying AX = U with the properties below: • SampleD(A, T , U, σ) −→ X ([GPV08]): a randomized algorithm that, when σ = kT k · √ A A GS ω( log m), outputs a random sample X from a distribution that is statistically close to U Dσ(Λq (A)). 0 • RandBasis(A, TA, σ) −→ TA ([CHKP10]): a randomized algorithm that, when σ = kTAkGS · √ 0 ⊥ ω( log m), outputs a basis TA of Λq (A) sampled from a distribution that is statistically close ⊥ m 0 √ to (Dσ(Λq (A))) . Note that kTAkGS < σ m with all but negligible probability.

Randomness extraction. We conclude with a variant of the left-over hash lemma from [ABB10].

Lemma 2.7. Suppose that m > (n+1) log2 q +ω(log n) and that q > 2 is prime. Let S be an m×k matrix chosen uniformly in {1, −1}m×k mod q where k = k(n) is polynomial in n. Let A and B n×m n×k m be matrices chosen uniformly in Zq and Zq respectively. Then, for all vectors e in Zq , the distribution (A, AS, STe) is statistically close to the distribution (A, B, STe).

m Note that the lemma holds for every vector e in Zq , including low norm vectors.

Additional algorithms Throughout the paper we will use the following algorithms:

Lemma 2.8. • SampleRight(A, TA, B, U, σ) : a randomized algorithm that given full-rank ma- n×m n×m ⊥ √ trices A, B ∈ Zq , matrix U ∈ Zq , a basis TA of Λq (A) and σ = kTAkGS · ω( log m), 2m×m U outputs a random sample X ∈ Zq from a distribution that is statistically close to Dσ(Λq ((A|B))). This algorithm is the composition of two algorithms: ExtendRight(A, TA, B) −→ T(A|B) and SampleD((A|B), T(A|B), U, σ) −→ X. • SampleLeft(A, S, y, U, σ) : a randomized algorithm that given full-rank matrix A ∈ n×m, ma- √ Zq n×m √ trices S, U ∈ Zq , y 6= 0 ∈ Zq and σ = 5·(1+kSk2)·ω( log m), outputs a random sample 2m×m U X ∈ Zq from a distribution that is statistically close to Dσ(Λq ((A|yG + AS))), where G is the matrix from Lemma 2.4, part 4. This algorithm is the composition of two algorithms: ExtendLeft(A, yG, TG, S) −→ T(A|yG+AS) and SampleD((A|yG+AS), T(A|yG+AS), U, σ) −→ X.

2.3 Multilinear Maps Assume there exists a group generator G that takes the security parameter 1λ and the pairing λ bound k and outputs groups G1,...,Gk each of large prime order q > 2 . Let gi be the generator of group Gi and let g = g1. In addition, the algorithm outputs a description of a set of bilinear maps: {eij : Gi × Gj → Gi+j | i, j ≥ 1, i + j ≤ k} a b ab satisfying eij(gi , gj ) = gi+j for all a, b ∈ Zq. We sometimes omit writing eij and for convince simply use e as the map descriptor.

11 Definition 2.9. [(k, `)-Multilinear Diffie-Hellman Exponent Assumption] The challenger runs G(1λ, k) to generate groups G1,...,Gk, generators g1, . . . , gk and the map descriptions eij. Next, it picks , , . . . , ck ∈ Zq at random. The (k, `)-MDHE problem is hard if no adversary can distinguish between the following two experiments with better than negligible advantage in λ:

`+2 `+1 Q ` 2` c 2≤i≤k ci c1 c1 c1 c1 c2 ck 1  g , . . . , g , . . . , g , . . . , g , g , . . . , g , β = gk and c c` c`+2 c2` c c g 1 , . . . , g 1 , . . . , g 1 , . . . , g 1 , g 2 , . . . , g k , β where β is a randomly chosen element in Gk. We note that if k = 2, then this corresponds exactly to the bilinear Diffie-Hellman Exponent `+1 Q c1 2≤i≤k−1 ci Assumption (BDHE). Also, is easy to compute gk by repeated pairing of the challenge components.

3 Fully Key-Homomorphic PKE (FKHE)

Our new ABE constructions are a direct application of fully key-homomorphic public-key encryption (FKHE), a notion that we introduce. Such systems are public-key encryption schemes that are homomorphic with respect to the public encryption key. We begin by precisely defining FKHE and then show that a key-policy ABE with short keys arises naturally from such a system.

Let {Xλ}λ∈N and {Yλ}λ∈N be sequences of finite sets. Let {Fλ}λ∈N be a sequence of sets of ` functions, namely Fλ = {f : Xλ → Yλ} for some ` > 0. Public keys in an FKHE scheme are pairs (x, f) ∈ Yλ × Fλ. We call x the “value” and f the associated function. All such pairs are valid ` public keys. We also allow tuples x ∈ Xλ to function as public keys. To simplify the notation we often drop the subscript λ and simply refer to sets X , Y and F. In our constructions we set X = Zq for some q and let F be the set of `-variate functions on Zq computable by polynomial size arithmetic circuits. Now, an FKHE scheme for the family of functions F consists of five PPT algorithms:

λ • SetupFKHE(1 ) → (mpkFKHE, mskFKHE) : outputs a master secret key mskFKHE and public pa-

rameters mpkFKHE.  • KeyGenFKHE mskFKHE, (y, f) → sky,f : outputs a decryption key for the public key (y, f) ∈ Y × F.

`  • EFKHE mpkFKHE, x ∈ X , µ −→ cx : encrypts message µ under the public key x. • Eval : a deterministic algorithm that implements key-homomorphism. Let c be an encryption of message µ under public key x ∈ X `. For a function f : X ` → Y ∈ F the algorithm does:  Eval f, x, c −→ cf

where if y = f(x1, . . . , x`) then cf is an encryption of message µ under public-key (y, f).

• DFKHE(sky,f , c) : decrypts a ciphertext c with key sky,f . If c is an encryption of µ under public key (x, g) then decryption succeeds only when x = y and f and g are identical arithmetic circuits.

12 Algorithm Eval captures the key-homomorphic property of the system: ciphertext c encrypted with  key x = (x1, . . . , x`) is transformed to a ciphertext cf encrypted under key f(x1, . . . , x`), f .

Correctness. The key-homomorphic property is stated formally in the following requirement: ` For all (mpkFKHE, mskFKHE) output by Setup, all messages µ, all f ∈ F, and x = (x1, . . . , x`) ∈ X :

`  If c ← EFKHE mpkFKHE, x ∈ X , µ , y = f(x1, . . . , x`),  cf = Eval f, x, c , sk ← KeyGenFKHE(mskFKHE, (y, f))

Then DFKHE(sk, cf ) = µ.

An ABE from a FKHE. A FKHE for a family of functions F = {f : X ` → Y} immediately gives a key-policy ABE. Attribute vectors for the ABE are `-tuples over X and the supported key-policies are functions in F. The ABE system works as follows:

λ λ • Setup(1 , `) : Run SetupFKHE(1 ) to get public parameters mpk and master secret msk. These function as the ABE public parameters and master secret.  • Keygen(msk, f) : Output skf ← KeyGenFKHE mskFKHE, (0, f) . Jumping ahead, we remark that in our FKHE instantiation (in Section4), the number of bits needed to encode the function f in skf depends only on the depth of the circuit computing f, not its size. Therefore, the size of skf depends only on the depth complexity of f.

`  • Enc(mpk, x ∈ X , µ) : output (x, c) where c ← EFKHE(mpkFKHE, x, µ .   • Dec skf , (x, c) : if f(x) = 0 set cf = Eval f, x, c and output the decrypted answer DFKHE(skf , cf ). Note that cf is the encryption of the plaintext under the public key (f(x), f). Since skf is the decryption key for the public key (0, f), decryption will succeed whenever f(x) = 0 as required.

The security of FKHE systems. Security for a fully key-homomorphic encryption system is defined so as to make the ABE system above secure. More precisely, we define security as follows.

Definition 3.1 (Selectively-secure FKHE). A fully key homomorphic encryption scheme Π = `(λ) (SetupFKHE, KeyGenFKHE, EFKHE, Eval) for a class of functions Fλ = {f : Xλ → Yλ} is selectively secure if for all p.p.t. adversaries A where A = (A1, A2, A3), there is a negligible function ν(λ) such that h i h i AdvFKHE(λ) def= Pr EXP(0) (λ) = 1 − Pr EXP(1) (λ) = 1 ≤ ν(λ), Π,A FKHE,Π,A FKHE,Π,A

(b) where for each b ∈ {0, 1} and λ ∈ N the experiment EXPFKHE,Π,A(λ) is defined as:

∗ `(λ)  1. x ∈ Xλ , state1 ← A1(λ)

2.( mpkFKHE, mskFKHE) ← SetupFKHE(λ)

∗ KGKH(mskFKHE,x ,·,·) 3.( µ0, µ1, state2) ← A2 (mpkFKHE, state1)

13 ∗ ∗ 4. c ← EFKHE(mpkFKHE, x , µb)

∗ 0 KGKH(mskFKHE,x ,·,·) ∗ 0 5. b ← A3 (c , state2) // A outputs a guess b for b 6. output b0 ∈ {0, 1}

∗ where KGKH(mskFKHE, x , y, f) is an oracle that on input f ∈ F and y ∈ Yλ, returns ⊥ whenever ∗  f(x ) = y, and otherwise returns KeyGenFKHE mskFKHE, (y, f) . With Definition 3.1 the following theorem is now immediate. Theorem 3.2. The ABE system above is selectively secure provided the underlying FKHE is se- lectively secure.

4 An ABE and FKHE for arithmetic circuits from LWE

We now turn to building an FKHE for arithmetic circuits from the learning with errors (LWE) problem. This directly gives an ABE with short private keys as explained in Section3. Our construction follows the key-homomorphism paradigm outlined in the introduction. n×m For integers n and q = q(n) let m = Θ(n log q). Let G ∈ Zq be the fixed matrix from n×m n Lemma 2.4 (part 4). For x ∈ Zq, B ∈ Zq , s ∈ Zq , and δ > 0 define the set

 T m Es,δ(x, B) = (xG + B) s + e ∈ Zq where kek < δ

For now we will assume the existence of three efficient deterministic algorithms Evalpk, Evalct, Evalsim that implement the key-homomorphic features of the scheme and are at the heart of the construc- tion. We present them in the next section. These three algorithms must satisfy the following prop- ` erties with respect to some family of functions F = {f :(Zq) → Zq} and a function αF : Z → Z. ~ n×m ` n×m • Evalpk( f ∈ F, B ∈ (Zq ) ) −→ Bf ∈ Zq .

` m n×m • Evalct( f ∈ F, (xi, Bi, ci) i=1 ) −→ cf ∈ Zq . Here xi ∈ Zq, Bi ∈ Zq and n ci ∈ Es,δ(xi, Bi) for some s ∈ Zq and δ > 0. Note that the same s is used for all ci. The output cf must satisfy

cf ∈ Es,∆(f(x), Bf ) where Bf = Evalpk(f, (B1,..., B`))

and x = (x1, . . . , x`). We further require that ∆ < δ · αF (n) for some function αF (n) that measures the increase in the noise magnitude in cf compared to the input ciphertexts. This algorithm captures the key-homomorphic property: it translates ciphertexts encrypted ` under public-keys {xi}i=1 into a ciphertext cf encrypted under public-key (f(x), f).

∗ ` m×m ∗ m×m • Evalsim( f ∈ F, (xi , Si) i=1, A) −→ Sf ∈ Zq . Here xi ∈ Zq and Si ∈ Zq . With ∗ ∗ ∗ x = (x1, . . . , xn), the output Sf satisfies ∗ ∗ ∗  ASf − f(x )G = Bf where Bf = Evalpk f, (AS1 − x1G,..., AS` − x` G) .

m×m We further require that for all f ∈ F, if ,..., S` are random matrices in {±1} then

kSf k2 < αF (n) with all but negligible probability.

14 Definition 4.1. The deterministic algorithms (Evalpk, Evalct, Evalsim) are αF -FKHE enabling for ` some family of functions F = {f :(Zq) → Zq} if there are functions q = q(n) and αF = αF (n) for which the properties above are satisfied.

We want αF -FKHE enabling algorithms for a large function family F and the smallest possible

αF . In the next section we build these algorithms for polynomial-size arithmetic circuits. The function αF (n) will depend on the depth of circuits in the family.

The FKHE system. Given FKHE-enabling algorithms (Evalpk, Evalct, Evalsim) for a family of ` functions F = {f :(Zq) → Zq} we build an FKHE for the same family of functions F. We prove selective security based on the learning with errors problem.

• Parameters : Choose n and q = q(n) as needed for (Evalpk, Evalct, Evalsim) to be αF -FKHE

enabling for the function family F. In addition, let χ be a χmax-bounded noise distribution for which the (n, q, χ)-LWE problem is hard as discussed in Appendix 2.2. As usual, we set m = Θ(n log q). √ Set σ = ω(αF · log m). We instantiate these parameters concretely in the next section. 2 1 √ For correctness of the scheme we require that αF · m < 12 · (q/χmax) and αF > n log m . λ n m • SetupFKHE(1 ) → (mpkFKHE, mskFKHE) : Run algorithm TrapGen(1 , 1 , q) from Lemma 2.4 n×m (part 1) to generate (A, TA) where A is a uniform full-rank matrix in Zq . n×m Choose random matrices D, B1,..., B` ∈ Zq and output a master secret key mskFKHE and

public parameters mpkFKHE:

mpkFKHE = (A, D, B1,..., B`); mskFKHE = (TA)

 • KeyGenFKHE mskFKHE, (y, f) → sky,f : Let Bf = Evalpk(f, (B1,..., B`)). 2m×m Output sky,f := Rf where Rf is a low-norm matrix in Z sampled from the discrete D Gaussian distribution Dσ(Λq (A|yG + Bf )) so that (A|yG + Bf ) · Rf = D. To construct Rf run algorithm SampleRight(A, TA, yG + Bf , D, σ) from Lemma√ 2.8, part 1. Here σ is sufficiently large for algorithm SampleRight since σ = kT k · ω( log m), where √ A GS kTAkGS = O( n log q). 2m×m Note that the secret key sky,f is always in Z independent of the complexity of the

function f. We assume sky,f also implicitly includes mpkFKHE.

`  n • EFKHE mpkFKHE, x ∈ X , µ −→ cx : Choose a random n dimensional vector s ← Zq and m m×m error vectors e0, e1 ← χ . Choose ` uniformly random matrices Si ← {±1} for i ∈ [`]. n×(`+1)m (`+1)m Set H ∈ Zq and e ∈ Zq as

n×(`+1)m H = (A | x1G + B1 | · · · | x`G + B`) ∈ Zq T (`+1)m e = (Im|S1| ... |S`) · e0 ∈ Zq

T T (`+2)m Let cx = (H s + e, D s + e1 + dq/2eµ) ∈ Zq . Output the ciphertext cx.

15 • DFKHE(sky,f , c) : Let c be the encryption of µ under public key (x, g). If x 6= y or f and g are not identical arithmetic circuits, output ⊥. Otherwise, let c = (cin, c1,..., c`, cout) ∈ (`+2)m Zq . `  m Set cf = Evalct f, {(xi, Bi, ci)}i=1 ∈ Zq . 0 2m T 0 m Let cf = (cin|cf ) ∈ Zq and output Round(cout − Rf cf ) ∈ {0, 1} .

This completes the description of the system.

Correctness. The correctness of the scheme follows from our choice of parameters and, in par- 2 1 ticular, from the requirement αF · m < 12 · (q/χmax). Specifically, to show correctness, first note that when f(x) = y we know by the requirement on Evalct that cf is in Es,∆(y, Bf ) so that T cf = yG + Bf s + e with kek < ∆. Consequently,

0 T 0 0 cf = (cin|cf ) = (A|yG + Bf ) s + e where ke k < ∆ + χmax < (αF + 1)χmax .

2m×m D Since Rf ∈ Z is sampled from the distribution Dσ(Λq (A|yG + Bf )) we know that (A|yG + T Bf ) · Rf = D and, by Lemma 2.5, kRf k2 < 2mσ with overwhelming probability. Therefore

T 0 T T T 0 T 0 cout − Rf cf = (D s + e1) − (D s + Rf e ) = e1 − Rf e

T 0 2 and ke1 − Rf e k ≤ χmax + 2mσ · (αF + 1)χmax ≤ 3αF · χmax · m with overwhelming probability. By the bounds on αF this quantity is less than q/4 thereby ensuring correct decryption of all bits of µ ∈ {0, 1}m.

Security. Next we prove that our FKHE is selectively secure for the family of functions F for which algorithms (Evalpk, Evalct, Evalsim) are FKHE-enabling.

Theorem 4.2. Given the three algorithms (Evalpk, Evalct, Evalsim) for the family of functions F, the FKHE system above is selectively secure with respect to F, assuming the (n, q, χ)-LWE assumption holds where n, q, χ are the parameters for the FKHE.

Proof idea. Before giving the complete proof we first briefly sketch the main proof idea which hinges on the properties of algorithms (Evalpk, Evalct, Evalsim) and also employs ideas from [CHKP10, ABB10]. We build an LWE algorithm B that uses a selective FKHE attacker A to solve LWE. B n×2m m is given an LWE challenge matrix (A|D) ∈ Zq and two vectors cin, cout ∈ Zq that are either random or their concatenation equals (A|D)Ts + e for some small noise vector e. ∗ ∗ ` A starts by committing to the target attribute vector x = (x1, . . . , x` ) ∈ Zq. In response B ∗ ∗ m×m constructs the FKHE public parameters by choosing random matrices S1,..., S` in {±1} and ∗ ∗ setting Bi = ASi − xi G. It gives A the public parameters mpkFKHE = (A, D, B1,..., B`). A ∗ n×m standard argument shows that each of ASi is uniformly distributed in Zq so that all Bi are uniform as required for the public parameters. Now, consider a private key query from A for a function f ∈ F and attribute y ∈ Zq. ∗ ∗ ∗ Only functions f and attributes y for which y = f(x1, . . . , x` ) 6= y are allowed. Let Bf =  2m×m Evalpk f, (B1,..., B`) . Then B needs to produce a matrix Rf in Z satisfying (A|Bf )·Rf =

16 ⊥ D. To do so B needs a recoding matrix from the lattice Λq (F) where F = (A|Bf ) to the lattice ⊥ ⊥ Λq (D). In the real key generation algorithm this short basis is derived from a short basis for Λq (A) ⊥ using algorithm SampleRight. Unfortunately, B has no short basis for Λq (A). m×m ∗ Instead, as explained below, B builds a low-norm matrix Sf ∈ Zq such that Bf = ASf −y G. ∗ Because y 6= y, algorithm B can construct the required key as Rf ← SampleLeft(A, Sf , (y − y∗), D, σ). m×m The remaining question is how does algorithm B build a low-norm matrix Sf ∈ Zq such ∗ ∗ that Bf = ASf − y G. To do so B uses Evalsim giving it the secret matrices Si . More precisely, B ∗ ∗ ` runs Evalsim(f, (xi , Si ) i=1, A) and obtains the required Sf . This lets B answer all private key queries. To complete the proof it is not difficult to show that B can build a challenge ciphertext c∗ ` for the attribute vector x ∈ Zq that lets it solve the given LWE instance using adversary A. An important point is that B cannot construct a key that decrypts c∗. The reason is that it cannot ∗ build a secret key sky,f for functions where f(x ) = y and these are the only keys that will decrypt c∗.

Proof of Theorem 4.2. The proof proceeds in a sequence of games where the first game is iden- tical to the ABE game from Definition 2.1. In the last game in the sequence the adversary has advantage zero. We show that a PPT adversary cannot distinguish between the games which will prove that the adversary has negligible advantage in winning the original ABE security game. The LWE problem is used in proving that Games 2 and 3 are indistinguishable. Game 0. This is the original ABE security game from Definition 2.1 between an attacker A against our scheme and an ABE challenger. Game 1. Recall that in Game 0 part of the public parameters mpk are generated by choosing n×m random matrices B1,..., B` in Zq . At the challenge phase (step 4 in Definition 2.1) a challenge ∗ ∗ ∗ m×m ciphertext c is generated. We let S1,..., S` ∈ {−1, 1} denote the random matrices generated for the creation of c∗ in the encryption algorithm Enc. In Game 1 we slightly change how the matrices B1,..., B` are generated for the public param- ∗ ∗ ∗ ` eters. Let x = (x1, . . . , x` ) ∈ Zq be the target point that A intends to attack. In Game 1 the ∗ ∗ m×m random matrices S1,..., S` in {±1} are chosen at the setup phase (step 2) and the matrices B1,..., B` are constructed as ∗ ∗ Bi := ASi − xi G (2) The remainder of the game is unchanged. We show that Game 0 is statistically indistinguishable from Game 1 by Lemma 2.7. Observe ∗ that in Game 1 the matrices Si are used only in the construction of Bi and in the construction of the ∗ ∗ T m challenge ciphertext where e := (Im|S1| · · · |S` ) · e0 is used as the noise vector for some e0 ∈ Zq . ∗ ∗ ∗ ∗ Let S = (S1| · · · |S` ), then by Lemma 2.7 the distribution (A, AS , e) is statistically close to the 0 0 n×`m distribution (A, A , e) where A is a uniform matrix in Zq . It follows that in the adversary’s ∗ view, all the matrices ASi are statistically close to uniform and therefore the Bi as defined in (2) are close to uniform. Hence, the Bi in Games 0 and 1 are statistically indistinguishable. Game 2. We now change how A in mpk is chosen. In Game 2 we generate A as a random matrix n×m ∗ ∗ in Zq . The construction of B1,..., B` remains as in Game 1, namely Bi = ASi − xi G. The key generation oracle responds to private key queries (in steps 3 and 5 of Definition 2.1) using the trapdoor TG. Consider a private key query for function f ∈ F and element y ∈ Y. Only

17 ∗ ∗ ∗ f such that y = f(x1, . . . , x` ) 6= y are allowed. To respond, the key generation oracle computes  2m×m Bf = Evalpk f, (B1,..., B`) and needs to produce a matrix Rf in Z satisfying

(A|yG + Bf ) · Rf = D in Zq .

To do so the key generation oracle does:

∗ ∗ ` m×m • It runs Sf ← Evalsim(f, (xi , Si ) i=1, A) and obtains a low-norm matrix Sf ∈ Zq such ∗ that ASf − y G = Bf . By definition of Evalsim we know that kSf k2 ≤ αF .

• Finally, it responds with Rf = SampleLeft(A, Sf , y, D, σ). By definition of SampleLeft√ we know that R is distributed as required. Indeed because kS k ≤ α (n), σ = 5 · (1 + √ f f 2 F kSf k2) · ω( log m) as needed for algorithm SampleLeft in Lemma 2.8, part 2. Game 2 is otherwise the same as Game 1. Since the public parameters and responses to private key queries are statistically close to those in Game 1, the adversary’s advantage in Game 2 is at most negligibly different from its advantage in Game 1. Game 3. Game 3 is identical to Game 2 except that in the challenge ciphertext (x∗, c∗) the vector ∗ (`+2)m (`+2)m c = (cin|c1| · · · |c`|cout) ∈ Zq is chosen as a random independent vector in Zq . Since the challenge ciphertext is always a fresh random element in the ciphertext space, A’s advantage in this game is zero. It remains to show that Game 2 and Game 3 are computationally indistinguishable for a PPT adversary, which we do by giving a reduction from the LWE problem. Reduction from LWE. Suppose A has non-negligible advantage in distinguishing Games 2 and 3. We use A to construct an LWE algorithm B.

LWE Instance. B begins by obtaining an LWE challenge consisting of two random matrices A, D n×m m m in Zq and two vectors cin, cout in Zq . We know that cin, cout are either random in Zq or

T T cin = A s + e0 and cout = D s + e1 (3)

n m for some random vector s ∈ Zq and e0, e1 ← χ . Algorithm B’s goal is to distinguish these two cases with non-negligible advantage by using A.

∗ ∗ m Public parameters. A begins by committing to a target point x = (x1, . . . , x` ) ∈ Zq where it wishes to be challenged. B assembles the public parameters mpk as in Game 2: choose ∗ ∗ m×m ∗ ∗ random matrices S1,..., S` in {±1} and set Bi = ASi − xi G. It gives A the public parameters mpk = (A, D, B1,..., B`)

Private key queries. B answers A’s private-key queries (in steps 3 and 5 of Definition 2.1) as in Game 2.

m Challenge ciphertext. When B receives two messages µ0, µ1 ∈ {0, 1} from A, it prepares a challenge ciphertext by choosing a random b ← {0, 1} and computing

∗ ∗ ∗ T (`+1)m c0 = (Im|S1| ... |S` ) · cin ∈ Zq (4)

18 ∗ ∗ (`+2)m ∗ ∗ and c = (c0, cout + dq/2eµb) ∈ Zq . B sends (x , c ) as the challenge ciphertext to A. We argue that when the LWE challenge is pseudorandom (namely (3) holds) then c∗ is ∗ distributed exactly as in Game 2. First, observe that when encrypting (x , µb) the matrix H constructed in the encryption algorithm Enc is

∗ ∗ H = (A | x1G + B1 | · · · | x` G + B`) ∗ ∗ ∗ ∗ ∗ ∗  ∗ ∗ = A | x1G + (AS1 − x1G) | · · · | x` G + (AS` − x` G) = (A | AS1 | · · · | AS` )

∗ Therefore, c0 defined in (4) satisfies:

∗ ∗ ∗ T T c0 = (Im|S1| ... |S` ) · (A s + e0) ∗ ∗ T ∗ ∗ T T = (A|AS1 | · · · | AS` ) · s + (Im|S1| · · · |S` ) · e0 = H s + e

∗ ∗ T where e = (Im|S1| · · · |S` ) · e0. This e is sampled from the same distribution as the noise ∗ vector e in algorithm Enc. We therefore conclude that c0 is computed as in Game 2. Moreover, T ∗ since cout = D s + e1 we know that the entire challenge ciphertext c is a valid encryption ∗ of (x , µb) as required. m When the LWE challenge is random we know that cin and cout are uniform in Zq . Therefore ∗ (`+1)m the public parameters and c0 defined in (4) are uniform and independent in Zq by a standard application of the left over hash lemma (e.g. Theorem 8.38 of [Sho08]) where the T T universal hash function is defined as multiplication by the random matrix (A |cin) . Since (`+2)m cout is also uniform, the challenge ciphertext overall is uniform in Zq , as in Game 3. Guess. Finally, A guesses if it is interacting with a Game 2 or Game 3 challenger. B outputs A’s guess as the answer to the LWE challenge it is trying to solve.

We already argued that when the LWE challenge is pseudorandom the adversary’s view is as in Game 2. When the LWE challenge is random the adversary’s view is as in Game 3. Hence, B’s advantage in solving LWE is the same as A’s advantage in distinguishing Games 2 and 3, as required. This completes the description of algorithm B and completes the proof.

Remark 4.3. We note that the matrix Rf in KeyGenFKHE can alternatively be generated using a sampling method from [MP12]. To do so we choose FKHE public parameters as we do in the m×m security proof by choosing random matrices Si,..., S` in {±1} and setting Bi = ASi. We ` then define the matrix Bf as Bf := ASf where Sf = Evalsim(f, ((0, Si))i=1, A). We could then build the secret key matrix sky,f = Rf satisfying (A|yG + Bf ) · Rf = D directly from the bit decomposition of D/y. Adding suitable low-norm noise to the result will ensure that sky,f is distributed as in the simulation in the security proof. Note that this approach can only be used to build secret keys sky,f when y 6= 0 where as the method in KeyGenFKHE works for all y.

4.1 Evaluation Algorithms for Arithmetic Circuits

In this section we build the FKHE-enabling algorithms (Evalpk, Evalct, Evalsim) that are at the heart of the FKHE construction in Section4. We do so for the family of polynomial depth, unbounded fan-in arithmetic circuits.

19 4.2 Evaluation algorithms for gates We first describe Eval algorithms for single gates, i.e. when G is the set of functions that each takes k inputs and computes either weighted addition or multiplication:   g(x1, . . . , xk) = α1x1 + α2x2 + ... + αkxk [  k  G = g | g : Zq → Zq, or (5) α,α1,...,αk∈Zq  g(x1, . . . , xk) = α · x1 · x2 · ... · xk 

We assume that all the inputs to a multiplication gate (except possibly one input) are integers in the interval [−p, p] for some bound p < q. We present all three deterministic Eval algorithms at once: ~ n×m k n×m Evalpk(g ∈ G, B ∈ (Zq ) ) −→ Bg ∈ Zq k m Evalct(g ∈ G, (xi, Bi, ci) i=1 ) −→ cg ∈ Zq ∗ k m×m Evalsim(g ∈ G, (xi , Si) i=1, A) −→ Sg ∈ Zq

• For a weighted addition gate g(x1, . . . , xk) = α1x1 + ··· + αkxk do: m×m For i ∈ [k] generate matrix Ri ∈ Zq such that

GRi = αiG : Ri = BD(αiG) (as in Lemma 2.4 part 4). (6)

Output the following matrices and the ciphertext:

k k k X X X T Bg = BiRi, Sg = SiRi, cg = Ri ci (7) i=1 i=1 i=1

• For a weighted multiplication gate g(x1, . . . , xk) = αx1 · ... · xk do: m×m For i ∈ [k] generate matrices Ri ∈ Zq such that

GR1 = αG : R1 = BD(αG) (8)

GRi = −Bi−1Ri−1 : Ri = BD(−Bi−1Ri−1) for all i ∈ {2, 3, . . . , k} (9)

Output the following matrices and the ciphertext:

k  k  k  k  X Y ∗ X Y T Bg = BkRk, Sg =  xi  SjRj, cg =  xi Rj cj (10) j=1 i=j+1 j=1 i=j+1

∗ ∗ T T For example, for k = 2, Bg = B2R2, Sg = x2S1R1 + S2R2, cg = x2R1 c1 + R2 c2.

For multiplication gates, the reason we need an upper bound p on all but one of the inputs xi is that these xi values are used in (10) and we need the norm of Sg and the norm of the noise in the ciphertext cg to be bounded from above. The next two lemmas show that these algorithms satisfy the required properties to be FKHE-enabling.

Lemma 4.4. Let βg(m) = km. For a weighted addition gate g(x) = α1x1 + ... + αkxk we have:

20 n 1. If ci ∈ Es,δ(xi, Bi) for some s ∈ Zq and δ > 0, then cg ∈ Es,∆(g(x), Bg) where ∆ ≤ βg(m)·δ and Bg = Evalpk(g, (B1,..., Bk)).

∗ 2. The output Sg satisfies ASg − g(x )G = Bg where kSgk2 ≤ βg(m) · maxi∈[k] kSik2 ∗ ∗  and Bg = Evalpk g, (AS1 − x1G,..., ASk − xkG) . Proof. By Eq.7 the output ciphertext is computed as follows:

k k X T X T  T  T cg = Ri · ci = Ri · (xiG + Bi) s + ei = // substitute for ci = (xiG + Bi) s + ei i=1 i=1 k k k X T X T X T = (xiGRi) s + (BiRi) s + (Ri ei) = // break the product into components i=1 i=1 i=1 k ! k X T T X = αixi G s + Bg s + eg = // GRi = αiRi from Eq.6 and Bg = BiRi from Eq.7 i=1 i=1 T = [g(x)G + Bg] s + eg

Lemma 2.4,part 4 T T  T  The noise bound is: kegk = kR1 e1+···+Rk ekk ≤ k·maxj∈[k] kRj k2 · kejk ≤ km·δ. This completes the proof of the first part of the lemma.

In the second part of the lemma, by Eq.7 the output matrix Bg is computed as follows:

k X ∗ Bg = (ASi − xi G)Ri = // plug-in matrices given in the lemma into Eq.7 i=1 k k X X ∗ ∗ =A SiRi − αixi G = ASg − g(x )G // GRi = αiRi from Eq.6 i=1 i=1

Lemma 2.4,part 4 Pk Then kSgk2 = k i=1 SiRik2 ≤ k · maxi∈[k] (kSik2 · kRik2) ≤ km · maxi∈[k] (kSik2) as required.

The next Lemma proves similar bounds for a multiplication gate. Qk Lemma 4.5. For a multiplication gate g(x) = α i=1 xi we have the same bounds on cg and Sg pk−1 as in Lemma 4.4 with βg(m) = p−1 m.

21 Pk Qk  T Proof. Set eg = j=1 i=j+1 xi Rj ej. Then the output ciphertext is computed as follows:

k  k  k  k  X Y T X Y T  T  cg =  xi Rj cj =  xi Rj (xjG + Bj) s + ej = // substitute for cj j=1 i=j+1 j=1 i=j+1 T  k ! k  k   Y X Y ((( (((( =  xi GR1 +  xi (GR((j + Bj−1Rj−1) + BkRk s + eg = // regroup i=1 j=2 i=j

" k ! #T Y = xi GR1 + BkRk s + eg = // use Eq.9 to cancel terms i=1 T = [g(x)G + Bg] s + eg // use the facts GR1 = αG (Eq.8), Bg = BkRk (Eq. 10)

The bound on the noise kegk is:

k  k  Lemma. 2.3 k X Y T  k−1  T  p − 1 kegk =  xi Rj ej ≤ 1 + p + ... + p · max kRj k2 · kejk ≤ m · δ j∈[k] p − 1 j=1 i=j+1 This completes the first part of the lemma. In the second part of the lemma, the output matrix Bg is computed as follows:

Eq. 9 Bg =(ASk − xkG)Rk = // by (9) we have GRk = −(ASk−1 − xk−1G)Rk−1 Eq. 9 Eq. 9 = (ASkRk + xkASk−1Rk−1 − xk · xk−1GRk−1) = ... = Eq. 8 = (ASkRk + xkASk−1Rk−1 + xk · xk−1ASk−2Rk−2 + ... + (−x1 ··· xkGR1)) =

= (ASg − αx1 ··· xkG) = (ASg − g(x)G)

Moreover, the bound on the norm of Sg is:   k k X Y kSgk2 =  xi SjRj

j=1 i=j+1 2 Lemma. 2.3 k  k−1 p − 1 ≤ 1 + p + ... + p max (kSik2 · kRik2) ≤ m · max (kSik2) i∈[k] p − 1 i∈[k] as required.

4.3 Evaluation algorithms for circuits We will now show how using the algorithms for single gates, that compute weighted additions and multiplications as described above, to build algorithms for the depth d, unbounded fan-in circuits.

Let {Cλ}λ∈N be a family of polynomial-size arithmetic circuits. For each C ∈ Cλ we index the wires of C following the notation in [GVW13]. The input wires are indexed 1 to `, the internal wires have indices ` + 1, ` + 2,..., |C| − 1 and the output wire has index |C|, which also denotes the kw size of the circuit. Every gate gw : Zq → Zq (in G as per5) is indexed as a tuple ( w1, . . . , wkw , w)

22 where kw is the fan-in of the gate. We assume that all (but possibly one) of the input values to the multiplication gates are bounded by p which is smaller than scheme modulus q. The “fan-out wires” in the circuit are given a single number. That is, if the outgoing wire of a gate feeds into the input of multiple gates, then all these wires are indexed the same. For some λ ∈ N, define the family of functions F = {f : f can be computed by some C ∈ Cλ}. Again we will describe the three Eval algorithms together, but it is easy to see that they can be separated.

~ n×m ` n×m Evalpk(f ∈ F, B ∈ (Zq ) ) −→ Bf ∈ Zq ` m Evalct(f ∈ F, (xi, Bi, ci) i=1 ) −→ cf ∈ Zq ∗ ` m×m Evalsim(f ∈ F, (xi , Si) i=1, A) −→ Sf ∈ Zq

Let f be computed by some circuit C ∈ Cλ, that has ` input wires. We construct the required matrices inductively input to output gate-by-gate. For all w ∈ [C] denote the value that wire w carries when circuit C is evaluated on x or x∗ to be ∗ xw or xw respectively. Consider an arbitrary gate of fan-in kw (we will omit the subscript w where k it is clear from the context): (w1, . . . , wk, w) that computes the function gw : Zq → Zq. Each wire wi caries a value xwi . Suppose we already computed Bw1 ,..., Bwk , Sw1 ,..., Swk and cw1 ,..., cwk , note that if w1, . . . , wk are all in {1, 2, . . . , `} then these matrices and vectors are the inputs of the corresponding Eval functions. Using Eval algorithms described in Section 4.2, compute

Bw = Evalpk(gw, (Bw1 ,..., Bwk )) k cw = Evalct(gw, (xwi , Bwi , cwi ) i=1) S = Eval (g , (x∗ , S )k , A) w sim w wi wi i=1

Output Bf := B|C|, cf := c|C|, Sf := S|C|. Next we show that these outputs satisfy the required properties. pk−1 n Lemma 4.6. Let β(m) = p−1 m. If ci ∈ Es,δ(xi, Bi) for some s ∈ Zq and δ > 0, then d cf ∈ Es,∆(f(x), Bf ) where ∆ < (β(m)) · δ and Bf = Evalpk(f, (B1,..., B`)).

Proof. By Lemma 4.4 and 4.5, after each level of the circuit the noise is multiplied by βgw (m), which is upperbounded by β(m) and the total number of levels is equal to the depth d of the circuit. The lemma follows.

m×m Lemma 4.7. Let β(m) be as defined in Lemma 4.6. If S1,..., S` are random matrices in {±1} , ∗ d √ then the output Sf satisfies ASf − f(x )G = Bf where kSf k2 ≤ (β(m)) · 20 m and ∗ ∗  Bf = Evalpk f, (AS1 − x1G,..., AS` − x` G) . Proof. Since the input S for i ∈ [`] are random matrices in {±1}m×m, by Lemma 2.5 for all i ∈ [`], √ i kSik2 < 20 m. By Lemma 4.4 and 4.5, after each level of the circuit the bound on S gets multiplied by at most β(m), therefore after d levels, which is the depth of the circuit, the bound on the output d √ matrix will be kSf k2 ≤ (β(m)) · 20 m. The lemma follows.

In summary, algorithms (Evalpk, Evalct, Evalsim) are αF -FKHE enabling for d √ k−1 d√  αF (n) = (β(m)) · 20 m = O (p m) m , where m = Θ(n log q). (11) This is sufficient for polynomial depth arithmetic circuits as discussed in the introduction.

23 4.4 ABE with Short Secret Keys for Arithmetic Circuits from LWE ` The FKHE for a family of functions F = {f :(Zq) → Zq} we constructed in Section4 immediately gives a key-policy ABE as discussed in Section3. For completeness we briefly describe the resulting ABE system. Given FKHE-enabling algorithms (Evalpk, Evalct, Evalsim) for a family of functions F from Sec- tion 4.1, the ABE system works as follows:

• Setup(1λ, `): Choose n, q, χ, m and σ as in “Parameters” in Section4. n m Run algorithm TrapGen(1 , 1 , q) (Lemma 2.4, part 1) to generate (A, TA). n×m Choose random matrices D, B1,..., B` ∈ Zq and output the keys:

mpk = (A, D, B1,..., B`); msk = (TA, D, B1,..., B`)

• Keygen(msk, f): Let Bf = Evalpk(f, (B1,..., B`)). 2m×m Output skf := Rf where Rf is a low-norm matrix in Z sampled from the discrete D Gaussian distribution Dσ(Λq (A|Bf )) so that (A|Bf ) · Rf = D.

To construct Rf run algorithm SampleRight(A, TA, yG + Bf , D, σ) from Lemma 2.8, part 1. 2m×m Note that the secret key skf is always in Z independent of the complexity of the func- tion f.

` m n • Enc(mpk, x ∈ Zq, µ ∈ {0, 1} ): Choose a random vector s ← Zq and error vectors e0, e1 ← m m×m χ . Choose ` uniformly random matrices Si ← {±1} for i ∈ [`]. Set

n×(`+1)m H = (A | x1G + B1 | · · · | x`G + B`) ∈ Zq T (`+1)m e = (Im|S1| ... |S`) · e0 ∈ Zq

T T (`+2)m Output c = (H s + e, D s + e1 + dq/2eµ) ∈ Zq .  • Dec skf , (x, c) : If f(x) 6= 0 output ⊥. Otherwise, let the ciphertext c = (cin, c1,..., c`, cout) ∈ (`+2)m `  m Zq , set cf = Evalct f, {(xi, Bi, ci)}i=1 ∈ Zq . 0 2m T 0 m Let cf = (cin|cf ) ∈ Zq and output Round(cout − Rf cf ) ∈ {0, 1} .

This completes the description of the system. The proof of the following security theorem follows from Theorems 4.2 and 3.2.

Theorem 4.8. For FKHE-enabling algorithms (Evalpk, Evalct, Evalsim) for the family of functions F, the ABE system above is correct and selectively-secure with respect to F, assuming the (n, q, χ)- LWE assumption holds where n, q, χ are the parameters for the FKHE-enabling algorithms.

5 Extensions

5.1 Key Delegation Our ABE easily extends to support full key delegation. We first sketch the main idea for adding key delegation and then describe the resulting ABE system.

24 In the ABE scheme from Section 4.4, a secret key for a function f is a matrix Rf that maps (A|Bf ) to some fixed matrix D. Instead, we can give as a secret key for f a trapdoor (i.e. a short basis) TF for the matrix F = (A|Bf ). The decryptor could use TF to generate the matrix Rf herself using algorithm SampleD. Now, for a given function g, to construct a secret key that decrypts whenever the attribute vector x satisfies f(x) = g(x) = 0 we extend the trapdoor for F into a trapdoor for (F|Bg) = (A|Bf |Bg) using algorithm ExtendRight. We give a randomized version of this trapdoor as a delegated secret key for f ∧ g. Intuitively this trapdoor can only be used to decrypt if the decryptor can obtain the ciphertexts under matrices Bf and Bg which by security of ABE can only happen if the ciphertexts was created for an attribute vector x satisfying f(x) = g(x) = 0. The top level secret key generated by Keygen is a (2m×2m) matrix in Z. After k delegations the secret key becomes a ((k + 1)m × (k + 1)m) matrix. Hence, the delegated key grows quadratically with the number of delegations k.

Definition. Formally, a delegatable attribute-based encryption (DABE) scheme is an attribute- based encryption scheme that in addition to four standard algorithms (Setup, Keygen, Enc, Dec) offers a delegation algorithm Delegate. Consider a ciphertext c encrypted for index vector x. The algorithm Keygen returns the secret key skf for function f and this key allows to decrypt the ciphertext c only if f(x) = 0. The delegation algorithm given the key skf and a function g outputs a “delegated” secret key that allows to decrypt the ciphertext only if f(x) = 0 ∧ g(x) = 0, which is a more restrictive condition. The idea can be generalized to arbitrary number of delegations:

Delegate(mpk, skf1,...,fk , fk+1) → skf1,...,fk+1 :

Takes as input the master secret key msk, the function fk+1 ∈ F and the secret key skf1,...,fk that was generated either by algorithm Keygen, if k = 1 or by algorithm Delegate, if k > 1.

Outputs a secret key skf1,...,fk+1 .

Correctness. We require the scheme to give a correct ABE as discussed in Section 2.1 and in addition to satisfy the following requirement. For all sequence of functions , . . . , fk ∈ F, a message ` m ∈ M and index x ∈ Zq, s.t. f1(x) = 0 ∧ ... ∧ fk(x) = 0 it holds that µ = Dec(skf1,...,fk , (x, c)) with an overwhelming probability over the choice of (mpk, msk) ← Setup(1λ, `), c ← Enc(mpk, x ∈ ` X , µ), skf1 ← Keygen(msk, f1) and skf1,...,fi+1 ← Delegate(mpk, skf1,...,fi , fi+1) for all i ∈ [k].

Security. The security of DABE schemes is derived from definition of selective security for ABE scheme (see Definition 2.1) by providing the adversary with access to a key-generation oracle.

Definition 5.1 (Selectively-secure DABE). A DABE scheme Π = (Setup, Keygen, Enc, Dec, Delegate) ` ` for a class of functions F = {Fλ}λ∈N with ` = `(λ) inputs over an index space X = {Xλ}λ∈N and a message space M = {Mλ}λ∈N is selectively secure if for any probabilistic polynomial-time adversary A, there exists a negligible function ν(λ) such that h i h i sDABE def (0) (1) AdvΠ,A (λ) = Pr ExptsDABE,Π,A(λ) = 1 − Pr ExptsDABE,Π,A(λ) = 1 ≤ ν(λ),

(b) where for each b ∈ {0, 1} and λ ∈ N the experiment ExptsDABE,Π,A(λ) is defined as follows:

25 ∗ ∗ ` 1.( x , state1) ← A(λ), where x ∈ X . 2.( mpk, msk) ← Setup(λ).

KG(msk,x∗,·) 3.( µ0, µ1, state2) ← A (mpk, state1), where µ0, µ1 ∈ Mλ.

∗ ∗ 4. c ← Enc(mpk, x , µb).

0 KG(msk,x∗,·) ∗ 5. b ← A (c , state2). 6. Output b0 ∈ {0, 1}.

∗ Here the key-generation oracle KG(msk, x , (f1, . . . , fk)) takes a set of functions f1, . . . , fk ∈ F and ∗ ∗ returns the secret key skf1,...,fk if f1(x ) 6= 0 ∨ ... ∨ fk(x ) 6= 0 and otherwise the oracle returns

⊥. The secret key skf1,...,fk is defined as follows: skf1 = KeyGen(msk, f1) and for all i ∈ {2, . . . , k} skf1,...,fi = Delegate(mpk, skf1,...,fi−1 , fi).

5.1.1 A delegatable ABE scheme from LWE The DABE scheme will be almost identical to ABE scheme described earlier, except as a secret key for function f instead of recoding matrix from (A|Bf ) to D we will give the rerandomized trapdoor for (A|Bf ) and then the decryptor can build the recoding matrix to D himself. KeyGen(msk, f): Let Bf = Evalpk(f, (B1,..., B`)). n×2m Build the basis Tf for F = (A|B√f ) ∈ Zq as Tf ← RandBasis(F, ExtendRight√(A, TA, Bf ), σ), for big enough σ = kTAkGS · ω( log m) (we will set σ as before: σ = ω(αF · log m)). Output skf := Tf .

Delegate(mpk, skf1,...,fk , g): (k+1)m×(k+1)m Parse the secret key skf1,...,fk as a matrix Tk ∈ Zq which is a trapdoor for the n×(k+1)m matrix (A|Bf1 | ... |Bfk ) ∈ Zq . Let Bg = Evalpk(g, (B1,..., B`)). n×(k+2)m Build the basis for matrix F = (A|Bf1 | ... |Bfk |Bg) ∈ Zq :

Tk+1 = RandBasis(F, ExtendRight((A|Bf1 | ... |Bfk ), Tk, Bg), σk).

√ k (k+2)m×(k+2)m Here σk = σ · ( m log m) . Output skf1,...,fk,g := Tk+1 ∈ Zq . Note that the size of the key grows quadratically with the number of delegations k.  Dec skf1,...,fk , (x, c) : If f1(x) 6= 0 ∨ ... ∨ fk(x) 6= 0 output ⊥. (k+1)m×(k+1)m Otherwise parse the secret key skf1,...,fk as a matrix Tk ∈ Zq which is a trapdoor

for the matrix (A|Bf1 | ... |Bfk ).

Run R ← SampleD((A|Bf1 | ... |Bfk ), Tk, D, σk) to generate a low-norm matrix (k+1)m×m R ∈ Zq such that (A|Bf1 | ... |Bfk ) · R = D. `  3m For all j ∈ [k], compute (cin, cj, cout) = Evalct {(xi, Bi)}i=1, c, fi ∈ Zq . Note that cin and cout stay the same across all i ∈ [k]. 0 (k+1)m T 0 Let c = (cin|c1| ... |ck) ∈ Zq . Output µ = Round(cout − R c ).

26 Correctness. To show correctness, note that when f1(x) = 0∧...∧fk(x) = 0 we know by the requirement on Evalct that the resulting ciphertexts cfi ∈ Es,∆(0, Bfi ) for ∀i ∈ [k]. Consequently,

T 0 0 (cin|cf1 | ... |cfk ) = (A|Bf1 | ... |Bfk ) s + e where ||e || < k∆ + χmax < (kαF + 1)χmax.

T We know that (A|Bf1 | ... |Bfk ) · R = D and ||R ||2 < (k + 1)mσk with overwhelming probability by Lemma 2.5. Therefore

T 0 T T T 0 T 0 cout − R cf = (D s + e1) − (D s + R e ) = e1 − R e . Finally,

T 0 2 k/2+1 ke1 − R e k ≤ χmax + (k + 1)mσk · (αF + 1)χmax ≤ (k + 2)αF · χmax · m

2 k/2+1 1 with overwhelming probability. The bound on αF : αF m < 4(k+2) · (q/χmax) ensures that this quantity is less than q/4 thereby ensuring correct decryption of all bits of µ ∈ {0, 1}m.

Security. The security game is similar to the security game for FKHE, described in Section4, except in Game 2 we need to answer delegated key queries. Consider a private key query skf1,...,fk , ∗ ∗ where f1, . . . , fk ∈ F. This query is only allowed when f1(x ) 6= 0 ∨ ... ∨ fk(x ) 6= 0. Without ∗ ∗ ∗ loss of generality, assume that f1(x ) = 0 ∧ ... ∧ fk−1(x ) = 0 and fk(x ) 6= 0. Indeed for all other cases, the adversary may ask for the key for a smaller sequence of functions and delegate herself.  The key generation oracle for all i ∈ [k] computes Bfi = Evalpk fi, (B1,..., B`) and needs to (k+1)m×(k+1)m n×(k+1)m produce a trapdoor Tk ∈ Z for the matrix (A|Bf1 | ... |Bfk ) ∈ Zq . To do so the key generation oracle does:

∗ ∗ ` m×m • Run Sfk ← Evalsim(fk, (xi , Si ) i=1, A) and obtains a low-norm matrix Sfk ∈ Zq such ∗ that ASfk − fk(x )G = Bfk . By definition of Evalsim we know that kSfk k2 ≤ αF . ∗ ∗ • Let F = (A|Bf1 | ... |Bfk ) = (A|Bf1 | ... |Bfk−1 |ASfk − y G). Because y 6= 0 the key gener- ation oracle can obtain a trapdoor T(A|B ) by running fk ∗ T(A|B ) ← ExtendLeft(y G, TG, A, Sf ) fk k

And then produce T(A|B |B |...|B ) by running fk f1 fk−1

T(A|B |B |...|B ) ← ExtendRight(G, TG, (Bf | ... |Bf )) fk f1 fk−1 1 k−1

Now we can switch the rows of the matrix T(A|B |B |...|B ) to get the matrix TF , which fk f1 fk−1

is a trapdoor for (A|Bf1 | ... |Bfk ). This operation, as well as ExtendRight function (according to Lemma 2.4, part 2) does not change the Gram-Schmidt norm of the basis, therefore this trapdoor satisfies √ kTFkGS ≤ kTGkGS · kSfk k2 ≤ 5αF (n)

where the bound on kTGkGS is from Lemma 2.4 (part 4).

• Finally, it responds with rerandomized trapdoor Tk = RandBasis(F, TF, σk). By definition of RandBasis we know that T is distributed as D (ΛF(F)) as required. Indeed √ k σk q σk = kTFkGS · ω( log m) as needed for algorithm RandBasis in Lemma 2.6 (part 3).

27 5.2 Polynomial gates We can further reduce the depth of a given arithmetic circuit (and thereby shrink the required lattice sizes) by allowing the circuit to use more general gates than simple addition and multiplication. For example, the k-way OR gate polynomial can be implemented using a single gate. Definition 5.2. An `-variate polynomial is said to have restricted arithmetic complexity (`, d, g) if it can be computed by a depth-d circuit that takes ` inputs x1, . . . , x` ∈ Zq and outputs a single x ∈ Zq. The circuit contains g gates, each of them is either a fan-in 2 addition gate or a fan-in 2 multiplication gate. Multiplication gates are further restricted to have one of their two inputs be one of the inputs to the circuit: x1, . . . , x`. We build the Eval algorithms for polynomials with complexity (`, d, g) whose running time is proportional to g and that increase the magnitude of the noise in a given ciphertext by a factor of at most O(pd · m), where p is the bound on all the intermediate values. Were we to directly use the Eval algorithms from the previous section on this polynomial, the magnitude of the noise would increase by O((pm)d) which is considerably larger, especially when p is small (e.g. p = 1). We can build arithmetic circuits using polynomials with complexity (`, d, g) as gates. Evaluating a depth D arithmetic circuit with such polynomial gates would increase the magnitude of the noise by at most a factor of O((pd · m)D). Again, if we were to simply treat the circuit as a standard arithmetic circuit with basic addition and multiplication gates the noise would instead grow as O((pm)dD) which is larger.

Next we present ABE-enabling algorithms Evalpk, Evalct, Evalsim for these enhanced polynomial gates with the noise bounds discussed in the previous paragraph. To support multiplication and addition of constants, we may assume that we have an extra 0-th input to the circuit that always carries the value 1. We present all three algorithms at the same time. Suppose that f is a polyno- mial with complexity (`, d, g), then the three algorithms work as follows:

~ n×m ` n×m Evalpk(f, B ∈ (Zq ) ) −→ Bf ∈ Zq ` m Evalct(f, (xi, Bi, ci) i=1 ) −→ cf ∈ Zq ` m×m Evalsim(f, (xi, Si) i=1, A) −→ Sf ∈ Zq

For each wire w ∈ [|f|] (here |f| denotes the total number of wires in the circuit and the notation of naming the wires is as described in Section 4.3) starting from the input wires and proceeding to n×m m×m m the output we will construct the matrices Bw ∈ Zq , Sw ∈ Zq , cw ∈ Zq . Finally we output Bf = B|f|, Sf = S|f|, cf = c|f|. Consider an arbitrary gate and suppose that matrices on the input wires are computed, then to compute the matrices on the output wire do the following:

• Suppose the gate computes addition, has input wires w1 and w2 and output wire w. Then set the output matrices on wire w to be:

Bw = Bw1 + Bw2 , Sw = Sw1 + Sw2 , cw = cw1 + cw2 .

• Suppose the gate computes the multiplication by xi for some i ∈ [`], the input wires are u m×m and i, the output wire is w. Then generate matrix R ∈ Zq to satisfy GR = −Bu by running R = BD(−Bu). Output T Bw = BiR, Sw = SiR + xwSu, cw = xicu + R ci .

28 Note that the amount of work required to run the Eval algorithms is proportional to the number of gates g in the circuit. The following lemma shows that the noise in the output ciphertext grows by at most the factor of O(pdm), where p is the upper bound on the intermediate values in the circuit.

n Lemma 5.3. If ci ∈ Es,δ(xi, Bi) for some s ∈ Zq , δ > 0 and the bound on the numbers p ≥ 2, then d for the polynomial f of complexity (`, d, g) with βd = (1 + p + ... + p ) · m we have:

• cf satisfies cf ∈ Es,∆(f(x), Bf ) where Bf = Evalpk(f, (B1,..., B`)) and ∆ < βd(m) · δ,  • Sf satisfies ASf − f(x)G = Bf where Bf = Evalpk f, (AS1 − x1G,..., AS` − x`G) and ||Sf ||2 ≤ βd(m) · γ where γ = maxi∈[`] ||Si||2. Proof. We prove the lemma by induction.

• Consider an addition gate at level i with input wires w1 and w2 and output wire w. Suppose

for j ∈ [2], the noise in the ciphertexts ||ewj || ≤ βi−1(m)δ and ||Swi ||2 ≤ βi−1(m) · γ.

T T T –c w = cw1 +cw2 = (xw1 G+Bw1 ) s+ew1 +(xw2 G+Bw2 ) s+ew2 = (xwG+Bw) s+ew

– ||ew|| = ||ew1 + ew2 || ≤ ||ew1 || + ||ew2 || ≤ (βi−1(m) + βi−1(m))δ ≤ βi(m)δ

–B w = Bw1 +Bw2 = (ASw1 −xw1 G)+(ASw2 −xw2 G) = A(Sw1 +Sw2 )−(xw1 +xw2 )G = ASw − xwG

– ||Sw||2 = ||Sw1 + Sw2 ||2 ≤ ||Sw1 ||2 + ||Sw2 ||2 ≤ (βi−1(m) + βi−1(m)) · γ ≤ βi(m) · γ. • Consider a gate which has input wires u and i ∈ [`], output wire w and which computes multiplication. Suppose ||eu|| ≤ βi−1(m) and ||Su||2 ≤ βi−1(m) · γ, then the following holds –c = x c + RT c = x (x G + B )T s + x e + RT (x G + B )T s + RT e = w i u i i u u i u i i i  T (xwG + xi(Bg + GR) + Bw) s + ew T – ||ew||2 = ||xieu + R ei||2 ≤ p||eu||2 + m||ei||2 ≤ (pβi−1(m) + m)δ ≤ βi(m) · δ

–B w = BiR = (ASi − xiG)R = ASiR + xiBu = ASiR + xi(ASu − xuG) = A(xiSu + SiR) − (xixu)G = ASw − xwG

– ||Sw||2 = ||xiSu + SiR||2 ≤ (pβi−1(m) + m) · γ ≤ βi(m) · γ. as required.

Now combining Lemma 5.3 and lemmas analogous to Lemmas 4.6, 4.7 we can build an ABE system for a set of functions F which can be computed by depth D circuits with (k, d, g)-complexity gates. The bound function will then be

D √ d D√ αF (n) = (βd(m)) · 20 m = O((p m) m).

The time complexity of the Eval algorithms for circuit C that consists of (k, d, g)-complexity gates will be O(g · |C|).

29 5.2.1 Example applications for polynomial gates Unbounded fan-in OR gate. Assuming that boolean inputs are interpreted as integers in {0, 1}, the OR gate of ` inputs can be computed with the following recursive formula:

OR`+1(x1, . . . , x`, x`+1) = x`+1 + (1 − x`+1) · OR`(x1, . . . , x`), where OR1(x1) = x1.

It is easy to see that OR` has restricted complexity (`, 3`, 3`), since at each of the ` iterations we do one multiplication by x`+1 and two fan-in 2 additions. Therefore, by Lemma 5.3, an OR` gate increases the noise in the ciphertext by a factor of O(` · m). If we were computing the OR` function with addition and multiplication gates as in Section 4.3, the most efficient way would be to use the De Morgan’s law:

OR`+1(x1, . . . , x`, x`+1) = 1 − (1 − x1)(1 − x2) ... (1 − x`).

This function can be computed with one level of ` fan-in-2 addition gates (to compute (1 − xi) for Q` i ∈ [`]), one level of a single fan-in-` multiplication gate (to compute i=1(1 − xi)) and one more level of a single fan-in-2 addition gate. The noise then will grow by a factor of O(` · m3), which will make the scheme 3 times less efficient.

The Fibonacci polynomial. Consider the following polynomial, defined for x ∈ [−p, p]` using the following recurrence:

Π1(x) = x1, Π2(x) = x2

Πi+2(x) = Πi+1(x) + Πi(x) · xi+2 for i ∈ {1, . . . , ` − 2}

If expanded, the number of monomials in Π` is equal to the `-th Fibonacci number, which is ` exponential in `. The degree of the polynomial is b 2 c. The recurrence shows that the restricted arithmetic complexity of this polynomial is (`, `, 2`). Therefore, we can compute it with a single polynomial gate and, by Lemma 5.3, the growth in ciphertext noise will be proportional to p` · m. We conjecture that computing this polynomial with a polynomial-size arithmetic circuit requires linear depth in `. Therefore, the growth in ciphertext noise using the approach of Section 4.3 will be proportional to (pm)O(`) which is much worse.

6 ABE with Short Ciphertexts from Multi-linear Maps

We assume familiarity with multi-linear maps [BS02, GGH13a], which we overview in Section 2.3.

Intuition. We assume that the circuits consist of and and or gates. To handle general circuits (with negations), we can apply De Morgan’s rule to transform it into a monotone circuit, doubling the number of input attributes (similar to [GGH+13c]). The inspiration of our construction comes from the beautiful work of Applebaum, Ishai, Kushile- vitz and Waters [AIKW13] who show a way to compress the garbled input in a (single use) garbling scheme all the way down to size |x| + poly(λ). This is useful to us in the context of ABE schemes due to a simple connection between ABE and reusable garbled circuits with authenticity observed in [GVW13]. In essence, they observe that the secret key for a function f in an ABE scheme corre- sponds to the garbled circuit for f, and the ciphertext encrypting an attribute vector x corresponds

30 to the garbled input for x in the reusable garbling scheme. Thus, the problem of compressing ci- phertexts down to size |x| + poly(λ) boils down to the question of generalizing [AIKW13] to the setting of reusable garbling schemes. We are able to achieve this using multilinear maps. Security of the scheme relies on a generalization of the bilinear Diffie-Hellman Exponent As- sumption to the multi-linear setting (see Definition 2.9). 1 The bilinear Diffie-Hellman Exponent Assumption was recently used to prove the security of the first broadcast encryption with constant size ciphertexts [BGW05] (which in turn can be thought of as a special case of ABE with short ciphertexts.)

Theorem 6.1 (Selective security). For all polynomials dmax = dmax(λ), there exists a selectively- secure attribute-based encryption with ciphertext size poly(dmax) for any family of polynomial-size circuits with depth at most dmax and input size `, assuming hardness of (d + 1, `)−Multilinear Diffie-Hellman Exponent Assumption.

6.1 Our Construction λ • Params(1 , dmax): The parameters generation algorithm takes the security parameter and the maximum circuit depth. It generates a multi-linear map G(1λ, k = d+1) that produces groups (G1,...,Gk) along with a set of generators g1, . . . , gk and map descriptors {eij}. It outputs  the public parameters pp = {Gi, gi}i∈[k], {eij}i,j∈[k] , which are implicitly known to all of the algorithms below.

` • Setup(1 ): For each input bit i ∈ {1, 2, . . . , `}, choose a random element qi in Zp. Let g = g1 q be the generator of the first group. Define hi = g i . Also, choose α at random from Zp and α let t = gk . Set the master public key

mpk := (h1, . . . , h`, t) and the master secret key as msk := α. • Keygen(msk,C): The key-generation algorithm takes a circuit C with ` input bits and a master secret key msk and outputs a secret key skC defined as follows.  2 1. Choose randomly (r1, z1),..., (r`, z`) from Zq for each input wire of the circuit C.  3 In addition, choose (r`+1, a`+1, b`+1),..., (rn, an, bn) from Zq randomly for all internal wires of C. z r 2. Compute an ` × ` matrix M˜ , where all diagonal entries (i, i) are of the form (hi) i g i z −z and all non-diagonal entries (i, j) are of the form (hi) j . Append g i as the last row of the matrix and call the resulting matrix M. 3. Consider a gate Γ = (u, v, w) where wires u, v are at depth j − 1 and w is at depth j. If Γ is an or gate, compute

1 aw 2 bw 3 rw−awru 4 rw−bwrv  KΓ = KΓ = g ,KΓ = g ,KΓ = gj ,KΓ = gj Else if Γ is an and gate, compute

1 aw 2 bw 3 rw−awru−bwrv  KΓ = KΓ = g ,KΓ = g ,KΓ = gj

1Our construction can be converted to multi-linear graded-encodings, recently instantiated by Garg et al. [GGH13a] and Coron et al. [CLT13].

31 α−rn 4. Set σ = gk−1 5. Define and output the secret key as  skC := C, {KΓ}Γ∈C , M, σ

• Enc(mpk, x, µ): The encryption algorithm takes the master public key mpk, an index x ∈ ` {0, 1} and a message µ ∈ {0, 1}, and outputs a ciphertext cx defined as follows. Choose a s random element s in Zq. Let X be the set of indices i such that xi = 1. Let γ0 = t if µ = 1, otherwise let γ0 be a randomly chosen element from Gk. Output ciphertext as   s Y s cx := x, γ0, g , γ1 = hi i∈X

• Dec(skC , cx): The decryption algorithm takes the ciphertext cx, and secret key skC and proceeds as follows. If C(x) = 0, it outputs ⊥. Otherwise,

1. Let X be the set of indices i such that xi = 1. For each input wire i ∈ X, using the ri Q zi matrix M compute g j∈X hj and then     ris s ri Y zi −zi g2 = e g , g hj · e γ1, g j∈X     s ri Y zi Y s −zi = e g , g hj · e hj , g j∈X j∈X

2. Now, for each gate Γ = (u, v, w) where w is a wire at level j, (recursively going from the rws input to the output) compute gj+1 as follows: rws 1 rus s 3 - If Γ is an or gate, and C(x)u = 1, compute gj+1 = e KΓ, gj · e g ,KΓ . rws 2 rvs s 4 - Else if C(x)v = 1, compute gj+1 = e KΓ, gj · e g ,KΓ . rws 1 rus 2 rvs s 3 - Else if Γ is an and gate, compute gj+1 = e KΓ, gj · e KΓ, gj · e g ,KΓ .

rns 3. If C(x) = 1, then the user computes gk for the output wire. Finally, compute

s  rns s α−rn  rns ψ = e g , σ · gk = e g , gk−1 · gk

4. Output µ = 1 if ψ = γ0, otherwise output 0.

6.2 Correctness

srw Claim 6.2. For all active wires w at level j (that is, C(x)w = 1) the user holds gi+1. Proof. Clearly, the base case is satisfied as shown above. Now consider a gate Γ = (u, v, w). If g is an or gate and assume C(x)u = 1, then

srw 1 rus s 3 gj+1 = e KΓ, gj · e g ,KΓ aw rus s rw−awru  = e g , gj · e g , gj awrus srw −awrus = e g, gj · e g, gj · e g, gj

32 The case when C(x)v = 1 is similar. Also, if g is an and gate, then

srw 1 rus 2 rvs s 3 gj+1 = e KΓ, gj · e KΓ, gj · e g ,KΓ aw rus bw rvs s rw−awru−bwrv  = e g , gj · e g , gj · e g , gj awrus bwrvs srw −awrus−bwrvs = e g, gj · e g, gj · e g, gj · e g, gj awrus+bwrvs srw −awrus−bwrvs = e g, gj · e g, gj · e g, gj

srn Hence, if C(x) = 1, the user computes gk and so

s  rns ψ = e g , σ · gk s α−rn  rns = e g , gk−1 · gk αs s = gk = t = γ0 if m = 1.

6.3 Security Proof Assume there is an adversary Adv∗ that breaks the security of the ABE scheme. We construct an adversary Adv that breaks the (k, `)-Multi-linear Diffie-Hellman Exponent Assumption. The adversary Adv is given a challenge

c c` c`+2 c2` c c g 1 , . . . , g 1 , . . . , g 1 , . . . , g 1 , g 2 , . . . , g k , β

`+1 Q c1 2≤i≤k ci ∗ where β is either gk or a random element of Gk. The adversary invokes Adv and gets ∗ x as the challenge index. Let X be the set of indices i such that xi = 1. The adversary will ensure `+1 Q the following induction: for every inactive wire w at depth j, rw = c1 2≤i≤j ci (plus known `+1 randomness). Hence, for all input wires w, rw = c1 (plus known randomness). We now define simulated experiments which Adv will be using to break the assumption.

∗ ` • Setup (1 ): For each input bit i∈ / X, choose a random element bi in Zq and implicitly set qi = `+1−i c1 + bi. For each i ∈ X, choose a random qi ∈ Zq. Let g = g1 be the generator of the first `+1 Q c ci+γ qi α 1 2≤i≤k−1 group. For all i, compute hi = g . Randomly choose γ and let t = gk = gk which can be computed from the challenge component by repeated pairing. Set the master public key mpk := (h1, . . . , h`, t) and the master secret key as msk :=⊥.

• Keygen∗(C, msk): The key-generation algorithm takes a circuit C with ` input bits and a master secret key msk and outputs a secret key skC defined as follows.

1. For all i ∈ X, choose randomly ri ∈ Zq. For all i∈ / X, randomly choose fi ∈ Zq and `+1 implicitly set ri = c1 + fi (that is, we embed the challenge into the attributes ∈/ X). i 2. For all i ∈ [`], choose pi ∈ Zq at random and implicitly set zi = −c1 + pi.

33 3. Compute the matrix M:

 g−z1 g−z2 g−z3 . . . g−z`     z r z z z  (h1) 1 g 1 (h1) 2 (h1) 3 ... (h1) `       z z r z z   () 1 (h2) 2 g 2 (h2) 3 ... (h2) `      M :=    (h )z1 (h )z2 (h )z3 gr3 ... (h )z`   3 3 3 3       . . .   . .. .      z1 z2 z3 z r (h`) (h`) (h`) ... (h`) ` g `

4. We now argue that the adversary can compute every entry in the matrix M. −z ci −p ci −p (a) Entries of the first row can be computed by g i = g 1 i = g 1 · g i , where pi is known. (b) Note that for all i = j (i.e. the diagonal entries). If i∈ / X, then

`+1−i i `+1 `+1−i i zi ri (c +bi)(−c +pi) c +fi c pi−bic +bipi+fi (hi) · g = g 1 1 · g 1 = g 1 1

If i ∈ X, then qi, zi, ri are all known. (c) Now, consider non-diagonal entries i 6= j. If i∈ / X and j ∈ X, then

`+1−i j `+1−i+j j `+1−i zj c +bi −c1+pj −c −bic pj c bipj (hi) = g 1 = g 1 · g 1 · g 1 · g

which can be computed given the challenge and the knowledge of bi, pj. Also, if i ∈ X and j∈ / X, similarly

j j zj qi −c1+pj −c qi qipj (hi) = g = g 1 · g

can be computed given the challenge and the knowledge of qi, pj. 5. Consider a gate Γ = (u, v, w) where wires u, v are at depth j − 1 and w is at depth j.

∗ (a) If Γ is an or gate and C(x )w = 1, then values rw, aw, bw are randomly chosen from Zq. Otherwise, we implicitly set aw = cj + dw, bw = cj + kw, where dw, kw ∈ Zq are randomly chosen and cj is the value a part of the challenge. Also, implicitly set `+1 Q rw = c1 2≤i≤j ci + ew, where ewZq is randomly chosen. Compute

1 aw 2 bw 3 rw−awru 4 rw−bwrv  KΓ = KΓ = g ,KΓ = g ,KΓ = gj ,KΓ = gj ∗ Note that in the case C(x )w = 0,

`+1 Y  `+1 Y  rw − awru = c1 ci + ew − cj + dw c1 ci + nu 2≤i≤j 2≤i≤j−1 `+1 Y  = −cjnu − dw c1 ci − dwnu + ew 2≤i≤j−1

34 3 Hence, component KΓ can be computed by pairing j elements from the challenge: c1 ` c2 cj−1 4 g , g , g , . . . , g . Similarly, for term KΓ.

∗ (b) Else if Γ is an and gate and C(x )w = 1, then values rw, aw, bw are randomly chosen from Zq. And the adversary computes

1 aw 2 bw 3 rw−awru−bwrv  KΓ = KΓ = g ,KΓ = g ,KΓ = gj ∗ `+1 Q Otherwise, if C(x )u = 0, then implicitly set rw = c1 2≤i≤j ci + ew, aw = cj + dw where ew, dw are randomly chosen. Also, choose bw at random. Again, the adversary can compute

1 aw 2 bw 3 rw−awru−bwrv  KΓ = KΓ = g ,KΓ = g ,KΓ = gj Note that, `+1 Y  `+1 Y  rw − awru − bwrv = c1 ci + ew − cj + dw c1 ci + nu − bwrv 2≤i≤j 2≤i≤j−1 `+1 Y  = ew − cjnu − dw c1 ci − dwnu − bwrv 2≤i≤j−1 3 Hence, KΓ can be computed by the adversary by applying j pairings to the chal- lenge components gc1 , g`, gc2 , . . . , gcj−1 and using the other known randomness com- ponents.

∗ The adversary performs the symmetric operations if C(x )v = 0. α−rn ∗ 6. Set σ = gk−1 . Note that since C(x ) = 0 the component rn embeds parts challenge into it. Hence, σ can be computed by the adversary due to cancellation in the exponent:

`+1 Y `+1 Y α − rn = c1 cj + γ − c1 cj + en = γ + en 2≤i≤k−1 2≤i≤k−1 7. Define and output the secret key as  skC := C, {KΓ}g∈C , σ • Enc∗(mpk, x∗, m): The encryption algorithm takes the master public key mpk, an index x∗ and a message m, and outputs a ciphertext ctx∗ defined as follows. Let X be the set of indices ∗ γck i such that xi = i. Implicitly let s = ck. Let γ0 = γ = β · gk . Output ciphertext as   ck Y ck ctx := x, γ0, g , γ1 = hi i∈X Q s where b is a randomly chosen bit. Note that i∈X hi can be computed given the challenge `+1 Q c ci ck 1 2≤i≤k component g and known randomness qi for i ∈ X. If β = gk , then, c`+1 Q γck 1 2≤i≤k−1 γck β · gk = gk · gk `+1 Q c1 2≤i≤k−1 +γck = gk = tck = ts

35 which corresponds to an encryption of 1. Otherwise, if β is a randomly chosen in Gk, this corresponds to an encryption of 0.

The adversary Adv uses the above simulated algorithms to answer the queries to Adv∗. If Adv∗ `+1 Q c1 2≤i≤k ci returns m = 1, then Adv outputs that β = gk . Otherwise, it outputs that β is randomly chosen in the target.

7 Applications and Extensions

7.1 Single-Key Functional Encryption and Reusable Garbled Circuits Goldwasser, Kalai, Popa, Vaikuntanathan and Zeldovich showed how to obtain a Single-Key Func- tional Encryption (SKFE) and Reusable Garbled Circuits from: (1) Attribute-based Encryption, (2) Fully-Homomorphic Encryption and (3) “one-time” Garbled Circuits [GKP+13b]. In this section we show what we gain in efficiency in the secret key and ciphertext sizes for these two construction by using our ABE schemes.

Theorem 7.1 ([GKP+13b]). There is a (fully/selectively secure) single-key functional encryption scheme FE for any class of circuits C that take ` bits of input and produce a one-bit output, assuming the existence of (1) C-homomorphic encryption scheme, (2) a (fully/selectively) secure ABE scheme for a related class of predicates and (3) Yao’s Garbling Scheme, where:

1. The size of the secret key is 2 · α · abe.keysize, where abe.keysize is the size of the ABE key for circuit performing homomorphic evaluation of C and outputting a bit of the resulting ciphertext.

2. The size of the ciphertext is 2 · α · abe.ctsize(` · α + γ) + poly(λ, α, β) where (α, β, γ) denote the sizes of the FHE (ciphertext, secret key, public key), respectively. abe.keysize, abe.ctsize(k) are the size of ABE secret key, ciphertext on k-bit attribute vector and λ is the security parameter.

Since FHE (and Yao’s Garbled Circuits) can also be instantiated assuming the sub-exponential hardness of LWE ([BV11], [BGV12]), we obtain the following corollaries.

Corollary 7.2. Combining our short secret key ABE construction (Theorem-4.4) and Theorem- 7.1, we obtain a single-key functional encryption scheme for a circuit class C with depth at most dmax, where the secret key size is some poly(dmax, λ) and λ is the security parameter. To obtain a short ciphertext for functional encryption scheme, we need another observation. There exists a fully-homomorphic encryption scheme where ciphertext encrypting k bits of input is of size k + poly(λ), where λ is the security parameter. We refer the reader to the full version for further details.

Corollary 7.3. Combining the above observation, our short ciphertext ABE construction (Theorem- 6.1) and Theorem-7.1, we obtain a single-key functional encryption scheme for any circuit class C with depth at most dmax and ` bit inputs, where the size of the ciphertext is ` + poly(dmax, λ) and λ is the security parameter.

36 Next, we apply our results to get the optimal construction of reusable garbled circuits.

Theorem 7.4 ([GKP+13b]). There exists a reusable garbling scheme for any class of circuits C that take ` bits of input, assuming the existence (1) symmetric-encryption algorithm, (2) a single-key functional encryption for C, where:

1. The size of the secret key is |C| + fe.keysize + poly(λ), where fe.keysize is the size of the FE key for circuit performing symmetric-key decryption and evaluation of C.

2. The size of the ciphertext is fe.ctsize(λ + `) where fe.ctsize(λ + `) is the size of FE ciphertext on λ + `-bit input.

Corollary 7.5. From Corollary-7.2 and Theorem-7.4, we obtain a reusable garbled circuits scheme for any class of polynomial-size circuits with depth at most dmax, where the secret key size is |C| + poly(dmax, λ). Corollary 7.6. From Corollary-7.3 and Theorem-7.4, we obtain a reusable garbled circuits scheme for any class of polynomial-size circuits with depth at most dmax and ` bit inputs, where the cipher- text size is ` + poly(dmax, λ).

8 Conclusions and open problems

We presented an ABE for arithmetic circuits with short secret keys whose security is based on the LWE problem. At the heart of our construction is a method for transforming a noisy vector of T T the form c = (A|x1G + B1| · · · |x`G + B`) s + e into a vector (A|yG + Bf ) s + ef where y = f(x1, . . . , x`) and ef is not much longer than e. The short decryption key skf provides a way to decrypt when y = 0. We refer to this property as a public-key homomorphism and expect it to find other applications. Natural open problems that remain are a way to provide adaptive security from LWE with a polynomial-time reduction. It would also be useful to construct an efficient ABE for arithmetic circuits where multiplication gates can handle inputs as large as the modulus q.

Acknowledgments. We thank Chris Peikert for his helpful comments and for suggesting Re- mark 4.3. D. Boneh is supported by NSF, the DARPA PROCEED program, an AFO SR MURI award, a grant from ONR, an IARPA project provided via DoI/NBC, and Google faculty award. Opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of DARPA or IARPA. S. Gorbunov is supported by Alexander Graham Bell Canada Graduate Scholarship (CGSD3). G. Segev is supported by the European Union’s Seventh Framework Programme (FP7) via a Marie Curie Career Integration Grant, by the Israel Science Foundation (Grant No. 483/13), and by the Israeli Centers of Research Excellence (I-CORE) Program (Center No. 4/11). V. Vaikuntanathan is supported by an NSERC Discovery Grant, DARPA Grant number FA8750- 11-2-0225, a Connaught New Researcher Award, an Alfred P. Sloan Research Fellowship, and a Steven and Renee Finn Career Development Chair from MIT.

37 References

[ABB10] S. Agrawal, D. Boneh, and X. Boyen. Efficient lattice (H)IBE in the standard model. In EUROCRYPT, 2010.

[ABV+12] S. Agrawal, X. Boyen, V. Vaikuntanathan, P. Voulgaris, and H. Wee. Functional encryption for threshold functions (or fuzzy ibe) from lattices. In PKC, 2012.

[AFV11] S. Agrawal, D. M. Freeman, and V. Vaikuntanathan. Functional encryption for inner product predicates from learning with errors. In ASIACRYPT, 2011.

[AIKW13] B. Applebaum, Y. Ishai, E. Kushilevitz, and B. Waters. Encoding functions with constant online rate or how to compress garbled circuits keys. In CRYPTO, 2013.

[Ajt99] M. Ajtai. Generating hard instances of the short basis problem. In ICALP, 1999.

[ALdP11] N. Attrapadung, B. Libert, and E. de Panafieu. Expressive key-policy attribute-based encryption with constant-size ciphertexts. In Public Key , volume 6571, pages 90–108, 2011.

[AP09] J. Alwen and C. Peikert. Generating shorter bases for hard random lattices. In STACS, 2009.

[BB11] D. Boneh and X. Boyen. Efficient selective identity-based encryption without random oracles. Journal of Cryptology, 24(4):659–693, 2011.

[BF03] D. Boneh and M. K. Franklin. Identity-based encryption from the Weil pairing. SIAM Journal on Computing, 32(3):586–615, 2003. Preliminary version in CRYPTO ’01.

[BGG+14] Dan Boneh, Craig Gentry, Sergey Gorbunov, Shai Halevi, Valeria Nikolaenko, Gil Segev, Vinod Vaikuntanathan, and Dhinakaran Vinayagamurthy. Fully key- homomorphic encryption, arithmetic circuit abe, and compact garbled circuits. In Proc. of Eurocrypt’14, 2014.

[BGV12] Z. Brakerski, C. Gentry, and V. Vaikuntanathan. (leveled) fully homomorphic encryp- tion without bootstrapping. In ITCS, 2012.

[BGW05] D. Boneh, C. Gentry, and B. Waters. Collusion resistant broadcast encryption with short ciphertexts and private keys. In CRYPTO, 2005.

[BHHI10] B. Barak, I. Haitner, D. Hofheinz, and Y. Ishai. Bounded key-dependent message security. In EUROCRYPT, 2010.

[BMR90] D. Beaver, S. Micali, and P. Rogaway. The round complexity of secure protocols (extended abstract). In STOC, 1990.

[BNS13] Dan Boneh, Valeria Nikolaenko, and Gil Segev. Attribute-based encryption for arithmetic circuits. Cryptology ePrint Archive, Report 2013/669, 2013. http: //eprint.iacr.org/.

[Boy13] X. Boyen. Attribute-based functional encryption on lattices. In TCC, 2013.

38 [BS02] D. Boneh and A. Silverberg. Applications of multilinear forms to cryptography. Con- temporary Mathematics, 324:71–90, 2002.

[BSW11] D. Boneh, A. Sahai, and B. Waters. Functional encryption: Definitions and challenges. In TCC, 2011.

[BV11] Z. Brakerski and V. Vaikuntanathan. Efficient fully homomorphic encryption from (standard) lwe. In FOCS, 2011.

[BW07] D. Boneh and B. Waters. Conjunctive, subset, and range queries on encrypted data. In TCC, 2007.

[BW13] D. Boneh and B. Waters. Constrained pseudorandom functions and their applications. In ASIACRYPT, 2013.

[CHKP10] D. Cash, D. Hofheinz, E. Kiltz, and C. Peikert. Bonsai trees, or how to delegate a lattice basis. In EUROCRYPT, 2010.

[CLT13] J. Coron, T. Lepoint, and M. Tibouchi. Practical multilinear maps over the integers. In CRYPTO, 2013.

[Coc01] C. Cocks. An identity based encryption scheme based on quadratic residues. In IMA Int. Conf., 2001.

[FN93] A. Fiat and M. Naor. Broadcast encryption. In CRYPTO, 1993.

[GGH13a] S. Garg, C. Gentry, and S. Halevi. Candidate multilinear maps from ideal lattices. In EUROCRYPT, 2013.

[GGH+13b] S. Garg, C. Gentry, S. Halevi, M. Raykova, A. Sahai, and B. Waters. Candidate indistinguishability obfuscation and functional encryption for all circuits. In FOCS, 2013.

[GGH+13c] S. Garg, C. Gentry, S. Halevi, A. Sahai, and B. Waters. Attribute-based encryption for circuits from multilinear maps. In CRYPTO, 2013.

[GGH+13d] Craig Gentry, Sergey Gorbunov, Shai Halevi, Vinod Vaikuntanathan, and Dhinakaran Vinayagamurthy. How to compress (reusable) garbled circuits. Cryptology ePrint Archive, Report 2013/687, 2013. http://eprint.iacr.org/.

[GGP10] R. Gennaro, C. Gentry, and B. Parno. Non-interactive verifiable computing: Out- sourcing computation to untrusted workers. In CRYPTO, 2010.

[GGSW13] S. Garg, C. Gentry, A. Sahai, and B. Waters. Witness encryption and its applications. In STOC, 2013.

[GHV10] C. Gentry, S. Halevi, and V. Vaikuntanathan. A simple BGN-type cryptosystem from LWE. In EUROCRYPT, 2010.

[GKP+13a] S. Goldwasser, Y. T. Kalai, R. A. Popa, V. Vaikuntanathan, and N. Zeldovich. How to run turing machines on encrypted data. In CRYPTO, 2013.

39 [GKP+13b] S. Goldwasser, Y. T. Kalai, R. A. Popa, V. Vaikuntanathan, and N. Zeldovich. Reusable garbled circuits and succinct functional encryption. In STOC, 2013.

[GKR08] S. Goldwasser, Y. T. Kalai, and G. N. Rothblum. Delegating computation: interactive proofs for muggles. In STOC, 2008.

[GMW87] O. Goldreich, S. Micali, and A. Wigderson. How to play any mental game or a com- pleteness theorem for protocols with honest majority. In STOC, 1987.

[GPSW06] V. Goyal, O. Pandey, A. Sahai, and B. Waters. Attribute-based encryption for fine- grained access control of encrypted data. In ACM CCS, 2006.

[GPV08] C. Gentry, C. Peikert, and V. Vaikuntanathan. Trapdoors for hard lattices and new cryptographic constructions. In STOC, 2008.

[GVW13] S. Gorbunov, V. Vaikuntanathan, and H. Wee. Attribute-based encryption for circuits. In STOC, 2013.

[HW13] S. Hohenberger and B. Waters. Attribute-based encryption with fast decryption. In PKC, 2013.

[KS08] V. Kolesnikov and T. Schneider. Improved garbled circuit: Free xor gates and appli- cations. In ICALP, 2008.

[KSW08] J. Katz, A. Sahai, and B. Waters. Predicate encryption supporting disjunctions, poly- nomial equations, and inner products. In EUROCRYPT, 2008.

[LO13] S. Lu and R. Ostrovsky. How to garble ram programs. In EUROCRYPT, 2013.

[LOS+10] A. B. Lewko, T. Okamoto, A. Sahai, K. Takashima, and B. Waters. Fully secure functional encryption: Attribute-based encryption and (hierarchical) inner product encryption. In EUROCRYPT, pages 62–91, 2010.

[LPRTJ05] A. Litvak, A. Pajor, M. Rudelson, and N. Tomczak-Jaegermann. Smallest singular value of random matrices and geometry of random polytopes. Advances in Mathemat- ics, 195(2):491–523, 2005.

[LW12] A. B. Lewko and B. Waters. New proof methods for attribute-based encryption: Achieving full security through selective techniques. In CRYPTO, 2012.

[MP12] D. Micciancio and C. Peikert. Trapdoors for lattices: Simpler, tighter, faster, smaller. In EUROCRYPT, 2012.

[OT10] T. Okamoto and K. Takashima. Fully secure functional encryption with general rela- tions from the decisional linear assumption. In CRYPTO, 2010.

[Pei09] C. Peikert. Public-key cryptosystems from the worst-case shortest vector problem. In STOC, 2009.

[PRV12] B. Parno, M. Raykova, and V. Vaikuntanathan. How to delegate and verify in public: Verifiable computation from attribute-based encryption. In TCC, 2012.

40 [PTMW06] M. Pirretti, P. Traynor, P. McDaniel, and B. Waters. Secure attribute-based systems. In ACM CCS, 2006.

[Reg05] O. Regev. On lattices, learning with errors, random linear codes, and cryptography. In STOC, 2005.

[Sha84] A. Shamir. Identity-based cryptosystems and signature schemes. In CRYPTO, 1984.

[Sho08] Victor Shoup. A Computational Introduction to Number Theory and Algebra, second edition. Cambridge University Press, 2008.

[SW05] A. Sahai and B. Waters. Fuzzy identity-based encryption. In EUROCRYPT, 2005.

[Wat12] B. Waters. Functional encryption for regular languages. In CRYPTO, 2012.

[Yao86] A. C. Yao. How to generate and exchange secrets (extended abstract). In FOCS, 1986.

41