encryptogroup / ABY

ABY - A Framework for Efficient Mixed-protocol Secure Two-party Computation
GNU Lesser General Public License v3.0
463 stars 132 forks source link

Wrong results in bench_operations and millionaire_prob_test #100

Closed Lucieno closed 5 years ago

Lucieno commented 6 years ago

How I compile: cmake .. -DABY_BUILD_EXE=On Version no. commit e237e648fc008994adb02ebfd3701aa310ceadcd

How I run: Server ./bin/bench_operations -r 0 Client ./bin/bench_operations -r 1 And they are on the same machine but different terminals.

Error messages:

Base OTs:       0
Op      1-bit   8-bit   16-bit  32-bit  64-bit
-----------------------------------------------
xorbool 0.619   Error:
        SERVER xorbool: values[0]: a = 201, b = 227, c = 63, verify = 42
0.401   Error:
        SERVER xorbool: values[0]: a = 30786, b = 462, c = 12594, verify = 31116
0.45    Error:
        SERVER xorbool: values[0]: a = 17627935, b = 262783479, c = 1999394163, verify = 245709544
0.272   Error:
        SERVER xorbool: values[0]: a = 5419185836575071031, b = 8975705317428515808, c = 3720700065592392394, verify = 4009554556454947031
0.425
...

Almost all the results on both server and client side are wrong.

Also, millionaire_prob_test has produce wrong results. Server:

Testing Millionaire's Problem in Yao sharing:

Alice Money:    844482695
Bob Money:      1134641053
Circuit Result: ALICE
Verify Result:  BOB

Client:

Testing Millionaire's Problem in Yao sharing:

Alice Money:    1305393236
Bob Money:      1831834216
Circuit Result: ALICE
Verify Result:  BOB

I ran the same commands on two different machines and repaeted them many times. One of machine is running on CentOS 7 (with gcc-8 and cmake 3.12.1) and the other on Ubuntu 16.04 (with gcc-8 and cmake 3.12.1), so it is not likely a problem caused by machine/package configuration.

lenerd commented 6 years ago

Regarding the Millionaire's Problem: Try to start server and client in the same second. E.g. with

./bin/millionaire_prob_test -r 0 &; ./bin/millionaire_prob_test -r 1

Then, both parties should have the same values, since the RNG is seeded with time(NULL).