-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #710 from cryspen/franziskus/mldsa-c2
C extraction for ML-DSA
- Loading branch information
Showing
145 changed files
with
29,598 additions
and
2,656 deletions.
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
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 @@ | ||
build/ |
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,143 @@ | ||
# cmake -B build -G "Ninja Multi-Config" | ||
# cmake --build build | ||
# # For release (benchmarks) | ||
# cmake --build build --config Release | ||
|
||
cmake_minimum_required(VERSION 3.10) | ||
|
||
project(libcrux-ml-dsa | ||
VERSION 0.1.0 | ||
LANGUAGES C CXX | ||
) | ||
|
||
set(CMAKE_C_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD 20) | ||
|
||
if(NOT MSVC) | ||
add_compile_options( | ||
-Wall | ||
-fstack-usage | ||
-Wunused-function | ||
$<$<CONFIG:DEBUG>:-g> | ||
$<$<CONFIG:DEBUG>:-Og> | ||
$<$<CONFIG:RELEASE>:-g> | ||
$<$<CONFIG:RELEASE>:-O3> | ||
) | ||
endif(NOT MSVC) | ||
|
||
if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND | ||
CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "13.0.0") OR | ||
(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND | ||
CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "13.1.6")) | ||
# add_compile_options(-Werror -Wframe-larger-than=25344) | ||
endif() | ||
|
||
set(CMAKE_COLOR_DIAGNOSTICS "ON") | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS 1) | ||
include_directories( | ||
${PROJECT_SOURCE_DIR} | ||
${PROJECT_SOURCE_DIR}/karamel | ||
) | ||
|
||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64") | ||
message(STATUS "Detected an x64 architecture") | ||
add_compile_definitions(LIBCRUX_X64) | ||
endif() | ||
|
||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|arm64|arm64v8" AND DEFINED ENV{LIBCRUX_NEON}) | ||
message(STATUS "Detected an arm64 architecture") | ||
add_compile_definitions(LIBCRUX_AARCH64) | ||
endif() | ||
|
||
# --- Tests | ||
|
||
# Get gtests | ||
include(FetchContent) | ||
FetchContent_Declare(googletest | ||
DOWNLOAD_EXTRACT_TIMESTAMP TRUE | ||
URL https://github.com/google/googletest/archive/refs/tags/release-1.11.0.zip | ||
) | ||
|
||
# For Windows: Prevent overriding the parent project's compiler/linker settings | ||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) | ||
FetchContent_MakeAvailable(googletest) | ||
|
||
# Get nlohmann json | ||
FetchContent_Declare(json | ||
DOWNLOAD_EXTRACT_TIMESTAMP TRUE | ||
URL https://github.com/nlohmann/json/archive/refs/tags/v3.10.3.zip | ||
) | ||
FetchContent_MakeAvailable(json) | ||
|
||
add_executable(ml_dsa_test | ||
${PROJECT_SOURCE_DIR}/tests/mldsa65.cc | ||
) | ||
target_link_libraries(ml_dsa_test PRIVATE | ||
gtest_main | ||
nlohmann_json::nlohmann_json | ||
) | ||
|
||
# add_executable(kyber_test | ||
# ${PROJECT_SOURCE_DIR}/tests/kyber768.cc | ||
# ) | ||
# target_link_libraries(kyber_test PRIVATE | ||
# gtest_main | ||
# nlohmann_json::nlohmann_json | ||
# ) | ||
|
||
# add_executable(sha3_test | ||
# ${PROJECT_SOURCE_DIR}/tests/sha3.cc | ||
# ) | ||
# target_link_libraries(sha3_test PRIVATE | ||
# gtest_main | ||
# nlohmann_json::nlohmann_json | ||
# ) | ||
|
||
# # --- Benchmarks | ||
# if(DEFINED ENV{LIBCRUX_BENCHMARKS}) | ||
# FetchContent_Declare(benchmark | ||
# GIT_REPOSITORY https://github.com/google/benchmark.git | ||
# GIT_TAG v1.8.4 | ||
# ) | ||
# FetchContent_MakeAvailable(benchmark) | ||
|
||
# add_executable(ml_dsa_bench | ||
# ${PROJECT_SOURCE_DIR}/benches/mldsa768.cc | ||
# ) | ||
# target_link_libraries(ml_dsa_bench PRIVATE | ||
# benchmark::benchmark | ||
# ) | ||
|
||
# if(DEFINED ENV{SYMCRYPT_PATH}) | ||
# message("Symcrypt path: $ENV{SYMCRYPT_PATH}") | ||
# add_compile_definitions(LIBCRUX_SYMCRYPT) | ||
# target_include_directories(ml_dsa_bench PRIVATE $ENV{SYMCRYPT_PATH}) | ||
# target_link_directories(ml_dsa_bench PRIVATE $ENV{SYMCRYPT_PATH}/bin/lib) | ||
# target_link_libraries(ml_dsa_bench PRIVATE symcrypt) | ||
# endif(DEFINED ENV{SYMCRYPT_PATH}) | ||
|
||
# add_executable(ml_dsa_keygen | ||
# ${PROJECT_SOURCE_DIR}/benches/mldsa768_keygen.cc | ||
# ) | ||
# target_link_libraries(ml_dsa_keygen PRIVATE | ||
# benchmark::benchmark | ||
# ) | ||
|
||
# add_executable(ml_dsa_encaps | ||
# ${PROJECT_SOURCE_DIR}/benches/mldsa768_encaps.cc | ||
# ) | ||
# target_link_libraries(ml_dsa_encaps PRIVATE | ||
# benchmark::benchmark | ||
# ) | ||
|
||
# if(NOT MSVC) | ||
# # We benchmark internal functions here that are inlined and thus not available | ||
# # in MSVC. | ||
# add_executable(sha3_bench | ||
# ${PROJECT_SOURCE_DIR}/benches/sha3.cc | ||
# ) | ||
# target_link_libraries(sha3_bench PRIVATE | ||
# benchmark::benchmark | ||
# ) | ||
# endif(NOT MSVC) | ||
# endif(DEFINED ENV{LIBCRUX_BENCHMARKS}) |
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,6 +1,6 @@ | ||
This code was generated with the following revisions: | ||
Charon: 45f5a34f336e35c6cc2253bc90cbdb8d812cefa9 | ||
Eurydice: e2db6e88adc9995ca9d3dedf7fa9bc4095e9ca20 | ||
Karamel: 8c3612018c25889288da6857771be3ad03b75bcd | ||
F*: 5643e656b989aca7629723653a2570c7df6252b9-dirty | ||
Libcrux: ef3ee2539580595003c62a749034ae0c76d22a0d | ||
Charon: a68994d00017b76a805d0115ca06c1f2c1805e79 | ||
Eurydice: b665364a6d86749566ce2d650d13fa12c8fab2c5 | ||
Karamel: 96572bc631fde691a2aea7bce5a5a3838b3a5968 | ||
F*: b0961063393215ca65927f017720cb365a193833-dirty | ||
Libcrux: d4b51bcb3af12fb1358ed37830e33cbd72d31590 |
Oops, something went wrong.