Skip to content
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

Add all variants of kyber to hacl-packages, with compilation and all #463

Merged
merged 25 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d0154d3
Refresh code with all Kyber variants + a little script to assemble a …
protz Apr 23, 2024
b271dc3
refresh
protz Apr 23, 2024
30a74e4
Modify glue to support more variants
msprotz Apr 23, 2024
2d0144a
Update glue to have a slightly less precise prototype to avoida comp…
msprotz Apr 23, 2024
76bf31e
Fix -mavx2 compilation
msprotz Apr 23, 2024
5bc9b01
Remove usage of VLAs since it trips MSVC
protz Apr 23, 2024
b9b232f
Fixes for 512/1024 that fell through the cracks
protz Apr 23, 2024
920f629
Revert local change
protz Apr 24, 2024
e08b194
Refresh latest code with all kyber variants
protz Apr 24, 2024
aebf39c
Refresh packaged copy of fstar_uint128_msvc.h
protz Apr 25, 2024
a8a9553
more extern c for libcrux
franziskuskiefer Apr 28, 2024
fb40dca
Merge remote-tracking branch 'origin/franziskus/msvc-build-update' in…
protz Apr 29, 2024
0f25722
Update README.md
franziskuskiefer Apr 29, 2024
35b13ff
Edit msvc default config
protz Apr 29, 2024
edea4f6
Update README.md
franziskuskiefer Apr 29, 2024
8dc8628
Missing files
protz Apr 29, 2024
fa43882
Bug in a subdirectory... bump
protz Apr 29, 2024
a42431d
missing benchmark
protz Apr 29, 2024
43fee14
Refresh glue
protz May 1, 2024
5e9ef23
Refresh
protz May 1, 2024
c40a4e7
Further improvements
protz May 1, 2024
efce4d4
16% performance boost, there you go
msprotz May 1, 2024
157d1eb
Merge remote-tracking branch 'origin/franziskus/msvc-build-update' in…
protz May 7, 2024
96fc489
Merge branch 'protz_all_kyber_variants' of github.com:cryspen/hacl-pa…
protz May 7, 2024
826413c
more reasonable name
protz May 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,11 @@ if(ENABLE_TESTS)
target_compile_options(${TEST_NAME} PRIVATE /std:c++20)
endif(MSVC)

add_dependencies(${TEST_NAME} hacl hacl_cpu_features)
add_dependencies(${TEST_NAME} hacl libcrux_static hacl_cpu_features)
target_link_libraries(${TEST_NAME} PRIVATE
gtest_main
hacl_static
libcrux_static
hacl_cpu_features
nlohmann_json::nlohmann_json
)
Expand Down Expand Up @@ -513,7 +514,7 @@ if(ENABLE_TESTS)
target_compile_options(${TEST_NAME} PRIVATE /std:c++20)
endif(MSVC)

add_dependencies(${TEST_NAME} hacl hacl_cpu_features)
add_dependencies(${TEST_NAME} hacl libcrux_static hacl_cpu_features)
target_link_libraries(${TEST_NAME} PRIVATE
gtest_main
hacl_cpu_features
Expand Down Expand Up @@ -553,7 +554,8 @@ if(ENABLE_BENCHMARKS)
FetchContent_Populate(benchmark
GIT_REPOSITORY https://github.com/google/benchmark.git
# The latest release 1.7.1 is broken due to https://github.com/google/benchmark/pull/1517
GIT_TAG b177433f3ee2513b1075140c723d73ab8901790f
# But also: need the fix for https://github.com/google/benchmark/pull/1669
GIT_TAG bc946b919cac6f25a199a526da571638cfde109f
)
add_subdirectory(${benchmark_SOURCE_DIR} ${benchmark_BINARY_DIR})

Expand Down Expand Up @@ -591,9 +593,10 @@ if(ENABLE_BENCHMARKS)
target_compile_options(${BENCH_NAME} PRIVATE /std:c++20)
endif(NOT MSVC)

add_dependencies(${BENCH_NAME} hacl hacl_cpu_features)
add_dependencies(${BENCH_NAME} hacl libcrux_static hacl_cpu_features)
target_link_libraries(${BENCH_NAME} PRIVATE
hacl_static
libcrux_static
ecckiila
blake2
digestif
Expand All @@ -620,7 +623,7 @@ if(ENABLE_BENCHMARKS)

target_compile_definitions(${BENCH_NAME} PUBLIC NO_OPENSSL)

add_dependencies(${BENCH_NAME} hacl hacl_cpu_features)
add_dependencies(${BENCH_NAME} hacl libcrux_static hacl_cpu_features)
target_link_libraries(${BENCH_NAME} PRIVATE
hacl_cpu_features
benchmark::benchmark
Expand Down
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,28 @@ $ ./mach build --test

... to build HACL Packages and run the tests. All actions are driven by [mach]. See `./mach --help` for details.

### MSVC Build

The hacl-packages build is designed for non-MSVC compilers.
Building with MSVC can be achieved as follows.


<details>
<summary><b>MSVC Build</b></summary>

```powershell
# Setup build directory
mkdir build
cp config\default_config_msvc.cmake build\config.cmake
cp config\default_config_msvc.h build\config.h

# Build
cmake -B build -DBUILD_LIBCRUX=1 -G "Visual Studio 17 2022" -A x64 -DUSE_MSVC=1 -DENABLE_TESTS=ON -DENABLE_BENCHMARKS=ON
# Use --config Release to build in release mode
cmake --build build
```
</details>

## Platform support

The HACL Packages are supported based on the following tiers.
Expand Down
8 changes: 7 additions & 1 deletion config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,13 @@
"file": "Libcrux_Kem_Kyber_Kyber768.c"
},
{
"file": "libcrux_kyber.c"
"file": "libcrux_kyber512.c"
},
{
"file": "libcrux_kyber768.c"
},
{
"file": "libcrux_kyber1024.c"
},
{
"file": "libcrux_hacl_glue.c"
Expand Down
6 changes: 6 additions & 0 deletions config/default_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ set(BENCHMARK_SOURCES
${PROJECT_SOURCE_DIR}/benchmarks/drbg.cc
${PROJECT_SOURCE_DIR}/benchmarks/hmac.cc
${PROJECT_SOURCE_DIR}/benchmarks/rsapss.cc
${PROJECT_SOURCE_DIR}/benchmarks/kyber.cc
)
set(VALE_SOURCES_osx
${PROJECT_SOURCE_DIR}/vale/src/cpuid-x86_64-darwin.S
Expand Down Expand Up @@ -476,6 +477,11 @@ set(VALE_SOURCES_msvc
)
set(LIBCRUX_SOURCES
${PROJECT_SOURCE_DIR}/libcrux/src/Libcrux_Kem_Kyber_Kyber768.c
${PROJECT_SOURCE_DIR}/libcrux/src/libcrux_kyber512.c
${PROJECT_SOURCE_DIR}/libcrux/src/libcrux_kyber768.c
${PROJECT_SOURCE_DIR}/libcrux/src/libcrux_kyber1024.c
${PROJECT_SOURCE_DIR}/libcrux/src/libcrux_hacl_glue.c
${PROJECT_SOURCE_DIR}/libcrux/src/core.c
)
set(ALGORITHM_TEST_FILES
TEST_FILES_detection
Expand Down
Loading
Loading