-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
224 changed files
with
32,109 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
common --experimental_repo_remote_exec | ||
|
||
build --incompatible_new_actions_api=false | ||
build --copt=-fdiagnostics-color=always | ||
build --enable_platform_specific_config | ||
|
||
build --cxxopt=-std=c++17 | ||
build --host_cxxopt=-std=c++17 | ||
|
||
# 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 --cxxopt -Wno-deprecated-enum-enum-conversion | ||
build:macos --cxxopt -Wno-deprecated-anon-enum-enum-conversion | ||
|
||
build:asan --strip=never | ||
build:asan --copt -fno-sanitize-recover=all | ||
build:asan --copt -fsanitize=address | ||
build:asan --copt -Og | ||
build:asan --copt -g | ||
build:asan --copt -fno-omit-frame-pointer | ||
build:asan --linkopt -fsanitize=address | ||
|
||
build:ubsan --strip=never | ||
build:ubsan --copt -fno-sanitize-recover=all | ||
build:ubsan --copt -fsanitize=undefined | ||
build:ubsan --copt -Og | ||
build:ubsan --copt -g | ||
build:ubsan --copt -fno-omit-frame-pointer | ||
build:ubsan --linkopt -fsanitize=undefined | ||
|
||
|
||
test --keep_going | ||
test --test_output=errors | ||
test --test_timeout=180 | ||
|
||
test:asan --strip=never | ||
test:asan --copt -fno-sanitize-recover=all | ||
test:asan --copt -fsanitize=address | ||
test:asan --copt -O0 | ||
test:asan --copt -g | ||
test:asan --copt -fno-omit-frame-pointer | ||
test:asan --linkopt -fsanitize=address | ||
test:asan --linkopt -static-libasan | ||
|
||
test:ubsan --strip=never | ||
test:ubsan --copt -fno-sanitize-recover=all | ||
test:ubsan --copt -fsanitize=undefined | ||
test:ubsan --copt -O0 | ||
test:ubsan --copt -g | ||
test:ubsan --copt -fno-omit-frame-pointer | ||
test:ubsan --linkopt -fsanitize=undefined | ||
test:ubsan --linkopt -static-libubsan |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Use the Google style in this project. | ||
BasedOnStyle: Google | ||
|
||
IncludeBlocks: Regroup | ||
IncludeCategories: | ||
- Regex: '^<.*\.h>' | ||
Priority: 1 | ||
- Regex: '^<.*' | ||
Priority: 2 | ||
- Regex: '.*\.pb\.h"$' | ||
Priority: 5 | ||
- Regex: '^"yasl.*' | ||
Priority: 4 | ||
- Regex: '^".*' | ||
Priority: 3 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
Checks: "abseil-cleanup-ctad, | ||
abseil-faster-strsplit-delimiter, | ||
abseil-duration-*, | ||
abseil-no-namespace, | ||
abseil-redundant-strcat-calls, | ||
abseil-str-cat-append, | ||
abseil-string-find-startswith, | ||
abseil-upgrade-duration-conversions | ||
bugprone-*, | ||
-bugprone-easily-swappable-parameters, | ||
google-build-using-namespace, | ||
google-explicit-constructor, | ||
google-global-names-in-headers, | ||
google-readability-casting, | ||
google-runtime-int, | ||
google-runtime-operator, | ||
misc-unused-using-decls, | ||
modernize-*, | ||
-modernize-use-trailing-return-type, | ||
-modernize-use-nodiscard, | ||
performance-*, | ||
readability-*, | ||
-readability-else-after-return, | ||
-readability-identifier-length, | ||
-readability-magic-numbers, | ||
-readability-named-parameter" | ||
|
||
CheckOptions: | ||
- key: bugprone-argument-comment.StrictMode | ||
value: 1 | ||
|
||
- key: bugprone-dangling-handle.HandleClasses | ||
value: "std::basic_string_view;std::experimental::basic_string_view;absl::string_view" | ||
|
||
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic | ||
value: 1 | ||
|
||
# Ignore GoogleTest function macros. | ||
- key: readability-identifier-naming.FunctionIgnoredRegexp | ||
value: "(TEST|TEST_F|TEST_P|INSTANTIATE_TEST_SUITE_P|MOCK_METHOD|TYPED_TEST)" | ||
|
||
- key: readability-identifier-naming.ClassCase | ||
value: "CamelCase" | ||
|
||
- key: readability-identifier-naming.EnumCase | ||
value: "CamelCase" | ||
|
||
- key: readability-identifier-naming.EnumConstantCase | ||
value: "CamelCase" | ||
|
||
- key: readability-identifier-naming.ParameterCase | ||
value: "lower_case" | ||
|
||
- key: readability-identifier-naming.PrivateMemberCase | ||
value: "lower_case" | ||
|
||
- key: readability-identifier-naming.PrivateMemberSuffix | ||
value: "_" | ||
|
||
- key: readability-identifier-naming.StructCase | ||
value: "CamelCase" | ||
|
||
- key: readability-identifier-naming.TypeAliasCase | ||
value: "CamelCase" | ||
|
||
- key: readability-identifier-naming.UnionCase | ||
value: "CamelCase" | ||
|
||
- key: readability-identifier-naming.FunctionCase | ||
value: "CamelBack" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# devtools | ||
.idea/ | ||
*.plist | ||
clion/ | ||
*.swp | ||
tags | ||
sftp-config.json | ||
build_cmakelist.py | ||
.akconfig | ||
.vscode/ | ||
.cloudide/ | ||
*.code-workspace | ||
vipclient-* | ||
*.pb.h | ||
*.pb.cc | ||
compile_commands.json | ||
.clangd | ||
Pipfile | ||
|
||
# python-package | ||
/dist | ||
*.egg-info | ||
__pycache__ | ||
build | ||
_build | ||
|
||
# bazel | ||
bazel-* | ||
|
||
# cmake related | ||
abseil-cpp | ||
bld | ||
bld.install | ||
CMakeCache.txt | ||
cmake_install.cmake | ||
CTestTestfile.cmake | ||
|
||
# mixed | ||
.DS_Store | ||
.ipynb_checkpoints | ||
trace.*log | ||
|
||
dump/ | ||
|
||
# clangd cache | ||
.cache | ||
external | ||
|
||
#brpc | ||
rpc_data |
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Legal Disclaimer | ||
|
||
Within this source code, the comments in Chinese shall be the original, governing version. Any comment in other languages are for reference only. In the event of any conflict between the Chinese language version comments and other language version comments, the Chinese language version shall prevail. | ||
|
||
法律免责声明 | ||
|
||
关于代码注释部分,中文注释为官方版本,其它语言注释仅做参考。中文注释可能与其它语言注释存在不一致,当中文注释与其它语言注释存在不一致时,请以中文注释为准。 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,48 @@ | ||
# yasl | ||
# YASL: Yet Another Simple library | ||
|
||
YASL (Yet Another Simple library) is a C++ library contains modules and utilities which other Secretflow code depends on. | ||
|
||
## Build | ||
|
||
### Prerequisite | ||
|
||
#### Linux | ||
```sh | ||
Install gcc>=10.3, cmake, ninja, nasm | ||
``` | ||
|
||
#### macOS | ||
```sh | ||
# Install Xcode | ||
https://apps.apple.com/us/app/xcode/id497799835?mt=12 | ||
|
||
# Select Xcode toolchain version | ||
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer | ||
|
||
# Install homebrew | ||
https://brew.sh/ | ||
|
||
# Install dependencies | ||
brew install bazel cmake ninja nasm automake lbtool | ||
``` | ||
|
||
### Build & UnitTest | ||
``` sh | ||
# build as debug | ||
bazel build //... -c dbg | ||
|
||
# build as release | ||
bazel build //... -c opt | ||
|
||
# test | ||
bazel test //... | ||
|
||
# [optional] build & test with ASAN | ||
bazel build //... -c dbg --config=asan | ||
bazel test //... --config=asan -c dbg | ||
``` | ||
|
||
### Bazel build options | ||
|
||
- `--define gperf=on` enable gperf | ||
- `--define tracelog=on` enable link trace log. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Repository layout | ||
|
||
YASL is a fundamental library used in the secretflow stack. The major components are listed here: | ||
|
||
- [base/](yasl/base/): Basic types and utils in yasl. | ||
- [crypto/](yasl/crypto/): Crypto related utilities, say symmetric and asymmetric crypto, PRNG, hashing etc. | ||
- [mpctools/](yasl/mpctools/): Common security building blocks in MPC world. | ||
- [dpf/](yasl/mpctools/dpf/): Distributed Point Function (DPF). | ||
- [ot/](yasl/mpctools/ot/): Various oblivious transfer primitives. | ||
- [io/](yasl/io/): A simple streaming based io library. | ||
- [link/](yasl/link/): A simple rpc based MPI framework. It provides the [SPMD](https://en.wikipedia.org/wiki/SPMD) parallel programming capability. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# C++ coding style | ||
|
||
Yasl follows the [Envoy C++ style guidelines](https://github.com/envoyproxy/envoy/blob/main/STYLE.md), i.e. we also encourage appropriate exception uses. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
workspace(name = "yasl") | ||
|
||
load("//bazel:repositories.bzl", "yasl_deps") | ||
|
||
yasl_deps() | ||
|
||
load( | ||
"@rules_foreign_cc//foreign_cc:repositories.bzl", | ||
"rules_foreign_cc_dependencies", | ||
) | ||
|
||
rules_foreign_cc_dependencies( | ||
register_built_tools = False, | ||
register_default_tools = False, | ||
register_preinstalled_tools = True, | ||
) | ||
|
||
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") | ||
|
||
# Hedron's Compile Commands Extractor for Bazel | ||
# https://github.com/hedronvision/bazel-compile-commands-extractor | ||
git_repository( | ||
name = "hedron_compile_commands", | ||
commit = "1d21dc390e20ecb24d73e9dbb439e971e0d30337", | ||
remote = "https://gitee.com/anakin-xc/bazel-compile-commands-extractor.git", | ||
shallow_since = "1644967664 -0800", | ||
) | ||
|
||
load("@hedron_compile_commands//:workspace_setup.bzl", "hedron_compile_commands_setup") | ||
|
||
hedron_compile_commands_setup() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
|
||
config_setting( | ||
name = "yasl_build_as_release", | ||
values = {"compilation_mode": "opt"}, | ||
) | ||
|
||
config_setting( | ||
name = "yasl_build_as_debug", | ||
values = {"compilation_mode": "dbg"}, | ||
) | ||
|
||
config_setting( | ||
name = "yasl_build_as_fast", | ||
values = {"compilation_mode": "fastbuild"}, | ||
) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
load("@rules_cc//cc:defs.bzl", "cc_library") | ||
|
||
cc_library( | ||
name = "blake3_c", | ||
srcs = [ | ||
"c/blake3.c", | ||
"c/blake3_dispatch.c", | ||
"c/blake3_portable.c", | ||
] + select({ | ||
"@bazel_tools//src/conditions:darwin_arm64": [ | ||
"c/blake3_neon.c", | ||
], | ||
"@bazel_tools//src/conditions:linux_aarch64": [ | ||
"c/blake3_neon.c", | ||
], | ||
"//conditions:default": [ | ||
"c/blake3_sse2_x86-64_unix.S", | ||
"c/blake3_sse41_x86-64_unix.S", | ||
"c/blake3_avx2_x86-64_unix.S", | ||
"c/blake3_avx512_x86-64_unix.S", | ||
], | ||
}), | ||
hdrs = [ | ||
"c/blake3.h", | ||
"c/blake3_impl.h", | ||
], | ||
defines = ["BLAKE3_C_EXTERNAL"], | ||
includes = ["include"], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
load("@yasl//bazel:yasl.bzl", "yasl_cmake_external") | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
filegroup( | ||
name = "all_srcs", | ||
srcs = glob(["**"]), | ||
) | ||
|
||
yasl_cmake_external( | ||
name = "cpu_features", | ||
cache_entries = { | ||
"CMAKE_INSTALL_LIBDIR": "lib", | ||
"CMAKE_POSITION_INDEPENDENT_CODE": "ON", | ||
"BUILD_TESTING": "OFF", | ||
}, | ||
lib_source = ":all_srcs", | ||
out_lib_dir = "lib", | ||
out_static_libs = ["libcpu_features.a"], | ||
) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
load("@rules_cc//cc:defs.bzl", "cc_library") | ||
|
||
cc_library( | ||
name = "curve25519_donna", | ||
srcs = ["curve25519.c"], | ||
hdrs = glob(["*.h"]), | ||
visibility = ["//visibility:public"], | ||
) |
Oops, something went wrong.