Skip to content

Commit

Permalink
repo-sync-2024-08-16T11:45:41+0800 (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie authored Aug 16, 2024
1 parent 58bbbeb commit 364a413
Show file tree
Hide file tree
Showing 47 changed files with 1,891 additions and 1,268 deletions.
41 changes: 14 additions & 27 deletions ALGORITHMS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Supported Crypto Algorithms
# Supported Advanced Crypto Algorithms

## Primitives

### Oblivious Transfer and Extensions
## Oblivious Transfer and Extensions

- The Simplest Protocol for Oblivious Transfer\
*Tung Chou, Claudio Orlandi*\
Expand Down Expand Up @@ -36,7 +34,7 @@
*Lawrence Roy*\
Crypto 2022, [publisher](https://www.iacr.org/cryptodb//data/paper.php?pubkey=32258), Roy22

### Vector Oblivious Linear Evaluation (over Field 2k)
## Vector Oblivious Linear Evaluation (over Field 2k)

Base VOLE:

Expand All @@ -58,8 +56,13 @@ Silent VOLE:
*Elette Boyle, Geoffroy Couteau, Niv Gilboa, Yuval Ishai, Lisa Kohl, Nicolas Resch, Peter Scholl*\
Crypto 2022, [eprint](https://eprint.iacr.org/2022/1014), BCG+22

Subfield VOLE:

- Wolverine: Fast, Scalable, and Communication-Efficient Zero-Knowledge Proofs for Boolean and Arithmetic Circuits\
*Chenkai Weng, Kang Yang, Jonathan Katz, Xiao Wang*
SP, 2021, [eprint](https://eprint.iacr.org/2020/925), WYKW21

### Codes
## Codes

Local Linear Code

Expand All @@ -80,19 +83,13 @@ Expanding Accumulation Code
Crypto 2022, [eprint](https://eprint.iacr.org/2022/1014), BCG+22


## Theoretical Tools

Random Oracle (RO)

- TBD
## Distributed Point Functions

Random Permutation (RP)
- Function secret sharing: improvements and extensions\
*Elette Boyle, Niv Gilboa, Yuval Ishai*\
CCS 2016, [eprint](https://eprint.iacr.org/2018/707), BGI16

- TBD

Pseudorandom Generator (PRG)

- TBD
## Theoretical Tools

Correlation-Robust Hash (CrHash)

Expand All @@ -106,13 +103,3 @@ Circular Correlation-Robust Hash (CCR Hash)
*Chun Guo, Jonathan Katz, Xiao Wang, Yu Yu*\
Preprint 2019, [eprint](https://eprint.iacr.org/2019/074), GKWY19

## Basic (Traditional) algorithms (TBD)

- AEAD
- AES
- Block Cipher
- ECC
- Hash
- HMAC
- Public-Key Encryption: RSA, SM2
- Digital Signature: RSA, SM2
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Supported platforms:

## Getting Started

Yacl uses the [bazel](https://bazel.build/) build system, you may use the following codes to build and test yacl modules. For more guidelines about how to **do crypto research on Yacl**, **use Yacl's shipped crypto tools**, or **integrate Yacl into your system**, please check the [Getting Started Guide](GETTING_STARTED.md).
Yacl uses the [bazel](https://bazel.build/) build system, you may use the following codes to build and test yacl modules. For more guidelines about **how to develop on yacl**, please check the [Getting Started Guide](GETTING_STARTED.md).

## License

Expand Down
1 change: 1 addition & 0 deletions bazel/openssl.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ yacl_configure_make(
}),
lib_name = "openssl",
lib_source = ":all_srcs",
linkopts = ["-ldl"],
# Note that for Linux builds, libssl must come before libcrypto on the linker command-line.
# As such, libssl must be listed before libcrypto
out_static_libs = [
Expand Down
2 changes: 1 addition & 1 deletion examples/psu/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ yacl_cc_library(
"//yacl/kernel/algorithms:kkrt_ote",
"//yacl/kernel/algorithms:softspoken_ote",
"//yacl/link",
"//yacl/math/f2k",
"//yacl/math/galois_field:gf_intrinsic",
"@com_google_absl//absl/types:span",
],
)
Expand Down
11 changes: 6 additions & 5 deletions examples/psu/krtw19_psu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ auto HashInputs(const std::vector<uint128_t>& elem_hashes, size_t count) {
uint64_t Evaluate(const std::vector<uint64_t>& coeffs, uint64_t x) {
uint64_t y = coeffs.back();
for (auto it = std::next(coeffs.rbegin()); it != coeffs.rend(); ++it) {
y = yacl::GfMul64(y, x) ^ *it;
y = yacl::math::Gf64Mul(y, x) ^ *it;
}
return y;
}
Expand All @@ -71,7 +71,7 @@ std::vector<uint64_t> Interpolate(const std::vector<uint64_t>& xs,
for (size_t j = 0; j < size; ++j) {
uint64_t sum = 0;
for (size_t k = 0; k <= j + 1; ++k) {
sum = std::exchange(poly[k], yacl::GfMul64(poly[k], xs[j]) ^ sum);
sum = std::exchange(poly[k], yacl::math::Gf64Mul(poly[k], xs[j]) ^ sum);
}
}

Expand All @@ -83,13 +83,14 @@ std::vector<uint64_t> Interpolate(const std::vector<uint64_t>& xs,
uint64_t xi = xs[i];
subpoly[size - 1] = 1;
for (int32_t k = size - 2; k >= 0; --k) {
subpoly[k] = poly[k + 1] ^ yacl::GfMul64(subpoly[k + 1], xi);
subpoly[k] = poly[k + 1] ^ yacl::math::Gf64Mul(subpoly[k + 1], xi);
}

auto prod = yacl::GfMul64(ys[i], yacl::GfInv64(Evaluate(subpoly, xi)));
auto prod =
yacl::math::Gf64Mul(ys[i], yacl::math::Gf64Inv(Evaluate(subpoly, xi)));
// update coeff
for (size_t k = 0; k < size; ++k) {
coeffs[k] = coeffs[k] ^ yacl::GfMul64(subpoly[k], prod);
coeffs[k] = coeffs[k] ^ yacl::math::Gf64Mul(subpoly[k], prod);
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/psu/krtw19_psu.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include "yacl/base/int128.h"
#include "yacl/link/link.h"
#include "yacl/math/f2k/f2k.h"
#include "yacl/math/galois_field/gf_intrinsic.h"
#include "yacl/secparam.h"

/* submodules */
Expand Down
52 changes: 52 additions & 0 deletions yacl/crypto/experimental/dpf/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,23 @@ load("//bazel:yacl.bzl", "yacl_cc_library", "yacl_cc_test")

package(default_visibility = ["//visibility:public"])

yacl_cc_library(
name = "ge2n",
srcs = ["ge2n.h"],
deps = [
"//yacl/base:exception",
"//yacl/base:int128",
],
)

yacl_cc_library(
name = "dpf",
srcs = ["dpf.cc"],
hdrs = ["dpf.h"],
deps = [
":ge2n",
"//yacl/base:int128",
"//yacl/crypto/rand",
"//yacl/crypto/tools:prg",
"//yacl/link",
],
Expand All @@ -34,3 +45,44 @@ yacl_cc_test(
":dpf",
],
)

yacl_cc_library(
name = "dcf",
srcs = ["dcf.cc"],
hdrs = ["dcf.h"],
deps = [
":ge2n",
"//yacl/base:int128",
"//yacl/crypto/rand",
"//yacl/crypto/tools:prg",
"//yacl/link",
],
)

yacl_cc_test(
name = "dcf_test",
srcs = ["dcf_test.cc"],
deps = [
":dcf",
],
)

yacl_cc_library(
name = "pprf",
srcs = ["pprf.cc"],
hdrs = ["pprf.h"],
deps = [
":ge2n",
"//yacl/base:int128",
"//yacl/crypto/tools:prg",
],
)

yacl_cc_test(
name = "pprf_test",
srcs = ["pprf_test.cc"],
deps = [
":pprf",
"//yacl/crypto/rand",
],
)
Loading

0 comments on commit 364a413

Please sign in to comment.