Closed whoqz closed 7 months ago
The top of the following file has some instructions: https://github.com/data61/MP-SPDZ/blob/master/Programs/Source/htmac.mpc I suggest you start with local computation:
./compile.py htmac 1 1 1
Scripts/shamir.sh htmac-1-1-1
If that works, you can expand this by running the following on every node
./compile.py htmac 1 1 1
./shamir-party.x -p <node number> -N <total nodes> -h <hostname/IP of node 0> htmac-1-1-1
thank you for your reply! but i can't access to this link for some how. can you explain something about htmac.mpc? i.e. the function of this file or something else. what is the connection between this mpc file and prf_mimc.mpc?
Apologies, I've used the wrong repository, the link should now work. htmac.mpc
includes prf_mimc.mpc
on line 53.
oh! thank you so much! another question pls, can you explain those orders(command) you list above ? what's the meaning of those order? i can figure out part of some simple command, i would like to consult someone about those command lines, they are really confused for me. if i encounter some issues after, maybe i can count on myself to solve the problem. Besides, what does "shamir-party.x" actually do? i am a bit confused about the connection between mpc file and binary file like"shamir-party.x". how do they work together to reach my purpose?Could you please enlighten me?
shamir-party.x
implements secure computation based on Shamir's secret sharing via a virtual machine, and compile.py
produces the matching virtual machine code from the Python high-level code. The following section in the documentation goes deeper into this: https://mp-spdz.readthedocs.io/en/latest/journey.html
htmac.mpc is a benchmark test file or not? but i want to reach such scene: there are several nodes, every nodes has shares of secret and plaintext(via shamir),i want them to do the mpc with MiMC(need a secret and a plaintext as input),i want to obtain the final PRF result those nodes return with original secret and plaintext. how can i get the actual result?
Most of MP-SPDZ is geared towards benchmarking. I'm not particularly familiar with MiMC because someone else wrote that code. For ways of getting data into and out of an MPC computation, see the documentation: https://mp-spdz.readthedocs.io/en/latest/io.html
thank you! i just try those command you list before,
./compile.py htmac 1 1 1 Scripts/shamir.sh htmac-1-1-1
it told me "You can use Scripts/setup-ssl.sh <nparties>
i set 2 parties ,but i got error message "terminate called after throwing an instance of 'boost::wrapexcept
Shamir's secret sharing requires 3 parties.
still wrong. i set Scripts/setup-ssl.sh 3
and then Scripts/shamir.sh htmac-1-1-1
receive "terminate called after throwing an instance of 'boost::wrapexcept
Are there any more messages? As there are several parties, it would say:
some errors...
=== Party 1
more errors....
=== Party 2
more errors...
@localhost mp-spdz-0.3.8]$ Scripts/shamir.sh htmac-1-1-1
Running /home/hqz/mp-spdz-0.3.8/Scripts/../shamir-party.x 0 htmac-1-1-1 -pn 10077 -h localhost -N 3
Running /home/hqz/mp-spdz-0.3.8/Scripts/../shamir-party.x 1 htmac-1-1-1 -pn 10077 -h localhost -N 3
Running /home/hqz/mp-spdz-0.3.8/Scripts/../shamir-party.x 2 htmac-1-1-1 -pn 10077 -h localhost -N 3
Using statistical security parameter 40
Server-side handshake with P2 failed. Make sure both sides have the necessary certificate (Player-Data/P0.pem in the default configuration on their side and Player-Data/P2.pem on ours), and run `c_rehash <directory>` on its location.
The certificates should be the same on every host. Also make sure that it's still valid. Certificates generated with `Scripts/setup-ssl.sh` expire after a month.
See also https://mp-spdz.readthedocs.io/en/latest/troubleshooting.html#handshake-failures
Signature (should match the other side): d2dd14e19d6e5a4b2dfbb1acb8f83439/945cffb2e097261ee7d1684cfdde5674
terminate called after throwing an instance of 'boost::wrapexcept<boost::system::system_error>'
what(): handshake: stream truncated
/home/hqz/mp-spdz-0.3.8/Scripts/run-common.sh: line 90: 48933 Aborted (core dumped) $my_prefix $SPDZROOT/$bin $i $params 2>&1
48934 Done | { if test "$BENCH"; then
if test $i = $front_player; then
tee -a $log;
else
cat >> $log;
fi;
else
if test $i = $front_player; then
tee $log;
else
cat > $log;
fi;
fi; }
/home/hqz/mp-spdz-0.3.8/Scripts/run-common.sh: line 90: 48935 Aborted (core dumped) $my_prefix $SPDZROOT/$bin $i $params 2>&1
48936 Done | { if test "$BENCH"; then
if test $i = $front_player; then
tee -a $log;
else
cat >> $log;
fi;
else
if test $i = $front_player; then
tee $log;
else
cat > $log;
fi;
fi; }
/home/hqz/mp-spdz-0.3.8/Scripts/run-common.sh: line 90: 48937 Aborted (core dumped) $my_prefix $SPDZROOT/$bin $i $params 2>&1
48938 Done | { if test "$BENCH"; then
if test $i = $front_player; then
tee -a $log;
else
cat >> $log;
fi;
else
if test $i = $front_player; then
tee $log;
else
cat > $log;
fi;
fi; }
=== Party 1
Signature (should match the other side): d2dd14e19d6e5a4b2dfbb1acb8f83439/4dd1a79eec2faa69d678dc11c410253f
terminate called after throwing an instance of 'boost::wrapexcept<boost::system::system_error>'
what(): handshake: tlsv1 alert unknown ca
=== Party 2
Signature (should match the other side): d2dd14e19d6e5a4b2dfbb1acb8f83439/4dd1a79eec2faa69d678dc11c410253f
terminate called after throwing an instance of 'boost::wrapexcept<boost::system::system_error>'
what(): handshake: certificate verify failed
after i exec the
Scripts/setup-ssl.sh 3
Scripts/shamir.sh htmac-1-1-1
i got those erro message
What is the output of Scripts/setup-ssl.sh
?
@localhost mp-spdz-0.3.8]$ Scripts/setup-ssl.sh 3
Setting up SSL for 3 parties
Generating a 2048 bit RSA private key
....+++
......................+++
writing new private key to 'Player-Data/P0.key'
-----
Generating a 2048 bit RSA private key
................................................................................................................................................+++
...............................+++
writing new private key to 'Player-Data/P1.key'
-----
Generating a 2048 bit RSA private key
..............................................+++
............................+++
writing new private key to 'Player-Data/P2.key'
-----
Scripts/setup-ssl.sh: line 17: c_rehash: command not found
maybe c_rehash's cause?
Almost certainly. Which system are you using?
centos 7 in VMware
You should be able to install c_rehash
with yum install openssl-perl
.
finally, i got those command
Scripts/setup-ssl.sh 3
Scripts/shamir.sh htmac-1-1-1
work ! but i didn't set threshold value and give the original secret key value or anything else(seems like time_private_mac use some random data to do the test). what does shamir.sh do then? besides if i use
./shamir-party.x -p 0 -N 3 htmac 1-1-1
./shamir-party.x -p 1 -N 3 htmac 1-1-1
./shamir-party.x -p 2 -N 3 htmac 1-1-1
what actually do i set? in the htmac.mpc the node 0,node 1, node 2 seems like to play no roles. total messages in mpc file is
message = [sint(2*i+1) for i in range(nmessages)]
and the key is
key = sint.get_random_int(128)
then node 0,1,2 that i set play what roles in the mpc or the bechmarking test? have them(shamir.sh and those shamir-party.x command) or not play any differences?those nodes i set seems like to obtain no data and don't execute the mpc progress. i can not tell the actual process and still feel confused! thank you so much for your patience!
I still have some questions, looking forward to your further replies if you are free!
Indeed, the code uses some constants for the message and a fresh random key. See the documentation on input/output to learn about the ways of creating sint
values from external data and outputting: https://mp-spdz.readthedocs.io/en/latest/io.html
for example
./shamir-party.x 0 htmac-1-1-1 -pn 12168 -h localhost -N 3
./shamir-party.x 1 htmac-1-1-1 -pn 12168 -h localhost -N 3
./shamir-party.x 2 htmac-1-1-1 -pn 12168 -h localhost -N 3
So does this mean that the three commands above have already implemented the collaborative computation to obtain the PRF result? I noticed that in htmac.mpc, there doesn't seem to be a process for allocating shares to each participant. Is this process implemented by shamir-party.x? If I want to see the share information of each participant, what should I do? i have already checked the I/O document and found few useful information, the private outputs parts reveals few info.
So does this mean that the three commands above have already implemented the collaborative computation to obtain the PRF result?
Yes
I noticed that in htmac.mpc, there doesn't seem to be a process for allocating shares to each participant. Is this process implemented by shamir-party.x?
Yes
If I want to see the share information of each participant, what should I do? i have already checked the I/O document and found few useful information, the private outputs parts reveals few info.
You can use print_ln('%s', x, print_secrets=True)
to output secret shares.
What do you mean?
oh!sorry,i just find you have already answer my question before,perhaps it's network's delay, Thank you, i will check your answer above first. sorry
Much appreciated!, now i understand much better, Thank you!
@mkskeller another issue
You can use print_ln('%s', x, print_secrets=True) to output secret shares.
./shamir-party.x 0 htmac-1-1-1 -pn 12168 -h localhost -N 3 ./shamir-party.x 1 htmac-1-1-1 -pn 12168 -h localhost -N 3 ./shamir-party.x 2 htmac-1-1-1 -pn 12168 -h localhost -N 3
Considering situation above, what does x present? party 0, 1 or 2? In the mpc file, how can i get or set the x which contains the share information about every party? use
get_input_from()
(seems to be not ok) or something else?
x
would be an instance of sint
to see the secret sharing, but it can also be a cleartext value.
I know that, but where does x come from? how do i get the secret sharing of party 0,1 and 2?(i.e. how do i get access to the x? i want to get sharings of party 0, 1 and 2. )
x
can be any sint
representing a secret value, see the tutorial for some examples: https://github.com/data61/MP-SPDZ/blob/master/Programs/Source/tutorial.mpc
If you use print_ln
as above (and -OF .
when calling the virtual machine), every party will output their own share.
If you use print_ln as above (and -OF . when calling the virtual machine), every party will output their own share.
Can you explain this more detailed or give some examples?
Consider the following program:
x = sint(0) * sint(0)
print_ln('%s', x, print_secrets=True)
If you put that into Programs/Source/test.py
and then run
./compile.py test
./shamir-party.x 0 -OF . test &
./shamir-party.x 1 -OF . test &
./shamir-party.x 2 -OF . test
You should see three random-looking numbers, which corresponds to the shares. You can run the last three commands in three separate terminals for a less messy output.
i got several nodes, every nodes got shares of secrets and plaintexts seperately(via shamir), i want to get the final mimc result through the nodes(in the distributed way),i found the prf_mimc.mpc and the shamir-party.x(don't konw right or not),how can i use prf_mimc.mpc and shamir-party.x to reach my purpose? i am a rookie in this field, please can anyone give me some tips or help?