Eurocrypt 2022: Free branching for MPC with more than two parties

This blog post is based on the paper Secure Multiparty Computation with Free Branching, presented by Aarushi Goel at EuroCrypt 2022.

Branching in MPC

The communication complexity of most modern MPC protocols is at least linear on the size of the circuit representation of the function to be computed, and is thus dependent on how succinct this representation can be. When evaluating conditional branches, for example, communication will depend on the total size of all the branches, when only the output of the active branch is required for the computation. It would, therefore, be desirable to have MPC protocols where the communication depends only on the size of the branch we actually need to compute (while maintaining the identity of this branch hidden from all the parties!).

Figure 1 – Evaluating conditional branches. (source: presenter slides)

Recent works by Heath and Kolsnekov (from Crypto 2020 and EuroCrypt 2021) have addressed this problem and achieved two-party semi-honest protocols for boolean circuits where communication depends only on the size of the largest branch. (Note that in their recent work in collaboration with Haque, Lu, Ostrovsky and Shah presented at EuroCrypt 2022 they additionally achieved sublinear evaluation cost in the circuit size – if you want to learn more about it be sure to check out this other blog post.) There was, however, no equivalent solution for protocols with more than two parties, and this is precisely the problem addressed by the authors of this work.

The authors present a compiler that generates a semi-honest MPC protocol with communication complexity linear on the size of the largest branch from any MPC protocol where the circuit is evaluated gate by gate, and the parties hold a sharing of the value associated with each intermediate wire. This result is extended to malicious adversaries (with an additional multiplicative overhead in the communication complexity), resulting in the first construction for efficiently evaluating conditional branches with malicious security. Additionally, they propose a (semi-honest) MPC protocol for boolean circuits with constant number of rounds, obtained by building a BMR-type garbled circuit through the linearly key-homomorphic PRFs based approach of Ben-Efraim et al.

The rest of this blog will focus on the non-constant round protocol.

How it works

Instead of having the parties evaluate all the branches and then filtering out the correct output, which was the general approach taken in previous related work, the goal in this paper is to obliviously select the correct branch and then execute this branch only. Note that this is similar to the problem of Private Function Evaluation (PFE), where one single party knows the function to be evaluated, and the rest of the parties provides the inputs and computes it in the blind. The situation in conditional branching is essentially a distributed version of this. No one knows the function to be computed (i.e., the active branch), but together they hold information that allows them to perform the correct operations.

This word builds upon the techniques introduced in the EuroCrypt 2013 paper by Mohassel and Sadeghian, which will be summarized below.

Private function evaluation

Mohassel and Sadeghian observe in their work that to hide the topology of the circuit representing the function to be computed, it is necessary to hide both the function associated with each gate in the circuit, as well as the wire configuration (i.e., the parties know the number of gates to be computed, but not how they are connected or which operation they perform).

Hiding gate functions: To achieve this, the party holding the function associates a selection variable to each gate \( g \) of the circuit. This variable will be 0 or 1 depending on whether the gate computes an addition or a multiplication, and it will be secret shared among all the parties. The parties can then compute both an addition and a multiplication of the input values, and use the selection variable to filter out the correct result:

\( [select_g] \cdot ([input_1] \cdot [input_2]) + (1-[select_g]) \cdot ([input_1] + [input_2])\)

Hiding wire configuration: This is done by considering that each intermediate wire has two endpoints: one associated with the gate it outputs from, and the other with the gate where it serves as input. There will be a mapping \(\pi\) between incoming and outgoing endpoints that is known to the function holder only. The non-function holding parties sample incoming and outgoing masks to hide the values in the wire, while the function holding party only learns the difference between the incoming and the outgoing mask of the same wire \(w\):

\(\Delta_w = imask_w\, -\, omask_{\pi(w)}\).

Note that only the function holding party can learn \(\Delta_w\) since the other parties do not know the map \(\pi\). The value \(\Delta_w\) allows the function holder to convert between masked output wire values and masked input wire values (meaning that the value remains the same, but it is now blinded with the corresponding incoming mask). After each gate is evaluated, its masked output value can be revealed in the clear. Then, the function holder converts it to the masked input value of the same wire. Whenever the value in this wire needs to be used as input, this masked input value is provided to the other parties, who will be able to remove the incoming mask without knowing the source of the wire.

Conditional branches

The main ideas used to adapt the PFE scheme for evaluating conditional branches are now outlined. Note that all the parties know the function represented by each branch, but they do not know which of them is the active branch. Since no party knows the function to be computed, no one will know the map \(\pi\) (which is needed to compute \(\Delta_w\)) or which are the variables \(select_g\) for the gates \(g\) of the active branch. To overcome these problems, the authors note that the parties will have a secret sharing of the unary representation of the index \(\alpha\) of the active branch, and also that they know the variables \(select_g\) associated with every gate of every branch. Then, by combining these two pieces of information, they can obtain a sharing of \(select_{g_\alpha}\) for the gates of the active branch:

\([select_{g_\alpha}] = [\alpha_1]\cdot select_{g_1} + … + [\alpha_k]\cdot select_{g_k} \)

where \(k\) is the number of branches. Similarly, they can locally compute the maps \(\pi_i\) for every branch, and locally generate shares of the incoming and outgoing masks (note that there will be as many incoming/outgoing masks as the number of wires in the largest branch). The outgoing masks must be permuted according to the maps \(\pi\) of all the branches, and then the sharing of \(\alpha\) can be used to select the correct set of permuted masks.

\([omask_{\pi_\alpha(w)}] = [\alpha_1]\cdot [omask_{\pi_1(w)}] + … + [\alpha_k]\cdot [omask_{\pi_k(w)}] \)

It is then easy to locally compute shares of \(\Delta\). However, calculating this inner product naively will incur communication dependent on the number of branches. Instead, the authors use Threshold Linearly Homomorphic Encryption to build a primitive called Oblivious Internal Product (OIP), which essentially allows each party to evaluate the inner product above over the encrypted shares of \(\alpha\) of every party.

To extend this to the case with malicious adversaries, it must be ensured that the inputs used to calculate the OIPs are consistent with the ones used in the underlying MPC. For the OIP receiver’s input, this is done by performing a MAC check through the underlying MPC, while for the OIP sender’s input a cut-and-choose approach is used.

Implementation and benchmarks

An implementation of the semi-honest, non-constant round compiler is available here. The implementation was done on top of both the MASCOT and the CDN protocols, and each of them was compared against the original protocol without the efficient branching compiler. The experiments show that the communication for this new technique remains nearly constant as the number of branches is increased, and there is and improvement over the original protocols as long as at least 8 branches are considered. For \(2^{6}\) branches, the improvement is more than 3-fold when using CDN, and more than 6-fold when using MASCOT.