secretflow / spu

SPU (Secure Processing Unit) aims to be a provable, measurable secure computation device, which provides computation ability while keeping your private data protected.
https://www.secretflow.org.cn/docs/spu/en/
Apache License 2.0
235 stars 102 forks source link

MPC代码实现中的一些不理解的地方,希望被解答 #884

Open WandQ opened 2 weeks ago

WandQ commented 2 weeks ago

Issue Type

Build/Install

Modules Involved

MPC protocol

Have you reproduced the bug with SPU HEAD?

Yes

Have you searched existing issues?

Yes

SPU Version

最新

OS Platform and Distribution

UBUNTU 20.04

Python Version

3.8

Compiler Version

11.2.1

Current Behavior?

以下这些是ABY3的api:

  // register arithmetic & binary kernels
  ctx->prot()
      ->regKernel<                                              //
          aby3::P2A, aby3::V2A, aby3::A2P, aby3::A2V,           // Conversions
          aby3::B2P, aby3::P2B, aby3::A2B,                      // Conversion2
          aby3::B2ASelector, /*aby3::B2AByOT, aby3::B2AByPPA*/  // B2A
          aby3::CastTypeB,                                      // Cast
          aby3::NegateA,                                        // Negate
          aby3::AddAP, aby3::AddAA,                             // Add
          aby3::MulAP, aby3::MulAA, aby3::MulA1B,               // Mul
          aby3::MatMulAP, aby3::MatMulAA,                       // MatMul
          aby3::LShiftA, aby3::LShiftB,                         // LShift
          aby3::RShiftB, aby3::ARShiftB,                        // (A)Rshift
          aby3::MsbA2B,                                         // MSB
          aby3::EqualAA, aby3::EqualAP,                         // Equal
          aby3::CommonTypeB, aby3::CommonTypeV,                 // CommonType
          aby3::AndBP, aby3::AndBB,                             // And
          aby3::XorBP, aby3::XorBB,                             // Xor
          aby3::BitrevB,                                        // bitreverse
          aby3::BitIntlB, aby3::BitDeintlB,  // bit(de)interleave
          aby3::RandA,                       // rand
#ifdef ENABLE_PRECISE_ABY3_TRUNCPR
          aby3::TruncAPr,  // Trunc
#else
          aby3::TruncA,
#endif
          aby3::OramOneHotAA, aby3::OramOneHotAP, aby3::OramReadOA,      // oram
          aby3::OramReadOP,                                              // oram
          aby3::RandPermM, aby3::PermAM, aby3::PermAP, aby3::InvPermAM,  // perm
          aby3::InvPermAP                                                // perm
          >();
}

问题1:里面的MulAP的P是什么缩写,这方法名是什么意思。V2A中的V是什么的缩写?

问题2:here中的方法涉及到了Bool电路的加减法,布尔电路的加法如何实现的呢?

Standalone code to reproduce the issue

同上

Relevant log output

No response

fionser commented 2 weeks ago
zhangwaer commented 6 days ago
  • P for public value (i.e., known to all parties)
  • V for local private value (i.e,. only known to one party)
  • A for arithmetic secret share
  • B for boolean secret share

thanks very much!!! so there is no Yao 3pc used in the aby3-spu?