This blog post summarizes our contribution and main ideas of the paper “Fast Evaluation of S-boxes with Garbled Circuits” published in IEEE Transactions on Information Forensics and Security (paper link, eprint). This is joint work with Aysajan Abidin and Bart Preneel.
This post requires some background knowledge on garbled circuits. Some introductory articles can be found here: garbled circuits, oblivious transfer.
We introduce a new two-party garbling scheme that is tailored for two-party, semi-honest secure computation of symmetric-key primitives with substitution-permutation network structure. Our work offloads garbling cost and communication into the offline phase to gain considerable evaluation speed-ups. Many applications allow this offline-online phase split and benefit from faster evaluation. We discuss two applications later on. The implementation that confirms the theoretical speed-up in a practical benchmark can be found here: https://github.com/KULeuven-COSIC/gc-fast-sbox-eval. We extended the MP-SPDZ framework.
Technical Overview
We extend the encoding of values in a garbled circuit label to support 2n instead of 2 values per label. This means, instead of 1 bit, the wire values in the garbled circuit can now carry n-bit strings. We use the same technique as [KS08], which makes XOR gates practically free. In [KS08], the garbler chooses a random offset value R and encodes each bit b as W = W0 ⊕ b * R. W0 is a fresh random value for each wire. The main observation is that an XOR gate can be realized by simply XORing the wire labels.
Both garbler and evaluator can compute the output label Wc as XOR of the input wire labels Wc = Wa ⊕ Wb.
Further efforts [ZRE15, RR21] build on this to reduce the circuit size of AND gates.
Our approach takes a different direction. We observe that if the garbler chooses n random offset values R1, …, Rn carefully (for details, see Definition 1 in the paper), we can encode n bits b1, …, bn per wire label as W = W0 ⊕ b1 * R1 ⊕ … ⊕ bn * Rn. With this encoding, XOR gates that take two n-bit wires as input and perform bit-wise XOR can be computed practically for free in the same way as in [KS08] by XORing the input wires.
However, AND gates as in [ZRE15, RR21] no longer work, instead we obtain so called projection gates that compute functions mapping n-bit to m-bit values. These gates are garbled in a standard way using Yao’s original approach where one row of this function table is encrypted using the respective encoded input wire as key. The result is a circuit size of 2n encrypted rows/ciphertexts per such gate. While this is expensive for garbling and communication, we note that evaluating such “complicated” n- to m-bit function only requires a single decryption operation. (Likewise, standard row-reduction and point-and-permute techniques can be applied that reduce the circuit size to 2n-1.)
We capitalize on this to accelerate SPN primitive evaluation since SPN primitives can be expressed as S-box functions and n-bit bit-wise XOR operations. The S-box function is computed with a n-bit to n-bit projection gate.
Many established primitives can be expressed in this way. We studied AES, CRAFT, Fides, MANTIS, Midori, Piccolo, SKINNY, TWINE and WAGE in the paper. Appendix B contains concrete descriptions of that expression for each primitive (family).
For instance the state of the SKINNY cipher (the round function is shown below) can be represented by 16 4-bit wires. The S-box layer simply computes a projection gate per state wire and all other operations are bit-wise XOR that are grouped as 4-bit wire XOR gates.

SPN Applications and performance
We briefly describe two applications: distributed Kerberos and MPC-based transciphering.
In the Kerberos authentication protocol, the key distribution center KDC holds central secret symmetric keys from participants as well as the ticket granting service’s secret key material. Since compromise of the KDC breaks authentication in the whole system, we can improve robustness and security by distributing the KDC and all the data it holds among two parties, a garbler and a evaluator. Then, each single party only holds XOR-shared secrets and therefore cannot compromise the system alone. Further, the circuits used for each operation are fixed and known beforehand which enables a split into offline and online phase. Then if, for instance, the client session key needs to be encrypted by the KDC, the client secret-shares the request data to the two parties. The garbler and evaluator only have to perform the input phase of the evaluation protocol since the garbled circuit has already been transmitted to the evaluator beforehand. A fast evaluation therefore means low latency for the client. Further, since clients only authenticate infrequently, sufficient downtime allows the garbler to replenish garbled circuits stored on the evaluating party.
In MPC-based transciphering, data is encrypted and the encryption key is secret shared among an MPC cluster. The ciphertext is used as public input the the MPC computation, which after performing a distributed decryption to obtain secret shares of the data can compute useful services, like privacy-preserving machine learning inference. Only secret sharing the key and not the whole data increases flexibility and allows for efficient re-use of the data by different MPC clusters using different protocols. Especially, if the data is sensor data from resource constraint IoT devices, this approach is beneficial. The MOZAIK project investigates such a use-case. This setting is also described in this blog post.

For all encryption or decryption operations that are described above, the bottleneck is the block cipher or permutation evaluation within the symmetric-key encryption scheme. We implemented this bottleneck operation using our garbling scheme and compared to two, state-of-the-art schemes, namely Half-Gates [ZRE15] and ThreeHalves [RR21].

We measured garbling time, the circuit size and evaluation time of a block cipher evaluation. We observe up to one order of magnitude speed-up during evaluation. This is traded off by slower garbling and/or larger circuit size. However, both these parts happen in the offline phase.
Security and Open Questions
We want to conclude this post by a brief discussion about security. We introduce a new notion for circular correlation robustness of hash functions, called n-TCCR. This definition is a generalization of tweakable circular correlation robustness where instead of one circular offset, the distinguisher can choose among n circular offsets.
If this definition is instantiated with random permutations (in practice via fixed-key AES, for instance), then the point-and-permute bits in a label encoding use n bit and thus reduce the security to k-n where k is the permutation input/output size. Concretely, using AES-128, garbling with our scheme has 128-n bits of security. For the studied use-cases, however, where n=4 or n=8, the security loss is not significant.
An interesting open question would be a construction of a n-TCCR function from a permutation call that does not require longer wire labels.
References
[KS08] Kolesnikov, V., Schneider, T. (2008). Improved Garbled Circuit: Free XOR Gates and Applications. In: Automata, Languages and Programming. ICALP 2008. Lecture Notes in Computer Science, vol 5126. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-70583-3_40
[ZRE15] Zahur, S., Rosulek, M., Evans, D. (2015). Two Halves Make a Whole. In: Advances in Cryptology – EUROCRYPT 2015. EUROCRYPT 2015. https://doi.org/10.1007/978-3-662-46803-6_8
[RR21] Rosulek, M., Roy, L. (2021). Three Halves Make a Whole? Beating the Half-Gates Lower Bound for Garbled Circuits. In: Advances in Cryptology – CRYPTO 2021. CRYPTO 2021. https://doi.org/10.1007/978-3-030-84242-0_5


