From d0d35720b5575e98b02717ae70f08184ff8eea86 Mon Sep 17 00:00:00 2001 From: Marcel Keller Date: Mon, 14 Aug 2017 13:58:20 +0100 Subject: [PATCH] Bug when private inputs and private outputs in wrong order. --- Processor/Input.cpp | 25 ++++++++++++++----------- Processor/Input.h | 2 +- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Processor/Input.cpp b/Processor/Input.cpp index c76f2c9be..cc42ff40f 100644 --- a/Processor/Input.cpp +++ b/Processor/Input.cpp @@ -10,7 +10,7 @@ template Input::Input(Processor& proc, MAC_Check& mc) : - proc(proc), MC(mc), values_input(0) + proc(proc), MC(mc), shares(proc.P.num_players()), values_input(0) { buffer.setup(&proc.private_input, -1, "private input"); } @@ -34,15 +34,17 @@ void Input::adjust_mac(Share& share, T& value) template void Input::start(int player, int n_inputs) { + shares[player].resize(n_inputs); + vector rr(n_inputs); + if (player == proc.P.my_num()) { octetStream o; - shares.resize(n_inputs); for (int i = 0; i < n_inputs; i++) { T rr, t; - Share& share = shares[i]; + Share& share = shares[player][i]; proc.DataF.get_input(share, rr, player); T xi; buffer.input(t); @@ -56,19 +58,21 @@ void Input::start(int player, int n_inputs) proc.P.send_all(o, true); values_input += n_inputs; } + else + { + T t; + for (int i = 0; i < n_inputs; i++) + proc.DataF.get_input(shares[player][i], t, player); + } } template void Input::stop(int player, vector targets) { - T tmp; + for (unsigned int i = 0; i < targets.size(); i++) + proc.get_S_ref(targets[i]) = shares[player][i]; - if (player == proc.P.my_num()) - { - for (unsigned int i = 0; i < targets.size(); i++) - proc.get_S_ref(targets[i]) = shares[i]; - } - else + if (proc.P.my_num() != player) { T t; octetStream o; @@ -78,7 +82,6 @@ void Input::stop(int player, vector targets) for (unsigned int i = 0; i < targets.size(); i++) { Share& share = proc.get_S_ref(targets[i]); - proc.DataF.get_input(share, t, player); t.unpack(o); adjust_mac(share, t); } diff --git a/Processor/Input.h b/Processor/Input.h index bb0a767b4..69a870727 100644 --- a/Processor/Input.h +++ b/Processor/Input.h @@ -23,7 +23,7 @@ class Input { Processor& proc; MAC_Check& MC; - vector< Share > shares; + vector< vector< Share > > shares; Buffer buffer; Timer timer;