emp-toolkit/emp-pvc

Initializing inputs and capturing outputs

Closed this issue · 4 comments

I'm trying to convert a semihonest code to pvc code. I had moved all the initialization before the TPCF_OT_ONLY flag, however that doesn't seem to working. The circuit inputs are still being initialized to some random values. Also, printing the circuit output (using reveal) doesn't seem to be getting the right output (even for the test examples). Do the input and output values needs to be dealt with in a different manner?

@nitincic Hi,

  1. Could you provide some example codes ?
  2. "even for the test examples" -> Do you mean that you can not run the provided example correctly ?

@nitincic Hi,

  1. Could you provide some example codes ?
  2. "even for the test examples" -> Do you mean that you can not run the provided example correctly ?
  1. So doing something like the following within the emp-pvc code doesn't seem to work
Integer M = Integer(8,4);
cout<<M.reveal<string>();

This seems to return some incorrect value. Similarly after obtaining the output of the circuit, the reveal function doesn't seem to print the right value. I'm just trying to hard code the input into the code and not pass it using the run_[party] functions.

  1. For example, printing 'c' here seems to print some fixed incorrect values. Also, it seems to be independent of the initialization of a & b in the following function. Probably, it's an invalid operation?
Rt run_mult_circut(const void *al, const void *bb, int flag)
{
    long alice_len = std::max(2048L, ALICE_LEN);
    long bob_len = std::max(2048L, BOB_LEN);
    Integer a(alice_len, 5L, ALICE);
    Integer b(bob_len, 7L, BOB);
    if (flag & TPCF_OT_ONLY)
        return "";
    Integer c = a * b;
    cout<< c.reveal<string>(BOB); //added cout statement
    return "";
}

@nitincic

Hi, it seems the example codes are misleading. Sorry for that.
Actually, the "run_XX_circuit" is just a description about the circuit (e.g. number of input wires, and specify the output wires). The code "c.reveal(BOB)" here does not correspoding to any true output, but only specify that wires are the output wires.

The emp-pvc framework would do the actual output behind.
this line would print the result (in little endian bits format).
For example, run the run_mult_circut with 5 and 7 would give the following output
(perhaps you better use a smaller bit length < 2048).

ans = 11000100000000000000000000000000 (which is 35 in little endian format).

Hopes it solves your question.