emp-toolkit / emp-ag2pc

Authenticated Garbling and Efficient Maliciously Secure Two-Party Computation
Other
23 stars 19 forks source link

incorrect output using ag2pc #18

Closed kzhong130 closed 4 years ago

kzhong130 commented 4 years ago

Hi, I am trying out ag2pc to run a simple application (addition with values from two party). It turns out that the results after I reveal are incorrect. I have provided codes and detailed description in this repo: https://github.com/kzhong130/emp-ag2pc-max-example. I think this is related to @issue8 but not exactly the same. Thank you! Please let me know if there is anything unclear.

weikengchen commented 4 years ago

(Can you also attach a Makefile or something for the compilation commands?)

kzhong130 commented 4 years ago

Sure, for max-circuit-gen.cpp, I add that to the test directory of emp-tool repo, and then add a line "add_test(max-circuit-gen)" to the end of CMakeLists.txt in emp-tool repo. And for max-ag2.cpp, I do the same thing on emp-ag2pc repo. I can quickly fork those two repos and put the files under them, if that makes things easier. But that might require you complie/install the emp-tool & emp-ag2pc again? Please let me know which way works best for you, thank you!

weikengchen commented 4 years ago

I reproduced a similar incorrect result: A[0]: 4 A[1]: 6 A[2]: 2 B[0]: 5 B[1]: 1 B[2]: 3 A[0]+B[0]: 9 A[1]+B[1]: 7 A[2]+B[2]: 5

with the modification that A[0]+B[0] follows a different order.

I am on the way to look into it...

kzhong130 commented 4 years ago

Ah, sorry, I think we got the same result. I made a typo when pasting the results of A[i]+B[i]. Have pushed to my repo.

wangxiao1254 commented 4 years ago

I may not be able to take a look this week, but I suggest first using sh2pc to run the circuit. This makes sure nothing wrong with the circuit or how input is encoded.

Xiao

On Mon, Nov 2, 2020 at 11:52 PM Ke Zhong notifications@github.com wrote:

Ah, sorry, I think we got the same result. I made a typo when pasting the results of A[i]+B[i]. Have pushed to my repo.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/emp-toolkit/emp-ag2pc/issues/18#issuecomment-720918786, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARKGCWS3P5N2QYLC4OEBRLSN6LBBANCNFSM4TIJM4QQ .

weikengchen commented 4 years ago

Made a pull request here: https://github.com/kzhong130/emp-ag2pc-max-example/pull/1

It seems that the current plaintext engine demands Alice's input be allocated before Bob's input.

kzhong130 commented 4 years ago

Works now! Thank you so much. Sorry that I did not find any related stuff to that requirement before... So I am following another survey repo for this tool: https://github.com/MPC-SoK/frameworks/wiki/EMP-toolkit. In their example it seems find to just allocate both inputs in one loop. So maybe it would be great to mention that there as well.

weikengchen commented 4 years ago

I would say it is a limitation of emp-tool at this moment. The Bristol fashion circuits are not easy to work with. (This might be changed in the coming years.)