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

Added a dummy Kyber implementation and test scaffolding #438

Merged
merged 10 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
44 changes: 44 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,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 -Wsign-conversion -Wconversion -Wall -Wextra -pedantic)
endif()
endif()

# Install
# # This allows package maintainers to control the install destination by setting
# # the appropriate cache variables.
Expand Down Expand Up @@ -482,6 +489,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 hacl_cpu_features)
target_link_libraries(${TEST_NAME} PRIVATE
gtest_main
hacl_static
hacl_cpu_features
nlohmann_json::nlohmann_json
libcrux_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 Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ $ sudo pacman -S gcc

<details>
<summary><b>Fedora</b></summary>

```sh
$ sudo dnf install cmake ninja-build python3

Expand All @@ -51,7 +51,7 @@ $ sudo dnf install gcc

<details>
<summary><b>Ubuntu</b></summary>

```sh
$ sudo apt install cmake ninja-build python3

Expand Down
2 changes: 1 addition & 1 deletion _build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ printf " ! USE ./mach FOR MORE OPTIONS !\n\n"

mkdir build
cp config/default_config.cmake build/config.cmake
cmake -B build -G"Ninja Multi-Config"
cmake -B build -G"Ninja Multi-Config" -DBUILD_LIBCRUX=ON
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used anywhere where we want libcrux on?
I don't think we want libcrux here just yet.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just added it there so that it's tested on some of the CI jobs that run this script, but I can remove it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If they go through, leave it. But if it makes problems, drop it.

ninja -f build-Release.ninja -C build
15 changes: 15 additions & 0 deletions config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"vale_include_paths": [
"vale/include"
],
"libcrux_include_paths": [
"libcrux/include"
],
"hacl_sources": {
"nacl": [
{
Expand Down Expand Up @@ -337,6 +340,13 @@
}
]
},
"libcrux_sources": {
"kyber": [
{
"file": "Libcrux_Kem_Kyber_Kyber768.c"
}
]
},
"vale_sources": {
"std": {
"osx": [
Expand Down Expand Up @@ -509,6 +519,11 @@
"aead.cc"
]
},
"libcrux_tests": {
"kyber": [
"kyber.cc"
]
},
"benchmarks": {
"blake2": [
"blake.cc"
Expand Down
57 changes: 39 additions & 18 deletions config/default_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ set(SOURCES_std
${PROJECT_SOURCE_DIR}/src/Hacl_HMAC_DRBG.c
${PROJECT_SOURCE_DIR}/src/Hacl_HMAC.c
${PROJECT_SOURCE_DIR}/src/Hacl_Hash_SHA2.c
${PROJECT_SOURCE_DIR}/src/Hacl_Hash_Blake2b.c
${PROJECT_SOURCE_DIR}/src/Hacl_Hash_Blake2s.c
${PROJECT_SOURCE_DIR}/src/Hacl_Hash_Blake2b.c
${PROJECT_SOURCE_DIR}/src/Hacl_Ed25519.c
${PROJECT_SOURCE_DIR}/src/Hacl_EC_Ed25519.c
${PROJECT_SOURCE_DIR}/src/Hacl_Hash_Base.c
Expand Down Expand Up @@ -57,8 +57,8 @@ set(SOURCES_std
set(SOURCES_vec256
${PROJECT_SOURCE_DIR}/src/Hacl_Hash_Blake2b_Simd256.c
${PROJECT_SOURCE_DIR}/src/Hacl_AEAD_Chacha20Poly1305_Simd256.c
${PROJECT_SOURCE_DIR}/src/Hacl_MAC_Poly1305_Simd256.c
${PROJECT_SOURCE_DIR}/src/Hacl_Chacha20_Vec256.c
${PROJECT_SOURCE_DIR}/src/Hacl_MAC_Poly1305_Simd256.c
${PROJECT_SOURCE_DIR}/src/Hacl_SHA2_Vec256.c
${PROJECT_SOURCE_DIR}/src/Hacl_HKDF_Blake2b_256.c
${PROJECT_SOURCE_DIR}/src/Hacl_HMAC_Blake2b_256.c
Expand All @@ -73,8 +73,8 @@ set(SOURCES_vec128
${PROJECT_SOURCE_DIR}/src/Hacl_Bignum64.c
${PROJECT_SOURCE_DIR}/src/Hacl_GenericField64.c
${PROJECT_SOURCE_DIR}/src/Hacl_AEAD_Chacha20Poly1305_Simd128.c
${PROJECT_SOURCE_DIR}/src/Hacl_MAC_Poly1305_Simd128.c
${PROJECT_SOURCE_DIR}/src/Hacl_Chacha20_Vec128.c
${PROJECT_SOURCE_DIR}/src/Hacl_MAC_Poly1305_Simd128.c
${PROJECT_SOURCE_DIR}/src/Hacl_SHA2_Vec128.c
${PROJECT_SOURCE_DIR}/src/Hacl_HKDF_Blake2s_128.c
${PROJECT_SOURCE_DIR}/src/Hacl_HMAC_Blake2s_128.c
Expand Down Expand Up @@ -112,16 +112,16 @@ set(INCLUDES
${PROJECT_SOURCE_DIR}/karamel/krmllib/dist/minimal/LowStar_Endianness.h
${PROJECT_SOURCE_DIR}/include/Hacl_Salsa20.h
${PROJECT_SOURCE_DIR}/include/Hacl_MAC_Poly1305.h
${PROJECT_SOURCE_DIR}/include/Hacl_Streaming_Types.h
${PROJECT_SOURCE_DIR}/include/Hacl_Krmllib.h
${PROJECT_SOURCE_DIR}/include/Hacl_Curve25519_51.h
${PROJECT_SOURCE_DIR}/include/internal/Hacl_Krmllib.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_Krmllib.h
${PROJECT_SOURCE_DIR}/include/Hacl_HMAC_DRBG.h
${PROJECT_SOURCE_DIR}/include/Hacl_Streaming_Types.h
${PROJECT_SOURCE_DIR}/include/Hacl_HMAC.h
${PROJECT_SOURCE_DIR}/include/Hacl_Hash_SHA2.h
${PROJECT_SOURCE_DIR}/include/Hacl_Hash_Blake2b.h
${PROJECT_SOURCE_DIR}/include/Hacl_Hash_Blake2s.h
${PROJECT_SOURCE_DIR}/include/Hacl_Hash_Blake2b.h
${PROJECT_SOURCE_DIR}/include/internal/Hacl_Ed25519.h
${PROJECT_SOURCE_DIR}/include/internal/Hacl_Hash_SHA2.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_Hash_SHA2.h
Expand All @@ -138,14 +138,16 @@ set(INCLUDES
${PROJECT_SOURCE_DIR}/include/Hacl_EC_Ed25519.h
${PROJECT_SOURCE_DIR}/include/Hacl_Hash_Base.h
${PROJECT_SOURCE_DIR}/include/internal/Hacl_Hash_Blake2b.h
${PROJECT_SOURCE_DIR}/include/internal/Hacl_Hash_Blake2s.h
${PROJECT_SOURCE_DIR}/include/internal/Hacl_Impl_Blake2_Constants.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_Hash_Blake2b.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_Hash_Blake2s.h
${PROJECT_SOURCE_DIR}/include/lib_memzero0.h
${PROJECT_SOURCE_DIR}/include/Hacl_Hash_Blake2b_Simd256.h
${PROJECT_SOURCE_DIR}/include/internal/Hacl_Hash_Blake2s.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_Hash_Blake2s.h
${PROJECT_SOURCE_DIR}/include/internal/Hacl_Hash_Blake2b_Simd256.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_Hash_Blake2b_Simd256.h
${PROJECT_SOURCE_DIR}/include/libintvector.h
${PROJECT_SOURCE_DIR}/include/Hacl_Hash_Blake2s_Simd128.h
${PROJECT_SOURCE_DIR}/include/internal/Hacl_Hash_Blake2s_Simd128.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_Hash_Blake2s_Simd128.h
${PROJECT_SOURCE_DIR}/include/Hacl_Bignum256_32.h
${PROJECT_SOURCE_DIR}/include/Hacl_Bignum.h
${PROJECT_SOURCE_DIR}/include/internal/Hacl_Bignum.h
Expand All @@ -159,16 +161,16 @@ set(INCLUDES
${PROJECT_SOURCE_DIR}/include/Hacl_GenericField64.h
${PROJECT_SOURCE_DIR}/include/Hacl_AEAD_Chacha20Poly1305.h
${PROJECT_SOURCE_DIR}/include/Hacl_Chacha20.h
${PROJECT_SOURCE_DIR}/include/internal/Hacl_MAC_Poly1305.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_MAC_Poly1305.h
${PROJECT_SOURCE_DIR}/include/Hacl_Chacha20_Vec32.h
${PROJECT_SOURCE_DIR}/include/internal/Hacl_Chacha20.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_Chacha20.h
${PROJECT_SOURCE_DIR}/include/Hacl_AEAD_Chacha20Poly1305_Simd128.h
${PROJECT_SOURCE_DIR}/include/Hacl_MAC_Poly1305_Simd128.h
${PROJECT_SOURCE_DIR}/include/Hacl_Chacha20_Vec128.h
${PROJECT_SOURCE_DIR}/include/internal/Hacl_MAC_Poly1305_Simd128.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_MAC_Poly1305_Simd128.h
${PROJECT_SOURCE_DIR}/include/Hacl_AEAD_Chacha20Poly1305_Simd256.h
${PROJECT_SOURCE_DIR}/include/Hacl_MAC_Poly1305_Simd256.h
${PROJECT_SOURCE_DIR}/include/Hacl_Chacha20_Vec256.h
${PROJECT_SOURCE_DIR}/include/internal/Hacl_MAC_Poly1305_Simd256.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_MAC_Poly1305_Simd256.h
Expand All @@ -195,11 +197,15 @@ set(INCLUDES
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_Hash_SHA1.h
${PROJECT_SOURCE_DIR}/include/internal/Hacl_Hash_MD5.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_Hash_MD5.h
${PROJECT_SOURCE_DIR}/include/internal/Hacl_HMAC.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_HMAC.h
${PROJECT_SOURCE_DIR}/include/Hacl_HKDF.h
${PROJECT_SOURCE_DIR}/include/Hacl_HKDF_Blake2s_128.h
${PROJECT_SOURCE_DIR}/include/Hacl_HMAC_Blake2s_128.h
${PROJECT_SOURCE_DIR}/include/Hacl_Hash_Blake2s_Simd128.h
${PROJECT_SOURCE_DIR}/include/Hacl_HKDF_Blake2b_256.h
${PROJECT_SOURCE_DIR}/include/Hacl_HMAC_Blake2b_256.h
${PROJECT_SOURCE_DIR}/include/Hacl_Hash_Blake2b_Simd256.h
${PROJECT_SOURCE_DIR}/include/Hacl_RSAPSS.h
${PROJECT_SOURCE_DIR}/include/Hacl_HPKE_Curve64_CP128_SHA256.h
${PROJECT_SOURCE_DIR}/include/Hacl_HPKE_Interface_Hacl_Impl_HPKE_Hacl_Meta_HPKE.h
Expand Down Expand Up @@ -240,6 +246,8 @@ set(INCLUDES
${PROJECT_SOURCE_DIR}/include/EverCrypt_Cipher.h
${PROJECT_SOURCE_DIR}/include/EverCrypt_Chacha20Poly1305.h
${PROJECT_SOURCE_DIR}/include/EverCrypt_Poly1305.h
${PROJECT_SOURCE_DIR}/include/Hacl_MAC_Poly1305_Simd256.h
${PROJECT_SOURCE_DIR}/include/Hacl_MAC_Poly1305_Simd128.h
${PROJECT_SOURCE_DIR}/include/EverCrypt_AEAD.h
${PROJECT_SOURCE_DIR}/include/internal/Hacl_SHA3_Scalar.h
${PROJECT_SOURCE_DIR}/include/Hacl_SHA3_Scalar.h
Expand All @@ -254,15 +262,15 @@ set(PUBLIC_INCLUDES
${PROJECT_SOURCE_DIR}/karamel/krmllib/dist/minimal/LowStar_Endianness.h
${PROJECT_SOURCE_DIR}/include/Hacl_Salsa20.h
${PROJECT_SOURCE_DIR}/include/Hacl_MAC_Poly1305.h
${PROJECT_SOURCE_DIR}/include/Hacl_Streaming_Types.h
${PROJECT_SOURCE_DIR}/include/Hacl_Krmllib.h
${PROJECT_SOURCE_DIR}/include/Hacl_Curve25519_51.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_Krmllib.h
${PROJECT_SOURCE_DIR}/include/Hacl_HMAC_DRBG.h
${PROJECT_SOURCE_DIR}/include/Hacl_Streaming_Types.h
${PROJECT_SOURCE_DIR}/include/Hacl_HMAC.h
${PROJECT_SOURCE_DIR}/include/Hacl_Hash_SHA2.h
${PROJECT_SOURCE_DIR}/include/Hacl_Hash_Blake2b.h
${PROJECT_SOURCE_DIR}/include/Hacl_Hash_Blake2s.h
${PROJECT_SOURCE_DIR}/include/Hacl_Hash_Blake2b.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_Hash_SHA2.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_Curve25519_51.h
${PROJECT_SOURCE_DIR}/include/lib_intrinsics.h
Expand All @@ -273,11 +281,11 @@ set(PUBLIC_INCLUDES
${PROJECT_SOURCE_DIR}/include/Hacl_EC_Ed25519.h
${PROJECT_SOURCE_DIR}/include/Hacl_Hash_Base.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_Hash_Blake2b.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_Hash_Blake2s.h
${PROJECT_SOURCE_DIR}/include/lib_memzero0.h
${PROJECT_SOURCE_DIR}/include/Hacl_Hash_Blake2b_Simd256.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_Hash_Blake2s.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_Hash_Blake2b_Simd256.h
${PROJECT_SOURCE_DIR}/include/libintvector.h
${PROJECT_SOURCE_DIR}/include/Hacl_Hash_Blake2s_Simd128.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_Hash_Blake2s_Simd128.h
${PROJECT_SOURCE_DIR}/include/Hacl_Bignum256_32.h
${PROJECT_SOURCE_DIR}/include/Hacl_Bignum.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_Bignum.h
Expand All @@ -290,14 +298,13 @@ set(PUBLIC_INCLUDES
${PROJECT_SOURCE_DIR}/include/Hacl_GenericField64.h
${PROJECT_SOURCE_DIR}/include/Hacl_AEAD_Chacha20Poly1305.h
${PROJECT_SOURCE_DIR}/include/Hacl_Chacha20.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_MAC_Poly1305.h
${PROJECT_SOURCE_DIR}/include/Hacl_Chacha20_Vec32.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_Chacha20.h
${PROJECT_SOURCE_DIR}/include/Hacl_AEAD_Chacha20Poly1305_Simd128.h
${PROJECT_SOURCE_DIR}/include/Hacl_MAC_Poly1305_Simd128.h
${PROJECT_SOURCE_DIR}/include/Hacl_Chacha20_Vec128.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_MAC_Poly1305_Simd128.h
${PROJECT_SOURCE_DIR}/include/Hacl_AEAD_Chacha20Poly1305_Simd256.h
${PROJECT_SOURCE_DIR}/include/Hacl_MAC_Poly1305_Simd256.h
${PROJECT_SOURCE_DIR}/include/Hacl_Chacha20_Vec256.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_MAC_Poly1305_Simd256.h
${PROJECT_SOURCE_DIR}/include/Hacl_Curve25519_64.h
Expand All @@ -312,11 +319,14 @@ set(PUBLIC_INCLUDES
${PROJECT_SOURCE_DIR}/include/Hacl_SHA2_Vec256.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_Hash_SHA1.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_Hash_MD5.h
${PROJECT_SOURCE_DIR}/include/internal/../Hacl_HMAC.h
${PROJECT_SOURCE_DIR}/include/Hacl_HKDF.h
${PROJECT_SOURCE_DIR}/include/Hacl_HKDF_Blake2s_128.h
${PROJECT_SOURCE_DIR}/include/Hacl_HMAC_Blake2s_128.h
${PROJECT_SOURCE_DIR}/include/Hacl_Hash_Blake2s_Simd128.h
${PROJECT_SOURCE_DIR}/include/Hacl_HKDF_Blake2b_256.h
${PROJECT_SOURCE_DIR}/include/Hacl_HMAC_Blake2b_256.h
${PROJECT_SOURCE_DIR}/include/Hacl_Hash_Blake2b_Simd256.h
${PROJECT_SOURCE_DIR}/include/Hacl_RSAPSS.h
${PROJECT_SOURCE_DIR}/include/Hacl_HPKE_Curve64_CP128_SHA256.h
${PROJECT_SOURCE_DIR}/include/Hacl_HPKE_Interface_Hacl_Impl_HPKE_Hacl_Meta_HPKE.h
Expand Down Expand Up @@ -353,6 +363,8 @@ set(PUBLIC_INCLUDES
${PROJECT_SOURCE_DIR}/include/EverCrypt_Cipher.h
${PROJECT_SOURCE_DIR}/include/EverCrypt_Chacha20Poly1305.h
${PROJECT_SOURCE_DIR}/include/EverCrypt_Poly1305.h
${PROJECT_SOURCE_DIR}/include/Hacl_MAC_Poly1305_Simd256.h
${PROJECT_SOURCE_DIR}/include/Hacl_MAC_Poly1305_Simd128.h
${PROJECT_SOURCE_DIR}/include/EverCrypt_AEAD.h
${PROJECT_SOURCE_DIR}/include/Hacl_SHA3_Scalar.h
${PROJECT_SOURCE_DIR}/include/Hacl_SHA3_Vec256.h
Expand Down Expand Up @@ -388,6 +400,7 @@ set(INCLUDE_PATHS
${PROJECT_SOURCE_DIR}/karamel/include
${PROJECT_SOURCE_DIR}/karamel/krmllib/dist/minimal
${PROJECT_SOURCE_DIR}/vale/include
${PROJECT_SOURCE_DIR}/libcrux/include
)
set(TEST_SOURCES
${PROJECT_SOURCE_DIR}/tests/detection.cc
Expand All @@ -414,6 +427,7 @@ set(TEST_SOURCES
${PROJECT_SOURCE_DIR}/tests/nacl.cc
${PROJECT_SOURCE_DIR}/tests/evercrypt.cc
${PROJECT_SOURCE_DIR}/tests/aead.cc
${PROJECT_SOURCE_DIR}/tests/kyber.cc
)
set(BENCHMARK_SOURCES
${PROJECT_SOURCE_DIR}/benchmarks/blake.cc
Expand Down Expand Up @@ -460,6 +474,9 @@ set(VALE_SOURCES_msvc
${PROJECT_SOURCE_DIR}/vale/src/curve25519-x86_64-msvc.asm
${PROJECT_SOURCE_DIR}/vale/src/poly1305-x86_64-msvc.asm
)
set(LIBCRUX_SOURCES
${PROJECT_SOURCE_DIR}/libcrux/src/Libcrux_Kem_Kyber_Kyber768.c
)
set(ALGORITHM_TEST_FILES
TEST_FILES_detection
TEST_FILES_bignum
Expand All @@ -482,6 +499,7 @@ set(ALGORITHM_TEST_FILES
TEST_FILES_nacl
TEST_FILES_evercrypt
TEST_FILES_aead
TEST_FILES_kyber
)
set(TEST_FILES_detection
detection.cc
Expand Down Expand Up @@ -549,3 +567,6 @@ set(TEST_FILES_evercrypt
set(TEST_FILES_aead
aead.cc
)
set(TEST_FILES_kyber
kyber.cc
)
32 changes: 32 additions & 0 deletions libcrux/include/Libcrux_Kem_Kyber_Kyber768.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#ifndef __Libcrux_Kem_Kyber_Kyber768_H
#define __Libcrux_Kem_Kyber_Kyber768_H

#if defined(__cplusplus)
extern "C"
{
#endif

#include <inttypes.h>

#define KYBER768_SECRETKEYBYTES 2400
#define KYBER768_PUBLICKEYBYTES 1184
#define KYBER768_CIPHERTEXTBYTES 1088
#define KYBER768_SHAREDSECRETBYTES 32

int Libcrux_Kyber768_GenerateKeyPair(uint8_t* pk,
uint8_t* sk,
const uint8_t* randomness);
int Libcrux_Kyber768_Encapsulate(uint8_t* ct,
uint8_t* ss,
const uint8_t* pk,
const uint8_t* randomness);
int Libcrux_Kyber768_Decapsulate(uint8_t* ss,
const uint8_t* ct,
const uint8_t* sk);

#if defined(__cplusplus)
}
#endif

#define __Libcrux_Kem_Kyber_Kyber768_H_DEFINED
#endif
Loading
Loading