Next Article in Journal
NotchPUF: Printed Circuit Board PUF Based on Microstrip Notch Filter
Next Article in Special Issue
On Detecting Relay Attacks on RFID Systems Using Qubits
Previous Article in Journal
Linear Cryptanalysis of Reduced-Round Simon Using Super Rounds
Previous Article in Special Issue
QUARC: Quantum Research Cubesat—A Constellation for Quantum Communication
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

On Quantum Chosen-Ciphertext Attacks and Learning with Errors †

1
Joint Center for Quantum Information and Computer Science, University of Maryland, College Park, MD 20742, USA
2
National Institute of Standards and Technology, Gaithersburg, MD 20899, USA
3
Centrum Wiskunde & Informatica, 1098 XG Amsterdam, The Netherlands
4
QuSoft, 1098 XG Amsterdam, The Netherlands
5
Institute for Logic, Language and Computation (ILLC), University of Amsterdam, 1012 WN Amsterdam, The Netherlands
6
Department of Computing and Mathematical Sciences, California Institute of Technology, Pasadena, CA 91125, USA
*
Authors to whom correspondence should be addressed.
This paper is an extended version of our paper published in the Proceedings of the 14th Conference on the Theory of Quantum Computation, Communication and Cryptography (TQC) 2019, College Park, MD, USA, 3–5 June 2019.
Cryptography 2020, 4(1), 10; https://doi.org/10.3390/cryptography4010010
Submission received: 16 December 2019 / Revised: 17 March 2020 / Accepted: 18 March 2020 / Published: 21 March 2020
(This article belongs to the Special Issue Quantum Cryptography and Cyber Security)

Abstract

:
Large-scale quantum computing poses a major threat to classical public-key cryptography. Recently, strong “quantum access” security models have shown that numerous symmetric-key cryptosystems are also vulnerable. In this paper, we consider classical encryption in a model that grants the adversary quantum oracle access to encryption and decryption, but where we restrict the latter to non-adaptive (i.e., pre-challenge) queries only. We formalize this model using appropriate notions of ciphertext indistinguishability and semantic security (which are equivalent by standard arguments) and call it QCCA 1 in analogy to the classical CCA 1 security model. We show that the standard pseudorandom function ( PRF )-based encryption schemes are QCCA 1 -secure when instantiated with quantum-secure primitives. Our security proofs use a strong bound on quantum random-access codes with shared randomness. Revisiting plain IND CPA -secure Learning with Errors ( LWE ) encryption, we show that leaking only a single quantum decryption query (and no other leakage or queries of any kind) allows the adversary to recover the full secret key with constant success probability. Information-theoretically, full recovery of the key in the classical setting requires at least a linear number of decryption queries. Our results thus challenge the notion that LWE is unconditionally “just as secure” quantumly as it is classically. The algorithm at the core of our attack is a new variant of the well-known Bernstein–Vazirani algorithm. Finally, we emphasize that our results should not be interpreted as a weakness of these cryptosystems in their stated security setting (i.e., post-quantum chosen-plaintext secrecy). Rather, our results mean that, if these cryptosystems are exposed to chosen-ciphertext attacks (e.g., as a result of deployment in an inappropriate real-world setting) then quantum attacks are even more devastating than classical ones.

1. Introduction

1.1. Background

Full-fledged quantum computers with millions of logical qubits threaten classical cryptography dramatically. The ability of such devices to run Shor’s efficient quantum factoring algorithm (and its variants) would lead to devastation of the currently deployed public-key cryptography infrastructure [1,2]. This threat has led to significant work on so-called “post-quantum” alternatives, where a prominent category is occupied by cryptosystems based on the Learning with Errors ( LWE ) problem of solving noisy linear equations over Z q  [3] and its variants [1,4]. The  LWE problem is closely related to lattice problems and is widely believed to be intractable even for quantum computers. It thus forms the basis for a number of candidate post-quantum cryptosystems. In addition to motivating significant work on post-quantum cryptosystems, the threat of quantum computers has also spurred general research on secure classical cryptography in the presence of quantum adversaries. One area in particular explores strong security models where a quantum adversary gains precise quantum control over portions of a classical cryptosystem. In such models, a number of basic symmetric-key primitives can be broken by simple quantum attacks based on Simon’s algorithm [5,6,7,8,9]. It is unclear if the assumption behind these models is plausible for typical physical implementations of symmetric-key cryptography. However, attacks which involve quantumly querying a classical function are always available in scenarios where the adversary has access to a circuit for the relevant function. This is certainly the case for hashing, public-key encryption, and circuit obfuscation. Moreover, understanding this model is crucial for gauging the degree to which any physical device involved in cryptography must be resistant to reverse engineering or forced quantum behavior (consider, e.g., the so-called “frozen smart card” example [10]). For instance, one may reasonably ask: what happens to the security of a classical cryptosystem when the device leaks only a single quantum query to the adversary?
When deciding which functions the adversary might have (quantum) access to, it is worth recalling the classical setting. For classical symmetric-key encryption, a standard approach considers the security of cryptosystems when exposed to so-called chosen-plaintext attacks ( CPA ). This notion encompasses all attacks in which an adversary attempts to defeat security (by, e.g., distinguishing ciphertexts or extracting key information) using oracle access to the function which encrypts plaintexts with the secret key. This approach has been highly successful in developing cryptosystems secure against a wide range of realistic real-world attacks. One devastating attack that allows an adversary to exercise precise control over a cryptosystem is characterized by a chosen-ciphertext attack ( CCA ). In this scenario, the attacker receives adaptive access to the encryption and decryption procedures of a cryptosystem, i.e., the attacker is able to choose plaintexts and ciphertexts that depend on previous outcomes of the attack. Despite their strong security requirements, chosen-ciphertext attacks are often perfectly realistic. Surprisingly, even widely adopted cryptosystems such as RSA have been shown to be vulnerable. For example, a well-known attack due to Bleichenbacher [11] only requires access to an oracle that decides if the input ciphertext is encrypted according to a particular RSA standard.
In this work, we consider analogues of both CPA and CCA attacks, in which the relevant functions are quantumly accessible to the adversary. Prior works have formalized the quantum-accessible model for classical cryptography in several settings, including unforgeable message authentication codes and digital signatures [12,13], encryption secure against quantum chosen-plaintext attacks ( QCPA ) [10,14], and encryption secure against adaptive quantum chosen-ciphertext attacks ( QCCA 2 ) [12]. Gagliardoni, Hülsing and Schaffner also consider a wide range of indistinguishability and semantic-security models within the  QCPA framework [10].

1.2. Our Contributions

1.2.1. The Model

In this work, we consider a quantum-secure model of encryption called QCCA 1 . This model grants non-adaptive access to the decryption oracle, and is thus intermediate between QCPA and QCCA 2 . Studying weaker and intermediate models is a standard and useful practice in theoretical cryptography. In fact, CPA and CCA2 are intermediate models themselves, since they are both strictly weaker than authenticated encryption. Our particular intermediate model is naturally motivated: it is sufficent for a new and interesting quantum attack on LWE encryption. As is typical, the challenge in  QCCA 1 can be semantic, or take the form of an indistinguishability test, where the adversary supplies two challenge plaintexts ( m 0 , m 1 ) , receives a challenge ciphertext Enc k ( m b ) for random b, and must correctly guess b. Alternatively, the challenge can be semantic, where the adversary receives partial information about a plaintext m, and is tasked with outputting some additional information about m by making use of its encryption Enc k ( m ) . This leads to natural security notions for symmetric-key encryption, which we call IND QCCA 1 and SEM QCCA 1 , respectively. Following previous works, it is straightforward to define both IND QCCA 1 and SEM QCCA 1 formally, and prove that they are equivalent [10,12,14].
We then prove IND QCCA 1 security for two symmetric-key encryption schemes, based on standard assumptions. Specifically, we show that the standard encryption schemes based on quantum-secure pseudorandom functions ( QPRF ) and quantum-secure pseudorandom permutations ( QPRP ) are both IND QCCA 1 . We remark that both QPRF s and QPRP s can be constructed from quantum-secure one-way functions [15,16]. Our security proofs use a novel technique, in which we control the amount of information that the adversary can extract from the oracles and store in their internal quantum state (prior to the challenge) by means of a certain bound on quantum random-access codes.

1.2.2. A Quantum-Query Attack on LWE

We then revisit the aforementioned question: what happens to a post-quantum cryptosystem if it leaks a single quantum query? Our main result is that standard IND CPA -secure LWE -based encryption schemes can be completely broken using only a single quantum decryption query and no other queries or leakage of any kind. In our attack, the adversary recovers the complete secret key with constant success probability. In standard bit-by-bit LWE encryption, a single classical decryption query can yield at most one bit of the secret key; The classical analogue of our attack thus requires n log q queries. The attack is essentially an application of a modulo-q variant of the Bernstein–Vazirani algorithm [17]. Our new analysis shows that this algorithm correctly recovers the key with constant success probability, despite the decryption function only returning an inner product which is rounded to one of two values. We show that the attack applies to four variants of standard IND CPA -secure LWE -based encryption: The symmetric-key and public-key systems originally described by Regev [3], the  FrodoPKE scheme ( FrodoPKE is an  IND CPA -secure building block in the  IND CCA 2 -secure post-quantum cryptosystem “FrodoKEM” [18]. Our results do not affect the post-quantum security of Frodo and do not contradict the  CCA 2 security of FrodoKEM.) [18,19], and standard Ring LWE  [20,21].
Finally, we consider a setting where the adversary receives one quantum encryption query, including access to the randomness register. We show that a similar algorithm again leads to complete key recovery in this model. In this case, the analysis amounts to the observation of Grilo et al. that the  LWE problem becomes easy with access to quantum samples [22].
The novelty of our results on LWE is as follows. First, we show that a variant of the Bernstein–Vazirani algorithm succeeds even if the parameters correspond to a broad cryptographic security model; second, we show that this leads to a dramatic quantum speed-up in an actual attack: full key-recovery with a single quantum query in each case.

1.2.3. Important Caveats

Our results challenge the view that LWE encryption is “just as secure” classically as it is quantum in any real-world application; notably, this intuition stems from the conjecture that quantum computers do not seem to solve the standard LWE problem much faster than classical computers. Nonetheless, the reader is cautioned to interpret our work carefully. Our results do not indicate a weakness in  LWE (or any LWE -based cryptosystem) in the standard post-quantum security model. Since it is widely believed that quantum-algorithmic attacks will need to be launched over purely classical channels, post-quantum security does not allow for quantum queries to encryption or decryption oracles. Moreover, while our attack does offer a dramatic quantum speedup (i.e., one query vs. linear queries), the classical attack is already efficient.
The plain LWE -based encryption schemes we consider in this work are already vulnerable to decryption queries in a purely classical attack model. In particular, we remark that one classical decryption query can produce at most one bit of the  ( n log q ) -bit key. Similarly, a classical encryption query which can access also the randomness used in the encryption can produce at most log q bits of the key. Our results should thus not be interpreted as a weakness of these cryptosystems in their stated security setting (i.e., IND CPA ). The proper interpretation is that, if these cryptosystems are exposed to chosen-ciphertext attacks, then quantum attacks can be even more devastating than classical ones. Finally, we remark that schemes we attack can me modified to achieve chosen-ciphertext security [23].

1.2.4. Related Work

We remark that Grilo, Kerenidis and Zijlstra recently observed that a version of LWE with so-called “quantum samples” can be solved efficiently (as a learning problem) using Bernstein–Vazirani [22]. Our result, by contrast, demonstrates an actual cryptographic attack on standard cryptosystems based on LWE , in a plausible security setting. Moreover, in terms of solving the learning problem, our analysis shows that constant success probability is achievable with only a single query, whereas [22] require a number of queries which is at least linear in the modulus q. In particular, our cryptographic attack succeeds with a single query even for superpolynomial modulus.

1.3. Technical Summary of Results

1.3.1. Security Model and Basic Definitions

First, we set down the basic QCCA 1 security model, adapting the ideas of [10,13]. Recall that an encryption scheme is a triple Π = ( KeyGen , Enc , Dec ) of algorithms (key generation, encryption, and decryption, respectively) satisfying Dec k ( Enc k ( m ) ) = m for any key k KeyGen and message m. Here, KeyGen represents a procedure for generating a key, Enc represents the encryption procedure, and  Dec the decryption procedure. In what follows, all oracles are quantum, meaning that a function f is accessed via the unitary operator | x | y | x | y f ( x ) . We define ciphertext indistinguishability and semantic security as follows.
Definition 1
(informal). Π is IND QCCA 1 if no quantum polynomial-time algorithm ( QPT ) A can succeed at the following experiment with probability better than 1 / 2 + negl ( n ) .
1. 
a key k KeyGen ( 1 n ) and a uniformly random bit b $ { 0 , 1 } are generated; A gets access to oracles Enc k and Dec k , and outputs ( m 0 , m 1 ) ;
2. 
A receives Enc k ( m b ) and gets access to an oracle for Enc k only, and outputs a bit b ; A wins if  b = b .
Definition 2
(informal). Consider the following game with a  QPT A .
1. 
a key k KeyGen ( 1 n ) is generated; A gets access to oracles Enc k , Dec k and outputs circuits ( Samp , h , f ) ;
2. 
Sample m Samp ; A receives h ( m ) , Enc k ( m ) , and access to an oracle for Enc k only, and outputs a string s; A wins if  s = f ( m ) .
Then Π is SEM QCCA 1 if for every QPT A there exists a  QPT S with the same winning probability but which does not get Enc k ( m ) in step 2.
The following fact is straightforward.
Theorem 1.
A classical symmetric-key encryption scheme is IND QCCA 1 if and only if it is SEM QCCA 1 .

1.3.2. Secure Constructions

Next, we show that standard pseudorandom-function-based encryption is QCCA 1 -secure, provided that the underlying PRF is quantum-secure (i.e., is a  QPRF .) a  QPRF can be constructed from any quantum-secure one-way function, or directly from the  LWE assumption [15]. Given a  PRF f = { f k } k , define PRFscheme [ f ] to be the scheme which encrypts a plaintext m using randomness r via Enc k ( m ; r ) = ( r , f k ( r ) m ) and decrypts in the obvious way.
Theorem 2.
If f is a  QPRF , then PRFscheme [ f ] is IND QCCA 1 -secure.
We also analyze a standard permutation-based scheme. Quantum-secure PRP s (i.e., QPRP s) can be obtained from quantum-secure one-way functions [16]. Given a  PRP P = { P k } k , define PRPscheme [ P ] to be the scheme that encrypts a plaintext m using randomness r via Enc k ( m ; r ) = P k ( m | | r ) , where  | | denotes concatenation; to decrypt, one applies P k 1 and discards the randomness bits. We show the following.
Theorem 3.
If P is a  QPRP , then PRPscheme [ P ] is IND QCCA 1 -secure.
We briefly describe our proof techniques for Theorems 2 and 3. In the indistinguishability game, the adversary can use the decryption oracle prior to the challenge to (quantumly) encode information about the relevant pseudorandom function instance (i.e., f k or P k ) in their private, poly-sized quantum memory. From this point of view, establishing security means showing that this encoded information cannot help the adversary compute the value of the relevant function at the particular randomness used in the challenge. To prove this, we use a bound on quantum random access codes ( QRAC ). Informally, a  QRAC is a mapping from N-bit strings x to d-dimensional quantum states ϱ x , such that given ϱ x , and any index j [ N ] , the bit x j can be recovered with some probability p x , j = 1 2 + ϵ x , j . The average bias of such a code is the expected value of ϵ x , j , over uniform x and j. A  QRAC with shared randomness further allows the encoding and decoding procedures to both depend on some random variable.
Lemma 1.
The average bias of a quantum random access code with shared randomness that encodes N bits into a d-dimensional quantum state is O ( N 1 log d ) . In particular, if  N = 2 n and d = 2 poly ( n ) the bias is O ( 2 n / 2 poly ( n ) ) .
The proof of Theorem 3 is similar to that of Theorem 2.

1.3.3. Key Recovery Against LWE

Our attack on LWE encryption will make use of a new analysis of the performance of a large-modulus variant of the Bernstein–Vazirani algorithm [17], in the presence of a certain type of “rounding” noise.

1.3.4. Quantum Algorithm for Linear Rounding Functions

In the simplest case we analyze, the oracle outputs 0 if the inner product is small, and 1 otherwise. Specifically, given integers n 1 and q 2 , we consider keyed families of (binary) linear rounding functions, LRF k , q : Z q n { 0 , 1 } , with key k Z q n , as follows:
LRF k , q ( x ) : = 0 if | x , k | q 4 , 1 otherwise .
Here, · , · denotes the inner product modulo q. Our main technical contribution is the following.
Theorem 4
(informal). There exists a quantum algorithm which runs in time O ( n ) , makes one quantum query to LRF k , q (with q 2 and unknown k Z q n ), and outputs k with probability at least 2 π π 8 2 0.059 .
We also show that the same algorithm succeeds against more generalized function classes, in which the oracle indicates which “segment” of Z q the exact inner product belongs to.

1.3.5. One Quantum Query Against LWE

Finally, we revisit our central question of interest: what happens to a post-quantum cryptosystem if it leaks a single quantum query? we show that, in standard LWE -based schemes, the decryption function can (with some simple modifications) be viewed as a special case of a linear rounding function, as above. In standard symmetric-key or public-key LWE , for instance, we decrypt a ciphertext ( a , c ) Z q n + 1 with key k by outputting 0 if  | c a , k | q 4 and 1 otherwise. In standard Ring LWE , we decrypt a ciphertext ( u , v ) with key k (here u , v , k are polynomials in  Z q [ x ] / x n + 1 ) by outputting 0 if the constant coefficient of v k · u is small, and 1 otherwise.
Each of these schemes is secure against adversaries with classical encryption oracle access, under the  LWE assumption. If adversaries also gain classical decryption access, then it is not hard to see that a linear number of queries is necessary and sufficient to recover the private key. Our main result is that, by contrast, only a single quantum decryption query is required to achieve this total break. Indeed, in all three constructions described above, one can use the decryption oracle to build an associated oracle for a linear rounding function which hides the secret key. The following can then be shown using Theorem 4.
Theorem 5
(informal). Let Π be standard LWE or standard Ring LWE encryption (either symmetric-key, or public-key.) Let n be the security parameter. Then there is an efficient quantum algorithm that runs in time O ( n ) , uses one quantum query to the decryption function Dec k of Π, and outputs the secret key with constant probability.

1.4. Organization

The remainder of this paper is organized as follows. In Section 2, we outline preliminary ideas that we will make use of, including cryptographic concepts, and notions from quantum algorithms. In Section 3, we define the  QCCA 1 model, including the two equivalent versions IND QCCA 1 and SEM QCCA 1 . In Section 4, we define the  PRF and PRP scheme, and show that they are IND QCCA 1 -secure. In Section 5, we show how a generalization of the Bernstein–Vazirani algorithm works with probability bounded from below by a constant, even when the oracle outputs some rounded value of k , x (i.e., the oracle is a linear rounding function). In Section 6, we use the results of Section 5 to prove that a single quantum decryption query is enough to recover the secret key in various versions of LWE -encryption; we also observe a similar result for a model in which the adversary can make one quantum encryption query with partial access to the randomness register.

2. Preliminaries

2.1. Basic Notation and Conventions

Selecting an element x uniformly at random from a finite set X will be written as x $ X . If we are generating a vector or matrix with entries in  Z q by sampling each entry independently according to a distribution χ on Z q , we will write, e.g., v χ Z q n . Given a matrix A , A T will denote the transpose of A. We will view elements v of Z q n as column vectors; The notation v T then denotes the corresponding row vector. We use bold fonts to discriminate between vectors (or matrices) and scalars. The Kronecker delta δ i j of two nonnegative integers i and j is equal to 1 if  i = j , and 0 otherwise. The notation negl ( n ) denotes some function of n which is smaller than every inverse-polynomial. We denote the concatenation of strings x and y by x | | y . We abbreviate classical probabilistic polynomial-time algorithms as PPT algorithms. By quantum algorithm (or QPT ) we mean a polynomial-time uniform family of quantum circuits, where each circuit in the family is described by a sequence of unitary gates and measurements. In general, such an algorithm may receive (mixed) quantum states as inputs and produce (mixed) quantum states as outputs. Sometimes we will restrict QPT s implicitly; for example, if we write Pr [ A ( 1 n ) = 1 ] for a  QPT A , it is implicit that we are only considering those QPT s that output a single classical bit. The notation Pr [ 1 G AME 0 ] denotes the probability that a  QPT A outputs 1 in some security game G AME 0 .
Every function f : { 0 , 1 } m { 0 , 1 } determines a unitary operator U f : | x | y | x | y f ( x ) on m + qubits where x { 0 , 1 } m and y { 0 , 1 } . In this work, when we say that a quantum algorithm A gets (adaptive) oracle access to f (written A f ), we mean that A can apply the oracle unitary U f . This quantum oracle will sometimes also be denoted by O f .
Recall that a symmetric-key encryption scheme is a triple of classical probabilistic algorithms ( KeyGen ,   Enc ,   Dec ) whose run-times are polynomial in some security parameter n. Such a scheme must satisfy the following property: when a key k is sampled by running KeyGen ( 1 n ) , then it holds that Dec k ( Enc k ( m ) ) = m for all m except with negligible probability in n. In this work, all encryption schemes will be fixed-length, i.e., the length of the message m will be a fixed (at most polynomial) function of n.
Since the security notions we study are unachievable in the information-theoretic setting, all adversaries will be modeled by QPT s. When security experiments require multiple rounds of interaction with the adversary, it is implicit that A is split into multiple QPT s (one for each round), and that these algorithms forward their internal (quantum) state to the next algorithm in the sequence.

2.2. Basic Number Theory Notation

We briefly review the following mathematical conventions. We denote the greatest common divisor (gcd) between two integers a , b N as gcd ( a , b ) . The multiplicative group of integers modulo a prime q is denoted as Z q × . Recall that for m N , the Euler totient function φ ( m ) counts the number of positive integers up to m that are relatively prime to m. The Möbius function μ ( n ) is defined as the sum of the primitive n-th roots of unity. Finally, we also recall that ω ( m ) denotes the prime omega function which counts the number of distinct prime factors of an integer m N .

2.3. Quantum-Secure Pseudorandomness

A pseudorandom function is a family of deterministic and efficiently computable functions that appear random to any PPT adversary with adaptive (classical) oracle access. Similarly, a quantum-secure pseudorandom function achieves security against QPT adversaries with adaptive quantum oracle access. More specifically, let f : { 0 , 1 } n × { 0 , 1 } m { 0 , 1 } be an efficiently computable function, where n , m , are integers and where f defines a family of functions { f k } k { 0 , 1 } n with f k ( x ) = f ( k , x ) . We say f is a quantum-secure pseudorandom function (or QPRF ) if, for every QPT   A ,
Pr k $ { 0 , 1 } n A f k ( 1 n ) = 1 Pr g $ F m A g ( 1 n ) = 1 negl ( n ) .
Here, F m denotes the set of all functions from { 0 , 1 } m to { 0 , 1 } . The standard method for constructing a pseudorandom function from a one-way function produces a  QPRF , provided that the one-way function is quantum-secure [15,24,25].
A quantum-secure pseudorandom permutation is a a bijective function family of quantum-secure pseudorandom functions. More specifically, consider a function P : { 0 , 1 } n × { 0 , 1 } m { 0 , 1 } m , where n and m are integers, such that each function P k ( x ) = P ( k , x ) in the corresponding family { P k } k { 0 , 1 } n is bijective. We say P is a quantum-secure pseudorandom permutation (or QPRP ) if, for every QPT A with access to both the function and its inverse,
Pr k $ { 0 , 1 } n A P k , P k 1 ( 1 n ) = 1 Pr π $ P m A π , π 1 ( 1 n ) = 1 negl ( n ) ,
where P m denotes the set of permutations over m-bit strings. Throughout this work, we shall assume strong QPRP s under the above definition, i.e., such that the security is maintained despite additional access to an inverse. One can construct QPRP s from quantum-secure one-way functions [16].

2.4. Quantum Random Access Codes

A quantum random access code ( QRAC ) is a two-party scheme for the following scenario involving two parties Alice and Bob [26]:
  • Alice gets x { 0 , 1 } N and encodes it as a d-dimensional quantum state  ϱ x .
  • Bob receives ϱ x from Alice, and some index i { 1 , , N } , and is asked to recover the i-th bit of x, by performing some measurement on ϱ x .
  • They win if Bob’s output agrees with x i and lose otherwise.
We can view a  QRAC scheme as a pair of (not necessarily efficient) quantum algorithms: one for encoding, and another for decoding. We remark that the definition of a  QRAC does not require a bound on the number of qubits; The interesting question is with what parameters a  QRAC can actually exist.
A variation of the above scenario allows Alice and Bob to use shared randomness in their encoding and decoding operations [27] (note that shared randomness per se does not allow them to communicate). Hence, Alice and Bob can pursue probabilistic strategies with access to the same random variable. Finally, the definition also takes into account that the encoder and decoder are allowed to share an entangled state as part of ϱ x .
Define the average bias of a  QRAC with shared randomness as ϵ = p win 1 / 2 , where p win is the winning probability averaged over x $ { 0 , 1 } N and i $ { 1 , , N } .

2.5. Quantum Fourier Transform

For any positive integer q, the quantum Fourier transform over Z q is defined by the operation
QFT Z q | x = 1 q y Z q ω q x · y | y ,
where ω q = e 2 π i q . Due to early work by Kitaev [28], this variant of the Fourier transform can be implemented using quantum phase estimation in complexity polynomial in  log q . An improved approximate implementation of this operation is due to Hales and Hallgren [29].

3. The QCCA1 Security Model

3.1. Quantum Oracles

In our setting, adversaries will (at various times) have quantum oracle access to the classical functions Enc k and Dec k . The case of the deterministic decryption function Dec k is simple: The adversary gets access to the unitary operator U Dec k : | c | m | c | m Dec k ( c ) . For encryption, to satisfy IND CPA security, Enc k must be probabilistic and thus does not correspond to any single unitary operator. Instead, each encryption oracle call of the adversary will be answered by applying a unitary sampled uniformly from the family { U Enc k , r } r where
U Enc k , r : | m | c | m | c Enc k ( m ; r )
and r varies over all the possible values of the randomness register of Enc k . Note that, since Enc k and Dec k are required to be probabilistic polynomial-time algorithms provided by the underlying classical symmetric-key encryption scheme, both U Enc k , r and U Dec k correspond to efficient and reversible quantum operations. For the sake of brevity, we adopt the convenient notation Enc k and Dec k to refer to the above quantum oracles for encryption and decryption respectively.

3.2. Ciphertext Indistinguishability

We now define indistinguishability of encryptions (for classical, symmetric-key schemes) against non-adaptive quantum chosen-ciphertext attacks.
Definition 3
( IND QCCA 1 ). Let Π = ( KeyGen , Enc , Dec ) be an encryption scheme, A QPT , and n the security parameter. Define IndGame ( Π , A , n ) as follows.
1. 
Setup: a key k KeyGen ( 1 n ) and a bit b $ { 0 , 1 } are generated;
2. 
Pre-challenge: A gets access to oracles Enc k and Dec k , and outputs ( m 0 , m 1 ) ;
3. 
Challenge: A gets Enc k ( m b ) and access to Enc k only, and outputs a bit  b ;
4. 
Resolution: A wins if  b = b .
Then Π has indistinguishable encryptions under non-adaptive quantum chosen ciphertext attack (or is IND QCCA 1 ) if, for every QPT A ,
Pr [ w i n s IndGame ( Π , A , n ) ] 1 / 2 + negl ( n ) .
By inspection, one immediately sees that our definition lies between the established notions of IND QCPA and IND QCCA 2  [10,12,14]. It will later be convenient to work with a variant of the game IndGame , which we now define.
Definition 4
( IndGame ). We define the experiment IndGame ( Π , A , n ) just as IndGame ( Π , A , n ) , except that in the pre-challenge phase A only outputs a single message m, and in the challenge phase A receives Enc k ( m ) if  b = 0 , and  Enc k ( x ) for a uniformly random message x if  b = 1 .
Working with IndGame rather than IndGame does not change security. Specifically (as we show in Appendix A.2), Π is IND QCCA 1 if and only if, for every QPT A , Pr [ w i n s IndGame ( Π , A , n ) ] 1 / 2 + negl ( n ) .

3.3. Semantic Security

In semantic security, rather than choosing a pair of challenge plaintexts, the adversary chooses a challenge template: a triple of circuits ( Samp , h , f ) , where Samp outputs plaintexts from some distribution D Samp , and h and f are functions with domain the support of D Samp . The intuition is that Samp is a distribution of plaintexts m for which the adversary, if given information h ( m ) about m together with an encryption of m, can produce some new information  f ( m ) .
Definition 5
( SEM QCCA 1 ). Let Π = ( KeyGen , Enc , Dec ) be an encryption scheme, and consider the experiment SemGame ( b ) (with parameter b { real , sim } ) with a  QPT A , defined as follows.
1. 
Setup:a key k KeyGen ( 1 n ) is generated;
2. 
Pre-challenge: A gets access to oracles Enc k and Dec k , and outputs a challenge template ( Samp , h , f ) ;
3. 
Challenge: a plaintext m $ Samp is generated; A receives h ( m ) and gets access to an oracle for Enc k only; if  b = real , A also receives Enc k ( m ) ; A outputs a string s;
4. 
Resolution: A wins if  s = f ( m ) .
Π has semantic security under non-adaptive quantum chosen ciphertext attack (or is SEM QCCA 1 ) if, for every QPT A , there exists a  QPT S such that the challenge templates output by A and S are identically distributed, and
Pr [ w i n s SemGame ( real ) ] Pr [ S w i n s SemGame ( sim ) ] negl ( n ) .
Our definition is a straightforward modification of SEM QCPA  [10,12]; The modification is to give A and S oracle access to Dec k in the pre-challenge phase.
Theorem 6.
Let Π = ( KeyGen , Enc , Dec ) be a symmetric-key encryption scheme. Then, Π is IND QCCA 1 -secure if and only if Π is SEM QCCA 1 -secure.
The classical proof of the above (see, e.g., [30]) carries over directly to the quantum case. This was already observed for the case of QCPA by [10], and extends straightforwardly to the case where both the adversary and the simulator gain oracle access to Dec k in the pre-challenge phase. In fact, the proof works even if  Dec k access is maintained during the challenge, so the result is really that IND QCCA 2 is equivalent to SEM QCCA 2 .

4. Secure Constructions

4.1. PRF Scheme

Let us first recall the standard symmetric-key encryption based on pseudorandom functions.
Construction 1
( PRF scheme). Let n be the security parameter and let f : { 0 , 1 } n × { 0 , 1 } n { 0 , 1 } n be an efficient family of functions { f k } k . The symmetric-key encryption scheme PRFscheme [ f ] = ( KeyGen , Enc , Dec ) is defined by the following efficient algorithms:
1. 
KeyGen : output a key k $ { 0 , 1 } n ;
2. 
Enc : to encrypt a message m , choose a random string r $ { 0 , 1 } n and output ( r , f k ( r ) m ) ;
3. 
Dec : to decrypt a ciphertext ( r , c ) , output c f k ( r ) ;
For simplicity, we chose a particularly simple set of parameters for the  PRF , so that key length, input size, and output size are all equal to the security parameter. It is straightforward to check that the definition (and our results below) are valid for arbitrary polynomial-size parameter choices.
We show that the above scheme satisfies QCCA 1 , provided that the underlying PRF is secure against quantum queries.
Theorem 7.
If f is a  QPRF , then PRFscheme [ f ] is IND QCCA 1 -secure.
Proof. 
Fix a  QPT adversary A against Π : = PRFscheme [ f ] = ( KeyGen , Enc , Dec ) and let n denote the security parameter. It will be convenient to split A into the pre-challenge algorithm A 1 and the challenge algorithm A 2 .
We will work with the single-message variant of IndGame , IndGame , described below as Game 0. In Appendix A.2, we show that Π is IND QCCA 1 if and only if no QPT adversary can win IndGame with non-negligible bias. We first show that a version of IndGame where we replace f with a random function, called Game 1 below, is indistinguishable from IndGame , so that the winning probabilities cannot differ by a non-negligible amount. We then prove that no adversary can win Game 1 with non-negligible bias by showing how any adversary for Game 1 can be used to make a quantum random access code with the same bias.
Game 0: 
This is the game IndGame ( Π , A , n ) , which we briefly review for convenience (see also Figure 1). In the pre-challenge phase, A 1 gets access to oracles Enc k and Dec k , and outputs a message m * while keeping a private state | ψ for the challenge phase. In the challenge phase, a random bit b $ { 0 , 1 } is sampled, and  A 2 is run on input | ψ and a challenge ciphertext
c * : = Φ b ( m * ) : = Enc k ( m * ) if   b = 0 , Enc k ( x ) if   b = 1 .
Here, Enc k ( x ) : = ( r * , f k ( r * ) x ) where r * and x are sampled uniformly at random. In the challenge phase, A 2 only has access to Enc k and must output a bit b . A wins if  δ b b = 1 , so we call δ b b the outcome of the game.
Game 1: 
This is the same game as Game 0, except we replace f k with a uniformly random function F : { 0 , 1 } n { 0 , 1 } n .
First, we show that for any adversary A , the outcome when A plays Game 0 is at most negligibly different from the outcome when A plays Game 1. We do this by constructing a quantum oracle distinguisher D that distinguishes between the  QPRF { f k } k and a true random function, with distinguishing advantage
Pr [ 1 G AME 0 ] Pr [ 1 G AME 1 ] ,
which must then be negligible since f is a  QPRF . The distinguisher D gets quantum oracle access to a function g, which is either f k , for a random k, or a random function, and proceeds by simulating A playing IndGame as follows:
  • Run A 1 , answering encryption queries using classical calls to g in place of f k , and answering decryption queries using quantum oracle calls to g:
    | r | c | m | r | c | m c | r | c | m c g ( r ) ;
  • Simulate the challenge phase by sampling b $ { 0 , 1 } and encrypting the challenge using g in place of f k ; run A 2 and simulate encryption queries as before;
  • When A 2 outputs b , output δ b b .
It remains to show that no QPT adversary can win Game 1 with non-negligible probability. To do this, we design a quantum random access code from any adversary, and use the lower bound on the bias given in Lemma 1.
Intuition. We first give some intuition. In an encryption query, the adversary, either A 1 or A 2 , queries a message, or a superposition of messages m | m , and gets back m | m | r , m F ( r ) for a random r, from which he can easily get a sample ( r , F ( r ) ) . Thus, in essence, an encryption query is just classically sampling a random point of F.
In a decryption query, which is only available to A 1 , the adversary sends a ciphertext, or a superposition of ciphertexts, r , c | r , c and gets back r , c | r , c | c F ( r ) , from which he can learn r | r , F ( r ) . Thus, a decryption query allows A 1 to query F, in superposition. Later in the challenge phase, A 2 gets an encryption ( r * , m F ( r * ) ) and must decide if  m = m * . Since A 2 no longer has access to the decryption oracle, which allows him to query F, it follows there seem to be only two possible ways A 2 could learn F ( r * ) :
  • A 2 gets lucky in one of his at most poly ( n ) many queries to Enc k and happens to sample the challenge pair ( r * , F ( r * ) ) ;
  • Or, the adversary is somehow able to use what he learned while he had access to Dec k , and thus F, to learn F ( r * ) , meaning that the  poly ( n ) -sized quantum memory A 1 sends to A 2 , that can depend on queries to F, but which cannot depend on r * , allows A 2 to learn F ( r * ) .
The first possibility is exponentially unlikely, since there are 2 n possibilities for r * . As we will see shortly, the second possibility would imply a very strong quantum random access code. It would essentially allow A 1 to interact with F, which contains 2 n values, and make a state, which must necessarily be of polynomial size, such that A 2 can use that state to recover F ( r * ) for any of the  2 n possible values of r * , with high probability. We now formalize this intuition. To clarify notation, we will use boldface to denote the shared randomness bitstrings.
Construction of a quantum random access code. Let A be a  QPT adversary with winning probability p. Let = poly ( n ) be an upper bound on the number of queries made by A 2 . Recall that a random access code consists of an encoding procedure that takes (in this case) 2 n bits b 1 , , b 2 n , and outputs a state ϱ of dimension (in this case) 2 poly ( n ) , such that a decoding procedure, given ϱ and an index j { 1 , , 2 n } outputs b j with some success probability. We define a quantum random access code as follows (see also Figure 2).
Encoding. 
Let b 1 , , b 2 n { 0 , 1 } be the string to be encoded. Let s , y 1 , , y 2 n { 0 , 1 } n be given by the first n ( 1 + 2 n ) bits of the shared randomness, and let r 1 , , r { 0 , 1 } n be the next n bits. Define a function f ˜ : { 0 , 1 } n { 0 , 1 } n as follows. For  r { 0 , 1 } n , we will slightly abuse notation by letting r denote the corresponding integer value between 1 and 2 n . Define f ˜ ( r ) = y r b r s . Run A 1 , answering encryption and decryption queries using f ˜ in place of F. Let m * and | ψ be the outputs of A 1 (see Figure 1). Output ϱ = ( | ψ , m * , f ˜ ( r 1 ) , , f ˜ ( r ) ) .
Decoding. 
Let j { 1 , , 2 n } be the index of the bit to be decoded (so given ϱ as above, the goal is to recover b j ). Decoding will make use of the values s , y 1 , , y 2 n , r 1 , , r given by the shared randomness. Upon receiving a query j { 1 , , 2 n } , run A 2 with inputs | ψ and ( j , m * y j ) . On A 2 ’s i-th encryption oracle call, use randomness r i , so that if the input to the oracle is | m , c , the state returned is | m , c ( r i , m f ˜ ( r i ) ) (note that f ˜ ( r i ) is given as part of ϱ ). Return the bit b output by A 2 .
Average bias of the code. we claim that the average probability of decoding correctly, taken over all choices of b 1 , , b 2 n { 0 , 1 } and j { 1 , , 2 n } , is exactly p, the success probability of A . To see this, first note that from A ’s perspective, this is exactly Game 1: The function f ˜ is a uniformly random function, and the queries are responded to just as in Game 1. Further, note that if  b j = 0 , then m * y j = m * f ˜ ( j ) , so the correct guess for A 2 would be 0, and if  b j = 1 , then m * y j = m * f ˜ ( j ) s = x f ˜ ( j ) for the uniformly random string x = m * s , so the correct guess for A 2 would be 1.
Therefore, the average bias of the code is p 1 / 2 . We also observe that ϱ has dimension at most 2 poly ( n ) , since | ψ must be a  poly ( n ) -qubit state ( A 1 only runs for poly ( n ) time), and , the number of queries made by A 2 must be poly ( n ) , since A 2 only runs for poly ( n ) time. As this code encodes 2 n bits into a state of dimension 2 poly ( n ) , by Lemma 1 (proven in Appendix A.1), the bias is O ( 2 n / 2 poly ( n ) ) = negl ( n ) , so p 1 2 + negl ( n ) . □

4.2. PRP Scheme

We now prove the  IND QCCA 1 security of a standard encryption scheme based on pseudorandom permutations.
Construction 2
( PRP scheme). Let n be the security parameter and let P : { 0 , 1 } n × { 0 , 1 } 2 n { 0 , 1 } 2 n be an efficient family of permutations { P k } k . The symmetric-key scheme PRPscheme [ f ] = ( KeyGen ,   Enc ,   Dec ) is defined by the following efficient algorithms:
1. 
KeyGen : output k $ { 0 , 1 } n ;
2. 
Enc : to encrypt m { 0 , 1 } n , choose r $ { 0 , 1 } n and output P k ( m | | r ) ;
3. 
Dec : to decrypt c { 0 , 1 } 2 n , output the first n bits of P k 1 ( c ) .
As before, we chose a simple set of parameters; in general, the randomness length, plaintext length, and security parameter can be related by arbitrary polynomials.
Theorem 8.
If P is a  QPRP , then PRPscheme [ P ] is IND QCCA 1 -secure.
Proof. 
We follow a similar proof strategy as with the  PRF scheme. Fix a  QPT adversary A against Π : = PRPscheme [ P ] = ( KeyGen , Enc , Dec ) . We have that Π is IND QCCA 1 if and only if no QPT adversary can win IndGame with non-negligible bias. First, we show that a version of IndGame where we replace P with a random permutation, described below as Game 1, is indistinguishable from IndGame , so that the winning probabilities cannot differ by a non-negligible amount. We then prove that no adversary can win Game 1 with non-negligible bias, by showing how any adversary for Game 1 can be used to make a quantum random access code with the same bias.
Game 0: 
in the pre-challenge phase, A 1 gets access to oracles Enc k and Dec k . in the challenge phase, A 1 outputs m and its private data | ψ ; a random bit b $ { 0 , 1 } is sampled, and  A 2 is run on input | ψ and a challenge ciphertext
c * : = Enc k ( m * ) = P k ( m * | | r * ) if   b = 0 , Enc k ( x ) = P k ( x | | r * ) if   b = 1 ,
where r * $ { 0 , 1 } n and x is sampled uniformly at random. In the challenge phase, A 2 has oracle access to Enc k only and outputs a bit b . The outcome of the game is simply the bit  δ b b .
Game 1: 
This is the same game as Game 0, except we now replace P k with a perfectly random permutation π : { 0 , 1 } 2 n { 0 , 1 } 2 n .
We show that for any adversary A , the outcome when A plays Game 0 is at most negligibly different from the outcome when A plays Game 1. We construct a quantum oracle distinguisher D that distinguishes between P k and a perfectly random permutation, with distinguishing advantage
Pr [ 1 G AME 0 ] Pr [ 1 G AME 1 ] ,
which must then be negligible since P k is a  QPRP . Here, the distinguisher D receives quantum oracle access to a function φ , which is either P k for a random k, or a random permutation π , and proceeds by simulating A playing IndGame as follows:
  • Run A 1 , answering encryption queries using oracle calls to φ in place of P k , where for a given input and via randomness r,
    Enc : | m | c | m | c φ ( m | | r ) .
    Answer decryption queries using quantum oracle calls to φ ˜ 1 , a function that first computes φ 1 but then (analogous to the  PRP construction) discards the last n bits of the pre-image corresponding to the randomness, i.e.
    Dec : | c | m | c | m φ ˜ 1 ( c ) .
  • Simulate the challenge phase by sampling b $ { 0 , 1 } and encrypting using a randomness r * together with a classical call to φ in place of P k ; run A 2 and simulate encryption queries as before.
  • When A 2 outputs b , output δ b b .
It remains to show that no QPT adversary can win Game 1 with non-negligible probability. To do this, we will again design a random access code from any adversary’s strategy with success probability p, and use the lower bound on the bias given in Lemma 1. We will then construct a  QRAC with bias negl ( n ) from this adversary, and hence conclude that p 1 2 + negl ( n ) .
Construction of a quantum random access code. Let A be a  QPT adversary with winning probability p and let = poly ( n ) be an upper bound on the number of queries made by A 2 . When constructing a  QRAC for the  PRP scheme, we shall also assume for simplicity that both the encoder and decoder share a random permutation (as part of the shared randomness). According to the well known coupon collector’s problem [31], it is sufficient for the encoder and decoder to share around N ln ( N ) random strings on average, where N denotes the number of distinct random strings required to make up the desired permutation. We define a quantum random access code as follows (see also Figure 3).
Encoding. 
Let b 1 , , b 2 n { 0 , 1 } be the string to be encoded and let the shared randomness be given by a random string s together with a random permutation y = y 1 , , y 2 2 n { 0 , 1 } 2 n and a set of random strings r 1 , , r { 0 , 1 } n . Using b 1 , , b 2 n , we define a new random permutation by letting P ˜ ( x | | r ) : = y x b r s | | r ( P ˜ remains a permutation since P ˜ ( x | | r ) = P ˜ ( x | | r ) y x b r s | | r = y x b r s | | r ( r = r ) ( x = x ) ). Now run A 1 by answering encryption and decryption queries using P ˜ in place of π (for decryption, use P ˜ 1 and discard the last n bits). Let m * and | ψ be the outputs of A 1 . Then, output ϱ = ( | ψ , m * , b r 1 , , b r l ) .
Decoding. 
Let j { 1 , , 2 n } be the index of the bit to be decoded; so given ϱ as above, we will recover b j by making use of the shared randomness defined above. Upon receiving a query j { 1 , , 2 n } , run A 2 with inputs | ψ and c * = y m * | | j . Return the bit b output by A 2 .
Average bias of the code. we claim that the average probability of decoding correctly, taken over all choices of b 1 , , b 2 n { 0 , 1 } and j { 1 , , 2 n } , is exactly p, the success probability of A . To see this, first note that from A ’s perspective, this is exactly Game 1: The function P ˜ is a uniformly random permutation, and the queries are responded to just as in Game 1. Further, note that if  b j = 0 , the challenge amounts to P ˜ ( m * | | j ) = y m * | | j , so the correct guess for A 2 would be 0, and if b j = 1 , then y x | | j is an encryption of a uniformly random string x = m * s , so the correct guess for A 2 would be 1.
Therefore, the average bias of the code is p 1 / 2 . We now proceed with a similar analysis as with the  PRF scheme. Note that ϱ has dimension at most 2 poly ( n ) , since | ψ must be a  poly ( n ) -qubit state ( A 1 only runs for poly ( n ) time), and , the number of queries made by A 2 must be poly ( n ) , since A 2 only runs for poly ( n ) time. As this code encodes 2 n bits into a state of dimension 2 poly ( n ) , by Lemma 1, the bias is O ( 2 n / 2 poly ( n ) ) = negl ( n ) , so p 1 2 + negl ( n ) . □

5. Quantum Algorithm for Linear Rounding Functions

In this section, we analyze the performance of the Bernstein–Vazirani algorithm [17] with a modified version of the oracle. While the original oracle computes the inner product modulo q, our version only gives partial information about it by rounding its value to one of q / b blocks of size b, for some b { 1 , , q 1 } (if b does not divide q, one of the blocks will have size < b ).
Definition 6.
Let n 1 be an integer and q 2 be an integer modulus. Let a Z q , b Z q { 0 } and c : = q / b . We partition Z q into c disjoint blocks (most of them of size b) starting from a as follows (see Figure 4):
I v ( a , b ) : = { a + v b , , a + v b + b 1 } if v { 0 , , c 2 } , { a + v b , , a + q 1 } if v = c 1 .
Based on this partition, we define a family LRF k , a , b : Z q n Z c of keyed linear rounding functions, with key k Z q n , as follows:
LRF k , a , b ( x ) : = v if x , k I v ( a , b ) .
In words, we divide the cyclic group Z q into c blocks, beginning at a: The first c 1 have size b, and the last one has size b ( c b q ) b (see Figure 4). Then, the rounding function, LRF , classifies x by which of these blocks the value x , k falls into.
The following theorem shows that the modulo-q variant of the Bernstein–Vazirani algorithm (Algorithm 1) can recover k with constant probability of success by using only a single quantum query to LRF k , a , b .
Algorithm 1: Bernstein–Vazirani for linear rounding functions
Parametersn, q, b { 1 , , q 1 } , c = q / b .
Input 
:Quantum oracle U LRF : | x | z | x | z + LRF k , a , b ( x ) ( mod c ) where x Z q n , z Z c and LRF k , a , b is the rounded inner product function for some unknown k Z q n and a Z q .
Output 
:String k ˜ Z q n such that k ˜ = k with high probability.
  • Prepare the uniform superposition and append 1 c z = 0 c 1 ω c z | z where ω c = e 2 π i / c : 1 q n x Z q n | x 1 c z = 0 c 1 ω c z | z .
  • Query the oracle U LRF for LRF k , a , b to obtain 1 q n x Z q n ω c LRF k , a , b ( x ) | x 1 c z = 0 c 1 ω c z | z .
  • Discard the last register and apply the quantum Fourier transform QFT Z q n .
  • Measure in the computational basis and output the outcome k ˜ .
Theorem 9.
Let U LRF be the quantum oracle for the linear rounding function LRF k , a , b with modulus q 2 , block size b { 1 , , q 1 } , and an unknown a { 0 , , q 1 } , and unknown key k Z q n such that k has at least one entry that is a unit modulo q. By making one query to the oracle U LRF , Algorithm 1 recovers the key k with probability at least 2 π π 8 2 0.059 .
Proof. 
For an integer m, let ω m = e 2 π i / m . Several times in this proof, we will make use of the identity z = 0 1 ω m r z = ω m r ( 1 ) / 2 sin ( r π / m ) sin ( r π / m ) .
Let c = q / b and d = c b q . Throughout this proof, let LRF ( x ) = LRF k , a , b ( x ) . By querying with 1 c z = 0 c 1 ω c z | z in the second register, we are using the standard phase kickback technique, which puts the output of the oracle directly into the phase:
| x 1 c z = 0 c 1 ω c z | z U LRF | x 1 c z = 0 c 1 ω c z | z + LRF ( x ) ( mod c ) = | x 1 c z = 0 c 1 ω c z LRF ( x ) | z = ω c LRF ( x ) | x 1 c z = 0 c 1 ω c z | z .
Thus, after querying the uniform superposition over the cipherspace with 1 c z = 0 c 1 ω c z | z in the second register, we arrive at the state
1 q n x Z q n ω c LRF ( x ) | x 1 c z = 0 c 1 ω c z | z .
Note that ω c = ω q q / c . If we discard the last register and apply QFT Z q n , we get
| ψ = 1 q n y Z q n x Z q n ω q ( q / c ) LRF ( x ) + x , y | y .
We then perform a complete measurement in the computational basis. The probability of obtaining the key k is given by
| k | ψ | 2 = | * | 1 q n x Z q n ω q q c LRF ( x ) + x , k 2 = | * | 1 q n v = 0 c 1 ω q q c v x Z q n : LRF ( x ) = v ω q x , k 2 .
We are assuming that k has at least one entry that is a unit modulo q. For simplicity, suppose that entry is k n . Let k 1 : n 1 denote the first n 1 entries of k . Then, for any v { 0 , , c 2 } :
x Z q n : LRF ( x ) = v ω q x , k = x Z q n : x , k I v ( a , b ) ω q x , k = y Z q n 1 ω q y , k 1 : n 1 x n Z q : x n k n I v ( a y , k 1 : n 1 , b ) ω q x n k n .
(recall the definition of I v ( a , b ) from Definition 6). Since k n is a unit, for each z I v ( a y , k 1 : n 1 ) , there is a unique x n Z q such that x n k n = z . Thus, for a fixed y Z q n 1 , letting a = a y , k 1 : n 1 , we have:
x n Z q : x n k n I v ( a , b ) ω q x n k n = z = a + v b a + ( v + 1 ) b 1 ω q z = ω q a + v b z = 0 b 1 ω q z ,
which we can plug into (4) to get:
x Z q n : LRF ( x ) = v ω q x , k = y Z q n 1 ω q y , k 1 : n 1 ω q a y , k 1 : n 1 + v b z = 0 b 1 ω q z = q n 1 ω q a + v b z = 0 b 1 ω q z .
We can perform a similar analysis for the remaining case when v = c 1 . Recall that d = c b q 0 so v b = c b b = d + q b = ( b d ) ( mod q ) and we get
x Z q n : LRF ( x ) = c 1 ω q x , k = q n 1 ω q a ( b d ) z = 0 b d 1 ω q z .
This is slightly different from the  v < c 1 case, shown in (5), but very similar. If we substitute v = c 1 in (5) and compare it to (6), we get
| q n 1 ω q a ( b d ) z = 0 b d 1 ω q z q n 1 ω q a ( b d ) z = 0 b 1 ω q z | = q n 1 | z = b d b 1 ω q z | = q n 1 | z = 0 d 1 ω q z | = q n 1 | sin ( π d / q ) sin ( π / q ) | q n 1 π d / q 2 / q = q n 1 π 2 d .
Above, we have used the facts sin x x , and  | sin x | 2 x / π when | x | π / 2 . Now, plugging (5) into (3) for all the  v < c 1 terms, and using (7) and the triangle inequality for the  v = c 1 term, we get:
| k | ψ | | 1 q n v = 0 c 1 ω q q v / c · q n 1 ω q a + v b z = 0 b 1 ω q z | | 1 q n ω q q ( c 1 ) / c · q n 1 π 2 d | = 1 q | v = 0 c 1 ω q v ( b q / c ) sin ( b π / q ) sin ( π / q ) | π 2 d q = 1 q sin ( b π / q ) sin ( π / q ) | v = 0 c 1 ω q v ( b q / c ) | π 2 d q .
Since b q / c = d / c , we can bound the sum as follows:
| v = 0 c 1 ω q v ( b q / c ) | = | v = 0 c 1 ω q v d / c | | v = 0 c 1 cos 2 π q v d c
| v = 0 c 1 cos 2 π q d | = | c cos 2 π d q |
c | * | 1 ( 2 π d / q ) 2 c π 2 4 1 .
To get the inequalities (9) and (10) and, we used 0 v c and the assumption that d / q 1 / 4 (if  d / q > 1 / 4 , the claim of the theorem is trivial), which implies that 2 π v c d q π 2 . The last inequality follows from | cos x | 1 x 2 .
Next, we bound sin ( b π / q ) sin ( π / q ) . When b / q 1 / 2 , b π / q π / 2 , so we have sin ( b π / q ) 2 b / q . We also have sin ( π / q ) π / q . Thus,
sin ( b π / q ) sin ( π / q ) 2 b π .
on the other hand, when b / q > 1 / 2 , we must have c = 2 and b = q + d 2 . In that case
sin ( b π / q ) = sin π ( q + d ) 2 q = sin π 2 + π 2 d q = cos π d 2 q 1 π d 2 q 2 .
Since sin ( π / q ) π / q and q 2 b , and by the assumption that d / q 1 / 4 , we get
sin ( b π / q ) sin ( π / q ) 1 π d 2 q 2 π / q 2 b π 1 π 2 64 .
Thus, in both cases,
sin ( b π / q ) sin ( π / q ) 2 b π 1 π 2 64 .
Plugging this and (10) into (8), and again and using the assumption d / q 1 / 4 , we get:
| k , ψ | 1 q sin ( b π / q ) sin ( π / q ) | v = 0 c 1 ω q v ( b q / c ) | π 2 d q 2 π b c q 1 π 2 64 · π 2 4 1 π 8
2 π b c q π 8 = 2 π q + d q π 8 2 π π 8 ,
completing the proof. □

6. Key Recovery Against LWE

In this section, we consider various LWE -based encryption schemes and show using Theorem 9 that the decryption key can be efficiently recovered using a single quantum decryption query (Section 6.1, Section 6.2 and Section 6.3). Then, in Section 6.4, we show that a single quantum encryption query can be used to recover the secret key in a symmetric-key version of LWE , as long as the querying algorithm also has control over part of the randomness used in the encryption procedure.

6.1. Key Recovery via One Decryption Query in Symmetric-Key LWE

Recall the following standard construction of an  IND - CPA symmetric-key encryption scheme based on the  LWE assumption [3].
Construction 3
( LWE SKE [3]). Let n 1 be an integer, let q 2 be an integer modulus and let χ be a discrete and symmetric error distribution. Then, the symmetric-key encryption scheme LWE SKE ( n , q , χ ) = ( KeyGen , Enc , Dec ) is defined as follows:
1. 
KeyGen : output k 1 p t $ Z q n ;
2. 
Enc k : to encrypt b { 0 , 1 } , sample a $ Z q n , e χ Z q and output ( a , a , k + b q 2 + e ) ;
3. 
Dec k : to decrypt ( a , c ) , output 0 if  | c a , k | q 4 , else output 1.
We refer to an encryption scheme as correct if  Pr [ Dec k ( Enc k ( b ) ) = b ] = 1 negl ( n ) . To guarantee that the above LWE SKE scheme is correct, we need to restrict the support of the discrete error distribution χ by fixing the noise magnitude η so that | e | q 4 for all e χ .
As a corollary of Theorem 9, an adversary that is granted a single quantum decryption query can recover the key with probability at least 2 π π 8 2 :
Corollary 1.
There is a quantum algorithm that makes one quantum query to LWE SKE . Dec k and recovers the entire key k with probability at least 2 π π 8 2 0.059 .
Proof. 
Note that LWE SKE . Dec k coincides with a linear rounding function LRF k , a , b for a key k = ( k , 1 ) Z q n + 1 , which has a unit in its last entry. We consider the following two cases: if q is not 3 mod 4 , set b = q / 2 , a = q / 4 , hence we get Dec k = LRF k , a , b . If  q = 3 mod 4 , set b = q / 2 , a = q / 4 , and then we have Dec k = 1 LRF k , a , b . Our claim follows in both cases. Thus, by Theorem 9, Algorithm 1 makes one quantum query to LRF k , a , b , which can be implemented using one quantum query to LWE SKE . Dec k , and recovers k , and thus k , with probability at least 2 π π 8 2 . □
Note that the key in this scheme consists of n log q uniformly random bits, and that a classical decryption query yields at most a single bit of output. It follows that any algorithm making t classical queries to the decryption oracle recovers the entire key with probability at most 2 t n log q . Using a linear number of classical queries, a straightforward key-recovery algorithm does in fact recover the key with constant success probability. One can simply query “unit vectors” of the form e ( i ) = ( 0 , , 0 , 1 , 0 , , 0 ) in order to recover one entry of the key at a time by averaging over errors.

6.2. Key Recovery via One Decryption Query in Public-Key LWE

The key-recovery attack described in Corollary 3 required nothing more than the fact that the decryption procedure of LWE SKE is just a linear rounding function whose key contains the decryption key. as a result, the attack is naturally applicable to other variants of LWE . In this section, we consider two public-key variants. The first is the standard construction of IND CPA public-key encryption based on the  LWE assumption, as introduced by Regev [3]. The second is the  IND CPA -secure public-key encryption scheme FrodoPKE  [18], which is based on a construction of Lindner and Peikert [19]. In both cases, we demonstrate a dramatic speedup in key recovery using quantum decryption queries.
We emphasize once again that key recovery against these schemes was already possible classically using a linear number of decryption queries. Our results should thus not be interpreted as a weakness of these cryptosystems in their stated security setting (i.e., IND CPA ). The proper interpretation is that, if these cryptosystems are exposed to chosen-ciphertext attacks, then quantum attacks can be even more devastating than classical ones.

6.2.1. Regev’s Public-Key Scheme

The standard construction of an  IND CPA public-key encryption scheme based on LWE is the following.
Construction 4
( LWE PKE  [3]). Let m n 1 be integers, let q 2 be an integer modulus, and let χ be a discrete error distribution over Z q . The public-key scheme LWE PKE ( n , q , χ ) = ( KeyGen , Enc , Dec ) is defined by the following efficient algorithms:
1. 
KeyGen : output a secret key sk = k $ Z q n and a public key pk = ( A , a k + e ) Z q m × ( n + 1 ) , where a $ Z q m × n , e χ Z q m , and all arithmetic is done modulo q .
2. 
Enc : to encrypt b { 0 , 1 } , pick a random v { 0 , 1 } m with Hamming weight roughly m / 2 and output ( v T A , v T ( A k + e ) + b q 2 ) Z q n + 1 , where v T denotes the transpose of v .
3. 
Dec : to decrypt ( a , c ) , output 0 if  | c a , sk | q 4 , else output 1.
Although the encryption is now done in a public-key manner, all that matters for our purposes is the decryption procedure, which is identical to the symmetric-key case, LWE SKE . We thus have the following corollary, whose proof is identical to that of Corollary 3:
Corollary 2.
There is a quantum algorithm that makes one quantum query to LWE PKE . Dec sk and recovers the entire key sk with probability at least 2 π π 8 2 0.059 .

6.2.2. Frodo Public-Key Scheme

Next, we consider the  IND CPA -secure public-key encryption scheme FrodoPKE , which is based on a construction by Lindner and Peikert [19]. Compared to LWE PKE , this scheme significantly reduces the key-size and achieves better security estimates than the initial proposal by Regev [3]. For a detailed discussion of FrodoPKE , we refer to [18]. We present the entire scheme for completeness, but the important part for our purposes is the decryption procedure.
Construction 5
( FrodoPKE  [18]). Let n , m ¯ , n ¯ be integer parameters, let q 2 be an integer power of 2, let B denote the number of bits used for encoding, and let χ be a discrete symmetric error distribution. The public-key encryption scheme FrodoPKE = ( KeyGen , Enc , Dec ) is defined as follows:
1. 
KeyGen : generate a matrix a $ Z q n × n and matrices S , E χ Z q n × n ¯ ; compute B = a S + E Z q n × n ¯ ; output the key-pair ( pk , sk ) with public key pk = ( A , B ) and secret key sk = S .
2. 
Enc : to encrypt m { 0 , 1 } B · m ¯ · n ¯ (encoded as a matrix M Z q m ¯ × n ¯ with each entry having 0 s in all but the B most significant bits) with public key pk , sample error matrices S , E χ Z q m ¯ × n and E χ Z q m ¯ × n ¯ ; compute C 1 = S a + E Z q m ¯ × n and C 2 = M + S B + E Z q m ¯ × n ¯ ; output the ciphertext ( C 1 , C 2 ) .
3. 
Dec : to decrypt ( C 1 , C 2 ) Z q m ¯ × n × Z q m ¯ × n ¯ with secret-key sk = S , compute M = C 2 C 1 S Z q m ¯ × n ¯ . For each ( i , j ) [ m ¯ ] × [ n ¯ ] , output the first B bits of M i , j .
We now show how to recover m ¯ of the  n ¯ columns of the secret key S using a single quantum query to FrodoPKE . Dec S . If  m ¯ = n ¯ , as in sample parameters given in [18], then this algorithm recovers S completely.
Theorem 10.
There exists a quantum algorithm that makes one quantum query to FrodoPKE . Dec S and recovers any choice of m ¯ of the  n ¯ columns of S . For each of the chosen columns, if that column has at least one odd entry, then the algorithm succeeds in recovering the column with probability at least 2 π π 8 2 0.059 .
Proof. 
Let s 1 , , s n ¯ be the columns of S . Let U denote the map:
U : | c | z 1 | z n ¯ | c | z 1 + LRF s 1 , 0 , q / 2 B ( c ) | z n ¯ + LRF s n ¯ , 0 , q / 2 B ( c ) ,
for any c Z q n and z 1 , , z n ¯ Z 2 B . We first argue that one call to FrodoKEM . Dec S can be used to implement U m ¯ . Then we show that one call to U can be used to recover any choice of the columns of S with probability 2 π π 8 2 0.059 , as long as it has at least one entry that is odd.
Let Trunc : Z q Z 2 B denote the map that takes x Z q to the integer represented by the B most significant bits of the binary representation of x. We have, for any C 1 Z q m ¯ × n , C 2 = 0 m ¯ × n ¯ , and any { z i , j } i [ m ¯ ] , j [ n ¯ ] Z 2 B :
U FrodoKEM . Dec : | C 1 | 0 m ¯ · n ¯ i [ m ¯ ] , j [ n ¯ ] | z i , j | C 1 | 0 m ¯ · n ¯ i [ m ¯ ] , j [ n ¯ ] | z i , j + Trunc ( [ C 1 S ] i , j ) .
Above, [ C 1 S ] i , j represents the  i j -th entry of C 1 S . If  c 1 , , c m ¯ denote the rows of C 1 , then [ C 1 S ] i , j = c i , s j . Thus, Trunc ( [ C 1 S ] i , j ) = LRF s j , 0 , q / 2 B ( c i ) , the linear rounding function with block size b = q / 2 B , which is an integer since q is a power of 2, and  a = 0 . Note that we have also assumed that the plaintext is subtracted rather than added to the last register; this is purely for convenience of analysis, and can easily be accounted for by adjusting Algorithm 1 (e.g., by using inverse- QFT instead of QFT .)
Discarding the second register (containing C 2 = 0 ), the right-hand side of (13) becomes
| c 1 | c m ¯ i [ m ¯ ] , j [ n ¯ ] | z i , j + LRF s j , 0 , q / 2 B ( c i ) .
Reordering the registers of (14), we get:
i [ m ¯ ] | c i j [ n ¯ ] | z i , j + LRF s j , 0 , q / 2 B ( c i ) = U m ¯ i [ m ¯ ] | c i j [ n ¯ ] | z i , j .
Thus, we can implement U m ¯ using a single call to FrodoKEM . Dec S .
Next we show that for any particular j [ n ¯ ] , a single call to U can be used to recover s j , the j-th column of S , with probability at least 2 π π 8 2 0.059 , as long as at least one entry of s j is odd. To do this, we show how one use of U can be used to implement one phase query to LRF s j , 0 , q / 2 B . Then the result follows from the proof of Theorem 9.
Let | φ = 2 B / 2 z = 0 2 B 1 | z , and define
| ϕ j = | φ ( j 1 ) 1 2 B z = 0 2 B 1 ω 2 B z | z | φ ( n ¯ j ) .
Then for any c Z q n , we have:
1 2 B z = 0 2 B 1 | z + LRF s i , 0 , q / 2 B ( c ) = 1 2 B z = 0 2 B 1 | z = | φ ,
since addition here is modulo 2 B , and
1 2 B z = 0 2 B 1 ω 2 B z | z + LRF s j , 0 , q / 2 B ( c ) = 1 2 B z = 0 2 B 1 ω 2 B z LRF s j , 0 , q / 2 B ( c ) | z .
Thus:
U ( | c | ϕ j ) = | c | φ ( j 1 ) 1 2 B z = 0 2 B 1 ω 2 B z LRF s j , 0 , q / 2 B ( c ) | z | φ ( n ¯ j ) = ω 2 B LRF s j , 0 , q / 2 B ( c ) | c | ϕ j .
Thus, by the proof of Theorem 9, if we apply U to q n / 2 c Z q n | c | ϕ j , Fourier transform the first register, and then measure, assuming s j has at least one entry that is a unit (since q is a power of 2, this is just an odd number) we will measure s j with probability at least 2 π π 8 2 0.059 .
Thus, if we want to recover columns j 1 , j m ¯ of S , we apply our procedure for U m ¯ , which costs one query to FrodoKEM . Dec S , to the state
c Z q n 1 q n | c | ϕ j 1 c Z q n 1 q n | c | ϕ j m ¯ ,
Fourier transform each of the  c registers, and then measure. □

6.3. Key Recovery via One Decryption Query in Public-Key Ring-LWE

Next, we analyze key-recovery with a single quantum decryption query against Ring- LWE encryption. Unlike the plain LWE -based encryption schemes we considered in the previous sections, Ring- LWE encryption uses noisy samples over a polynomial ring. In the following, we consider the basic, bit-by-bit Ring- LWE public-key encryption scheme introduced in [20,21]. It is based on the rings R = Z [ X ] / X n + 1 and R q : = R / q R = Z q [ X ] / X n + 1 for some power-of-two integer n and poly ( n ) -bounded prime modulus q. The details of the error distribution χ below will not be relevant to our results.
In order to generate samples, we assume a symmetric error distribution χ that samples “small” error polynomials from R . For example, a typical choice (under a particular representation for R q ) is to use an n-dimensional Gaussian, more specifically the product of n centered one-dimensional Gaussian distributions.
Let us first recall the basic public-key encryption scheme based on Ring- LWE . We restrict our analysis to single-bit encryption only.
Construction 6
(Ring- LWE - PKE  [20,21]). Let n 1 be an integer, let q 2 be an integer modulus, and let χ be an error distribution over R . The public-key encryption scheme Ring LWE - PKE = ( KeyGen , Enc , Dec ) is defined as follows:
1. 
KeyGen : sample a $ R q and e , s χ R ; output s k = s and p k = ( a , c = a · s + e ( mod q ) ) R q 2 .
2. 
Enc : to encrypt b { 0 , 1 } , sample r , e 1 , e 2 χ R and output a ciphertext pair ( u , v ) R q 2 , where u = a · r + e 1 ( mod q ) and v = c · r + e 2 + b q / 2 ( mod q ) .
3. 
Dec : to decrypt ( u , v ) , compute v u · s = ( r · e s · e 1 + e 2 ) + b q / 2 ( mod q ) R q ; output 0 if the constant term of the polynomial is closer to 0 than q / 2 , else output 1.
We note that our choice of placing single-bit encryption in the constant term of the polynomial is somewhat arbitrary. Indeed, it is straightforward to extend our results to encryption with respect to other monomials. To speed up multiplication of large polynomials, various embeddings are adopted in practice that represent elements in  R q as vectors in  Z q n  [20]. For example, one can adopt the number-theoretic transform (NTT) to reduce polynomial multiplication to the much faster component-wise multiplication, such as in the post-quantum proposal New Hope [32]. We emphasize that our results are independent of the actual embedding used in practice, as long as the representation is an isomorphism between R q and Z q n . The same is true for the choice of ring R under a cyclotomic polynomial, and ultimately results in only slightly different classical post-processing. We show the following corollary to Theorem 9.
Corollary 3.
There is a quantum algorithm that makes one quantum query to Ring LWE - PKE . Dec s and recovers the entire key s with probability at least 2 π π 8 2 0.059 .
Proof. 
Let us first analyze the decryption function. We let ( p ) 0 denote the constant term of a polynomial p R q . Then, for any two polynomials u = j = 0 n 1 u j X j and s = j = 0 n 1 s j X j R q , we can identify the constant term of u · s as
( u · s ) 0 = u 0 s 0 + j = 1 n 1 u j s n j X j X n j u 0 s 0 u 1 s n 1 u 2 s n 2 u n 1 s 1 ( mod q ) ,
since X n 1 in  R q . We show that the outcome of Ring LWE - PKE . Dec s ( u , v ) coincides with a binary linear rounding function over Z q n . Let u , s Z q n denote the coefficient vectors of u , s R q respectively, and define a constant polynomial v v 0 R q and vector u : = ( u , v 0 ) Z q n + 1 , for some v 0 Z q . We find that Ring LWE - PKE . Dec s ( u , v 0 ) rounds the inner product u , s , where
s = ( s 0 ( mod q ) , s n 1 , , s 1 , 1 ) .
Thus, we can run the Bernstein–Vazirani algorithm for binary linear rounding functions on a uniform superposition over Z q n and recover s from s with simple classical post-processing. Note also that any choice of isomorphism between R q and Z q n necessarily preserves the inner product in Equation (15), and hence any measurement outcome can be mapped back to the standard basis prior to post-processing—independently of the actual ring representation used in practice.
By Theorem 9, Algorithm 1 makes one quantum query to LRF s , q , which can be implemented using one quantum query to Ring LWE - PKE . Dec s , and recovers the string s , and thus also s , with probability 2 π π 8 2 . □

6.4. Key Recovery via a Randomness-Access Query

While a linear number of classical decryption queries can be used to break LWE -based schemes, we have shown that only a single quantum decryption query is required. A natural question to ask is whether a similar statement can be made for encryption queries. Classically, it is known that the symmetric key version of LWE described in Construction 3, LWE SKE , can be broken using a linear number of classical encryption queries when the adversary is also allowed to choose the randomness used by the query: The adversary simply sets the value to e = 0 each time, with a taking n linearly independent values.
In case the adversary is allowed to make quantum encryption queries with randomness access, a single quantum query suffice to recover the entire key with non-negligible probability, even when the adversary only has control over a part of the randomness used by the encryption: The randomness used to prepare vectors a , but not the randomness used to select the error e. Specifically, the adversary is given quantum oracle access to the randomness-access encryption oracle U Enc k RA such that, on input ( b ; a ) , the adversary receives
Enc k RA ( b ; a ) = ( a , a , k + b q / 2 + e ) ,
where e χ . We extend this to a quantum randomness-access oracle by answering each element of the superposition using i.i.d. errors e a χ :
U Enc k RA : | m | a | c | m | a | c Enc k RA ( m ; a ) .
This model is identical to the noisy learning model considered by Grilo et al. [22] which was inspired by the original noise model of Bshouty and Jackson [33]. First, it is not hard to see that algorithms making classical queries to the above oracle can extract at most log q bits of key from each query (specifically, from the last component of the ciphertext), and thus still require a linear number of queries to recover the complete key with non-negligible probability.
On the other hand, by a slight generalization of the proof of Theorem IV . 1 from Ref. [22], we can recover the entire key with inverse polynomial success probability using a single query to U Enc k RA , as long as the noise magnitute η is polynomial in n. While Grilo et al. show how to apply Bernstein–Vazirani to solve a certain computational learning version of LWE with quantum samples, we adopt a wider set of cryptographic security parameters and show that this algorithm leads to a dramatic quantum speed-up in an actual attack. Specifically, our improved analysis shows that the modulus need not be prime. In particular, in the case of only a single query to a quantum randomness-access encryption oracle, the entire key can be recovered with inverse polynomial success probability, as long as the noise magnitude η is polynomial in n. This is certainly the case for the vast majority of schemes in practice. Recall that φ denotes the Euler totient function. Specifically, for m N , φ ( m ) counts the number of integers up to m that are relative prime to m. If m is prime, then φ ( m ) = m 1 . Our algorithm to recover the key is as follows.
Theorem 11.
Consider LWE SKE ( n , q , χ ) with an arbitrary integer modulus 2 q exp ( n ) and a symmetric error distribution χ of noise magnitude η. Then, Algorithm 2 makes one query to a randomness-accessible quantum encryption oracle for LWE SKE ( n , q , χ ) and recovers the entire key with probability at least φ ( q ) / ( 24 η q ) o ( 1 ) .
Proof. 
We follow a similar analysis as in Theorem IV . 1 in [22]. Let k denote the key as sampled by LWE SKE ( n , q , χ ) . After querying U Enc k RA upon a state corresponding to an encryption of a message b 0 = 0 , together with a choice of uniform superposition over the randomness register,
1 q n x Z q n | b 0 | x 1 | x n | 0 ,
Algorithm 2: Bernstein–Vazirani for randomness-accessible LWE encryption
input: Quantum randomness-access oracle U Enc k RA for LWE SKE ( n , q , χ )
output k Z q n with probability φ ( q ) / ( 24 η q )
  • Prepare a state corresponding to the message b 0 = 0 and uniform randomness:
    1 q n x Z q n | b 0 | x 1 | x n | 0 .
  • Query the randomness-accessible oracle U Enc k RA , resulting in
    1 q n x Z q n | b 0 | x 1 | x n | x , k + b 0 q / 2 + e x ( mod q ) .
  • Discard the first register and apply the quantum Fourier transform QFT Z q n + 1 .
  • Measure in the computational basis, yielding an outcome | y 1 | y n | z .
  • If gcd ( z , q ) = 1 , output k ˜ = ( y 1 , , y n ) / z ( mod q ) ,
    else output ⊥.
Algorithm 2 receives a sample | ψ where, for unknown independent errors e x χ of noise magnitude | e x | η ,
| ψ = 1 q n x Z q n | b 0 | x 1 | x n | x , k | + e x ( mod q ) .
Thus, when discarding the first register and applying the quantum Fourier transform, we find
QFT Z q n + 1 | ψ = 1 q n + 1 / 2 x Z q n y Z q n z Z q ω x , y + z k + e x z | y 1 | y n | z .
When measuring in the standard basis, the probability of obtaining outcome y 1 , , y n , z is
1 q 2 n + 1 | x Z q n ω x , y + z k + e x z | 2 .
In particular, the probability that y = z k ( mod q ) and also that z is prime relative to q (i.e., gcd ( z , q ) = 1 and thus z Z q × ) is given by
1 q 2 n + 1 z Z q × | x Z q n ω e x z | 2 = 1 q 2 n + 1 z Z q × [ ( x Z q n Re ω e x z ) 2 + ( x Z q n Im ω e x z ) 2 ] 1 q 2 n + 1 z Z q × x Z q n cos 2 π e x z q 2 1 q 2 n + 1 z Z q × 1 z q 6 η ( x Z q n 1 2 ) 2 1 4 q z Z q × 1 z q 6 η 1 φ ( q ) 24 η q O ( 1 / q ) .
in the last inequality, we used the fact that q 6 η = q 6 η + O ( 1 ) , as well as a standard identity on the Euler totient function which we state in Lemma A2: Let n , m > 1 be integers and let ω be the prime omega function. Then, the following identity holds:
1 j n gcd ( j , m ) = 1 1 = n φ ( m ) m + O 2 ω ( m ) .
Therefore, Algorithm 2 outputs the correct key k ˜ with probability at least φ ( q ) / ( 24 η q ) o ( 1 ) . Note that, because φ ( q ) = Ω q / log log ( q ) , the success probability is inverse polynomial so long as the noise magnitude η is polynomial in n. □
For completeness, we also consider a slightly different and yet plausible error model for quantum randomness-access queries. Unlike the previous model of i.i.d. errors, we now consider a single error e χ being sampled for every branch of the superposition of a single query. Our algorithm will crucially exploit the property that the error does not depend on any of the particular vectors in the respective branches of the wave function.
Surprisingly, we find that the error model of choice does matter, and greatly impacts the analysis of the algorithm. In fact, as we show next, one can now recover k with certainty using only a single query to the randomness access encryption oracle. We adapt Algorithm 2 as follows:
We are left with the following Corollary.
Corollary 4.
Consider LWE SKE ( n , q , χ ) with an arbitrary integer modulus 2 q exp ( n ) and a symmetric error distribution χ of noise magnitude η. Then, there exists a quantum algorithm that makes one query to a single-error randomness-accessible quantum encryption oracle for LWE SKE ( n , q , χ ) and recovers the entire key with probability 1.
Proof. 
The result follows straight from the definition of the quantum Fourier transform. After applying the transformation in step 3 of Algorithm 3, the register contains the entries ( k 1 , , k n ) . □
Algorithm 3: Bernstein–Vazirani for (single-error) randomness-accessible LWE encryption
input 
:Quantum randomness-access oracle U Enc k RA for LWE SKE ( n , q , χ ) in the single-error model.
output 
: k Z q n with probability 1
  • Prepare a particular state corresponding to the message b 0 = 0 as follows:
    1 q n x Z q n | b 0 | x 1 | x n 1 q z = 0 q 1 ω q z | z .
  • Query the randomness-accessible oracle U Enc k RA with single error e χ :
    1 q n x Z q n ω q x , k | b 0 | x 1 | x n 1 q z = 0 q 1 ω q z | z + e .
  • Discard the first and last register, and apply the quantum Fourier transform QFT Z q n .
  • Measure in the computational basis to obtain k Z q n .

Author Contributions

All authors contributed equally to this work. Conceptualization, G.A., S.J., M.O. and A.P.; formal analysis, G.A., S.J., M.O. and A.P.; writing—original draft preparation, G.A., S.J., M.O. and A.P.; writing—review and editing, G.A., S.J., M.O. and A.P. All authors have read and agreed to the published version of the manuscript.

Funding

GA is supported by National Science Foundation (NSF) grant CCF-1763736. SJ is supported by an NWO WISE Grant and NWO Veni Innovational Research Grant under project number 639.021.752. MO is supported by Leverhulme Trust Early Career Fellowship (ECF-2015-256). AP is partially supported by AFOSR YIP award number FA9550-16-1-0495, the IQIM—an NSF Physics Frontiers Center (NSF Grant PHY- 1733907), and the Kortschak Scholars program.

Acknowledgments

We thank Ronald de Wolf for helpful discussions, Jop Bri e ¨ t for Lemma A1 and Peter Humphries for providing us with a simple proof of Lemma A2.

Conflicts of Interest

The authors declare no conflict of interest.

Appendix A

Appendix A.1. Bound for Quantum Random Access Codes

Recall that a quantum random access code ( QRAC ) is the following scenario involving two parties, Alice and Bob [26]:
  • Alice receives an N-bit string x and encodes it as a quantum state ϱ x .
  • Bob receives ϱ x from Alice and is asked to recover the i-th bit of x, for some i { 1 , , N } , by measuring the state.
  • They win if Bob’s output agrees with x i and lose otherwise.
A variation of this scenario allows Alice and Bob to use shared randomness in their encoding and decoding operations [27] (note that shared randomness per se does not allow them to communicate). If we denote the shared random variable by λ , Alice’s can now produce ϱ x λ
We are interested in bounding the average bias ϵ = p win 1 / 2 of a quantum random access code with shared randomness, where p win is the winning probability averaged over x $ { 0 , 1 } N and i $ { 1 , , N } .
Lemma A1.
The average bias of a quantum random access code with shared randomness that encodes N bits into a d-dimensional quantum state is O ( N 1 log d ) . In particular, if N = 2 n and d = 2 poly ( n ) the bias is O ( 2 n / 2 poly ( n ) ) .
Proof. 
A quantum random access code with shared randomness that encodes N bits into a d-dimensional quantum state is specified by the following:
  • a shared random variable λ ,
  • for each x { 0 , 1 } N , a d-dimensional quantum state ϱ x λ encoding x,
  • for each i { 0 , , N } , an observable M i λ for recovering the i-th bit.
Formally, ϱ x λ and M i λ are d × d Hermitian matrices such that ϱ x λ 0 , Tr ϱ x λ = 1 , and || M i λ || 1 where || M i λ || denotes the operator norm of M i λ . Note that both ϱ x λ and M i λ depend on the shared random variable λ , meaning that Alice and Bob can coordinate their strategies.
The bias of correctly guessing x i , for a given x and i, is ( 1 ) x i Tr ( ϱ x λ M i λ ) / 2 . Moreover, if the average bias of the code is ϵ , then E λ E x , i ( 1 ) x i Tr ( ϱ x λ M i λ ) 2 ϵ . We can rearrange this expression and upper bound each term using its operator norm, and then apply the noncommutative Khintchine inequality [34]:
E λ E x 1 N Tr ϱ x λ i = 1 N ( 1 ) x i M i λ E λ E x 1 N || i = 1 N ( 1 ) x i M i λ || E λ 1 N c N log d = c log d N ,
for some constant c. In other words, ϵ c 2 log d N . in the particular case we are interested in, d = 2 poly ( n ) and N = 2 n so ϵ c 2 poly ( n ) 2 n , completing the proof. □

Appendix A.2. Equivalence of QCCA Models

Recall that the IND QCCA 1 notion is based on the security game IndGame defined in Definition 3. In the alternative security game IndGame (see Definition 4), the adversary provides only one plaintext m and must decide if the challenge is an encryption of m or an encryption of a random string. In this section, we prove the following:
Proposition A1.
An encryption scheme Π is IND QCCA 1 if and only if for every QPT A ,
Pr [ w i n s IndGame ( Π , A , n ) ] 1 / 2 + negl ( n ) .
Proof. 
Fix a scheme Π . For one direction, suppose Π is IND QCCA 1 and let A be an adversary against IndGame . Define an adversary A 0 against IndGame as follows: (i.) run A until it outputs a challenge plaintext m, (ii.) sample random r and output ( m , r ) , (iii.) run the rest of A and output what it outputs. The output distribution of IndGame ( Π , A , n ) is then identical to IndGame ( Π , A 0 , n ) , which in turn must be negligibly close to uniform by IND QCCA 1 security of Π .
For the other direction, suppose no adversary can win IndGame with probability better than 1 / 2 , and let B be an adversary against IndGame . Now, define two adversaries B 0 and B 1 against IndGame as follows. The adversary B c does: (i.) run B until it outputs a challenge ( m 0 , m 1 ) , (ii.) output m c , (iii.) run the rest of B and output what it outputs. Note that the pre-challenge algorithm is identical for B , B 0 , and B 1 ; define random variables M 0 , M 1 and R given by the two challenges and a uniformly random plaintext, respectively. The post-challenge algorithm is also identical for all three adversaries; call it C . The advantage of B over random guessing is then bounded by
C ( Enc k ( M 0 ) ) C ( Enc k ( M 1 ) ) 1 = C ( Enc k ( M 0 ) ) C ( Enc k ( M 1 ) ) C ( Enc k ( R ) ) + C ( Enc k ( R ) ) 1 C ( Enc k ( M 0 ) ) C ( Enc k ( R ) ) 1 + C ( Enc k ( M 1 ) ) C ( Enc k ( R ) ) 1 negl ( n ) ,
where the last inequality follows from our initial assumption, applied to both B 0 and B 1 . It follows that Π is IND QCCA 1 . □
Lemma A2.
Let n , m > 1 be integers. Then, the following holds where ω ( m ) is the prime omega function:
1 j n gcd ( j , m ) = 1 1 = n φ ( m ) m + O 2 ω ( m ) .
For completeness, we include a short and simple proof of the above statement.
Proof ([35])
j = 1 gcd ( j , m ) = 1 n 1 = j = 1 n d gcd ( j , m ) μ ( d ) = d m μ ( d ) j = 1 j 0 ( mod d ) n 1
Here, μ denotes the Möbius function. The sum over j = 1 , , n is equal to n d = n d + O ( 1 ) . Therefore,
n d m μ ( d ) d + O d m | μ ( d ) | = n φ ( m ) m + O ( 2 ω ( m ) ) .
Putting everything together, we arrive at the equation,
1 j n gcd ( j , m ) = 1 1 = n φ ( m ) m + O 2 ω ( m ) ,
thereby completing the proof. □

References

  1. Chen, L.; Jordan, S.; Liu, Y.K.; Moody, D.; Peralta, R.; Perlner, R.; Smith-Tone, D. Report on Post-Quantum Cryptography; Technical Report; National Institute of Standards and Technology: Gaithersburg, MD, USA, 2016. [CrossRef]
  2. Shor, P.W. Algorithms for quantum computation: Discrete logarithms and factoring. In Proceedings of the 35th Annual Symposium on Foundations of Computer Science, Santa Fe, NM, USA, 20–22 November 1994; IEEE: Piscataway, NJ, USA, 1994; pp. 124–134. [Google Scholar] [CrossRef]
  3. Regev, O. On lattices, learning with errors, random linear codes, and cryptography. J. ACM 2005, 56, 34:1–34:40. [Google Scholar] [CrossRef]
  4. National Institute of Standards and Technology (NIST). Post-Quantum Cryptography; NIST: Gaithersburg, MD, USA, 2017.
  5. Kuwakado, H.; Morii, M. Quantum distinguisher between the 3-round Feistel cipher and the random permutation. In Proceedings of the 2010 IEEE International Symposium on Information Theory, Austin, TX, USA, 13–18 June 2010; IEEE: Piscataway, NJ, USA, 2010; pp. 2682–2685. [Google Scholar] [CrossRef] [Green Version]
  6. Kuwakado, H.; Morii, M. Security on the quantum-type Even-Mansour cipher. In Proceedings of the 2012 International Symposium on Information Theory and its Applications, Honolulu, HI, USA, 28–31 October 2012; IEEE: Piscataway, NJ, USA, 2012; pp. 312–316. [Google Scholar]
  7. Kaplan, M.; Leurent, G.; Leverrier, A.; Naya-Plasencia, M. Breaking symmetric cryptosystems using quantum period finding. In Advances in Cryptology—CRYPTO 2016; Robshaw, M., Katz, J., Eds.; Springer: Berlin/Heidelberg, Germany, 2016; pp. 207–237. [Google Scholar] [CrossRef] [Green Version]
  8. Santoli, T.; Schaffner, C. Using Simon’s algorithm to attack symmetric-key cryptographic primitives. In Quantum Information & Computation; Rinton Press: Paramus, NJ, USA, 2017; pp. 65–78. [Google Scholar] [CrossRef]
  9. Simon, D.R. On the power of quantum computation. SIAM J. Comput. 1997, 26, 1474–1483. [Google Scholar] [CrossRef]
  10. Gagliardoni, T.; Hülsing, A.; Schaffner, C. Semantic security and indistinguishability in the quantum world. In Advances in Cryptology—CRYPTO 2016; Robshaw, M., Katz, J., Eds.; Springer: Berlin/Heidelberg, Germany, 2016; pp. 60–89. [Google Scholar] [CrossRef] [Green Version]
  11. Bleichenbacher, D. Chosen ciphertext attacks against protocols based on the RSA encryption standard PKCS #1. In Advances in Cryptology—CRYPTO ’98; Krawczyk, H., Ed.; Springer: Berlin/Heidelberg, Germany, 1998; pp. 1–12. [Google Scholar] [CrossRef] [Green Version]
  12. Boneh, D.; Zhandry, M. Secure signatures and chosen ciphertext security in a quantum computing world. In Advances in Cryptology—CRYPTO 2013; Canetti, R., Garay, J.A., Eds.; Springer: Berlin/Heidelberg, Germany, 2013; pp. 361–379. [Google Scholar] [CrossRef] [Green Version]
  13. Boneh, D.; Zhandry, M. Quantum-secure message authentication codes. In Advances in Cryptology—EUROCRYPT 2013; Johansson, T., Nguyen, P.Q., Eds.; Springer: Berlin/Heidelberg, Germany, 2013; pp. 592–608. [Google Scholar] [CrossRef] [Green Version]
  14. Broadbent, A.; Jeffery, S. Quantum homomorphic encryption for circuits of low T-gate complexity. In Advances in Cryptology—CRYPTO 2015; Gennaro, R., Robshaw, M., Eds.; Springer: Berlin/Heidelberg, Germany, 2015; pp. 609–629. [Google Scholar] [CrossRef] [Green Version]
  15. Zhandry, M. How to construct quantum random functions. In Proceedings of the 2012 IEEE 53rd Annual Symposium on Foundations of Computer Science, New Brunswick, NJ, USA, 20–23 October 2012; IEEE: Piscataway, NJ, USA, 2012; pp. 679–687. [Google Scholar] [CrossRef] [Green Version]
  16. Zhandry, M. A note on quantum-secure PRPs. arXiv 2016, arXiv:1611.05564. [Google Scholar]
  17. Bernstein, E.; Vazirani, U. Quantum complexity theory. SIAM J. Comput. 1997, 26, 1411–1473. [Google Scholar] [CrossRef]
  18. Alkim, E.; Bos, J.W.; Ducas, L.; Longa, P.; Mironov, I.; Naehrig, M.; Nikolaenko, V.; Peikert, C.; Raghunathan, A.; Stebila, D.; et al. FrodoKEM—Learning With Errors Key Encapsulation; Submission to the NIST Post-Quantum Cryptography standardization project; Round 2. Revised July 2, 2019. unpublished work.
  19. Lindner, R.; Peikert, C. Better key sizes (and attacks) for LWE-based encryption. In Topics in Cryptology—CT-RSA 2011; Kiayias, A., Ed.; Springer: Berlin/Heidelberg, Germany, 2011; pp. 319–339. [Google Scholar] [CrossRef]
  20. Lyubashevsky, V.; Peikert, C.; Regev, O. A toolkit for ring-LWE cryptography. In Advances in Cryptology—EUROCRYPT 2013; Johansson, T., Nguyen, P.Q., Eds.; Springer: Berlin/Heidelberg, Germany, 2013; pp. 35–54. [Google Scholar] [CrossRef] [Green Version]
  21. Lyubashevsky, V.; Peikert, C.; Regev, O. On ideal lattices and learning with errors over rings. J. ACM 2013, 60, 43:1–43:35. [Google Scholar] [CrossRef]
  22. Grilo, A.B.; Kerenidis, I.; Zijlstra, T. Learning with errors is easy with quantum samples. arXiv 2017, arXiv:1702.08255. [Google Scholar] [CrossRef] [Green Version]
  23. Fujisaki, E.; Okamoto, T. Secure integration of asymmetric and symmetric encryption schemes. In Advances in Cryptography—CRYPTO 1999; Springer: Berlin/Heidelberg, Germany, 1999; pp. 537–554. [Google Scholar]
  24. Goldreich, O.; Levin, L.A. A hard-core predicate for all one-way functions. In Proceedings of the Twenty-first Annual ACM Symposium on Theory of Computing (STOC ’89), Seattle, WA, USA, 14–17 May 1989; ACM: New York, NY, USA, 1989; pp. 25–32. [Google Scholar] [CrossRef]
  25. Goldreich, O.; Goldwasser, S.; Micali, S. How to construct random functions. J. ACM 1986, 33, 792–807. [Google Scholar] [CrossRef]
  26. Nayak, A. Optimal lower bounds for quantum automata and random access codes. In Proceedings of the 40th Annual Symposium on Foundations of Computer Science, New York City, NY, USA, 17–19 October 1999; pp. 369–376. [Google Scholar] [CrossRef] [Green Version]
  27. Ambainis, A.; Leung, D.; Mancinska, L.; Ozols, M. Quantum random access codes with shared randomness. arXiv 2008, arXiv:0810.2937. [Google Scholar]
  28. Kitaev, A.Y. Quantum measurements and the abelian stabilizer problem. arXiv 1995, arXiv:quant-ph/9511026. [Google Scholar]
  29. Hales, L.; Hallgren, S. An improved quantum Fourier transform algorithm and applications. In Proceedings of the 41st Annual Symposium on Foundations of Computer Science, Redondo Beach, CA, USA, 12–14 November 2000; pp. 515–525. [Google Scholar] [CrossRef]
  30. Goldreich, O. Foundations of Cryptography: Volume 2, Basic Applications; Cambridge University Press: Cambridge, UK, 2009. [Google Scholar]
  31. Cormen, T.H.; Leiserson, C.E.; Rivest, R.L.; Stein, C. Introduction to Algorithms, 2nd ed.; The MIT Press: Cambridge, MA, USA, 2001. [Google Scholar]
  32. Alkim, E.; Ducas, L.; Pöppelmann, T.; Schwabe, P. Post-quantum key exchange—A new hope. In Proceedings of the 25th USENIX Security Symposium (USENIX Security 16), Austin, TX, USA, 10–12 August 2016; USENIX Association: Austin, TX, USA, 2016; pp. 327–343. [Google Scholar]
  33. Bshouty, N.H.; Jackson, J.C. Learning DNF over the uniform distribution using a quantum example oracle. SIAM J. Comput. 1998, 28, 1136–1153. [Google Scholar] [CrossRef] [Green Version]
  34. Tomczak-Jaegermann, N. The moduli of smoothness and convexity and the Rademacher averages of the trace classes Sp (1≤p<). Stud. Math. 1974, 50, 163–182. [Google Scholar]
  35. Humphries, P. Reference for Euler Totient Function Identity? Mathematics Stack Exchange. Available online: https://math.stackexchange.com/q/2889027 (accessed on 8 May 2012).
Figure 1. IndGame from Definition 4.
Figure 1. IndGame from Definition 4.
Cryptography 04 00010 g001
Figure 2. Quantum random access code construction for the pseudorandom function ( PRF ) scheme.
Figure 2. Quantum random access code construction for the pseudorandom function ( PRF ) scheme.
Cryptography 04 00010 g002
Figure 3. Quantum random access code construction for the pseudorandom permutation ( PRP ) scheme.
Figure 3. Quantum random access code construction for the pseudorandom permutation ( PRP ) scheme.
Cryptography 04 00010 g003
Figure 4. Dividing Z q into c = q / b blocks, starting from a. The first c 1 blocks, labelled I 0 ( a , b ) , , I c 2 ( a , b ) , have size b and the last, labelled I c 1 ( a , b ) , contains the remaining b ( c b q ) b elements of Z q .
Figure 4. Dividing Z q into c = q / b blocks, starting from a. The first c 1 blocks, labelled I 0 ( a , b ) , , I c 2 ( a , b ) , have size b and the last, labelled I c 1 ( a , b ) , contains the remaining b ( c b q ) b elements of Z q .
Cryptography 04 00010 g004

Share and Cite

MDPI and ACS Style

Alagic, G.; Jeffery, S.; Ozols, M.; Poremba, A. On Quantum Chosen-Ciphertext Attacks and Learning with Errors. Cryptography 2020, 4, 10. https://doi.org/10.3390/cryptography4010010

AMA Style

Alagic G, Jeffery S, Ozols M, Poremba A. On Quantum Chosen-Ciphertext Attacks and Learning with Errors. Cryptography. 2020; 4(1):10. https://doi.org/10.3390/cryptography4010010

Chicago/Turabian Style

Alagic, Gorjan, Stacey Jeffery, Maris Ozols, and Alexander Poremba. 2020. "On Quantum Chosen-Ciphertext Attacks and Learning with Errors" Cryptography 4, no. 1: 10. https://doi.org/10.3390/cryptography4010010

Article Metrics

Back to TopTop