Issue67

Title SFDL converter
Type wish Status resolved
Importance 90.0
Superseder Nosy List mg, mk, stm, tpj
Assigned To tpj Keywords

Created on 2008-09-26.12:57:15 by mg, last changed 2010-08-12.12:23:59 by tpj.

Files
File name Uploaded Type Edit Remove
FairPlay.g mk, 2008-10-20.13:44:01 application/octet-stream
FairPlay2Viff.py mk, 2008-10-20.15:14:08 text/x-python
contextmanager.py mk, 2008-10-20.15:14:29 text/x-python
millionaires.py mg, 2008-10-26.13:20:04 text/x-python
object_descender.py mk, 2008-10-20.15:14:18 text/x-python
secondpriceauction.py mg, 2008-10-26.13:20:04 text/x-python
voting.py mg, 2008-10-26.13:20:04 text/x-python
Messages
msg314 (view) Author: tpj Date: 2010-08-12.12:23:59
A SFDL2.1 to VIFF compiler has been implemented and is available at

    http://bitbucket.org/aicis/fairplay2viff


Note that we ended up using the parser that was already built into the 
FairPlayMP system. Further details in

    http://bitbucket.org/aicis/fairplay2viff/src/tip/java/README.txt
msg287 (view) Author: mg Date: 2008-10-26.13:20:04
Hi,

I've had a look at the SFDL 2.1 semantics and I must say that it is
quite loosely defined in the PDF linked to from this page:

  http://www.cs.huji.ac.il/project/Fairplay/fairplayMP.html

But I have tried to sketch out a translation into VIFF programs, please
see the attached files. My idea is to:

* Find the arguments to the main function in SFDL. The argument types
  must be the player types, if I read the SFDL 2.1 spec correctly. Or
  rather, that is how the examples work.

* For each player type we make a class which functions as the struct in
  SFDL. The class has input and output attributes, which are initially
  set to None.

* Players object (alice, bob, ...) are created from the classes just
  defined.

* A input gathering step is done. Here the correct player asks for user
  input as necessary and stored this in the input attribute of the
  correct player object.

* Everybody then calls shamir_share with alice.input, bob.input, etc.
  After that, alice.input contains the correct share of Alice's input.

* Calculations can proceed on the input values -- assignments can be
  done to the output attributes as necessary. Here we need to

  * Handle assignments in if-statements by conditional assignments.
    Please see this message for some thoughts on this:

      http://article.gmane.org/gmane.comp.cryptography.viff.devel/311

  * Declare that we cannot handle most of the bit fiddling which is easy
    in FairPlay but tricky or imposible in VIFF. A left shift is easy,
    just multiply by 2**i.

* Output values are opened to the correct players.

Of course this needs a bit of boiler-plate code at the top and bottom,
but it seems doable.
msg286 (view) Author: stm Date: 2008-10-21.13:11:30
No, it is entirely correct usage, I hope you did not expect miracles ;)

On the other hand due to all the overloading we have, it is maybe not so 
difficult to make it into a viff program. Starting by secret-sharing the 
inputs, and ending up opening the outputs to the right players.
msg285 (view) Author: mk Date: 2008-10-21.12:37:47
Consider this SFDL program. It's about as simple as it gets:

program Simple {
    type int = Int[4];
    
    type Player = struct {int input, int output};
    
    function void main(Player player0, Player player1, Player player2) {
        output = player0.input + player1.input + player2.input;
        player0.output = output;
        player1.output = output;
        player2.output = output;        
    }
}

If we run it through the converter, we get the following in Python (I
removed a bunch of comment lines in the beginning):

import viff.field

def main(Type):
    output = ((player0.input+player1.input)+player2.input)
    player0.output = output
    player1.output = output
    player2.output = output

My conclusion is that this is definitely not a VIFF program, it's more
like SFDL Python Edition :) Seriously though, there's still a lot of
work to be done here. Sigurd please feel free to correct me, I'm just
naively applying your FairPlay2Viff program, maybe I missed something.

(If you got an email about this before, I apologise. I messed the
first one up :) )
msg283 (view) Author: mk Date: 2008-10-21.12:13:32
I got the converter to output some reasonable python code, but the
output program is clearly not finished, and some parts of SFDL are not
yet supported.

I will try to get it to convert a minimal test program 100% correctly
and we can go from there.
msg282 (view) Author: mk Date: 2008-10-20.15:15:11
I uploaded some missing files (also written by Sigurd). I haven't
really looked at it before, so for now I am happily exploring his work
and testing it.
msg281 (view) Author: mk Date: 2008-10-20.13:44:01
Status update: Sigurd has written a grammar, which I have attached. It
is for the ANTLR parser generator. Read about ANTLR at:
http://www.antlr.org/

I will be continuing the work on it this week, however if you want to
participate just have a chat with me. Initially, I need to learn about
the ANTLR program and play around with it a bit, so don't expect too
much right away.
msg257 (view) Author: mg Date: 2008-10-02.12:58:31
Who of you want to do this, or are you doing it together? Please
update the "Assigned To" field as appropriate.
msg231 (view) Author: mg Date: 2008-09-26.15:15:12
Adding Sigurd -- Mikkels tells me that you're also looking at this.
msg230 (view) Author: mg Date: 2008-09-26.14:55:51
Deadline is November 1st.
msg229 (view) Author: mg Date: 2008-09-26.12:57:15
We've promised to make a converter which can read a SFDL program and
turn it into an equivalent VIFF program.
History
Date User Action Args
2010-08-12 12:23:59tpjsetstatus: in-progress -> resolved
nosy: + tpj
messages: + msg314
assignedto: mk -> tpj
2008-10-26 13:20:04mgsetfiles: + millionaires.py, voting.py, secondpriceauction.py
messages: + msg287
2008-10-21 13:11:30stmsetmessages: + msg286
2008-10-21 12:37:49mksetmessages: + msg285
2008-10-21 12:36:06mksetmessages: - msg284
2008-10-21 12:35:43mksetmessages: + msg284
2008-10-21 12:13:32mksetimportance: 70.0 -> 90.0
messages: + msg283
2008-10-20 15:15:12mksetmessages: + msg282
2008-10-20 15:14:29mksetfiles: + contextmanager.py
2008-10-20 15:14:18mksetfiles: + object_descender.py
2008-10-20 15:14:09mksetfiles: + FairPlay2Viff.py
2008-10-20 13:44:01mksetstatus: chatting -> in-progress
files: + FairPlay.g
messages: + msg281
2008-10-02 12:58:31mgsetmessages: + msg257
2008-09-26 15:15:12mgsetnosy: + stm
messages: + msg231
2008-09-26 14:55:51mgsetstatus: unread -> chatting
messages: + msg230
2008-09-26 12:57:15mgcreate