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

Fix B2A conversion #72

Closed sebastianst closed 6 years ago

sebastianst commented 6 years ago

B2A Conversion takes two rounds. If two conversions happen on consecutive layers, some information that the client side needs in the 2nd round of the first conversion are overwritten by the first round of the second conversion. Now this information is saved to m_vCONVGates2 and m_nConvShareIdx2 at a carefully selected position. I also added some commentary so that the next brave soul who, like me, hasn't a telepathic connection to the original author has a better chance of understanding what is going on with the B2A conversion. No fun.

sebastianst commented 6 years ago

I repurposed this PR for the full B2A fix. The new commits implement bit-perfect conversion - no more zero padding -> much more efficient.

The global and round-scoped counters m_nConvShareIdx and m_nConvShare{Snd,Rcv}Ctr were repurposed/rescaled to count bits instead of full type Ts.

Note that this code only works with a fixed version of CBitVector::SetBitsPosOffset. As a workaround, commit 07646aed48fc9067670517777caba05c264caaaf can be used until this is fixed.

lenerd commented 6 years ago

merged