ECE 443/518 Fall 2024 - Project 6

Garbled Circuits



Report Due: 12/04 (Wed.), by the end of the day (Chicago time)
No Extension, Deadline is Final
Late submissions will NOT be graded

I. Overview

Garbled circuit enables two parties to compute a function collaboratively without revealing their own secrets. In this project, we are going to follow Lecture 19 and 20 to implement this mechanism with the following modifications.

  1. Instead of using 5-bit random strings to represent 0 and 1 for wires, we are going to use 128-bit random strings to make our circuits more secure.
  2. Instead of using modular addition/subtraction to encrypt and decrypt truth tables for gates, we are going to use the AES cipher with 256-bit key and 128-bit block. Since all of our gates are 2-input gates, this is a perfect fit - the two input signals have a total of 256 bits for the key, and the output signal, before and after encryption, has 128 bits.
  3. For simplicity, we setup input signals directly instead of implementing oblivious transfer.

II. Alice the Garbler

For your conveniece, we have implement part of the garbled circuit mechanism including the garbler, input/output, and a few tests, which can be downloaded here.

The implementation of the garbler is in the file alice.go and below are the details.


III. Implement Bob the Evaluator

Now it is your turn to complete the mechanism by implementing the evaluateGarbledCircuit function in bob.go . This is the only function you will need to modify for this section. In this function, a few lines of code are provided and below are the details.

Once you have implemented the function evaluateGarbledCircuit, you are ready to test your code by running the go package using "go run ." . There are 10 testcases in gc.go which are executed from the main function. The program will abort for any error during the execution but otherwise you will be able to see the messages "test 1 pass!" etc. indicating the tests pass. Note that you are not supposed to modify this file for this section.


IV. Support Additional Gate Types

Currently only NAND gates are supported. Although it is possible to implement any boolean logic with NAND gates only, it is not convenient at least and it is actually not efficient for garbled circuits. Please modify the code to support at least two kinds of logic gates from NOR, AND, OR, and XOR.

For this section you will need to modify alice.go for the two kinds of gates you choose to support. There is no need to modify bob.go after completing Section III. Then you will need to add 5 new testcases to gc.go and at least one testcase should use all the three kinds of gates (NAND and the two chosen by you).


V. Deliverables

Submit the following to Canvas for this project.

  1. 5 Points: A zip file including all your code and a project report explaining your code and approach. The report should also include screenshots showing whether the testcases are passed or not.
  2. 5 Points: 0.5 point for each passing testcase of the original 10 testcases of Section III.
  3. 5 Points: 1 point for each passing testcase of the 5 new testcases of Section IV.

VI. Bonus: Oblivious Transfer

Implement oblivious transfer to setup input signals for Bob. You may need to refer to Project 4 on how to use the rsa package in Go. You should also provide code to test your implementations.

Submit the following to Canvas together with your project submissions

  1. 3 Points: source code for implementation and testing, screenshots showing how it works, and a small paragraph explaining your approach.

The project should be done individually. You can discuss the project with other students but all the source code and writings should be your OWN. PLAGIARISM and called for DISCIPLINARY ACTION. NEVER share your source code and reports with others.