encryptogroup / ABY

ABY - A Framework for Efficient Mixed-protocol Secure Two-party Computation
GNU Lesser General Public License v3.0
463 stars 132 forks source link

Conversion BOOL -> YAO #102

Closed david-k closed 6 years ago

david-k commented 6 years ago

Hi, I have the following circuit:

std::vector<Sharing*>& sharings = party->GetSharings();
BooleanCircuit *aby_yao = dynamic_cast<BooleanCircuit*>(sharings.at(e_sharing::S_YAO)->GetCircuitBuildRoutine());
BooleanCircuit *aby_bool = dynamic_cast<BooleanCircuit*>(sharings.at(e_sharing::S_BOOL)->GetCircuitBuildRoutine());

uint32_t const_one_yao = aby_yao->PutConstantGate(1);
uint32_t const_zero_yao = aby_yao->PutINVGate(const_one_yao);
uint32_t const_zero_gmw = aby_yao->PutY2BCONVGate(const_zero_yao);
aby_bool->PutOUTGate(const_zero_gmw, ALL);

party->ExecCircuit();

Is this correct? Because during execution, I get the following error:

YaoClientSharing: Non-interactive operation not recognized: 7(Conversion)
dd23 commented 6 years ago

The conversion gates must be called from a circuit of the target sharing (see 3.3 in the developer guide).

So if you call uint32_t const_zero_gmw = aby_bool->PutY2BCONVGate(const_zero_yao); (aby_bool instead of aby_yao) the error should disappear.

Please give it a try and let us know if that worked.

david-k commented 6 years ago

Yes, this works. Sorry and thank you!

dd23 commented 6 years ago

No worries. Glad I could help :)