Skip to content

MPC: unexpected result when using bit shifts #227

Description

@sebw42

Hi, I've noticed an issue with the MPC compiler on the mpc_aws branch.
A combination of bit shifts and multiplications leads to unexpected results in certain cases.
Here is an example program:

int main(__attribute__((private(0))) int x){
    int y = (0 << 0);
    // should be 0
    return ((x * y) << 0);
}

Executing this results in a seemingly random number if we use the css selection scheme.

Compilation command:

export CARGO_MANIFEST_DIR="$PWD"; ./target/release/examples/circ --parties 2 examples/C/mpc/program.c mpc --cost-model "empirical" --selection-scheme css

Execution command:

/path/to/ABY/build/bin/aby_interpreter -m mpc -f ./scripts/aby_tests/tests/program_c -t ./scripts/aby_tests/test_inputs/program.txt -r 0 & /path/to/ABY/build/bin/aby_interpreter -m mpc -f ./scripts/aby_tests/tests/program_c -t ./scripts/aby_tests/test_inputs/program.txt -r 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions