-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
【OSCP】 + 在 YACL 上实现对称可搜索加密算法 #423
base: main
Are you sure you want to change the base?
Conversation
Hi, 因为现在架构有些变化,可否将 SSE 的实现代码放到 yacl/examples 文件夹下?感谢参与 |
以及,建议放在 |
Hello,UT 依然是失败的状态,麻烦先 fix 一下 |
[macOS_ut_arm64]这个UT中的错误貌似没有出在我贡献的代码中,我贡献的部分都通过测试了 |
Stale pull request message. Please comment to remove stale tag. Otherwise this pr will be closed soon. |
hello,麻烦处理下这个pr,谢谢 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1、增加一个yacl/examples/sse/README文件,简单描述新增的算法,并注明算法来源
参考
https://github.com/secretflow/secretflow/blob/d760429d8ab34cc4dcc45d4c7a5beab76c7edd36/examples/security/h_bd/README.md
2、为新增的类和方法增加注释,描述类和方法的作用;为代码实现增加注释
参考
https://github.com/secretflow/yacl/blob/5b1ecae2b15f43d9c5f4068019ac92bf505411f9/yacl/crypto/rand/rand.h
注释和文档请使用英文
namespace examples::sse { | ||
|
||
Sse::Sse(int bucket_size, int slot_size, int lambda, int n_lambda) | ||
: iv_(yacl::crypto::RandU32()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
使用 RandU128
std::tuple<std::map<std::string, std::string>, | ||
std::vector<std::vector<TSet::Record>>, | ||
std::vector<yacl::crypto::EcPoint>> | ||
SaveEDB(const std::string& k_map_file = "/tmp/sse_test_data/K_map.bin", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1、SaveEDB / LoadEDB 为什么要返回一份copy ?
2、不要在接口上指定默认值。
|
||
// append (e, y) to t. | ||
std::vector<uint8_t> ind_vector(ind.begin(), ind.end()); | ||
std::vector<uint8_t> e = AesCtrEncrypt(ind_vector, Ke, iv_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不要反复使用同一组key/iv加密不同的数据
sha256.Reset(); | ||
std::vector<uint8_t> K = sha256.Update(mac_str).CumulativeHash(); | ||
if (free_[b].empty()) { | ||
goto restart; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不要使用goto,用while/for等替代掉
} | ||
} | ||
|
||
return {tset_, Kt}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为什么 sse / tset两个类的一些函数要把私有成员变量copy一份返回出去?
如果外部有访问私有成员的需求,麻烦用 T& GetSomething() 或 const T& GetSomething() const 接口替代
|
||
c++; | ||
} | ||
T_[keyword] = t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
避免不必要的copy,std map/set/vector在插入新值时,如果可以 请使用 emplace(std::move(..), ..)
比如这里,用 T_.emplace(keyword, std::move(t))
Fixed + #97