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

Dev -> main #474

Open
wants to merge 98 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
1c9ddc8
Add merge group CI target
franziskuskiefer Jul 7, 2023
4849245
run workflows on dev
franziskuskiefer Jul 12, 2023
dec13d2
small doc and readme update
franziskuskiefer Jul 12, 2023
6d07dd8
Rust 32-bit Linux, Windows 32 & 64 bit (#416)
franziskuskiefer Jul 13, 2023
01661a9
Update build.yml
franziskuskiefer Jul 13, 2023
e9ada99
update docs
franziskuskiefer Jul 13, 2023
1575f26
Merge branch 'main' into dev
franziskuskiefer Jul 25, 2023
c4310ac
Merge branch 'main' into dev
franziskuskiefer Aug 11, 2023
3f8e5a4
Merge branch 'main' into dev
franziskuskiefer Dec 1, 2023
650268c
Integrate Vectorized SHA3
mamonet Dec 1, 2023
b024310
Run SHA3 Vec256 tests on supported machines
mamonet Dec 1, 2023
b4632e0
Add benchmark functions for SHA3 scalar and vec256
mamonet Dec 4, 2023
7a4721c
Merge remote-tracking branch 'upstream/main' into sha3-mb
mamonet Dec 4, 2023
3ad2fb4
run clang-format on tests/sha3.cc and benchmarks/sha3.cc
mamonet Dec 4, 2023
6b66fae
Merge pull request #433 from mamonet/sha3-mb
franziskuskiefer Dec 4, 2023
8e7f025
Rename SHA3 Scalar and Simd256 functions (#439)
mamonet Dec 6, 2023
6fda3af
Added a dummy Kyber implementation and test scaffolding (#438)
xvzcf Dec 6, 2023
34243fb
Removed duplicate Hacl_SHA3_* files. (#440)
xvzcf Dec 7, 2023
5b7b85e
Change order of SHA3 Scalar/Simd256 parameters
mamonet Dec 14, 2023
34a6736
Expose shake128_absorb/squeeze functions
mamonet Dec 14, 2023
fee3dc1
Add libcrux kyber (#442)
franziskuskiefer Jan 5, 2024
f1d02ee
Add SHA3 absorb nblocks/last API
mamonet Jan 15, 2024
9586ae7
Remove shake128_absorb API
mamonet Jan 15, 2024
69aa98d
Merge branch 'dev' into sha3-mb
franziskuskiefer Jan 16, 2024
60488ea
Document some API in SHA3 Scalar/SIMD256 headers
mamonet Jan 17, 2024
53f7df0
Merge branch 'sha3-mb' of https://github.com/mamonet/hacl-packages in…
mamonet Jan 17, 2024
856e97a
Fix calling Hacl_Hash_SHA3_Simd256_shake128 in libcrux_hacl_glue.c
mamonet Jan 17, 2024
ea5510b
Merge pull request #443 from mamonet/sha3-mb
franziskuskiefer Jan 18, 2024
c6bf1a5
Refresh with latest eurydice/kyber-crate
msprotz Feb 15, 2024
537dbdb
wip update
franziskuskiefer Feb 19, 2024
f7b9232
updated kyber
franziskuskiefer Feb 19, 2024
858e2b1
update kyber
franziskuskiefer Feb 28, 2024
70daa7e
new extraction
karthikbhargavan Feb 28, 2024
4f01ca1
hand edits for kyber
karthikbhargavan Feb 28, 2024
ba4d60a
kyber compiles but tests fail
karthikbhargavan Feb 28, 2024
924e2f2
debugging
karthikbhargavan Feb 28, 2024
dd82c5e
tests pass
karthikbhargavan Feb 28, 2024
b6dfc25
linux fixes
karthikbhargavan Feb 29, 2024
8eee8d4
fixed SIMD SHA-3 initialization
karthikbhargavan Feb 29, 2024
0a90cb0
passing tests with new C code
karthikbhargavan Mar 1, 2024
bcc51a4
fixed some compilation warnings in kyber-hacl glue code
karthikbhargavan Mar 1, 2024
3694777
new version wip
franziskuskiefer Mar 5, 2024
7447ad3
wip
franziskuskiefer Mar 6, 2024
40e2bb3
updated C code without panics
franziskuskiefer Mar 11, 2024
252dc42
fix glue for avx2
franziskuskiefer Mar 13, 2024
b5d2566
update
franziskuskiefer Mar 13, 2024
19b1300
Merge branch 'dev' into franziskus/ml-kem-c-update
franziskuskiefer Mar 13, 2024
6a71335
fixup after dev merge
franziskuskiefer Mar 13, 2024
efbf0ae
update pk validation
franziskuskiefer Mar 18, 2024
4f80d73
runtime detection in glue
franziskuskiefer Mar 19, 2024
bee1b59
fixup runtime detection for kyber
franziskuskiefer Mar 19, 2024
e2a6c3a
malloc
franziskuskiefer Mar 19, 2024
8ff0b36
update
franziskuskiefer Mar 23, 2024
5e51d8a
Merge pull request #453 from cryspen/franziskus/ml-kem-c-update
franziskuskiefer Apr 17, 2024
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
aee06b1
Merge pull request #463 from cryspen/protz_all_kyber_variants
franziskuskiefer May 15, 2024
705bc4f
Fix MSVC+CPP issue with including eurydice_glue.h w/ C++17
samuel-lee-msft May 16, 2024
871911a
Fix typos
s-zanella Apr 30, 2024
84e70aa
Always copy over default config from config/default_config_[msvc].cmake
s-zanella May 1, 2024
84fc1dd
Add CMakePresets.json with presets for x64 Ninja Multi-Config builds …
s-zanella May 1, 2024
a665439
Set flags for MSVC
s-zanella May 7, 2024
95e65ec
Document unified build workflow
s-zanella May 8, 2024
0a8137d
Cosmetics
s-zanella May 8, 2024
b252589
Add newline
s-zanella May 10, 2024
5186585
Add newline
s-zanella May 10, 2024
4a6b53a
Restore default_config.h
s-zanella May 10, 2024
829c842
Fix build
s-zanella May 17, 2024
bf157de
Merge pull request #472 from cryspen/main
franziskuskiefer Jun 18, 2024
6a7f083
Merge branch 'dev' into avoidMSVCdesignatedInitializers
franziskuskiefer Jun 18, 2024
f3fca59
Update .clabot
franziskuskiefer Jun 18, 2024
1a2288d
Merge branch 'dev' into avoidMSVCdesignatedInitializers
franziskuskiefer Jun 18, 2024
41e3f7b
Merge pull request #466 from samuel-lee-msft/avoidMSVCdesignatedIniti…
franziskuskiefer Jun 21, 2024
b825ccf
Merge branch 'dev' into dev
franziskuskiefer Jun 21, 2024
c8c980d
Merge pull request #469 from s-zanella/dev
franziskuskiefer Jun 26, 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
2 changes: 1 addition & 1 deletion .clabot
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"xvzcf": "Cryspen",
"msprotz": "Microsoft",
"R1kM": "Inria",
"samuel-lee-msft": "Microsoft
"samuel-lee-msft": "Microsoft"
},
"contributors": [
"franziskuskiefer",
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ rust/.c
.idea
cmake-build-debug

# ctags
tags
130 changes: 113 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,19 @@ endif()

set(hacl_VERSION_TWEAK "")

# Load global config from exteral file.
# This file must be generated before running cmake with ./mach.py --configure
# Load global config from external file.
# For a Clang build, this file can be generated before running cmake with
# ./mach.py --configure
# If the build is invoked through ./mach.py, a separate configuration is not
# needed.
# If the file is not present, i.e. cmake was invoked directly, we copy the default
# config from config/default_config.cmake
# We copy a default config from config/default_config.cmake or
# config/default_config_msvc.cmake
if(NOT EXISTS ${PROJECT_SOURCE_DIR}/build/config.cmake)
configure_file(${PROJECT_SOURCE_DIR}/config/default_config.cmake ${PROJECT_SOURCE_DIR}/build/config.cmake COPYONLY)
if(USE_MSVC)
configure_file(${PROJECT_SOURCE_DIR}/config/default_config_msvc.cmake ${PROJECT_SOURCE_DIR}/build/config.cmake COPYONLY)
else()
configure_file(${PROJECT_SOURCE_DIR}/config/default_config.cmake ${PROJECT_SOURCE_DIR}/build/config.cmake COPYONLY)
endif()
endif()

# Now include the config.
Expand Down Expand Up @@ -85,8 +90,11 @@ set(CMAKE_C_STANDARD_REQUIRED True)
include(build/config.cmake)

# Configure different targets
# TODO: Set flags for MSVC
if(NOT MSVC)
if(MSVC)
add_compile_options(
$<$<COMPILE_LANGUAGE:C,CXX>:/Ob3>
)
else()
add_compile_options(
# -Wall
# -Wextra
Expand All @@ -99,12 +107,20 @@ if(NOT MSVC)
)
endif()

if(WIN32 AND NOT MSVC)
# Enable everywhere for windows as long as libintvector.h is not included correctly.
add_compile_options(
-mavx
-mavx2
)
if(WIN32)
# Enable AVX and AVX2 everywhere for Windows as long as libintvector.h is not included correctly.
if(MSVC)
add_compile_options(
$<$<COMPILE_LANGUAGE:C,CXX>:/arch:AVX>
$<$<COMPILE_LANGUAGE:C,CXX>:/arch:AVX2>
)
else()
# On Windows with clang-cl (our default) we take the Linux assembly
add_compile_options(
-mavx
-mavx2
)
endif()
endif()

# Set include paths
Expand Down Expand Up @@ -168,6 +184,11 @@ if(ENABLE_UBSAN)
add_link_options(-fsanitize=undefined)
endif()

if(ENABLE_MSAN)
add_compile_options(-fsanitize=memory -fsanitize-memory-track-origins)
add_link_options(-fsanitize=memory)
endif()

# Sources are written by mach.py into the following lists
# - SOURCES_std: All regular files
# - SOURCES_vec128: Files that require vec128 hardware
Expand Down Expand Up @@ -335,7 +356,7 @@ configure_file(config/Config.h.in config.h)
# # Dynamic library
add_library(hacl SHARED ${SOURCES_std} ${VALE_OBJECTS})
if(NOT MSVC)
target_compile_options(hacl PRIVATE -Wsign-conversion -Wconversion -Wall -Wextra -pedantic)
target_compile_options(hacl PRIVATE -Wall -Wextra -pedantic)
endif()

if(TOOLCHAIN_CAN_COMPILE_VEC128 AND HACL_VEC128_O)
Expand All @@ -359,6 +380,13 @@ if(TOOLCHAIN_CAN_COMPILE_VEC256 AND HACL_VEC256_O)
target_sources(hacl_static PRIVATE $<TARGET_OBJECTS:hacl_vec256>)
endif()

if(BUILD_LIBCRUX)
add_library(libcrux_static STATIC ${LIBCRUX_SOURCES})
if(NOT MSVC)
target_compile_options(libcrux_static PRIVATE -Wall -Wextra -pedantic -Wshadow -Wunused-function)
endif()
endif()

# Install
# # This allows package maintainers to control the install destination by setting
# # the appropriate cache variables.
Expand Down Expand Up @@ -465,10 +493,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 All @@ -482,6 +511,43 @@ if(ENABLE_TESTS)
${PROJECT_SOURCE_DIR}/tests/${TEST_NAME} $<TARGET_FILE_DIR:${TEST_NAME}>)
endif()
endforeach()

if(BUILD_LIBCRUX)
foreach(TEST_FILE IN LISTS LIBCRUX_TEST_SOURCES)
get_filename_component(TEST_NAME ${TEST_FILE} NAME_WE)
add_executable(${TEST_NAME}
${TEST_FILE}
)

# Coverage
if(ENABLE_COVERAGE)
target_compile_options(${TEST_NAME} PRIVATE -fprofile-instr-generate -fcoverage-mapping)
target_link_options(${TEST_NAME} PRIVATE -fprofile-instr-generate -fcoverage-mapping)
endif()

if(MSVC)
# MSVC needs a modern C++ for designated initializers.
target_compile_options(${TEST_NAME} PRIVATE /std:c++20)
endif(MSVC)

add_dependencies(${TEST_NAME} hacl libcrux_static hacl_cpu_features)
target_link_libraries(${TEST_NAME} PRIVATE
gtest_main
hacl_cpu_features
nlohmann_json::nlohmann_json
libcrux_static
hacl_static
)

if(EXISTS ${PROJECT_SOURCE_DIR}/tests/${TEST_NAME})
# Copy test input files. They must be in a directory with the same
# name as the test and get copied to the build directory.
add_custom_command(TARGET ${TEST_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${PROJECT_SOURCE_DIR}/tests/${TEST_NAME} $<TARGET_FILE_DIR:${TEST_NAME}>)
endif()
endforeach()
endif()
endif()

# Benchmarks
Expand All @@ -504,7 +570,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 @@ -542,14 +609,43 @@ 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
hacl_cpu_features
benchmark::benchmark
)
endforeach()

if(BUILD_LIBCRUX)
foreach(BENCH_FILE IN LISTS LIBCRUX_BENCHMARK_SOURCES)
get_filename_component(BENCH_NAME ${BENCH_FILE} NAME_WE)
set(BENCH_NAME ${BENCH_NAME}_benchmark)
add_executable(${BENCH_NAME}
${BENCH_FILE}
)

# Use modern C++
if(NOT MSVC)
target_compile_options(${BENCH_NAME} PRIVATE -std=c++17)
else()
# MSVC needs a modern C++ for designated initializers.
target_compile_options(${BENCH_NAME} PRIVATE /std:c++20)
endif(NOT MSVC)

target_compile_definitions(${BENCH_NAME} PUBLIC NO_OPENSSL)

add_dependencies(${BENCH_NAME} hacl libcrux_static hacl_cpu_features)
target_link_libraries(${BENCH_NAME} PRIVATE
hacl_cpu_features
benchmark::benchmark
libcrux_static
hacl_static
)
endforeach()
endif()
endif(ENABLE_BENCHMARKS)
110 changes: 110 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 19,
"patch": 0
},
"configurePresets": [
{
"name": "default",
"displayName": "Default Config",
"hidden": true,
"binaryDir": "${sourceDir}/build/${presetName}",
"generator": "Ninja Multi-Config",
"cacheVariables": {
"CMAKE_INSTALL_PREFIX": "${sourceDir}/install/${presetName}",
"BUILD_LIBCRUX": "ON",
"ENABLE_TESTS": "ON",
"ENABLE_BENCHMARKS": "ON"
},
"architecture": {
"value": "x64",
"strategy": "external"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"hostOS": [ "Windows" ]
}
}
},
{
"name": "ninja.msvc",
"inherits": "default",
"displayName": "x64 Ninja Multi-Config MSVC",
"description": "x64 MSVC build using Ninja Multi-Config generator",
"cacheVariables": {
"USE_MSVC": "ON"
}
},
{
"name": "ninja.clang",
"inherits": "default",
"displayName": "x64 Ninja Multi-Config Clang",
"description": "x64 Clang build using Ninja Multi-Config generator"
}
],
"buildPresets": [
{
"name": "ninja.msvc.Release",
"description": "x64 MSVC build using Ninja Multi-Config generator - Release",
"displayName": "Release",
"configurePreset": "ninja.msvc",
"configuration": "Release"
},
{
"name": "ninja.msvc.Debug",
"description": "x64 MSVC build using Ninja Multi-Config generator - Debug",
"displayName": "Debug",
"configurePreset": "ninja.msvc",
"configuration": "Debug"
},
{
"name": "ninja.msvc.MinSizeRel",
"description": "x64 MSVC build using Ninja Multi-Config generator - MinSizeRel",
"displayName": "MinSizeRel",
"configurePreset": "ninja.msvc",
"configuration": "MinSizeRel"
},
{
"name": "ninja.msvc.RelWithDebInfo",
"description": "x64 MSVC build using Ninja Multi-Config generator - RelWithDebInfo",
"displayName": "RelWithDebInfo",
"configurePreset": "ninja.msvc",
"configuration": "RelWithDebInfo"
},
{
"name": "ninja.clang.Release",
"description": "x64 Clang build using Ninja Multi-Config generator - Release",
"displayName": "Release",
"configurePreset": "ninja.clang",
"configuration": "Release"
},
{
"name": "ninja.clang.Debug",
"description": "x64 Clang build using Ninja Multi-Config generator - Debug",
"displayName": "Debug",
"configurePreset": "ninja.clang",
"configuration": "Debug"
},
{
"name": "ninja.clang.MinSizeRel",
"description": "x64 Clang build using Ninja Multi-Config generator - MinSizeRel",
"displayName": "MinSizeRel",
"configurePreset": "ninja.clang",
"configuration": "MinSizeRel"
},
{
"name": "ninja.clang.RelWithDebInfo",
"description": "x64 Clang build using Ninja Multi-Config generator - RelWithDebInfo",
"displayName": "RelWithDebInfo",
"configurePreset": "ninja.clang",
"configuration": "RelWithDebInfo"
}
]
}
Loading
Loading