15. Garbled Circuits
A simple solution for two party computation would be to use oblivious transfers as noted here. However, this method is inefficient. We will look at Yao’s protocol, presented in 1986, for secure two-party computation.
The term garbled circuit was used by Beaver-Micali-Rogaway (BMR), presenting a multiparty protocol using a similar approach to Yao’s protocol.
Yao’s Protocol
This protocol is for general secure two party computation. By general, it means that the protocol can securely compute any functionality. The protocol works on boolean circuits using AND/OR gates, which can be extended to arbitrary circuits, such as addition, multiplication, etc. This protocol takes constant number of rounds, and is secure for semi-honest parties.
A plain circuit would be evaluated by giving raw values
Yao’s protocol is a compiler which transforms a circuit so that all information is hidden except for the final output.
Garbled Circuits
A garbled circuit is an encrypted circuit, with a pair of keys for each wire. For each gate, a key is given for each of the input wires. Using the keys, it is possible to compute the key of the gate output, but nothing else can be learned. For this process, we will use oblivious transfer.
Constructing a Garbled Circuit
The garbler first encrypts the circuit. First, assign two keys, called garbled values, to each wire of the circuit.
Suppose we have an AND gate, where
Then we have the following garbled values, as in columns 1 to 3. Now, encrypt the values of
For evaluation, the last column will be given to the other party as the representation of the garbled gate. The inputs will be given as
The above garbling process is done for all gates. For the last output gate, the garbler keeps a output translation table to himself, that maps
In summary, given a boolean circuit,
- Assign garbled values to all wires in the circuit.
- Construct garbled gates using the garbled values.
Note that the evaluator learns nothing during the evaluation.
Evaluating a Garbled Circuit
There is a slight problem here. In some encryption schemes, a ciphertext can be decrypted by an incorrect key. If the above encryptions are in arbitrary order, how does the evaluator know if he decrypted the correct one?
One method is to add redundant zeros to the
Another method is adding a bit to signal which ciphertext to decrypt. This method is called point-and-permute. The garbler chooses a random bit
For example, if the evaluator has
This method does not reduce security, since the bits
Protocol Description
Suppose we have garbler Alice and evaluator Bob.
- Alice garbles the circuit, generating garbled values and gates.
- Garbled gate tables and the garbled values of Alice’s inputs are sent to Bob.
- For Bob’s input wire
, Alice and Bob run an 1-out-of-2 OT protocol.
- Alice provides
and to the OT. - Bob inputs his input bit
to the OT, and Bob now has . - Bob has garbled values for all input wires, so evaluates the circuit.
- Bob sends the final garbled output to Alice.
- Alices uses the output translation table to recover the final result bit.
Note that OT can be done in parallel, reducing the round complexity.
Why is OT Necessary?
Suppose Alice gave both
Suppose we have a
So we need an OT to make sure that Bob only learns one of the garbled values.
Performance
- We need about
to rounds.- Depends on the implementation of the OT.
- Need additional rounds if the final output should be sent to a party.
- Anyways, takes constant number of rounds.
- Need
oblivious transfers, where is the number of inputs of Bob.- These can be carried out in parallel.
- Suppose that there are
gates.1 symmetric encryptions are required to build a garbled circuit. decryptions are required to compute the circuit.- We need to communicate the data of
gates.
Summary of Yao’s Protocol
Let
Alice generates a garbled circuit
Bob computes
Proof of Security (Semi-honest)
We show that if the underlying OT is secure, then Yao’s protocol is secure. If both parties are honest or corrupted, there is nothing to show, so we only show for the cases where one party is corrupted.
Alice is Corrupted
Alice’s view only consists of the messages it receives during the oblivious transfers. Since the OT is secure, OT will have its own simulator
In the OT-hybrid model, we assume an ideal OT. In this case, Alice receives no messages during the oblivious transfers. Then to simulate Alice, an empty transcript will be sufficient.
Bob is Corrupted
This case is harder to show. The simulator must construct a fake garbled circuit that is indistinguishable to the real one. But the simulator doesn’t know the inputs of Alice, so it cannot generate a real circuit.
Bob’s view contains his inputs
The output translation tables can be generated using this method. An entry of the table would be
Lastly for communicating garbled values, Alice’s input wires can be set to any two garbled values of the wire. Bob’s input wires should be simulated by the simulator of the OT, which will result in any one of the two values on the wire.
The BMR Protocol
This is a multiparty variant of Yao’s protocol.
For each wire of the circuit, two random super-seeds (garbled values) are used. Each party generates a seed, and the super-seed of the wire is the concatenation of all seeds generated by the parties.
For example, for input wire
where
Then for garbling gates, the super-seeds of the output wire is encrypted by the super-seeds of the input wires. As an example, suppose that we use
as the garbled value.
Why??? ↩︎