Faster Secure TwoParty Computation Using Garbled Circuits Yan
Faster Secure Two-Party Computation Using Garbled Circuits Yan Huang David Evans Jonathan Katz Lior Malka www. Might. Be. Evil. com
Secure Two-Party Computation Bob’s Genome: ACTG… Markers (~1000): [0, 1, …, 0] Bob Alice’s Genome: ACTG… Markers (~1000): [0, 0, …, 1] Alice Can Alice and Bob compute a function of their private data, without exposing anything about their data besides the result? 2
Overview • Describe a system for secure 2 -party computation using garbled circuits that is much more scalable and significantly faster than best prior work • Applications: – Face recognition: Hamming distance – Genomics: Edit distance, Smith-Waterman – Private encryption: Oblivious AES evaluation 3
Our Results 1, 2 10 1 max gates 8 0, 6 6 0, 4 4 0, 2 2 0 0 Fairplay [PSSW 09] TASTY Scalability Here non-free gates/s Fairplay [PSSW 09] TASTY Performance Here
Secure Function Evaluation Alice (circuit generator) Holds Bob (circuit evaluator) Holds Garbled Circuit Protocol Andrew Yao, 1986
Yao’s Garbled Circuits Inputs Output a b x 0 0 1 1 0 1 0 0 0 1 a b AND x
Computing with Meaningless Values? Inputs Output a a 0 a 1 ai, bi, xi are random values, chosen by the circuit generator but meaningless to the circuit evaluator. b b 0 b 1 a 0 or a 1 x x 0 x 0 x 1 b 0 or b 1 AND x 0 or x 1
Computing with Garbled Tables Inputs Output ai, bi, xi are random values, chosen by the circuit generator but meaningless to the circuit evaluator. b b 0 b 1 a 0 or a 1 x Enca 0, b 0(x 0) Enca 0, b 1(x 0) Enca 1, b 0(x 0) Enca 1, b 1(x 1) b 0 or b 1 AND x 0 or x 1 Ra pe ndo rm ml ut y e Bob can only decrypt one of these! a a 0 a 1 Garbled And Gate Enca 0, b 1(x 0) Enca 1, b 1(x 1) Enca 1, b 0(x 0) Enca 0, b 0(x 0)
Chaining Garbled Circuits a 0 a 1 b 0 AND Or Gate 2 Encx 00, x 11(x 21) Encx 01, x 10(x 21) Encx 00, x 10(x 20) b 1 x 0 And Gate 1 Enca 10, b 11(x 10) Enca 11, b 11(x 11) Enca 11, b 10(x 10) Enca 10, b 10(x 10) OR … x 2 Can do any computation privately this way! 9
Threat Model Semi-Honest (Honest-but-Curious) Adversary follows the protocol as specified (!), but tries to learn more from the protocol execution transcript May be good enough for some scenarios We are working on efficient solutions for malicious adversaries 10
Fairplay SFDL Compiler Circuit (SHDL) SFDL Program Alice Garbled Tables Generator Dahlia Malkhi, Noam Nisan, Benny Pinkas and Yaron Sella [USENIX Security 2004] Garb led T ables Bob Garbled Tables Evaluator 11
Problems? An alternative approach … would have been to apply Yao’s generic secure two-party protocol…. This would have required expressing the algorithm as a circuit … and then sending and computing that circuit. … [We] believe that the performance of our protocols is significantly better than that of applying generic protocols. Margarita Osadchy, Benny Pinkas, Ayman Jarrous, Boaz Moskovich. SCi. FI – A System for Secure Face Identification. Oakland 2010. [Generic SFE] is very fast … but the circuit size is extremely large…. Our prototype circuit compiler can compile circuits for problems of size (200, 200) but uses almost 2 GB of memory to do so…. larger circuits would be constrained by available memory for constructing their garbled versions. Somesh Jha, Louis Kruger, Vitaly Shmatikov. Towards Practical Privacy for Genomic Computation. Oakland 2008. 12
The Fallacy SFDL Compiler SFDL Program Alice Garbled Tables Generator The entire circuit is prepared and stored on both sides Circuit (SHDL) GGarb arbleled T d Taabbles Bob Garbled Tables Evaluator 13
Faster Garbled Circuits Circuit Structure GC Framework (Generator) Circuit-Level Application Circuit Structure GC Framework (Evaluator) Encx 00, x 11(x 21) Encx 20, x 21(x 30) x 20, (x 2 x 31(x 4 1) Enc ) Enc (x 5 x 0 , x 1 x 4 1 1 1 , x 3 1 ) 1) 0(x 3 Encx 2 Enc , x 2 x 4 1 1 x 501(x 6 1) 0, (x 4 ) Enc (x 7 x 2 , x 3 x 3 1 1 1 Enc (x 2 ) , x 6 1 ) 1) Enc x 0 1, x 10 x 41(x 3 , x 3110(x 5 Enc ) 0 0) Enc x 2 1, x 20 x 41(x 4 , x 511(x 6 Enc ) 0) Enc x 2 1, x 30 x 31(x 5 , x 601(x 7 Enc x 41, x 30 0) Enc (x 6 x 41, x 50 0) Enc (x 7 x 31, x 60 1) x 21 x 31 x 41 x 51 x 60 x 71 Gates can be evaluated as they are generated: pipelining 14
Benefits of Pipelining • Allows GC to scale to circuits of arbitrary size We ran circuits with over a billion gates, at a rate of roughly 10 μs per gate. • Improves the time efficiency
Problems in Existing (SFDL) Compilers Resource-demanding SFDL compilation It takes hours on a 40 GB memory server to compile a SFDL program that implements AES. Many optimization opportunities are missed Circuit level Minimize bitwidth Reduce the number of non-free gates Program level Treat public and secret values differently
Example: Secure Counter class Counter { int c = 0; void increment(bool b) { if (b) c++; } • SFDL requires pre-setting c to a fixed bit width • For best performance, its bit width should be adjusted dynamically • Saves n non-free gates (out of original n log n)
Circuit Optimization – Edit Distance for (int i = 1; i < a. length; ++i) for (int j = 1; j < b. length; ++j) { T = (a[i] == b[j]) ? 0 : 1; D[i][j] = min(D[i-1][j]+1, D[i][j-1]+1, D[i-1][j-1] + T); }
Circuit Optimization – Edit Distance D[i-1][j] D[i][j-1] D[i-1][j-1] 1 1 Add. One. Bit T Add. One. Bit 2 -Min D[i][j]
Circuit Optimization – Edit Distance D[i-1][j] D[i][j-1] D[i-1][j-1] 2 -Min T 1 Add. One. Bit 2 -Min D[i][j]
Circuit Optimization – Edit Distance D[i-1][j] D[i][j-1] D[i-1][j-1] 2 -Min T 1 2 -Min Mux Add. One. Bit D[i][j] Saves about 28% of gates
Circuit Library 1 2 -Min T 2 -Min Mux Add. One. Bit Through custom circuit design and the use of optimal circuit components, we strive to minimize the number of non-free gates V. Kolesnikov and T. Schneider. Improved Garbled Circuit: Free XOR Gates and Applications. (ICALP), 2008.
Some Results Problem Best Previous Result Our Result Hamming Distance (Face Recognition, Genetic Dating) – two 900 -bit vectors 213 s [SCi. FI, 2010] 0. 051 s 4176 x Levenshtein Distance (genome, text comparison) – two 200 -character inputs 534 s [Jha+, 2008] 18. 4 s 29 x [Not Implementable] 447 s - 3. 3 s [Henecka, 2010] 0. 2 s 16. 5 x Smith-Waterman (genome alignment) – two 60 nucleotide sequences AES Encryption Speedup Scalable: 1 billion gates evaluated at ≈100, 000 gates/second on regular PCs Comparisons are aligned to the same security level in the semi-honest model. 23
Timing Results 600 500 Best previous [Jha+, 2008] Here Seconds 400 300 [SCi. FI, 2010] 200 100 0 4176 x faster 29 x faster Hamming Distance Edit Distance Hamming distance (900 bits) (200 edit chars, 8 -bits(200 each)256 -bit chars)
Ease of Use • Our framework assumes no expert knowledge of cryptography • Need basic ideas of Boolean circuits • Circuit designs converted directly to Java programs
Use the Framework Traditional Java Application Rest of the Java Program Critical Component javac Library Circuit Critical Component Custom Circuit Critical Component Library Circuit Generator Java code Circuit Evaluator
Example: AES SBox Leveraging an existing ASIC design for AES allows us to reduce the state-ofthe-art AES circuit by 30% of non-free gates, compared to [PSSW 09] and [HKSSW 10] Wolkerstorfer, et al. An ASIC Implementation of the AES S-boxes. RSA-CT 2002.
Time Savings: AES 7 6 5 Seconds 4 3 2 16. 5 x faster 1 0 [PSSW 09] TASTY [Henecka, et al. CCS 2010] Here
Conclusion • Pipelining enables garbled-circuit technique to scale to large problem sizes • Circuit-level optimizations can dramatically reduce performance overhead Privacy-preserving applications can run orders of magnitude faster than previously thought.
Thanks! Questions? Download framework and Android demo application from Might. Be. Evil. com
- Slides: 30