Open
Conversation
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
usafchn
reviewed
Aug 22, 2023
usafchn
reviewed
Sep 22, 2023
Member
usafchn
left a comment
There was a problem hiding this comment.
所有的代码需要 format 一下
# c++
echo 'Formatting c++ code'
find . -type f -name '*.h' -o -name '*.cc' | xargs clang-format -i
# bazel
echo 'Formatting bazel code'
buildifier -r .
| do{ | ||
| get_prime(key_size/2,sk->p_); | ||
| get_prime(key_size/2,sk->q_); | ||
| }while(sk->p_ == sk->q_); |
Member
There was a problem hiding this comment.
- 判断 gcd(p-1 ,q-1) == 2,从而确保 n - 1 没有小因子
- 防止 square-root attacks, 需确保 p-q 是一个大整数
| namespace heu::lib::algorithms::leichi_paillier::test { | ||
| class KeyGenTest : public ::testing::TestWithParam<size_t> {}; | ||
| INSTANTIATE_TEST_SUITE_P(SubTest, KeyGenTest, | ||
| ::testing::Values(1024)); |
Member
There was a problem hiding this comment.
根据安全要求,即使 UT 代码也不再允许出现 1024 keysize,以避免对用户产生误导
| TEST_P(KeyGenTest, SubTest) { | ||
| SecretKey sk; | ||
| PublicKey pk; | ||
| KeyGenerator::Generate(GetParam(), &sk, &pk); |
|
|
||
| namespace heu::lib::algorithms::leichi_paillier::test { | ||
|
|
||
| class LEICHITest : public testing::Test { |
| return BN_cmp(bn1, bn2); | ||
| } | ||
|
|
||
| TEST_F(LEICHITest, DISABLE_EncDec) { |
Author
There was a problem hiding this comment.
PR提交测试时需要硬件支持,否则会failed,把单测都Disable了
| }; | ||
| void Deserialize(yacl::ByteContainerView in){ | ||
| std::istringstream is((std::string)in); | ||
| BN_bin2bn((uint8_t *)(is.str().data()), is.str().size(),n_.bn_); |
| std::vector<uint8_t> Tobin(T &op) | ||
| { | ||
| uint32_t n_bits_len = op.numBits(); | ||
| uint8_t* n_arr = new uint8_t[n_bits_len]; |
|
|
||
| Runtime _runtime; | ||
| std::vector<Plaintext> _pts(in_cts.size()); | ||
| uint8_t *ct_bytes = new uint8_t[in_cts.size()*BYTECOUNT(pk_.n_.numBits()*2)]; |
| } | ||
|
|
||
| TEST_P(EncryptorTest, MinMaxEnc) { | ||
| // if (GetParam() == SchemaType::Leichi) { |
| INVOKE(ENABLE_IPCL, func_or_macro, ::heu::lib::algorithms::paillier_ipcl, ##__VA_ARGS__) \ | ||
| INVOKE(true, func_or_macro, ::heu::lib::algorithms::paillier_z, ##__VA_ARGS__) \ | ||
| INVOKE(true, func_or_macro, ::heu::lib::algorithms::paillier_f, ##__VA_ARGS__) \ | ||
| INVOKE(ENABLE_LEICHI, func_or_macro, ::heu::lib::algorithms::leichi_paillier, ##__VA_ARGS__) \ |
Member
There was a problem hiding this comment.
leichi_paillier 加到 elgamal 之后,顺序与SchemaType enum相同
usafchn
reviewed
Jan 9, 2024
| } | ||
| } | ||
|
|
||
| OPERATION_TYPE Runtime::operation_trans(std::string operation) |
Member
There was a problem hiding this comment.
入参类型改成 const std::string & or std::string_view
| break; | ||
| case 512: | ||
| count = 1; | ||
| break; |
| }; | ||
|
|
||
| std::map<std::string, int> CHIP_TABLE = { | ||
| {"CHIP_0", (int) std::pow(2, 15)}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[Feature] Add algorithm(leichi_paillier) which uses leichi to speed up Paillier