emp-toolkit/emp-sh2pc

Porting sh2pc code to ag2pc; Generating GCs

Closed this issue · 5 comments

emp-sh2pc seems to work with c code (probably generating the GC in the background) while emp-ag2pc seems to need a pre designed GC as an input. Is there a way to port emp-sh2pc to emp-sg2pc for malicious security? Or is it possible to recover the underlying circuit file generated by emp-sh2pc.

Finally, are there standard garbled circuit generators (from a high level language like C) compatible with emp-ag2pc.

A tool in emp-tool's debug toolset provides this functionality. See this file:
https://github.com/emp-toolkit/emp-tool/blob/stable/test/gen_circuit.cpp

You will first write the function in this file, then you execute this debug program gen_circuit, which will generate a circuit file for the program.

Thanks. This works great. Though I'm a bit lost as to how to deal with Integer array inputs to the circuits. For an emp::Integer array A, passing something like ((block*)A[0].bits) to the compute function doesn't seem to be working quite alright.

I am not very sure which one is the compute(r) function. This file is an example related to the handling of integer, which could be helpful.

https://github.com/emp-toolkit/emp-tool/blob/stable/test/int.cpp

Sorry I mean the circuit "compute function" (https://github.com/emp-toolkit/emp-tool/blob/stable/emp-tool/circuits/circuit_file.h). I have generated a circuit using gen_circuit. It does work alright for Integer inputs (example signature "cf.compute((block*)a.bits, (block*)b.bits, (block*)b.bits)" ). However, I'm now trying to extend the circuit for inputs where a, b & c are Integer arrays. The gen_circuit seems to be generating the appropriate circuit, however I'm a bit unsure of function parameters for "compute" function in this case.