FRAST: TFHE-friendly Cipher Based On Random S-Boxes
FRAST: TFHE-friendly Cipher Based On Random S-Boxes
Random S-boxes
1 Introduction
2
Client Server
nc
k
EvalHE (E)
k E EncHE
Online
m EncHE
EncHE (m)
3
In terms of designing TFHE-friendly ciphers, homomorphic nonlinear opera-
tion by PBS removes the requirement of the algebraic simplicity of the nonlinear
layers. On the other hand, programmable bootstrapping requires that either one
padding bit is empty in the most significant bit (MSB) of the value hidden in
the ciphertext4 , or the table is negacyclic. For example, the Elisabeth cipher [25],
first proposed as a TFHE-friendly cipher, uses 4-bit negacyclic S-boxes in the
nonlinear layers.
Regardless of which HE scheme is used, an HE-friendly cipher is typically de-
signed as a stream cipher. The authors of Kreyvium [17], a variant of Trivium [27]
with 128-bit security, first claimed that with a stream cipher, a keystream can
be precomputed independently of a message in the transciphering framework,
leading to simple homomorphic decryption in the online phase5 . Since then, most
HE-friendly ciphers have been designed as stream ciphers. As the online phase
can be made simple with a stream cipher, high throughput for keystream eval-
uation in the offline phase becomes of practical relevance, in particular, in an
environment where a large amount of data is transferred.
4
Our WoP-PBS uses three GenPBS operations in a naive evaluation with-
out requiring additional evaluation keys or larger TFHE parameters for a larger
PBS precision. To the best of our knowledge, ComBo [23] is the only WoP-PBS
method satisfying the above constraints, while it uses four GenPBS operations
in its naive evaluation. Combined with the multi-value PBS [18] or PBSman-
yLUT [22], it is possible to reduce one GenPBS for both our WoP-PBS and
ComBo. Using parallel computation with log p threads, the latency of our WoP-
PBS becomes almost the same as a single GenPBS, where the plaintext space
is Zp for some power-of-two p. For ComBo, the latency can be reduced to two
GenPBS operations using parallel computation with two threads.
The second feature of our design is that the round function is based on ran-
domly generated S-boxes for some rounds. We note that the TFHE evaluation
of an S-box is independent of its structure unless it is constant or negacyclic.
Exploiting this property of the TFHE operation, random S-boxes efficiently mit-
igate various attacks using multiple input-output pairs from a fixed function. On
the other hand, some rounds of FRAST are still based on fixed S-boxes to guar-
antee concrete security against algebraic attacks.
We implement FRAST using the tfhe-rs library [50]. FRAST achieves 2.768
(resp. 10.57) times higher throughput compared to Kreyvium (resp. Elisabeth) on
the server-side offline phase.
5
by an algebraic attack [34]. After that, Hoffmann et al. [37] proposed several
patches for Elisabeth, named Elisabeth-b, Gabriel and Margrethe, whose TFHE
evaluation cost is at least twice more than Elisabeth under a single thread.
For the other type of TFHE-friendly ciphers, Balenbois et al. [4] proposed to
use Trivium and Kreyvium in the transciphering framework with TFHE. Kreyvium
is a variant of a stream cipher Trivium of 80-bit security, that supports a larger
key to achieve 128-bit security. Once an initial vector IV is chosen, the key
and IV are loaded on the registers. The registers are updated by a nonlinear
function, which also generates keystream bits after some initialization rounds.
They presented an efficient TFHE evaluation of Trivium and Kreyvium keystreams
by the multithreading technique.
2 Preliminaries
2.1 Notations
Throughout the paper, bold lowercase letters (resp. bold uppercase letters) de-
note vectors (resp. matrices). For two vectors (bit strings) a and b, their con-
catenation is denoted by a∥b. ⌊r⌉ denotes the nearest integer to r, rounding
upwards in case of a tie. A real interval [a, b) has an alternative notation: [a, b[.
For two integers a and b, Z ∩ [a, b[ is denoted by Ja, bJ. For an integer q, we
identify Zq = Z/qZ with J−q/2, q/2J in the context of TFHE. The set B and [n]
denote {0, 1} and {1, 2, . . . , n}, respectively, for a positive integer n. For a set
S, we will write a ← S to denote that a is chosen from S uniformly at random.
For a probability distribution D, a ← D denotes that a is sampled according to
the distribution D. Unless stated otherwise, all logarithms are to the base 2.
In the context of TFHE, we use p and q for the moduli of messages and
ciphertexts, respectively. We only consider the case where p and q are powers
of two. For a power-of-two N , we denote the cyclotomic ring Z[X]/(X N + 1)
by ZN [X]. For the polynomial ring over Zq , we write Rq,N = Zq [X]/(X N + 1).
Similarly, we write BN [X] = B[X]/(X N + 1).
2.2 TFHE
In this section, we briefly review the core concepts of the TFHE scheme. Al-
though TFHE itself is mathematically defined over the real torus T = R/Z [20],
it is common to use the discretized torus 1q Z/Z for q = 232 or q = 264 considering
its implementation. Hence, we identify the discretized torus 1q Z/Z as Zq , which
is commonly used in the recent descriptions of TFHE [21, 22, 8].
LWE, RLWE, and GLWE Ciphertexts. Under a secret key S ∈ Rkq,N ,
a message M ∈ Rp,N is encrypted into a GLWE ciphertext c ∈ Rk+1
q,N with a
scaling factor ∆ such that ∆ ≤ q/p as follows [16].
k
X
c = GLWES (∆ · M ) = (A1 , . . . , Ak , B = Ai · Si + [M · ∆]q + E)
i=1
6
where S = (S1 , . . . , Sk ), Ai ← Rq,N for i = 1, 2, . . . , k, and E ← χσ for some
Gaussian distribution χσ denoting the error distribution. (A1 , . . . , Ak ) and B
are called the mask and the body of the GLWE ciphertext c, respectively, and
k is called the GLWE dimension. It is common to use a binary secret key in the
TFHE scheme, so we only deal with binary secret keys in this paper.
A GLWE ciphertext with N = 1 is called an LWE ciphertext. In this case,
it is common to use n to denote the LWE dimension instead of k, so that an
LWE ciphertext is usually denoted (a1 , . . . , an , b) ∈ Zn+1
q . When k = 1, a GLWE
ciphertext is called an RLWE ciphertext. In this paper, we refer LWE ciphertexts
separately from GLWE ciphertexts of N > 1.
The decryption of a GLWE ciphertext is computing its phase, which is defined
as B − ⟨(A1 , . . . , Ak ), S⟩, followed by rounding the phase by the scaling factor ∆.
The decryption works correctly if the error contained in the ciphertext is small
enough to be eliminated during the rounding by ∆.
From the definition of the GLWE ciphertext, the addition of two GLWE
ciphertexts under the same secret key results in the addition of their internal
plaintexts in Rq,N . Multiplying the ciphertext by a scalar plaintext is possi-
ble by iterating the addition several times. Both the addition and the scalar
multiplication increase the error of the resulting ciphertext linearly.
GGSW Ciphertexts. In the case of nonlinear operations such as multiplica-
tion, TFHE uses another type of ciphertext called GGSW [33]. Let B ∈ N be a
ℓ(k+1)×(k+1)
power-of-two and ℓ ∈ N. A GGSW ciphertext C ∈ Rq,N of a message
k
M ∈ ZN [X] under a secret key S ∈ BN [X] is an ℓ(k + 1) × (k + 1) matrix over
Rq,N defined as follows.
q
C = GLWES −Si · j M
B (i,j)∈[k+1]×[ℓ]
C c = GadgetDecomp(c) · C
ℓ(k+1)
where GadgetDecomp(c) ∈ Rq,N is the gadget decomposition of c [33, 22]
of which coefficients are lying in J−B/2, B/2J. The external product between
GGSW and GLWE ciphertexts defines homomorphic module scalar multipli-
cation on the discretized torus 1q Z/Z. Roughly speaking, the external product
increases the error by the magnitude of the plaintext in the GGSW ciphertext.
Thus it is common to use GGSW ciphertext encrypting a single bit of message
in the external product.
The controlled mux gate, dubbed CMux, is the key operation used in TFHE.
Suppose two GLWE ciphertexts c0 and c1 are given along with a secret Boolean
7
value b encrypted to a GGSW ciphertext C, where all three ciphertexts are
encrypted with the same key S. Then one may select cb without knowing b by
CMux(C, c0 , c1 ) = (c1 − c0 ) C + c0 .
8
Plaintext Encoding in TFHE. To keep the padding bit zero, Bergerat
et al. [8] proposed a new encoding method for TFHE splitting the traditional
plaintext space into three parts: one (or more) bit of padding at the MSB, the
carry subspace after the padding bits, and the message subspace at the LSBs.
By tracking the maximum possible value in the ciphertext, it clears the carry
space before the padding bit is filled. For example, the default parameters of
tfhe-rs library for shortint type, called PARAM MESSAGE 2 CARRY 2, uses the
encoding that consists of two message bits, two carry bits, and one padding bit.
d ω
!
X n
i=1
i
ignoring the constant factor, where 2 ≤ ω ≤ 3 denotes the linear algebra con-
stant.
Extended Linearization. Courtois et al. [26] proposed the eXtended Lin-
earization algorithm that can be used when the number of equations is less
than the number of monomials. Given a system of m equations of degree d in n
variables over F2 , the XL algorithm extends the system by multiplying all the
monomials of degree at most D − d for some D(> d) to obtain a larger num-
ber of (linearly independent) equations of degrees at most D. As the number of
equations grows faster than the number of monomials, it is possible to solve the
system for a sufficiently large D. The problem is that it is hard to determine the
smallest D, called the solving degree.7
When designing a symmetric cipher, we can assume that all the resulting
equations are linearly independent, which is in favor of an adversary. Then it is
7
The recent results show that the solving degree is the same as the degree of regular-
ity [47, 2].
9
possible to estimate the solving degree D as the smallest one satisfying
D−d D
!
X n X n
m≥
i=0
i i=1
i
assuming that all the monomials appear in the extended system of equations.
Then the complexity of the XL algorithm is given by
D ω
!
X n
(1)
i=1
i
ignoring the constant factor. There are some optimized variants such as the
Wiedemann XL algorithm [48], while using (1) with ω = 2 still gives a lower
bound on its complexity.
Hybrid Strategy. A hybrid strategy that guesses the values of some variables
can be applied to the linearization attacks. The complexity of the hybrid trivial
linearization after guessing k variables is given by
d !ω
k
X n−k
min 2 (2)
k
i=1
i
10
The degree of regularity dreg is determined by the smallest degree of the term
with a non-positive coefficient in the series Tm,n . Given the degree of regularity
dreg over F2 , the complexity of computing a Gröbner basis is known to be
ω
n
O . (5)
dreg
3.1 Specification
A stream cipher FRAST with 128-bit security takes as input a 256-bit key k ∈
Z64
16 and a 128-bit nonce nc ∈ {0, 1}
128
, and returns a 128-bit keystream block
32
knc ∈ Z16 . The FRAST cipher has two types of round functions: the randomized
one and the fixed one. Both types of round functions have the same structure
except for the underlying S-boxes.
In a nutshell, FRAST consists of 40 rounds, namely,
FRAST[k, nc] = RF[k, nc, 40] ◦ RF[k, nc, 39] ◦ · · · ◦ RF[k, nc, 1]
where RF[k, nc, i] is the i-th round function using secret key k and nonce nc. For
(x1 , . . . , x32 ) ∈ Z32 32
16 , RF[k, nc, i](x1 , . . . , x32 ) = (y1 , . . . , y32 ) ∈ Z16 is defined as
(nc; i) (i)
yj = xj + Serf (x1 + rkj ) for j = 2, 3, . . . , 32,
(nc; i) (i)
y1 = x1 + Scrf (y2 + y3 + · · · + y32 + rk1 )
11
nc XOF
x1 x2 x3 x32
(i)
rk2
(nc; i)
Serf
(i)
rk3 ···
(nc; i)
Serf
4-bit (i) .. 4-bit 4-bit 4-bit
rk32 .
(nc; i)
Serf
(nc; i)
Scrf
(i)
rk1
y1 y2 y3 y32
(i) (i)
Fig. 2: The i-th round function of FRAST. rk1 , . . . , rk32 are the i-th round keys.
(nc; i) (nc; i)
(Scrf (0), . . . , Scrf (7)) are sampled by the output from the underlying ex-
tendable output function XOF with input nc, and the other function values are
determined by the negacyclic property of the S-boxes.
The fixed rounds of FRAST use the same fixed S-box defined in Table 1 for
(nc; i) (nc; i)
their S-boxes Serf and Scrf . The S-box is one of the golden S-boxes of size
4-bit proposed in [46].
x 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
S(x) 0 3 5 8 6 9 12 7 13 10 14 4 1 15 11 2
Table 1: The fixed S-box used in the fixed rounds of FRAST.
12
one computes
z[ctr] = FRAST[k, nc∥ctr](ic),
where ic denotes a constant (0, 1, . . . , 15, 0, 1, . . . , 15) ∈ Z32
16 . Figure 3 shows the
overall structure of FRAST in the counter mode.
Fig. 3: The overall structure of FRAST in the counter mode, where ic is the
public input constant and z[ctr] is the keystream. Homomorphic operations are
performed in the box with thick lines. The i-th round is a fixed round if i is a
multiple of 5, and a random round otherwise.
13
FRAST encryption function. Since TFHE evaluates S-boxes by PBS operations,
the random structure of the S-box will not affect the evaluation cost of FRAST.
The size of the S-boxes in FRAST is 4 bits, which is common in symmetric
ciphers. As the performance of PBS operation with 4-bit precision is sufficiently
efficient11 , we choose 4-bit S-boxes for FRAST. For the efficiency of the homomor-
phic S-box evaluation, the random S-boxes are defined by negacyclic functions
whose half of the function values are sampled uniformly at random from Z16 ,
determining the others by the negacyclic property.
On the other hand, the fixed S-box of FRAST is non-negacyclic. It is one
of the golden S-boxes proposed in [46], which is known to have no polynomial
representation over Z16 (see Lemma 1). Although FRAST uses addition over Z16 ,
we analyze its security against algebraic attack with the XOR-variant of FRAST
as done in the Elisabeth cipher, focusing on classical algebraic properties over
F2 . Over F2 , all the output bits of the S-box have algebraic degree 3 and all
the input bits affect the output bits nonlinearly. Its inverse also has the same
algebraic properties. The number of quadratic equations induced by the S-box
is 21, which is the minimum for 4-bit S-boxes. The algebraic representations
of the S-box are given in Supplementary Material B. Zhang et al. [51] argue
that the golden S-boxes proposed in [46] might be vulnerable to differential and
linear attacks due to certain properties of the linear layers combined with the
S-boxes. When it comes to FRAST, randomly generated S-boxes mitigate such
vulnerabilities.
FRAST uses 256-bit keys, providing 128-bit security. The key length typically
affects the communication overload of the transciphering since it should be sent
to the server as a TFHE-ciphertext. When it comes to FRAST, most of the
round keys are sent to the server to enable the double blind rotation, so that
the length of the master key itself does not affect the communication overload.
Hence, to achieve stronger security against algebraic attacks, FRAST uses master
keys longer than the target level of security.
14
GenPBS of (t − 1)-bit precision). Using the additional evaluation keys of large
size requires an additional communication overload, so it might weaken the pur-
pose of the transciphering framework. WoP-PBS of t-bit precision using GenPBS
of t-bit precision is not compatible with the double blind rotation, a technique for
the FRAST evaluation described in Section 4.2, since the double blind rotation
requires one more padding bit to evaluate a non-negacyclic function. ComBo,
proposed by Clet et al. [23], is the first WoP-PBS method that can compute an
arbitrary function of t-bit precision using GenPBS of (t − 1)-bit precision with-
out additional evaluation keys. However, ComBo is also not compatible with the
double blind rotation since it uses GenPBS operations in depth 2.
15
Our WoP-PBS requires 3 GenPBS operations in its naive evaluation: one
for each of fmsb-odd , ClearMSB, and fmsb-even . When the multi-value PBS [18] or
PBSmanyLUT [22] can be used together, one can compute fmsb-odd and ClearMSB
in a single GenPBS operation since they compute negacyclic functions on the
same input.
Using parallel computation, a variant of our WoP-PBS can achieve almost
the same latency with a single GenPBS operation as follows. After decomposing
f into fmsb-odd and fmsb-even , one can further decompose fmsb-even using the same
method recursively by regarding fmsb-even as a function on J0, p/2J. For example,
when p = 16, an arbitrary function f on J0, pJ is decomposed into 4 negacyclic
functions f0 , f1 , f2 , f3 and one constant f4 such that
The round function of FRAST requires multiple S-box calls on the inputs of
the form x1 + rkj for j = 2, . . . , ℓ where x1 is the value of the first branch,
rkj ’s are the round keys, and ℓ is the number of branches. In the GenPBS
operation computing a function f on x1 + rkj , the blind rotation step rotates a
GLWE ciphertext encoding f by a factor of x1 + rkj . In a naive way, evaluating
f (x1 + rkj ) for all j = 2, . . . , ℓ requires rotating a GLWE ciphertext encoding f
by x1 + rkj independently for all j = 2, . . . , ℓ.
The idea of the double blind rotation is that the result of the rotation by x1
can be shared. Suppose an LWE ciphertext of x1 without padding and GGSW
ciphertexts of the round key bits rkj,b are given where rkj = rkj,4 ∥ . . . ∥rkj,1 for
j = 2, 3, . . . , ℓ and b = 1, . . . , 4. For a negacyclic function f , let GLWE(Pf ) be
a GLWE ciphertext of Pf ∈ Rq,N that encodes f on its coefficients. The blind
rotation on GLWE(Pf ) by LWE(x1 ) outputs GLWE(Pf · X −x̂1 ) where x̂1 is a
scaled value of x1 such that the constant term of Pf · X −x̂1 becomes f (x1 ). Then
12
Estimating the error variance as log p times larger one in the average-case requires
the heuristic assumption that outputs of the GenPBS operations on the inputs that
differ only by constant factors have independent errors.
16
ˆ ˆ
one can compute GLWE(Pf · X −(x̂1 +rkj ) ) by multiplying X −rkj homomorphi-
cally where rkˆ j is the scaled value of rkj . Given the GGSW ciphertexts of the
round key bits, it can be computed by additional 4 CMux gates. Therefore, one
can compute LWE(f (x1 + rkj )) for all j = 2, . . . , ℓ by a single GenPBS followed
by 4(ℓ − 1) CMux gates.
Two issues remain for applying the double blind rotation on FRAST. First,
the fixed S-box in the FRAST round function is not negacyclic, requiring WoP-
PBS for its evaluation instead of GenPBS. In this case, a WoP-PBS method that
does not perform GenPBS operations in depth 2 is required. Evaluating a non-
negacyclic function with the help of padding bits is also possible, but the double
blind rotation requires two bits of padding to guarantee xˆ1 + rk ˆ i < N . Our WoP-
PBS method can resolve this issue for evaluating FRAST with TFHE parameters
supporting a GenPBS operation in 4-bit precision. When S is decomposed into
Smsb-odd and Smsb-even , the double blind rotation can be applied to Smsb-odd as
it is negacyclic. In the case of Smsb-even , one can make two bits of padding in
the ciphertext of ClearMSB(x1 ) by one more GenPBS operation to change its
scaling factor, allowing the double blind rotation using a GenPBS operation of
4-bit precision13 . See Supplementary Material H for details of FRAST evaluation
by the double blind rotation.
The other is computing the GGSW ciphertexts of the round key bits. Since
the round key bits are fixed, we directly transfer the round key bits used for
the double blind rotation packed in the GLWE ciphertexts once, and convert
it into GGSW ciphertexts on the server-side by the GLWEtoGGSW conversion
proposed in [19]14 . The communication overload for the round keys and the
evaluation keys for the conversion is only a few MBs.
5 Security Analysis
In this work, we will consider the standard “secret-key model”, where an ad-
versary arbitrarily chooses a nonce, and obtains the corresponding keystream
without any information on the secret key. The related-key and the known-key
models are beyond the scope of this paper. We also limit the number of encryp-
tions under the same key up to 264 blocks since otherwise one would not be able
to avoid a nonce collision (when nonces are chosen uniformly at random).
The extendable output function whose output determines the random S-
boxes is modeled as a random oracle, so an adversary is not able to freely choose
the S-boxes. The input to the FRAST is also fixed as the known constant ic.
Therefore, in this model, we believe that FRAST is secure against any type of
chosen-plaintext attacks such as (higher-order) differential, truncated differen-
13
Using the variant of our WoP-PBS that fully decomposes a function into negacyclic
functions enables the double blind rotation using a GenPBS operation of 3-bit pre-
cision at the cost of more CMux gate operations.
14
It only deals with the case of converting RLWE to RGSW, but converting GLWE
to GGSW for k > 1 is also possible using the same idea.
17
tial, invariant subspace trail, and cube attacks. On the other hand, we assume
that the specifications of the random S-boxes are given to the attacker.
Overall, in this section, our focus will be mainly put on algebraic and linear
attacks, which are possible in the known-plaintext models. We analyze the secu-
rity of FRAST against algebraic (resp. linear) attacks based on the fixed (resp.
random) round functions of FRAST.
18
5.1.1 Trivial Linearization
One can build a system of equations using only the key variables as unknowns
and apply trivial linearization attack. The attack cost depends on the number
of monomials appearing in the system, determined by the degree of the system.
Consider a single round function of FRAST with input (x1 , x2 , . . . , xℓ ), output
(y1 , y2 , . . . , yℓ ), and round key (rk1 , rk2 , . . . , rkℓ ) where xj , yj , rkj ∈ F42 for j =
1, 2, . . . , ℓ15 . Then we have
y1 = x1 + S(y2 + y3 + · · · + yℓ + rk1 ),
yj = xj + S(x1 + rkj ) for j = 2, 3, . . . , ℓ. (6)
Since all the outputs of S are of degree 3, the degree of S(x + rk) is at least
deg x + 2, assuming that rkj is a dense linear combination of the master key.
Then, we have deg yj ≥ deg x1 + 2 for j = 2, . . . , ℓ and deg y1 ≥ deg x1 + 4. Let
(i−1) (i−1) (i) (i)
(x1 , . . . , xℓ ) (resp. (x1 , . . . , xℓ )) be the input (resp. output) of the i-th
(1)
round function. From deg xj = 3 for j = 2, . . . , ℓ, we obtain
(i)
deg x1 ≥ 4i + 1,
(i)
deg xj ≥ 4i − 1 for j = 2, . . . , ℓ
5.1.2 XL Attack
Other than the equations only in the key variables, one can build a system of
equations of low degrees by introducing new variables other than the key vari-
ables or guessing some bits of the internal state. Then it is possible to apply
algebraic attacks such as the XL attack and the Gröbner basis attack. We con-
sider the following three kinds of systems for FRAST.
1. A system of equations by introducing new intermediate variables for each
round.
15
ℓ = 32 in the actual specification of FRAST.
19
2. A system of equations by introducing new variables for the first branch of
each round.
3. A system of equations by guessing the values of the first branch for each
round.
New Variables for the Intermediate State. One can build a system of
equations by introducing new intermediate variables for each round. In this case,
using implicit relations induced by S leads to a larger number of equations of
(i−1) ℓ (i)
lower degrees than using explicit relations. Let (xj )j=1 and (xj )ℓj=1 denote
the input and the output of the i-th round function, respectively. From the im-
plicit relation S ′ (x, y) = 0 induced by S, one can obtain the following equations.
(i) (i) (i) (i) (i) (i−1)
S ′ x2 + x3 + · · · + xℓ + rk1 , x1 − x1 =0
(i−1) (i) (i) (i−1)
S ′ x1
+ rkj , xj − xj = 0 for j = 2, 3, . . . , ℓ (7)
(i)
where (rkj )ℓj=1 denotes the i-th round key which is linear to the master key.
Since S-box S has 21 implicit quadratic equations over F2 , each round induces
21ℓ quadratic equations. For r rounds of FRAST, one obtains 21ℓr quadratic
equations in 256 + 128(r − 1) variables. When m keystream blocks are used, one
obtains 21ℓrm quadratic equations in 256 + 128(r − 1)m variables.
New Variables for the First Branch. Since the first branch is common to
(i)
all the S-box evaluations, introducing new variables for (x1 )r−1
i=1 might signifi-
(r)
cantly reduce the degree of the keystream xj for all j = 2, 3, . . . , ℓ. Regarding
(i)
(x1 )r−1
i=1 as new variables, one obtains two types of equations: one from the
(r) (i)
keystream (xj )ℓj=2 and the other from (x1 )ri=1 . The first type of equations are
r
(r) (0) (i−1) (i)
X
xj = xj + S(x1 + rkj ) (8)
i=1
20
Guessing the First Branch. It is possible to guess the intermediate states
(i)
of the first branch x1 for i = 1, 2, . . . , r − 1, in which case we obtain equations
(r)
of the same degree except that equation (9) becomes linear for i = r since xj
(r)
are known for j = 1, 2, . . . , ℓ. This linear equation determines the value of rk1 ,
reducing the number of variables by 4. Hence, by guessing 4(r − 1) bits of the
intermediate state, one obtains a system of 4(ℓ + r − 2) equations of degree 3 in
252 variables.
(1)
When m keystream blocks are used, the round key rk1 fixed in the first
(r−1)
block determines x1 for all the other blocks. Therefore, one obtains a system
of 4(ℓ + r − 2)m equations of degree 3 in 252 variables by guessing 4(r − 1) +
4(r − 2)(m − 1) bits of the intermediate state of the first branch.
XL Attack Complexity. Table 2 summarizes the complexity of the XL at-
tacks for the above systems according to the number of keystream blocks used
to build the systems. One can find that FRAST is secure against the XL attacks
under 128-bit security even with the independent assumption.
21
ℓ=3 ℓ=3 r=8
log(Time) (s)
log(Time) (s)
log(Time) (s)
10 5
5 0
5
0 −5
0 −10
−5
−5
2 3 4 2 3 4 5 2 3 4 5 6 7
r r ℓ
(a) Intermediate Variables (b) First Branch Variables (c) Guess First Branches
Fig. 4: Gröbner basis computation time of the systems on toy parameters. The
number of rounds and branches are denoted by r and ℓ, respectively. The key
size is set to 4ℓ bits, which is half the actual key size.
The linear attack was originally introduced for binary spaces [41], but it can
also be applied to non-binary spaces [3]. The linear probability of a function
E : Zℓp → Zℓp with input and output masks a, b ∈ Zℓp is defined as follows:
2
E 2πi
LP (a, b) = Ex exp (− ⟨a, x⟩ + ⟨b, E(x)⟩)
p
where x is uniformly distributed over Zℓp . We refer to [3] for the details.
22
Traditional linear cryptanalysis that requires many input-output pairs of a
fixed function does not apply to FRAST since the keystream generating function
of FRAST changes for each keystream block. So in order to analyze the resistance
of FRAST against linear cryptanalysis, we consider the following three strategies
to be combined with linear attacks.
1. Applying nonzero linear masks on the XOF outputs generating the random
S-boxes of FRAST.
2. Collecting input-output pairs that can be analyzed by the same linear trail.
3. Collecting input-output pairs whose random S-boxes have linear relations.
In this section, we show how the above strategies are mitigated by the randomly
generated S-boxes of FRAST.
Nonzero Linear Masks on the XOF Outputs. The first approach is to
apply nonzero linear masks on the XOF outputs that determine the random
S-boxes of FRAST. Although the XOF outputs themselves are not controllable
by an attacker, they can be considered as additional inputs in the KPA model
since they are publicly known. Using this approach, one can apply the linear
cryptanalysis to FRAST by considering it as a fixed function whose input size
is larger than its output size. For example, a negacyclic random S-box S it-
self can be described by its function values (S(0), . . . , S(7)), and the function
LookUpk (x, S) = S(x + k) can be described as a function from Z16 × Z816 to Z16
defined by
7
X
LookUpk (x, S) = (1 {x + k = i} − 1 {x + k = i + 8}) S(i)
i=0
23
Using Compatible Input-Output Pairs. The next approach is to apply the
traditional linear cryptanalysis on data that can be analyzed under the same
linear trail. Suppose one finds a good linear trail on a single input/output pair
of FRAST. In general, applying the trail on the other input/output pair does
not work since the randomly generated S-boxes are different for the two data.
However, if the S-boxes of two data work identically with respect to the linear
approximation by the trail, one can analyze two data using the trail.
To consider such a case, we define two S-boxes S1 and S2 are compatible with
respect to the output linear mask b if b(S1 − S2 ) is constant16 . The probability
that two randomly chosen negacyclic S-boxes are compatible is at most 2−7 .
Since there is at least one active S-box in the non-trivial linear trail of FRAST,
the probability that two data are compatible with respect to a linear trail is at
most 2−224 , which is negligible under 128-bit security. We refer to Supplementary
Material E.2 for the details.
Using Linear Relations of Random S-boxes. One might use data from
multiple instances of FRAST whose random S-boxes have certain linear relations.
If the S-box has a linear relation such as ax + bS(x) = c for all x, then one can
construct input/output linear masks of linear probability 1 for the corresponding
round. When all the active S-boxes have linear relation, then one can use a
linear trail whose linear probability depends only on the fixed rounds. Since
the probability that a random negacyclic S-box has a linear relation is at most
2−6 (see Supplementary Material E.3 for the details), the probability that all
the active random S-boxes have such linear relations is at most 2−192 , which is
sufficiently small at the security level of 128 bits.
Zero-Correlation Attack. In contrast to the classical linear attack finding
a high linear correlation, Bogdanov and Rijmen [9] proposed a variant of linear
attack using linear hulls with correlation zero. This attack is based on the as-
sumption that there might be a linear hull of correlation zero for every secret
key (due to a certain specific structure of the block cipher), while it is not the
case for a truly random permutation. Hence if one knows such a linear hull of
correlation zero and collects 2n−1 input-output pairs under the same key, then
the block cipher can be distinguished from a random permutation.√Later, Bog-
danov and Wang [10] reduced the data complexity down to O(2n / ℓ), where ℓ
is the number of the linear hulls with correlation zero.
The zero-correlation attack is not applicable to FRAST since the output
keystream blocks of FRAST are not produced by a fixed permutation. To gen-
erate keystream blocks of FRAST, we feed a fixed input ic to different encryp-
tion functions based on random S-boxes. If each keystream block of FRAST is
regarded as an output of an independent permutation, then there will be no
correlation between the keystream blocks, giving no distinguishing advantage to
an adversary.
16
b(S1 − S2 ) need not to be zero since the constant difference does not affect the linear
probability.
24
6 Performance Evaluation
– GenPBS parameter
• LWE parameters: n = 742, σLWE = 7.06984 × 10−6
• GLWE parameters: k = 1, N = 2048, σGLWE = 2.94036 × 10−16
• PBS parameters: log BPBS = 23, ℓPBS = 1
• Keyswitching parameters: log BKS = 3, ℓKS = 5
– GLWEtoGGSW parameter
• GGSW parameters of the GLWE secret key: log BSK = 9, ℓSK = 5
• GLWE keyswitching parameters: log Bsubs = 9, ℓsubs = 5
• GGSW parameters of the round key bits: log Brk = 7, ℓrk = 3
With the above parameters, 128-bit security is achieved and the error probability
is upper bounded by 2−40 . See Supplementary Material H for detailed error
analysis. For Elisabeth and Kreyvium, the TwoKS parameters in [25] and the
parameters in [4] are used, respectively. For the performance evaluation, we
consider the case where the actual parameters after the transciphering are the
default parameters of tfhe-rs library for shortint type as in [4].
17
The PARAM MESSAGE 2 CARRY 2 parameters correspond to the case of p = 25 with
Set-II.
18
The authors also left the homomorphic evaluation of Margrethe as an open problem.
19
It has 6 P-cores @ 5.30 GHz and 8 E-cores @ 3.90 GHz, and we only used the 8
E-cores for the benchmark.
25
6.1 Benchmark and Comparison
The transciphering framework with a stream cipher requires only simple subtrac-
tion in the online phase, while, when it comes to TFHE, additional computation
is required after the subtraction for plaintext encoding such as clearing carry bits
and matching the plaintext encoding. Kreyvium clears the carry bit after sub-
traction by a single KSthenGenPBS operation [4]. When it comes to Elisabeth
producing ciphertexts of 4-bit keystream blocks without padding, Cosseron et al.
proposed to use one-bit smaller plaintext space with padding for the resulting ci-
phertext [25]. Although the online phase only requires homomorphic subtraction
for this plaintext encoding, it is not commonly used in TFHE. Most importantly,
the ciphertext expansion ratio becomes greater than 1 since each ciphertext of
4 bits only contains a plaintext of 3 bits.
FRAST produces ciphertexts of 4-bit keystream blocks without padding, too.
In order to support various types of plaintext encoding without ciphertext expan-
sion, we add a bit extraction process at the end of the offline phase; a ciphertext
of 4 bits is decomposed into 4 ciphertexts of a single bit whose plaintext encoding
supports 1-bit plaintext space without carry and padding space. This plaintext
encoding is also called 2-encoding in [11]. This extraction can be done homo-
morphically at the cost of almost one PBS by the multi-value PBS [18] since the
extraction functions are negacyclic under the 2-encoding.
The online phase computes homomorphic subtraction, a single PBS operation
to match the plaintext encoding of the resulting ciphertext, and a keyswitching
to the final TFHE parameters. We note that the online phase performance does
not depend on the cipher, but on the TFHE parameters it uses. Hence, by using
a faster bootstrapping key for the online phase, the online performance can
be improved. For FRAST, we use the bootstrapping key of Kreyvium for the bit
extraction and the online phase. The bootstrapping key of Elisabeth has a similar
performance to that of Kreyvium, so we can say that all the ciphers have almost
the same online performance.
Keystream Evaluation
Cipher Setup (s)
Lat. (ms) Thrp. (bit/s)
Elisabeth - 2049 (per 4-bit) 1.955
Elisabeth-b - 5538 (per 4-bit) 0.749
Gabriel - 4662 (per 4-bit) 0.858
Kreyvium 44.09 (4 threads) 134.0 (per 1-bit) 7.465
FRAST 24.99 (8 threads) 6194 (per 128-bit) 20.66
Table 3: Server-side offline phase performance. The setup time of Kreyvium is
optimized in 4 threads. Keystream evaluation is performed in a single thread.
26
Offline Phase. The offline phase consists of the setup phase and the keystream
evaluation phase. The setup phase is performed only once so that the latency
(optimized by multithreading) should be seen as a more appropriate metric than
the throughput. The setup time of Kreyvium is estimated as 1152 cycles for the
main loop, where each cycle is estimated by 2 KSthenGenPBS operations using
4 threads20 . The setup time of FRAST is spent to convert the GLWE ciphertexts
packing round key bits into GGSW ciphertexts of each round key bit, which can
be optimized by using multiple threads. On the other hand, Elisabeth and its
patches have no setup phase.
The latency for the keystream evaluation can be reduced by using multiple
threads, while it is more efficient to evaluate each keystream block independently
by each thread in terms of throughput. The offline performance of Kreyvium is
estimated by only 7 KSthenGenPBS operations, evaluating a single keystream
bit. The offline performance of Elisabeth is estimated by 96 KSthenGenPBS
operations, evaluating a 4-bit keystream block, followed by 1 KSthenGenPBS
operations for bit extraction. In case of Elisabeth-b (resp. Gabriel), evaluating
4-bit keystream block requires 252 (resp. 220) KSthenGenPBS operations, and
the bit extraction requires 1 KSthenGenPBS. The result is summarized in Ta-
ble 3. One can see that FRAST outperforms Elisabeth and Kreyvium in terms of
throughput by factors of 10.57 and 2.768, respectively.
Online Phase. For all the ciphers, the online performance is estimated by two
GenPBS operations followed by a single keyswitching to the default parameters
for a ciphertext of a 2-bit message, and it only depends on the online phase
parameters. In our setting, we obtain the latency of 46.08 ms for a ciphertext of
a 2-bit message, which implies the throughput of 43.40 bit/s.
Communication Overload. Communication overload is mainly due to ho-
momorphic ciphertexts of the secret keys and the TFHE evaluation keys for
the transciphering. The communication overload of Kreyvium (resp. Elisabeth) is
estimated as 10.72 MB (resp. 12.29 MB).
When it comes to FRAST, the bootstrapping keys for the default parameters
can be recycled in the actual usecase after transciphering, reducing the overall
communication overload. Instead, the bootstrapping keys of Kreyvium are used
for the bit extraction and the online phase, and additional evaluation keys for
the double blind rotation are required. In this way, the communication overload
for FRAST is estimated as 11.88 MB. See Supplementary Material G for details.
References
[1] Albrecht, M.R., Grassi, L., Perrin, L., Ramacher, S., Rechberger, C., Ro-
taru, D., Roy, A., Schofnegger, M.: Feistel Structures for MPC, and More.
20
The setup time for Kreyvium in [4] (which is called warm-up time) is obtained by
dividing the time for 1152 cycles by 64, considering the bit size of FheUint64 type
it computes. In this paper, we consider the total time required for initialization.
27
In: Sako, K., Schneider, S., Ryan, P.Y.A. (eds.) Computer Security – ES-
ORICS 2019. pp. 151–171. Springer International Publishing, Cham (2019).
https://doi.org/10.1007/978-3-030-29962-0 8
[2] Ars, G., Faugère, J.C., Imai, H., Kawazoe, M., Sugita, M.: Comparison Between
XL and Gröbner Basis Algorithms. In: Lee, P.J. (ed.) ASIACRYPT 2004. pp. 338–
353. Springer, Heidelberg (2004). https://doi.org/10.1007/978-3-540-30539-2 24
[3] Baignères, T., Stern, J., Vaudenay, S.: Linear Cryptanalysis of Non Binary Ci-
phers. In: Adams, C., Miri, A., Wiener, M. (eds.) Selected Areas in Cryptography.
vol. 4876, pp. 184–211. Springer (2007). https://doi.org/10.1007/978-3-540-77360-
3 13
[4] Balenbois, T., Orfila, J.B., Smart, N.P.: Trivial Transciphering With Trivium
and TFHE. Cryptology ePrint Archive, Paper 2023/980 (2023), https://eprint.
iacr.org/2023/980, to appear WAHC 2023
[5] Bardet, M., Faugere, J.C., Salvy, B.: On the complexity of Gröbner basis compu-
tation of semi-regular overdetermined algebraic equations. In: Proceedings of the
International Conference on Polynomial System Solving. pp. 71–74 (2004)
[6] Bardet, M., Faugère, J.C., Salvy, B., Spaenlehauer, P.J.: On the complexity of
solving quadratic Boolean systems. Journal of Complexity 29(1), 53–75 (2013).
https://doi.org/10.1016/j.jco.2012.07.001
[7] Beigel, R.: The polynomial method in circuit complexity. In: [1993] Proceedings of
the Eigth Annual Structure in Complexity Theory Conference. pp. 82–95 (1993).
https://doi.org/10.1109/SCT.1993.336538
[8] Bergerat, L., Boudi, A., Bourgerie, Q., Chillotti, I., Ligier, D., Orfila, J.B., Tap, S.:
Parameter Optimization and Larger Precision for (T)FHE. Journal of Cryptology
36, 28 (2023). https://doi.org/10.1007/s00145-023-09463-5
[9] Bogdanov, A., Rijmen, V.: Linear hulls with correlation zero and linear crypt-
analysis of block ciphers. Designs, codes and cryptography 70, 369–383 (2014).
https://doi.org/10.1007/s10623-012-9697-z
[10] Bogdanov, A., Wang, M.: Zero Correlation Linear Cryptanalysis with Reduced
Data Complexity. In: FSE 2012, Washington, DC, USA, March 19-21, 2012. Re-
vised Selected Papers. pp. 29–48. Springer (2012). https://doi.org/10.1007/978-
3-642-34047-5 3
[11] Bon, N., Pointcheval, D., Rivain, M.: Optimized Homomorphic Evaluation of
Boolean Functions. Cryptology ePrint Archive, Paper 2023/1589 (2023), https:
//eprint.iacr.org/2023/1589
[12] Bonte, C., Iliashenko, I., Park, J., Pereira, H.V.L., Smart, N.P.: FI-
NAL: Faster FHE Instantiated with NTRU and LWE. In: Agrawal, S.,
Lin, D. (eds.) ASIACRYPT 2022. pp. 188–215. Springer, Cham (2022).
https://doi.org/10.1007/978-3-031-22966-4 7
[13] Bosma, W., Cannon, J., Playoust, C.: The Magma algebra system.
I. The user language. J. Symbolic Comput. 24(3-4), 235–265 (1997).
https://doi.org/10.1006/jsco.1996.0125, http://dx.doi.org/10.1006/jsco.
1996.0125, computational algebra and number theory (London, 1993)
[14] Bouillaguet, C., Chen, H.C., Cheng, C.M., Chou, T., Niederhagen, R., Shamir, A.,
Yang, B.Y.: Fast Exhaustive Search for Polynomial Systems in F2 . In: CHES 2010.
pp. 203–218. Springer (2010). https://doi.org/10.1007/978-3-642-15031-9 14
[15] Brakerski, Z.: Fully Homomorphic Encryption without Modulus Switching from
Classical GapSVP. In: Safavi-Naini, R., Canetti, R. (eds.) CRYPTO 2012.
vol. 7417, pp. 868–886. Springer (2012). https://doi.org/10.1007/978-3-642-32009-
5 50
28
[16] Brakerski, Z., Gentry, C., Vaikuntanathan, V.: (Leveled) Fully Homomor-
phic Encryption without Bootstrapping. In: Proceedings of the 3rd Innova-
tions in Theoretical Computer Science Conference. p. 309–325. ACM (2012).
https://doi.org/10.1145/2633600
[17] Canteaut, A., Carpov, S., Fontaine, C., Lepoint, T., Naya-Plasencia, M.,
Paillier, P., Sirdey, R.: Stream ciphers: A Practical Solution for Efficient
Homomorphic-Ciphertext Compression. Journal of Cryptology 31(3), 885–916
(2018). https://doi.org/10.1007/s00145-017-9273-9
[18] Carpov, S., Izabachène, M., Mollimard, V.: New Techniques for Multi-value Input
Homomorphic Evaluation and Applications. In: Matsui, M. (ed.) CT-RSA 2019.
pp. 106–126. Springer (2019). https://doi.org/10.1007/978-3-030-12612-4 6
[19] Chen, H., Chillotti, I., Ren, L.: Onion Ring ORAM: Efficient Constant Bandwidth
Oblivious RAM from (Leveled) TFHE. In: Proceedings of the 2019 ACM SIGSAC
Conference on Computer and Communications Security. p. 345–360. CCS ’19,
ACM (2019). https://doi.org/10.1145/3319535.3354226
[20] Chillotti, I., Gama, N., Georgieva, M., Izabachène, M.: TFHE: Fast Fully Ho-
momorphic Encryption Over the Torus. Journal of Cryptology 33, 34–91 (2020).
https://doi.org/10.1007/s00145-019-09319-x
[21] Chillotti, I., Joye, M., Paillier, P.: Programmable Bootstrapping Enables Ef-
ficient Homomorphic Inference of Deep Neural Networks. In: Dolev, S., Mar-
galit, O., Pinkas, B., Schwarzmann, A. (eds.) Cyber Security Cryptography and
Machine Learning. pp. 1–19. Springer International Publishing, Cham (2021).
https://doi.org/10.1007/978-3-030-78086-9 1
[22] Chillotti, I., Ligier, D., Orfila, J.B., Tap, S.: Improved Programmable Bootstrap-
ping with Larger Precision and Efficient Arithmetic Circuits for TFHE. In: Ti-
bouchi, M., Wang, H. (eds.) ASIACRYPT 2021. pp. 670–699. Springer (2021).
https://doi.org/10.1007/978-3-030-92078-4 23
[23] Clet, P.E., Boudguiga, A., Sirdey, R., Zuber, M.: ComBo: A Novel
Functional Bootstrapping Method for Efficient Evaluation of Nonlinear
Functions in the Encrypted Domain. In: El Mrabet, N., De Feo, L.,
Duquesne, S. (eds.) AFRICACRYPT 2023. pp. 317–343. Springer (2023).
https://doi.org/10.1007/978-3-031-37679-5 14
[24] Cong, K., Das, D., Park, J., Pereira, H.V.: SortingHat: Efficient Pri-
vate Decision Tree Evaluation via Homomorphic Encryption and Transci-
phering. In: Proceedings of the 2022 ACM SIGSAC Conference on Com-
puter and Communications Security. p. 563–577. CCS ’22, ACM (2022).
https://doi.org/10.1145/3548606.3560702
[25] Cosseron, O., Hoffmann, C., Méaux, P., Standaert, F.X.: Towards Case-Optimized
Hybrid Homomorphic Encryption. In: Agrawal, S., Lin, D. (eds.) ASIACRYPT
2022. pp. 32–67. Springer (2022). https://doi.org/10.1007/978-3-031-22969-5 2
[26] Courtois, N., Klimov, A., Patarin, J., Shamir, A.: Efficient Algorithms for Solv-
ing Overdefined Systems of Multivariate Polynomial Equations. In: International
Conference on the Theory and Applications of Cryptographic Techniques. pp.
392–407. Springer (2000). https://doi.org/10.1007/3-540-45539-6 27
[27] De Cannière, C., Preneel, B.: Trivium. In: Robshaw, M., Billet, O. (eds.) New
Stream Cipher Designs: The eSTREAM Finalists. pp. 244–266. Springer (2008).
https://doi.org/10.1007/978-3-540-68351-3
[28] Dinur, I.: Cryptanalytic Applications of the Polynomial Method for Solv-
ing Multivariate Equation Systems over GF(2). In: Canteaut, A., Stan-
daert, F.X. (eds.) EUROCRYPT 2021. pp. 374–403. Springer, Cham (2021).
https://doi.org/10.1007/978-3-030-77870-5 14
29
[29] Fan, J., Vercauteren, F.: Somewhat Practical Fully Homomorphic Encryption.
IACR Cryptology ePrint Archive, Report 2012/144 (2012), https://eprint.
iacr.org/2012/144
[30] Faugere, J.C.: A new efficient algorithm for computing Gröbner bases
(F4 ). Journal of Pure and Applied Algebra 139(1-3), 61–88 (1999).
https://doi.org/10.1016/S0022-4049(99)00005-5
[31] Faugère, J.C.: A new efficient algorithm for computing Gröbner bases with-
out reduction to zero (F5 ). In: Proceedings of the 2002 international sym-
posium on Symbolic and algebraic computation. pp. 75–83. ACM (2002).
https://doi.org/10.1145/780506.780516
[32] Fröberg, R.: An Inequality for Hilbert Series of Graded Algebras. MATHEMAT-
ICA SCANDINAVICA 56 (Dec 1985)
[33] Gentry, C., Sahai, A., Waters, B.: Homomorphic Encryption from Learning
with Errors: Conceptually-Simpler, Asymptotically-Faster, Attribute-Based. In:
Canetti, R., Garay, J.A. (eds.) CRYPTO 2013. vol. 8042, pp. 75–92. Springer
(2013). https://doi.org/10.1007/978-3-642-40041-4 5
[34] Gilbert, H., Boissier, R.H., Jean, J., Reinhard, J.R.: Cryptanalysis of Elisabeth-4.
Cryptology ePrint Archive, Paper 2023/1436 (2023), https://eprint.iacr.org/
2023/1436, to appear ASIACRYPT 2023
[35] Grassi, L., Manterola Ayala, I., Hovd, M.N., Øygarden, M., Raddum, H., Wang,
Q.: Cryptanalysis of Symmetric Primitives over Rings and a Key Recovery Attack
on Rubato. In: Handschuh, H., Lysyanskaya, A. (eds.) CRYPTO 2023. pp. 305–
339. Springer, Cham (2023). https://doi.org/10.1007/978-3-031-38548-3 11
[36] Hoffmann, C., Méaux, P., Ricosset, T.: Transciphering, Using FiLIP and TFHE
for an Efficient Delegation of Computation. In: Bhargavan, K., Oswald, E.,
Prabhakaran, M. (eds.) INDOCRYPT 2020. pp. 39–61. Springer, Cham (2020).
https://doi.org/10.1007/978-3-030-65277-7 3
[37] Hoffmann, C., Méaux, P., Standaert, F.X.: The Patching Landscape of Elisabeth-
4 and the Mixed Filter Permutator Paradigm. Cryptology ePrint Archive, Pa-
per 2023/1895 (2023), https://eprint.iacr.org/2023/1895, https://eprint.
iacr.org/2023/1895
[38] Jakobsen, T., Knudsen, L.R.: The Interpolation Attack on Block Ciphers. In:
FSE’97. pp. 28–40. Springer (1997). https://doi.org/10.1007/BFb0052332
[39] Kluczniak, K., Schild, L.: FDFB: Full Domain Functional Bootstrapping To-
wards Practical Fully Homomorphic Encryption. IACR Transactions on Cryp-
tographic Hardware and Embedded Systems 2023(1), 501–537 (Nov 2022).
https://doi.org/10.46586/tches.v2023.i1.501-537
[40] Liu, Z., Micciancio, D., Polyakov, Y.: Large-Precision Homomorphic Sign Eval-
uation Using FHEW/TFHE Bootstrapping. In: Agrawal, S., Lin, D. (eds.) ASI-
ACRYPT 2022. pp. 130–160. Springer (2022). https://doi.org/10.1007/978-3-031-
22966-4 5
[41] Matsui, M.: Linear Cryptanalysis Method for DES Cipher. In: Helle-
seth, T. (ed.) EUROCRYPT ’93. vol. 765, pp. 386–397. Springer (1994).
https://doi.org/10.1007/3-540-48285-7 33
[42] Méaux, P., Carlet, C., Journault, A., Standaert, F.X.: Improved Filter Permuta-
tors for Efficient FHE: Better Instances and Implementations. In: Hao, F., Ruj, S.,
Sen Gupta, S. (eds.) INDOCRYPT 2019. vol. 11898, pp. 68–91. Springer (2019).
https://doi.org/10.1007/978-3-030-35423-7 4
[43] Méaux, P., Journault, A., Standaert, F.X., Carlet, C.: Towards Stream Ci-
phers for Efficient FHE with Low-Noise Ciphertexts. In: Fischlin, M., Coron,
30
J.S. (eds.) EUROCRYPT 2016. vol. 9665, pp. 311–343. Springer (2016).
https://doi.org/10.1007/978-3-662-49890-3 13
[44] Méaux, P., Park, J., Pereira, H.V.L.: Towards Practical Transciphering for FHE
with Setup Independent of the Plaintext Space. Cryptology ePrint Archive, Paper
2023/1531 (2023), https://eprint.iacr.org/2023/1531, to appear in Commu-
nications in Cryptology
[45] Naehrig, M., Lauter, K., Vaikuntanathan, V.: Can Homomorphic En-
cryption be Practical? In: Proceedings of the 3rd ACM Workshop
on Cloud Computing Security Workshop. p. 113–124. ACM (2011).
https://doi.org/10.1145/2046660.2046682
[46] Saarinen, M.J.O.: Cryptographic Analysis of All 4 × 4-Bit S-Boxes. In: Miri,
A., Vaudenay, S. (eds.) Selected Areas in Cryptography. pp. 118–133. Springer,
Heidelberg (2012). https://doi.org/10.1007/978-3-642-28496-0 7
[47] Yang, B.Y., Chen, J.M.: Theoretical Analysis of XL over Small Fields. In: Wang,
H., Pieprzyk, J., Varadharajan, V. (eds.) Information Security and Privacy. pp.
277–288. Springer, Heidelberg (2004). https://doi.org/10.1007/978-3-540-27800-
9 24
[48] Yang, B.Y., Chen, O.C.H., Bernstein, D.J., Chen, J.M.: Analysis of QUAD.
In: Biryukov, A. (ed.) FSE 2007. pp. 290–308. Springer, Heidelberg (2007).
https://doi.org/10.1007/978-3-540-74619-5 19
[49] Yang, Z., Xie, X., Shen, H., Chen, S., Zhou, J.: Tota: Fully homomorphic encryp-
tion with smaller parameters and stronger security. Cryptology ePrint Archive,
Paper 2021/1347 (2021), https://eprint.iacr.org/2021/1347
[50] Zama: TFHE-rs: A Pure Rust Implementation of the TFHE Scheme for Boolean
and Integer Arithmetics Over Encrypted Data (2022), https://github.com/
zama-ai/tfhe-rs
[51] Zhang, W., Bao, Z., Rijmen, V., Liu, M.: A New Classification of 4-bit Op-
timal S-boxes and Its Application to PRESENT, RECTANGLE and SPON-
GENT. In: Leander, G. (ed.) FSE 2015. pp. 494–515. Springer, Heidelberg (2015).
https://doi.org/10.1007/978-3-662-48116-5 24
31
Supplementary Material
32
cc5d2c6e0fc017d51dd55f15487505e6c8e49c8d5254552bf99e9f027a157d0d,
e46d369567e85730d69850b5a66381e8b351683333b7506ad2a7255b64d73d62,
28c59e68559ee74a28b004315653ee7b60201141119be7f6c9c5db6a9426aa84,
f8a619ee67f02c28240731427c7a73510de95c8d14bd535615124f7f2ea28536,
08cc2655daa1166a3e1e27e4d32e1964f4668906105704f16674e05f454674ac,
824b77fb8ebac0cfd6e501ebdd8399ffc6d3fdfaa252c546f07b2fcb3211c44b,
338ee3c9b964f458368b12fb5dda0a21d71b82895f344c84d79a209d2a8a2e9e,
11f895bcaa829a35766a9df798f76fdb75f52acf844b38e29843b3c4cba641e0,
76d3864ea625fa5162e954ee2e21de7d2b31f5c2a848b055f9a8d2ce3c4d602a,
8d2f7999216bb4ccb0ab4d2f3ea49216e3806f68911777716c5a3f57f39ad5ab,
932be23c972a02d874c896c8bdd9f9e8f25c7597255c785febb36f39f21e6047,
2af439cffb90a7e3cd449b98b4e41986c62feeeac893e948f6d39bccbaea882c,
b2ce76fa91b65528128fc2f75cb210d627de1a60405a99fe68049adf26ce6290,
90199dbacdbc4cd27d89078cb88488c953e8aafe40f9fdf145ac4126807ce2bb,
1e9edf31bc7674add23dc865f2b7e459fce2855b725168b709246198b67c28bc,
365c951b8f9157c59975fe4e2b2fe6d20559e8945cc951f2d66fa60189181705,
6ae54a50a73127b6e384b823cd5f7274c499db4357aa984134fcb8d7a2263a1c,
af24aab01b444a3a8d1959a200051f61b154411a9318d26f3c9fc9089dc5a15e,
a7c8d71ff32d30c5da29787bc37f7faf3ec301db0ee66623d73a44cf0a5221fc,
8db8ecc3b85043eb2c092b39393a501b286fe5133f2f13182b262c3fd5fb0ffe,
824d35b5f8343f86fcb4c850113c7b1c57c500cbe3c7d3dd57c2fffeaa472d73,
255bf17ef996b37e6a2031faeb3ebb5171db7b3a9edc299b1fc7b068acf41e67,
123e3ef3ce478c12792754b8fc94ba37dc7331415b0e1ad8fef70b4002500580,
fde6a170a8ba8349a6f366f26e5bdf1a4979c94ca8800c4875d3ef6e3314fac3,
cecab9b85ef7b9fbe7792d72c43b144ccc1cabc24a3403c38e00d8763610b6bb
];
Let (x0 , . . . , x3 ) ∈ F42 (resp. (y0 , . . . , y3 ) ∈ F42 ) be the input (resp. output) of S
where x0 (resp. y0 ) is the LSB of the input (resp. output). The explicit repre-
sentation of S over F2 is given as follows.
y0 = x0 x1 x3 + x0 x2 x3 + x0 + x1 x2 + x1 + x3
y
1 = x0 x1 x2 + x0 x1 x3 + x0 x1 + x0 + x1 x2 x3 + x1 x2 + x1 x3 + x2 x3 + x2
y2
= x0 x1 + x0 x2 x3 + x0 x2 + x0 x3 + x1 x2 x3 + x1 x2 + x1 x3 + x1 + x2 + x3
= x0 x1 x2 + x0 x1 + x0 x2 + x1 x2 + x2 x3 + x3
y3
All the output bits are of degree 3 with respect to the input bits, and all the
input bits work nonlinearly to the output as described in [46]. For the backward
direction, we obtain the following equations which have the same properties with
the forward ones.
x0
= y0 y1 y3 + y0 y2 y3 + y0 y2 + y1 y3 + y1 + y2 + y3
x
1 = y0 y1 y3 + y0 y1 + y0 y3 + y1 y2 y3 + y1 + y2 y3 + y2 + y3
x 2 = y0 y2 y3 + y0 y2 + y0 + y1 y2 y3 + y1 y3 + y1 + y2 y3
= y0 y1 y2 + y0 y2 y3 + y0 y3 + y0 + y1 + y2 y3 + y2
x3
33
The implicit representations over F2 are given as follows.
x3 x2 + x3 y3 + x3 y1 + x3 y0 = 0
x3 x2 + x2 x1 + x2 x0 + x3 y2 + x3 y0 + x2 + x1 + y3 + y1 + y0 = 0
x3 x2 + x2 y3 + x3 y2 + x3 y0 + x2 + x1 + y3 + y1 + y0 = 0
x2 x1 + x3 x0 + x2 y2 + x2 + y2 + y1 + y0 = 0
x3 x2 + x3 x1 + x3 x0 + x3 y3 + x3 y2 + x2 y1 + x1 + y3 + y1 + y0 = 0
x3 x1 + x3 y3 + x2 y0 + x2 + x0 + y3 + y1 = 0
x3 x0 + x1 x0 + x3 + y3 + y2 + y1 + y0 = 0
x1 y3 + x3 y0 + x3 + x1 + x0 + y3 + y2 + y1 = 0
x2 x1 + x3 x0 + x3 y3 + x1 y2 + x3 y0 + x2 + x1 + x0 + y1 = 0
x3 x2 + x3 x1 + x1 y1 + x3 y0 + x3 + x2 + x1 + y3 + y2 = 0
x2 x1 + x3 x0 + x3 y3 + x3 y2 + x3 y0 + x1 y0 + x1 + y3 + y2 + y1 + y0 = 0
x3 x0 + x0 y3 + x3 y0 + x3 + x2 + x0 + y2 + y0 = 0
x3 x2 + x3 x1 + x2 x1 + x3 y3 + x3 y2 + x0 y2 + x3 + x2 + x0 + y3 + y2 + y0 = 0
x3 x2 + x3 x1 + x3 x0 + x3 y3 + x0 y1 + x3 + x2 + y2 + y0 = 0
x2 x1 + x3 x0 + x3 y2 + x3 y0 + x0 y0 + x2 + y1 = 0
x3 x2 + x3 x1 + x3 x0 + x3 y2 + y3 y2 + x3 + x2 + x0 + y3 + y2 + y0 = 0
x3 x1 + x3 x0 + y3 y1 = 0
x3 x1 + y3 y0 + x1 + x0 + y2 + y1 = 0
x3 x2 + x3 x1 + x3 x0 + y2 y1 + x3 y0 + x3 + x1 + y3 + y1 + y0 = 0
x3 x2 + x2 x1 + y2 y0 + x1 + y3 + y2 + y1 + y0 = 0
x3 x1 + y1 y0 + x2 + y2 + y0 = 0
There are 21 linearly independent quadratic equations for S, which is the mini-
mum for 4-bit S-boxes.
34
Single Round Two Rounds
Degree Total
First Ratio Others Ratio First Ratio Others Ratio
1 16 15.24 0.953 16.00 1.000 14.91 0.932 16.00 1.000
2 120 112.74 0.940 119.80 0.998 112.52 0.938 119.93 0.999
3 560 524.99 0.937 542.68 0.969 525.45 0.938 559.78 0.999
4 1820 1707.71 0.938 - - 1705.61 0.937 1819.62 0.999
5 4368 4091.44 0.937 - - 4093.88 0.937 4367.08 0.999
6 8008 7485.90 0.935 - - 7506.56 0.937 8006.04 0.999
7 11440 9989.81 0.873 - - 10725.53 0.938 11437.21 0.999
8 12870 10852.44 0.843 - - 12068.20 0.938 12866.73 0.999
9 11440 5254.97 0.459 - - 10725.86 0.938 11428.58 0.999
10 8008 - - - - 7505.68 0.937 7863.41 0.982
11 4368 - - - - 4095.01 0.938 3930.39 0.900
12 1820 - - - - 1705.20 0.937 - -
13 560 - - - - 524.46 0.937 - -
14 120 - - - - 112.95 0.941 - -
15 16 - - - - 14.17 0.886 - -
16 1 - - - - 0.89 0.890 - -
Table 4: The (average) number of monomials appearing in the fixed round func-
tions of FRAST in the forward direction according to degrees. ‘Total’ denotes
the total number of monomials, ‘First’ (resp. ‘Others’) denotes the number of
monomials appearing in the first branch (resp. the other branches), and ‘Ratio’
denotes its ratio to the total number of monomials. The bold fonts denote the
lower bound of the degree proposed in Section 5.1.1.
35
Single Round Two Rounds
Degree Total
First Ratio Others Ratio First Ratio Others Ratio
1 16 16.00 1.000 16.00 1.000 14.97 0.936 16.00 1.000
2 120 108.07 0.901 119.92 0.999 112.53 0.938 119.96 0.999
3 560 409.45 0.731 558.90 0.998 524.48 0.937 559.88 0.999
4 1820 - - 1815.19 0.997 1706.24 0.937 1819.42 0.999
5 4368 - - 4213.67 0.965 4096.11 0.938 4366.93 0.999
6 8008 - - - - 7504.14 0.937 8005.58 0.999
7 11440 - - - - 10718.37 0.937 11437.00 0.999
8 12870 - - - - 12049.91 0.936 12866.47 0.999
9 11440 - - - - 9945.95 0.869 11436.99 0.999
10 8008 - - - - 6671.91 0.833 8006.18 0.999
11 4368 - - - - 1987.14 0.455 4366.63 0.999
12 1820 - - - - - - 1810.18 0.995
13 560 - - - - - - 529.75 0.946
Table 5: The (average) number of monomials appearing in the fixed round func-
tions of FRAST in the backward direction according to degrees. ‘Total’ denotes
the total number of monomials, ‘First’ (resp. ‘Others’) denotes the number of
monomials appearing in the first branch (resp. the other branches), and ‘Ratio’
denotes its ratio to the total number of monomials. The bold fonts denote the
lower bound of the degree proposed in Section 5.1.1.
In this section, we summarize the experimental result of the Gröbner basis com-
putation time on toy parameters. The source codes of the experiment are devel-
oped in MAGMA [13], and are executed in AMD Ryzen 7 2700X @ 3.70 GHz with
128 GB memory. Let r, ℓ, and m denote the number of rounds, branches, and
input/output pairs used to build a system, respectively.
Figure 5 shows the Gröbner basis computation time according to r when
ℓ = 3 for the system introducing new variables for all the intermediate states
and the system introducing new variables for the states of the first branch. The
key size is set to 4ℓ, which is half of the actual key size, to run the experiment on
various parameters. One can see that the computation time grows exponentially
according to r, and using larger m increases computation time.
Figure 6 shows the Gröbner basis computation time for the system by guess-
ing the values of the first branch according to ℓ when r = 8. The key size is
set to 8ℓ, which is the actual key size21 . One can see that the computation time
grows exponentially according to ℓ. The peak at (ℓ, m) = (3, 3) is caused by some
outliers in the data.
Conversely to the previous systems, using larger m tends to decrease the
Gröbner basis computation time. The reason is that the number of variables
21
The graph in Figure 4 uses the key size of 4ℓ.
36
Intermediate Variables First Branch Variables
10
10
log(Time) (s)
log(Time) (s)
5
5
0
0
−5
−5
2 3 4 2 3 4 5
r r
Fig. 5: Gröbner basis computation time of the systems introducing new variables
according to the number of rounds r. The number of branches ℓ is 3 and the key
size is 4ℓ bits.
10 m=1
m=2
log(Time) (s)
5 m=3
−5
−10
2 3 4 5 6 7 8
l
Fig. 6: Gröbner basis computation time of the systems with guessing the values
of the first branches. The number of round r is 8 and the key size is 8ℓ bits.
37
does not change while the number of equations increases according to m. That
said, this does not imply using larger m is advantageous for the attack since the
number of guessing 24rm increases much faster.
Remark 3. The whole running time of the Gröbner basis computing program is
much longer than the Gröbner basis computing time denoted in the graph, so
we could not run the experiment on larger parameters.
x x1
u u1
v1 u2
x x2
v2 v
x x1 + x2
(a) Branching: u = v1 + v2 (b) Addition: u1 = u2 = v
The first approach is to apply nonzero linear masks on the XOF outputs that
determine random S-boxes of FRAST. Although the XOF outputs themselves
are not controllable by an attacker, they can be considered as additional inputs
in the KPA model since they are publicly open. Using this approach, one can
apply the linear cryptanalysis to FRAST by considering it as a fixed function
whose input size is larger than its output size. A negacyclic random S-box S
itself can be described by its function values (S(0), . . . , S(7)), and the function
LookUpk (x, S) = S(x + k) can be described as a function from Z16 × Z816 to Z16
defined by
7
X
LookUpk (x, S) = (1 {x + k = i} − 1 {x + k = i + 8}) S(i)
i=0
38
where 1 {x + k = i} = 1 if x+k = i and 0 otherwise. From this point of view, the
linear probability of FRAST with additional linear masks on the XOF outputs
is well-defined.
For (x, Serf , Scrf ) ∈ Zℓ16 × Z816 × Z816 , define RF[k](x, Serf , Scrf ) = y ∈ Zℓ16 as
follows.
where rk = (rk1 , . . . , rkℓ ) ∈ Zℓ16 is a round key derived from the master key
k, x = (x1 , . . . , xℓ ) ∈ Zℓ16 , y = (y1 , . . . , yℓ ) ∈ Zℓ16 , and Serf and Scrf are the
negacyclic S-boxes derived from the XOF. As Serf and Scrf are independently
sampled, we separate the round function RF into two parts for simplicity: RFerf
and RFcrf .
a1 a2 a3 aℓ
x1 x2 x3 xℓ
rk2 (α0 , . . . , α7 )
(nc; i)
Serf
rk3 (α0 , . . . , α7 ) ···
RFerf (nc; i)
Serf
..
rkℓ . (α0 , . . . , α7 )
(nc; i)
Serf
c1 c2 c3 cℓ
(nc; i)
Scrf
RFcrf
(β0 , . . . , β7 )
rk1
y1 y2 y3 yℓ
b1 b2 b3 bℓ
RFerf is the expanding part of the round function. For (x, Serf ) ∈ Zℓ16 × Z816 ,
RFerf [k](x, Serf ) = y ∈ Zℓ16 is defined as follows.
39
RFcrf is the contracting part of the round function. For (x, Scrf ) ∈ Zℓ16 × Z816 ,
RFcrf [k](x, Scrf ) = y ∈ Zℓ16 is defined as follows.
yj = xj for j = 2, . . . , ℓ,
y1 = x1 + LookUprk1 (x2 + · · · + xℓ , Scrf ),
where rk1 ∈ Z16 is a round key derived from the master key k, x = (x1 , . . . , xℓ ) ∈
Zℓ16 , y = (y1 , . . . , yℓ ) ∈ Zℓ16 , and Scrf is the negacyclic S-box derived from the
XOF.
Then, the round function RF can be described as a composition of RFerf and
RFcrf as follows.
We depict the relation between RF, RFerf and RFcrf in Figure 8. By separating
RF into RFerf and RFcrf , we can compute the linear probability of RF from that
of RFerf and RFcrf .
Let a = (a1 , . . . , aℓ ) be an input mask to x, α = (α0 , . . . , α7 ) (resp. β =
(β0 , . . . , β7 )) be an input mask to Serf (resp. Scrf ), and b = (b1 , . . . , bℓ ) be an
output mask to y. To represent the linear probability of RF with respect to those
of RFerf and RFcrf , let c = (c1 , . . . , cℓ ) be an output (resp. input) mask of RFerf
(resp. RFcrf ) (see Figure 8). Then, the linear relation on RF forces cj = aj for
all j = 2, . . . , ℓ, c1 = b1 , and c2 − b2 = · · · = cℓ − bℓ . For such c, we obtain the
following.
LPRF[k] ((a, α, β), c) = LPRFerf [k] ((a, α), c) · LPRFcrf [k] ((c, β), b).
Linear Probability of RFerf . Let (a, α) ∈ Zℓ16 × Z816 be the input mask and
c ∈ Zℓ16 be the output mask to RFerf [k] where cj = aj for j = 2, . . . , ℓ. Then, the
linear probability of RFerf [k] is given as follows.
15
RFerf [k] 1 X 2πi
LP ((a, α), c) = 2 exp (c1 − a1 )x1
16 x =0 16
1
n o 2
∀j∈{0,...,7}
×1 Pℓ
i=2 ci (1{x1 +rki =j}−1{x1 +rki =j+8})=αj
where (rk2 , . . . , rkℓ ) is a part of the round key derived from k. One can see that
the above linear probability depends on the relation between the masks and the
keys, which is not the case in traditional linear cryptanalysis. Hence, the masks
should be chosen carefully to satisfy the following relation.
ℓ
X
∃x1 ∈ Z16 ; ci (1 {x1 + rki = j} − 1 {x1 + rki = j + 8}) = αj ∀j = 0, . . . , 7.
i=2
(10)
Otherwise, the linear probability would be zero.
40
For an attacker who does not know the round key, there are two possible
ways to build a trail of nonzero linear probability: a trivial linear trail such that
α = 0, and a linear trail such that only one component of α is nonzero.
The first approach is to build a linear trail that does not activate the LookUp
function by setting α = 0 and c2 = · · · = cℓ = 0, which also implies that a2 =
· · · = aℓ = 0. Then, by setting c1 = a1 ̸= 0, one obtain LPRFerf [k] ((a, α), c) = 1 for
nonzero input/output masks. This is the trivial linear trail of linear probability
1 on RFerf .
The other approach is to set only one component of (c2 , . . . , cℓ ) and α to
8 and the others to 0. Then, regardless of the round key, there exists a unique
z ∈ {0, . . . , 7} such that (10) holds for x1 = z and x1 = z + 8. By setting
2 | (c1 − a1 ), one obtain LPRFerf [k] ((a, α), c) = 2−6 .
Linear Probability of RFcrf . Let (c, β) ∈ Zℓ16 × Z816 be the input mask and
b ∈ Zℓ16 be the output mask to RFcrf [k] where c1 = b1 and c2 − b2 = · · · = cℓ − bℓ .
Then the linear probability of RFcrf [k] is given as follows.
15
1 X 2πi
LPRFcrf [k] ((c, β), b) = exp (b 2 − c 2 )x
162 x=0 16
n o 2
∀j∈{0,...,7}
×1 b1 (1{x+rk1 =j}−1{x+rk1 =j+8})=βj
where rk1 is the first component of the round key derived from k. The masks
should be chosen carefully to satisfy the following to build a linear trail of nonzero
linear probability.
Similar to the case of RFerf , an attacker can build two kinds of linear trails
of nonzero linear probability without knowing the round key. One is the trivial
linear trail to set β = 0 and b1 = c1 = 0, obtaining LPrkcrf [k] ((b, β), b) = 1. The
other nontrivial trail is to set b1 = 8, only one component of β by 8 and the
others by 0, obtaining the linear probability of 2−6 provided that 2 | (c2 − b2 ).
Combining two results. One can build a linear trail on RF by combining
those on RFerf and RFcrf . However, combining two trivial trails on RFerf and
RFcrf is impossible since it implies that all the input/output masks are zero.
Instead, it is possible to combine one of the trivial trails and the other nontrivial
trail, resulting in the linear trail of linear probability 2−6 . Such trail activates
only one LookUp function.
If more than two LookUp functions are activated, then the attacker should
know the difference between the round keys used in the activated LookUp func-
tions. The attacker might try to guess them, but it is infeasible since more than
128 bits need to be guessed for 32 random rounds of FRAST.
41
E.2 Analysis on Compatible Data
The linear attack is a kind of statistical attack that requires many input-output
pairs of a fixed function. In FRAST, negacyclic S-boxes are independent randomly
selected. Hence, we need to compute the probability that two input-output pairs
of FRAST from independent random round functions can be used together to
measure the linear bias for a given linear approximation.
a1 a2 a3 aℓ
x1 x2 x3 xℓ
rk2
u2 v2
(nc; i)
Serf
rk3 ···
u3 v3
(nc; i)
Serf
..
rkℓ .
uℓ vℓ
(nc; i)
Serf
v1 u1
(nc; i)
Scrf
wℓ
rk1 w2 w3
y1 y2 y3 yℓ
b1 b2 b3 bℓ
Fig. 9: Linear masks in a single round of the FRAST without considering XOF.
Linear Masks for the FRAST Round Function. Suppose that an input
linear mask a = (a1 , a2 , . . . , aℓ ) and an output linear mask b = (b1 , b2 , . . . , bℓ )
are used for a single round of FRAST. Let ui denote an input mask and let vi
denote an output mask of an S-box whose output is added to xi (see Figure 9).
From the properties of the branching and addition operations, the following
conditions must hold for the input and output masks to have a nonzero linear
probability.
Suppose that there are nonzero input and output masks a = (a1 , a2 , . . . , aℓ )
and b = (b1 , b2 , . . . , bℓ ) activating no S-box. Since all the S-boxes are not ac-
tivated, we have b1 = 0 and a2 = a3 = · · · = aℓ = 0 by (12). We also have
b2 = b3 = · · · = bℓ by (13). Then the linear probability LPRF (a, b) of the round
42
function for the masks a and b is given as follows.
2
1 X 2πi
LPRF (a, b) = 2ℓ exp (b2 (x2 + · · · + xℓ ))
16 16
x2 ,··· ,xℓ ∈Z16
2
2πi ℓ
(nc; i)
X X
× exp b2 Serf (x1 + rkj ) − a1 x1
16
x1 ∈Z16 j=2
= 1 {a1 = b2 = 0}
(nc; i)
where 1 {a1 = b2 = 0} is 1 if a1 = b2 = 0 and 0 otherwise, Serf is the randomly
generated S-box used in the round function and rkj is the round key added to
the input of the S-box whose output is added to the j-th branch. So we conclude
that the input and output masks activating no S-box cannot be both nonzero
and trivial.
43
E.3 Analysis with Random S-boxes Having Linear Relations
Suppose a negacyclic S-box S on Z16 has a linear relation ax + bS(x) = c for all
x = 0, 1, . . . , 15. Then, the following holds from the negacyclic property of S.
a(x + 8) + bS(x + 8) = ax + 8a − bS(x) = c
over Z16 for all x = 0, 1, . . . , 7. Combined with the original linear relation, one
obtain
(2x + 8)a = 2c
over Z16 for all x = 0, 1, . . . , 7. It can holds only if a, c ∈ {0, 8}. In this case, the
function bS(x) should be identical to one of 0, 8, 8x, and 8x + 8, which implies
that bS(0) and bS(1) determines bS(i) for i = 2, 3, . . . , 7. Hence, a negacyclic
S-box over Z16 has a linear relation with a probability at most 2−6 .
44
the function f1 on J0, 2J is given by
1
f1 (0) = (f (0) + f (2) − f (1) − f (3)),
4
1
f1 (1) = (f (1) + f (3) − f (0) − f (2)),
4
and the constant f2 is given by
1
f2 = (f (0) + f (1) + f (2) + f (3)).
4
G Communication Overload
22
In the tfhe-rs library, auxiliary information such as the LWE dimension or cipher-
text modulus type is saved together. We ignore such additional data size assuming
that it is fixed in the transciphering framework.
45
GenPBS Keysize. The evaluation keys for the GenPBS operation consist of
the bootstrapping key and the keyswitching key. Given an LWE secret key
s = (s1 , . . . , sn ) ∈ Bn and a GLWE secret key S′ = (S1′ , . . . , Sk′ ) ∈ BN [X]k ,
the bootstrapping key is a set of GGSW ciphertexts {GGSWS′ (si )}ni=1 with the
decomposition base BPBS and level ℓPBS . Since the GGSW ciphertexts are fresh,
the bootstrapping key can be compressed into seeded GGSW ciphertexts, re-
sulting in the size of ℓPBS (k + 1)nN log q bits. Let s′ = (s′1 , . . . , s′kN ) ∈ BkN be
the LWE secret key induced from S′ . The keyswitching key is a set of LWE ci-
j
phertexts {LWEs (s′i · q/BKS )}(i,j)∈[kN ]×[ℓKS ] where BKS and ℓKS are keyswitching
decomposition base and level, respectively. As a set of seeded LWE ciphertexts,
the keyswitching key is of size ℓKS kN log q bits. Table 7 summarizes the size of
the evaluation keys for the GenPBS operation.
46
GLWEtoGLWE Keyswitching Key GGSWS (−S)
Normal ℓsubs k(k + 1)N log N log q ℓSK (k + 1)2 N log q
Seeded ℓsubs kN log N log q ℓSK (k + 1)N log q
Table 8: Size of the GLWEtoGGSW evaluation keys in bits. The size of seeds or
auxiliary information is omitted.
of the default parameters is not taken into account for the communication over-
load since it is used in the actual usecase after the transciphering. To use double
blind rotation technique, FRAST requires additional evaluation keys: the GLWE-
toGLWE keyswitching keys of 880 KB, and the GGSW ciphertext GGSWS (−S)
of 160 KB. The round keys of 4808 bits are packed in ⌈4808/N ⌉ · ℓrk GLWE
ciphertexts of 144 KB, and the remaining round keys of 312 bits are sent to
the server in 78 LWE ciphertexts of size 624 B (see Supplementary Material H).
Hence, the total communication overload for FRAST is 11.88 MB.
47
possible to evaluate the S-boxes without computing GenPBS on x1 since the
input to the first round is the known constant ic. By giving GGSW ciphertexts
of the round key bits used in the expanding part of the first round, one can
evaluate the expanding part of the first round in a much smaller number of the
CMux gates.
For the other rounds, decompose S into Smsb-odd and Smsb-even . Since Smsb-odd is
negacyclic, it is possible to compute LWE(∆·Smsb-odd (x1 +rkj )) for all j = 2, . . . , ℓ
in a single GenPBS operation using the double blind rotation. Although the
range of Smsb-odd itself is not J0, pJ, one can regard LWE(∆ · Smsb-odd (x)) as
an LWE ciphertext of 2Smsb-odd (x) ∈ J0, 2pJ with a scaling factor of ∆/2 as
mentioned above.
During the evaluation of Smsb-odd on the input x1 , it is also possible to extract
the MSB bit of x1 for free using PBSmanyLUT [22].25 The extracted MSB bit
of x1 is subtracted from x1 , obtaining an LWE ciphertext of ClearMSB(x1 ) ∈
J0, p/2J that will be fed into Smsb-even .
To compute Smsb-even on ClearMSB(x1 ) is possible with a single GenPBS
operation using the cleared MSB bit of x1 , while one more padding bit is required
for the double blind rotation since ∆ · (ClearMSB(x1 ) + ClearMSB(rki )) might
exceed q/2, filling the padding bit of the ciphertext. Since Smsb-even is of only
3-bit precision, we address this issue by giving one more padding bit to the
ciphertext of ClearMSB(x1 ). Computing LWE((∆/2) · ClearMSB(x1 )) using one
more GenPBS operation, one can apply the double blind rotation using GenPBS
of 4-bit precision since ∆ 5
2 (ClearMSB(x1 ) + ClearMSB(rki )) ∈ Jq/2 , q/2J.
It is also possible to refresh the ciphertext of ClearMSB(x1 ) simultaneously
during the double blind rotation. Adding the refreshed ciphertext of the MSB
of x1 and ClearMSB(x1 ), which is obtained during adjusting its scaling factor
from ∆ to ∆/2 to evaluate Smsb-even , one can refresh the first state before adding
S(y2 + · · · + yℓ + rk1 ), making it possible to use PBSmanyLUT on the input of
the first branch.
The number of the CMux gates also can be reduced with a simple tweak: to
compute the blind rotation on S(x1 + rk2 ) instead of S(x1 ). Then S(x1 + rkj ) is
computed by the second blind rotation by the bits of rkj − rk2 for j = 3, . . . , ℓ.
It reduces the number of round key bits to be packed on the GLWE ciphertext,
but rk2 (for each round) should be sent to the server as an LWE ciphertext.
Refreshing the state of the first branch also requires additional subtraction by
rk2 since the ciphertext of x1 + rk2 is refreshed. In summary, evaluating the
expanding part of the FRAST round function requires 2 GenPBS operations
followed by 7(ℓ − 2) CMux gates.
25
The success probability of PBSmanyLUT is sensitive to the parameter and the error
contained in the input when N is small, so that it should be used carefully. For
FRAST, we have checked that PBSmanyLUT can be used with negligible failure
probability.
48
H.1.2 Contracting Part
The contracting part computes S(y2 + · · · + yℓ + rk1 ). If the summation is di-
rectly computed from y2 , . . . , yℓ , the magnitude of the error inside the summation
increases with the round. Instead, we use another variable, dubbed crfsum, to
manage the noise for the summation. Pℓ
At first, crfsum is initialized by the trivial encryption of j=2 ic[j]. In the
expanding part, the output ciphertexts of S(x1 + rkj ) for j = 2, . . . , ℓ are added
to crfsum. Then crfsum added by rk1 becomes the input of the S-box S in the
contracting part, which can be evaluated in 3 GenPBS operations using our WoP-
PBS. Using the same idea to refresh the first branch, one can refresh crfsum by
one more GenPBS operation. By the help of PBSmanyLUT, both evaluating the
S-box and refreshing crfsum can be done using 2 GenPBS operations.
49
Lemma 2 (Theorem 4.1 in [19]). Suppose GLWEtoGLWE keyswitching keys
( !)
q
KSm = GLWES(X m ) Si · j
Bsubs (i,j)∈[k]×[ℓ ] subs
2 i−1
such that Var(KSm ) ≤ σsubs
for all m = N/2 + 1, i = 1, . . . , log N are given.
PN −1
For an input c = GLWES ( i=0 bi X i ), Algorithm 3 in [19] outputs a set of
N −1
ciphertexts {cj = GLWEs (N bj )}j=0 with noise variance
N2 − 1
Var(cj ) ≤ N 2 Var(c) + Vsk
3
where
!
kN q2 1 kN 2
2
Bsubs +2
Vsk = 2ℓsubs
− + + kN ℓsubs σsubs .
2 12Bsubs 12 16 12
Proof. The noise increment Vsk of the GLWEtoGLWE keyswitching can be esti-
mated by the result of Appendix D in [22] with a slight modification. For each
iteration on i in Algorithm 3 in [19], the noise increases by Vsk for each GLWE-
toGLWE keyswitching. Then one can obtain the above upper bound following
the proof of Theorem 4.1 in [19] (considering the difference of the convention as
mentioned before).
Lemma 3 (Theorem 4.2 in [19]). Let A = GGSWS (−S) be a GGSW cipher-
text of −S with the base BSK and level ℓSK . For inputs A and GLWE ciphertexts
PN i
ℓrk
{cj = GLWES ( i=0 NbB iX
j+1 )}j=1 , Algorithm 4 in [19] outputs GGSW cipher-
rk
texts Ci = GGSWS (bi ) with the base Brk and level ℓrk of which noise variance
is given by
N2 − 1 B2 + 2
Var(Ci ) ≤ N 2 Var(c) + Vsk + ℓSK (k + 1)N SK Var(A)
3 12
2ℓSK 2
q 2 − BSK
kN kN 1 kN
+ 2ℓSK
1+ + + 1− (14)
12BSK 2 8 4 2
for all i = 0, . . . , N − 1.
Proof. One can obtain the above bound following the proof of Theorem 4.2
in [19] directly (considering the difference of the convention as mentioned before),
except that the GGSW ciphertexts A and Ci have different decomposition base
and level.
2
We denote the upper bound in (14) by σdbr for the rest of this section.
Lemma 4 (Theorem 4 in [22]). The noise variance of the GenPBS output is
2
BPBS +2
Var(PBS) = nℓ(k + 1)N σ PBS 2
12
2ℓPBS 2
q 2 − BPBS
kN nkN n kN
+n 2ℓPBS
1 + + + 1 −
24BPBS 2 32 16 2
50
where σPBS is the noise variance of the bootstrapping key, and BPBS and ℓPBS
are the base and level of GenPBS, respectively.
B2 + 2 2
V ar(c′ ) ≤ σprev
2
+ t2 ℓ(k + 1)N σ
12
2 !
q 2 − B 2ℓ
kN kN 1 kN
+t 1+ + + 1− .
12B 2ℓ 2 8 4 2
Proof. Following the analysis of Appendix B in [22] similarly with a partial As-
sumption 3.11(Independence heuristic) in [20], we may claim the term appearing
in Step (1) of Appendix B has at most quadratic growth over the iteration of ex-
ternal products, and the term appearing in Step (2) has a linear growth because
of their relative independence.
Lemma 6. In the double blind rotation, t nested CMux gates by GGSW cipher-
texts of noise variance at most σdbr after the common blind rotation increases
the output noise variance by
2
Brk +2 2
VDBR,t ≤ t2 ℓrk (k + 1)N σdbr
12
2ℓrk 2 !
q 2 − Brk
kN kN 1 kN
+t 2ℓrk
1+ + + 1− .
12Brk 2 8 4 2
where Brk and ℓrk are the base and level of the GGSW ciphertext, respectively.
Proof. The noise increment by the CMux gate can be estimated by the result
of Appendix B in [22] along with Lemma 5. The above upper bound is for the
worst-case such that the distribution of the plaintext of the GGSW ciphertext
is unknown over B, considering the dependency of the round key bits in FRAST
obtained from its master key.
Using the above lemmas, one can upper bound the noise variance of the S-box
outputs obtained by the double blind rotation as described in Section H.1.1. After
decomposing the S-box S into Smsb-odd and Smsb-even , one computes the common
blind rotation for Smsb-odd and Smsb-even on the input x1 +rk2 and ClearMSB(x1 +
rk2 ), respectively. Then, 4 (resp. 3) CMux gates follow using GGSW ciphertexts
of each bit of rkj − rk2 (resp. ClearMSB(rkj − rk2 )) for j = 3, . . . , ℓ. From
Lemma 6, the noise variance of the output ciphertext of Smsb-odd (x1 + rkj ) (resp.
Smsb-even (ClearMSB(x1 + rkj ))) by the double blind rotation is given as Var(PBS)
increased by VDBR,4 (reps. VDBR,3 ).
In the evaluation of the FRAST round function, the noisiest ciphertext is one
for the input to the S-box in the contracting part of the fixed round function,
51
which is named crfsum in Section H.1.1. Considering the output noise variance
of the resulting ciphertexts of the blind rotation, one can upper bound the noise
increment of crfsum in each round by
assuming that there is no correlation between the noises resulting from the com-
mon blind rotation and the GGSW ciphertexts of the round key bits, while there
is clear dependence on the noises from the common blind rotation.
Considering additional noise increments such as the initial noise in refreshed
crfsum, the noise in rk1 and the keyswitching noise before the GenPBS opera-
tion26 , all of which do not affect the failure probability significantly, we obtain
noise of standard deviation 254.17 for crfsum, small enough compared to the scal-
ing factor ∆ = 260 . We observed the upper bound of noise coincides empirically
with our result as Figure 10 shows the result of noise measurement to crfsum
in 1000 evaluations of FRAST for each round. The failure probability of the
GenPBS operation on the input of crfsum computed by Theorem 3 in [22] is
negligible, and even PBSmanyLUT with ϑ = 1, i.e., computing two functions on
the same input in a single GenPBS call, can be used with failure probability less
than 2−80 .
55
54
53
52
51
log(|ecrfsum |)
50
49
48
47
46
45
44
43
42
41
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
Rounds
Fig. 10: The magnitude of error of crfsum in each round of FRAST evaluation.
The experiment is performed 1000 times.
26
It can be computed by Theorem 2 in [22].
52