Skip to content

Commit

Permalink
repo-sync-2023-12-20T15:33:48+0800 (#176)
Browse files Browse the repository at this point in the history
* repo-sync-2023-12-20T15:33:48+0800

* repo-sync-2023-12-21T10:26:36+0800

* repo-sync-2023-12-21T12:51:40+0800

* repo-sync-2023-12-21T13:08:18+0800
  • Loading branch information
Jamie-Cui authored Dec 21, 2023
1 parent 0610185 commit 816ac40
Show file tree
Hide file tree
Showing 229 changed files with 7,170 additions and 6,214 deletions.
5 changes: 3 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

common --experimental_repo_remote_exec
common --experimental_cc_shared_library

build --incompatible_new_actions_api=false
build --copt=-fdiagnostics-color=always
Expand All @@ -31,7 +32,7 @@ build:macos --host_copt=-Wa,--noexecstack
# platform specific config
# Bazel will automatic pick platform config since we have enable_platform_specific_config set
build:macos --features=-supports_dynamic_linker
build:macos --linkopt="-Wl,-no_warn_duplicate_libraries"
build:macos --linkopt="-Wl"
build:macos --copt=-Wno-unused-command-line-argument
build:macos --host_copt=-Wno-unused-command-line-argument

Expand All @@ -40,4 +41,4 @@ build:ubsan --features=ubsan

test --keep_going
test --test_output=errors
test --test_timeout=180
test --test_timeout=360
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.4.0
6.2.1
31 changes: 19 additions & 12 deletions ALGORITHMS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Supported Crypto Algorithms

TODO

## Primitives

- OT
- Simplest OT : https://eprint.iacr.org/2015/267.pdf
- INKP OT Extension : https://www.iacr.org/archive/crypto2003/27290145/27290145.pdf
Expand All @@ -14,20 +13,28 @@ TODO
- Softspoken OT Extension : https://eprint.iacr.org/2022/192.pdf
- VOLE(over f2k)
- base VOLE : https://eprint.iacr.org/2016/505.pdf
- Silent VOLE : https://eprint.iacr.org/2019/1159.pdf, https://eprint.iacr.org/2021/1150.pdf, https://eprint.iacr.org/2022/1014.pdf
- Silent VOLE : https://eprint.iacr.org/2019/1159.pdf, https://eprint.iacr.org/2021/1150.pdf https://eprint.iacr.org/2022/1014.pdf

- CODE
- Local Linear Code : https://eprint.iacr.org/2020/924.pdf
- Low Density Parity Check Code (Silver Code) : https://eprint.iacr.org/2021/1150.pdf
- Expanding Accumulation Code : https://eprint.iacr.org/2022/1014.pdf

## Theoretical Tools

- Random Oracle
- Random Permutation
- Local Linear Code : https://eprint.iacr.org/2020/924.pdf
- Low Density Parity Check Code (Silver Code) : https://eprint.iacr.org/2021/1150.pdf
- Expanding Accumulation Code : https://eprint.iacr.org/2022/1014.pdf
- Correlation-Robust Hash Function : https://eprint.iacr.org/2019/074.pdf
- Circular Correlation-Robust Hash Function : https://eprint.iacr.org/2019/074.pdf
- Random Oracle (RO)
- Random Permutation (RP)
- Pseudorandom Generator (PRG)
- Correlation-Robust Hash (CrHash) : https://eprint.iacr.org/2019/074.pdf
- Circular Correlation-Robust Hash (CcrHash) : https://eprint.iacr.org/2019/074.pdf

## Basic (Traditional) algorithms

- AEAD
- AES
- Hash: SHA2, SM2
- RSA
- Block Cipher
- ECC (TODO)
- Hash
- HMAC
- PKE: RSA, SM2
- Signature: RSA, SM2
20 changes: 14 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,50 @@ All notable changes to this project will be documented in this file.
> - Add `[Bugfix]` prefix for bug fixes
> - Add `[API]` prefix for API changes
## Staging
- [YACL] v0.4.2
- [Dependency] Bump: Openssl 3.0.12 (experimental)
- [Feature] Add Softspoken OTe (malicious version)
- [API] Refactor entropy source, drbg, and rand; Refine traditional crypto APIs
- [Bugifx] Multiple bugfixes


## 2023-11-16
- [YACL] 0.4.1.1
- [YACL] v0.4.1.1
- [Feature] Init Global Security Parameters for Yacl [WIP: apply security parameter to all algorithms]
- [Feature] Add Softspoken OTe (semi-honest version)
- [Feature] Add Silent Vole [WIP: optimize MpVole and DualEncode]

## 2023-10-20
- [YACL] 0.4.1
- [YACL] v0.4.1
- [Feature] Add Sigma-type ZKP Protocols (An unified implementation)
- [Feature] Add ECC Pairing SPI and support to libmcl(ecc, pairing)
- [Feature] Add Multiplication for GF(2^64) and GF(2^128)
- [Bugfix] fix KOS OTe security flaws
- [Feature] Add AVX2 Matrix Transpose

## 2023-05-25
- [YACL] 0.3.3
- [YACL] v0.3.3
- [Feature] Add Ferret OTe
- [Feature] Add Gywz OTe (Correlated GGM Tree)
- [Feature] Add KOS OTe (warning: KOS still has potential security flaws)

## 2023-02-02
- [YACL] 0.3.1
- [YACL] v0.3.1
- [Feature] Add `dynamic_bitset` for manipulating bit vectors
- [API] RO now can accept multiple inputs
- [API] Add iknp cot api, improve iknp performance
- [Bugfix] Fix Several m1 related bugs

## 2022-12-08
- [YACL] 0.3.0
- [YACL] v0.3.0
- [Feature] Add random permutation and correlation-robust hash function
- [Feature] Add OT/OTe benchmark
- [API] Fix randomness implementation
- [API] Re-organize repo layout
- [Bugfix] Fix Random Oralce Usage

## 2022-12-01
- [YACL] 0.2.0
- [YACL] v0.2.0
- [API] Rename YASL to YACL
- [API] Re-organize repo layout
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ Repo layout:

- [base](yacl/base/): some basic types and utils in yacl.
- [crypto](yacl/crypto/): a crypto library desigend for secure computation and so on.
- [base](yacl/crypto/base): **basic/standarized crypto**, i.e. AES, DRBG, hashing.
- [base](yacl/crypto/base): **basic/standarized crypto**, i.e. AES, hashing.
- [primitives](yacl/crypto/primitives/): **crypto primitives**, i.e. OT, DPF.
- [tools](yacl/crypto/tools/): **theoretical crypto tools**, i.e. Random Oracle (RO), PRG.
- [utils](yacl/crypto/utils/): easy-to-use **crypto utilities**.
- [io](yacl/io/): a simple streaming-based io library.
- [link](yacl/link/): a simple rpc-based MPI framework, providing the [SPMD](https://en.wikipedia.org/wiki/SPMD) parallel programming capability.

## Supported Crypto Algorithms
## Supported crypto algorithms

See **Full List** of supported algorithms: [ALGORITHMS.md](ALGORITHMS.md)
See **Full List** of supported algorithms in: [ALGORITHMS.md](ALGORITHMS.md)

**Selected algorithms**:

Expand All @@ -26,14 +26,14 @@ See **Full List** of supported algorithms: [ALGORITHMS.md](ALGORITHMS.md)
- Distributed Point Function: [BGI16](https://eprint.iacr.org/2018/707.pdf)
- Threshold Proxy-Re-encryption: [umbral with GM](https://github.com/nucypher/umbral-doc/blob/master/umbral-doc.pdf).

## Build

### Supported platforms
## Supported platforms

| | Linux x86_64 | Linux aarch64 | macOS x86_64 | macOS Apple Silicon | Windows x86_64 | Windows WSL2 x86_64 |
|-----|--------------|---------------|--------------|---------------------|----------------|---------------------|
| CPU | yes | yes | yes | yes | no | yes |

## Build

### Prerequisite

#### Linux
Expand All @@ -53,7 +53,7 @@ sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
https://brew.sh/

# Install dependencies
brew install bazel cmake ninja nasm automake libtool
brew install bazel cmake ninja nasm automake libtool libomp
```

### Build & UnitTest
Expand Down
29 changes: 29 additions & 0 deletions bazel/hash_drbg.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2023 Ant Group Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("@rules_cc//cc:defs.bzl", "cc_library")

cc_library(
name = "hash_drbg",
srcs = [
"hash_drbg.c",
"hash_drbg_error_codes.h",
],
hdrs = ["hash_drbg.h"],
copts = ["-Wno-parentheses"],
visibility = ["//visibility:public"],
deps = [
"@com_github_openssl_openssl//:openssl",
],
)
73 changes: 36 additions & 37 deletions bazel/openssl.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,59 +14,58 @@

load("@yacl//bazel:yacl.bzl", "yacl_configure_make")

package(default_visibility = ["//visibility:public"])
# An openssl build file based on a snippet found in the github issue:
# https://github.com/bazelbuild/rules_foreign_cc/issues/337

# Read https://wiki.openssl.org/index.php/Compilation_and_Installation

filegroup(
name = "all_srcs",
srcs = glob(["**"]),
srcs = glob(
include = ["**"],
exclude = ["*.bazel"],
),
)

# This is the value defined by --config=android_arm64
config_setting(
name = "cpu_arm64_v8a",
values = {"cpu": "arm64-v8a"},
visibility = ["//visibility:private"],
)
CONFIGURE_OPTIONS = [
# fixed openssl work dir for deterministic build.
"--openssldir=/tmp/openssl",
"--libdir=lib",
"no-legacy",
"no-weak-ssl-ciphers",
"no-shared",
"no-tests",
"no-ui-console",
]

MAKE_TARGETS = [
"build_programs",
"install_sw",
]

yacl_configure_make(
name = "openssl",
configure_command = select(
{
":cpu_arm64_v8a": "Configure", # Use Configure for android build
"//conditions:default": "config",
},
),
configure_options = [
# fixed openssl work dir for deterministic build.
"--openssldir=/tmp/openssl",
"--libdir=lib",
"no-shared",
# https://www.openssl.org/docs/man1.1.0/man3/OpenSSL_version.html
# OPENSSL_ENGINES_DIR point to /tmp path randomly generated.
"no-engine",
"no-tests",
] + select(
{
":cpu_arm64_v8a": ["android-arm64"],
"//conditions:default": [],
},
),
copts = ["-Wno-format"],
args = ["-j 4"],
configure_command = "Configure",
configure_in_place = True,
configure_options = CONFIGURE_OPTIONS,
env = select({
"@bazel_tools//src/conditions:darwin": {
"ARFLAGS": "-static -s -o",
"@platforms//os:macos": {
"AR": "",
},
"//conditions:default": {
"MODULESDIR": "",
},
}),
lib_name = "openssl",
lib_source = ":all_srcs",
linkopts = ["-ldl"],
out_binaries = ["openssl"],
# 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 = [
"libssl.a",
"libcrypto.a",
],
targets = [
"-s",
"-s install_sw",
],
targets = MAKE_TARGETS,
visibility = ["//visibility:public"],
)
2 changes: 1 addition & 1 deletion bazel/patches/brpc.patch
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ index 5d317c90..5bb62a6e 100644
+ "@bazel_tools//src/conditions:linux_aarch64": ["-O1"],
+ "//conditions:default": [""],
})

LINKOPTS = [
"-pthread",
"-ldl",
Expand Down
Loading

0 comments on commit 816ac40

Please sign in to comment.