Skip to content
Open
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
35 changes: 29 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,8 @@ if(CRYPTO STREQUAL "mbedtls")
add_definitions(-DLIBSPDM_SM3_256_SUPPORT=0)
add_definitions(-DLIBSPDM_EDDSA_ED25519_SUPPORT=0)
add_definitions(-DLIBSPDM_EDDSA_ED448_SUPPORT=0)
add_definitions(-DLIBSPDM_SM2_DSA_P256_SUPPORT=0)
add_definitions(-DLIBSPDM_SM2_KEY_EXCHANGE_P256_SUPPORT=0)
add_definitions(-DLIBSPDM_AEAD_SM4_128_GCM_SUPPORT=0)

# Hard-disable ML-DSA and SLH-DSA for this mbedtls build.
add_definitions(-DLIBSPDM_ML_DSA_44_SUPPORT=0)
add_definitions(-DLIBSPDM_ML_DSA_65_SUPPORT=0)
add_definitions(-DLIBSPDM_ML_DSA_87_SUPPORT=0)
Expand All @@ -215,9 +214,32 @@ if(CRYPTO STREQUAL "mbedtls")
add_definitions(-DLIBSPDM_SLH_DSA_SHAKE_256S_SUPPORT=0)
add_definitions(-DLIBSPDM_SLH_DSA_SHA2_256F_SUPPORT=0)
add_definitions(-DLIBSPDM_SLH_DSA_SHAKE_256F_SUPPORT=0)
add_definitions(-DLIBSPDM_ML_KEM_512_SUPPORT=0)
add_definitions(-DLIBSPDM_ML_KEM_768_SUPPORT=0)
add_definitions(-DLIBSPDM_ML_KEM_1024_SUPPORT=0)

set(LIBSPDM_IPPCP_INCLUDE_DIR ${LIBSPDM_IPPCP_INCLUDE_DIR} CACHE PATH "Optional path to IPPCP include directory (containing ippcp.h)")
set(LIBSPDM_IPPCP_LIBRARY ${LIBSPDM_IPPCP_LIBRARY} CACHE FILEPATH "Optional path to IPPCP library (libippcp)")

if(NOT LIBSPDM_IPPCP_INCLUDE_DIR)
find_path(LIBSPDM_IPPCP_INCLUDE_DIR NAMES ippcp.h)
endif()

if(NOT LIBSPDM_IPPCP_LIBRARY)
find_library(LIBSPDM_IPPCP_LIBRARY NAMES ippcp)
endif()

if(NOT LIBSPDM_IPPCP_INCLUDE_DIR OR NOT LIBSPDM_IPPCP_LIBRARY)
message(FATAL_ERROR "ML-KEM for CRYPTO=mbedtls requires ipp-crypto (IPPCP). Set LIBSPDM_IPPCP_INCLUDE_DIR and LIBSPDM_IPPCP_LIBRARY or install ipp-crypto.")
endif()

message(STATUS "Enabling ML-KEM for mbedtls via IPPCP")
message(STATUS "IPPCP include: ${LIBSPDM_IPPCP_INCLUDE_DIR}")
message(STATUS "IPPCP library: ${LIBSPDM_IPPCP_LIBRARY}")
add_definitions(-DLIBSPDM_ML_KEM_512_SUPPORT=1)
add_definitions(-DLIBSPDM_ML_KEM_768_SUPPORT=1)
add_definitions(-DLIBSPDM_ML_KEM_1024_SUPPORT=1)

add_definitions(-DLIBSPDM_SM2_DSA_P256_SUPPORT=0)
add_definitions(-DLIBSPDM_SM2_KEY_EXCHANGE_P256_SUPPORT=0)
add_definitions(-DLIBSPDM_AEAD_SM4_128_GCM_SUPPORT=0)
elseif(CRYPTO STREQUAL "openssl")
message("CRYPTO = openssl")
add_definitions(-DLIBSPDM_SM2_KEY_EXCHANGE_P256_SUPPORT=0)
Expand Down Expand Up @@ -1114,6 +1136,7 @@ else()
add_subdirectory(unit_test/fuzzing/test_secured_message/test_spdm_decode_secured_message)
add_subdirectory(unit_test/fuzzing/test_secured_message/test_spdm_encode_secured_message)
add_subdirectory(unit_test/fuzzing/test_spdm_crypt/test_x509_certificate_check)
add_subdirectory(unit_test/fuzzing/test_spdm_crypt/test_mlkem_kem_api)
add_subdirectory(unit_test/fuzzing/test_responder/test_spdm_responder_set_certificate)
add_subdirectory(unit_test/fuzzing/test_requester/test_spdm_requester_set_certificate)
add_subdirectory(unit_test/fuzzing/test_responder/test_spdm_responder_csr)
Expand Down
5 changes: 5 additions & 0 deletions os_stub/cryptlib_mbedtls/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ target_include_directories(cryptlib_mbedtls
${LIBSPDM_DIR}/os_stub/mbedtlslib/mbedtls/include/mbedtls
)

target_include_directories(cryptlib_mbedtls PRIVATE ${LIBSPDM_IPPCP_INCLUDE_DIR})

target_sources(cryptlib_mbedtls
PRIVATE
cipher/aead_aes_gcm.c
Expand Down Expand Up @@ -65,3 +67,6 @@ if(MBEDTLS_CONFIG_FILE)
else()
target_compile_definitions(cryptlib_mbedtls PRIVATE -DMBEDTLS_CONFIG_FILE=<libspdm_mbedtls_config.h>)
endif()

# cryptlib_mbedtls is a static library; keep IPPCP dependency visible to final linkers.
target_link_libraries(cryptlib_mbedtls PUBLIC ${LIBSPDM_IPPCP_LIBRARY})
Loading
Loading