Our new format is utilized in the SCALE-MAMBA software system to define the circuits for garbling. The new format is designed to be independent of the number of parties, and to capture more the nature of the function we are evaluating.
The `basic' format is defined by a list of gates. Each gate has one or two input wires (INV/NOT/EQ/EQW gates have only one input wire, XOR and AND have two input wires). A gate can have only one output wire. The `extended' format allows addition MAND gates, standing for Multiple AND, these have an arbitrary number of inputs and outputs (see below for details). Each file is of the following format:
2 1 3 4 5 XORcorresponds to
w_5 = XOR(w_3,w_4)
1 1 0 3 EQ 1 1 1 4 EQto say that wire 3 is assigned the value 0 and wire 4 the value 1
1 1 0 4 EQWto say wire 4 should equal wire 1
4 2 0 2 1 3 4 5 MANDexecutes the two MAND operations concurrently...
2 1 0 1 4 AND 2 1 2 3 5 AND
Function | Basic Circuit File | Extended Circuit File | No. ANDs | No. XORs | No. INVs | Depth |
64-bit Adder | adder64.txt | adder64.txt | 63 | 313 | 0 | 63 |
64-bit Subtract | sub64.txt | sub64.txt | 63 | 313 | 63 | 63 |
64-bit Negation | neg64.txt | neg64.txt | 62 | 63 | 64 | 62 |
64x64 -> 64 bit Multiplier | mult64.txt | mult64.txt | 4033 | 9642 | 0 | 63 |
64x64 -> 128 bit Multiplier | mult2_64.txt | mult2_64.txt | 8128 | 19904 | 0 | 127 |
64x64-bit Division (Signed) | divide64.txt | divide64.txt | 4664 | 24817 | 445 | 4158 |
64x64-bit Division (Unsigned) | udivide64.txt | udivide64.txt | 4285 | 12603 | 64 | 2205 |
64-bit Equal to Zero Test | zero_equal.txt | zero_equal.txt | 63 | 0 | 64 | 6 |
Function | Basic Circuit File | Extended Circuit File | No. ANDs | No. XORs | No. INVs | Depth |
AES-128(k,m) | aes_128.txt | aes_128.txt | 6400 | 28176 | 2087 | 60 |
AES-192(k,m) | aes_192.txt | aes_192.txt | 7168 | 32080 | 2317 | 72 |
AES-256(k,m) | aes_256.txt | aes_256.txt | 8832 | 39008 | 2826 | 84 |
Keccak-f | Keccak_f.txt | Keccak_f.txt | 38400 | 115200 | 38486 | 24 |
SHA-256 | sha256.txt | sha256.txt | 22573 | 110644 | 1856 | 1607 |
SHA-512 | sha512.txt | sha512.txt | 57947 | 286724 | 4946 | 3303 |
For AES we created a design using the Boyar-Peralta S-Boxes, which have 32 AND gates per S-Box.
For SHA-256 and SHA-512 we give a circuit which maps an input buffer and an input chaining state to the next chaining state.
To get the nice gate counts for SHA-256 and SHA-512 we thank Steven Goldfeder who provided advice and help from his work in the paper:
The circuit for udivide64 was provided by Steve Lu, who generated it using the EMP-Toolkit.
Function | Basic Circuit File | Extended Circuit File | No. ANDs | No. XORs | No. INVs | Depth |
add | FP-add.txt | FP-add.txt | 5385 | 8190 | 2062 | 235 |
mul | FP-mul.txt | FP-mul.txt | 19626 | 21947 | 3326 | 129 |
div | FP-div.txt | FP-div.txt | 82269 | 84151 | 17587 | 3619 |
eq | FP-eq.txt | FP-eq.txt | 315 | 65 | 837 | 9 |
lt | FP-lt.txt | FP-lt.txt | 381 | 257 | 898 | 67 |
f2i | FP-f2i.txt | FP-f2i.txt | 1467 | 1625 | 840 | 94 |
i2f | FP-i2f.txt | FP-i2f.txt | 2416 | 3605 | 1115 | 206 |
sqrt | FP-sqrt.txt | FP-sqrt.txt | 91504 | 100120 | 19900 | 6507 |
floor | FP-floor.txt | FP-floor.txt | 651 | 595 | 367 | 71 |
ceil | FP-ceil.txt | FP-ceil.txt | 650 | 597 | 371 | 71 |
double xx=....; unsigned long zz; zz=(long) nearbyint(xx);With i2f doing the inverse operation, i.e. converting a 64-bit integer into a double.
The floating point circuits were created by using the Berkeley SoftFloat library (version 2), then the output was passed through CBMC-GC to produce Bristol Format files with no OR's. We then manually edited the result to produce Bristol Fashion files.
David Archer
Victor Arribas Abril
Steve Lu
Pieter Maene
Nele Mertens
Danilo Sijacic
Nigel Smart