encryptogroup / MOTION

An efficient, user-friendly, modular, and extensible framework for mixed-protocol secure multi-party computation with two or more parties
MIT License
85 stars 40 forks source link

Retrieving incorrect outputs #5

Closed maDnemo closed 3 years ago

maDnemo commented 3 years ago

I was trying to view the results of operations in the benchmark and benchmark_integers examples using the As() and Or() functions, but I get incorrect results for all of the operations. I was wondering if there is an issue with the operations, or if I am not obtaining the results correctly?

Oleksandr-Tkachenko commented 3 years ago

What output do you expect from those operations? I think there we constructed just dummy wires to eliminate any possible effects of input sharing.

The millionaires' example might actually be a better starting point to get familiar with MOTION (if that was your goal). Also, three more examples will be added in a few days.

maDnemo commented 3 years ago

I modified the DummyArithmeticGmwShare function such that dummy_input has value 2, and verified with As() that the share has value 2. I then tried adding them together with the + operation and used Out() on the result. When I tried to use As() after that, the result I got was 8, not 4. In addition, I modified DummyBooleanGmwShare so that I could set the entire BitVector to true or false, but no matter what values I used, I always got the same outputs for And, Or, Xor, and Inv.

Oleksandr-Tkachenko commented 3 years ago

If I understand you correctly, you have two parties in MPC, who both create two additively shared wires with the "local" value 2, so what is shared is 2 + 2 = 4. Now, you add them together and have 4 in the wire of one party and the same in the wire of another party. Afterwards, you put an output gate (Out()) on the result and both parties retrieve the cleartext value, which equals 4 + 4 = 8. Could you please check if this is the case?

maDnemo commented 3 years ago

It appears that this is the case. How should I create shares for each party's input and add their values together? Is that done with In()?

Oleksandr-Tkachenko commented 3 years ago

yes, it might be helpful to also take a look at the previously linked millionaires' example

maDnemo commented 3 years ago

That helped me understand how the shares work, thank you!