Skip to content
Open
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
39 changes: 30 additions & 9 deletions include/internal/libspdm_macro_check.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright Notice:
* Copyright 2021-2025 DMTF. All rights reserved.
* Copyright 2021-2026 DMTF. All rights reserved.
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
**/

Expand All @@ -22,6 +22,11 @@
((LIBSPDM_SHA2_SUPPORT) || (LIBSPDM_SHA3_SUPPORT) || \
(LIBSPDM_SM3_SUPPORT))

#define LIBSPDM_PQC_ASYM_ALGO_SUPPORT \
((LIBSPDM_ML_DSA_SUPPORT) || (LIBSPDM_SLH_DSA_SUPPORT))

#define LIBSPDM_KEM_ALGO_SUPPORT (LIBSPDM_ML_KEM_SUPPORT)

#if LIBSPDM_FIPS_MODE
#define LIBSPDM_FIPS_ASYM_ALGO_SUPPORT \
((LIBSPDM_RSA_SSA_SUPPORT) || (LIBSPDM_RSA_PSS_SUPPORT) || (LIBSPDM_ECDSA_SUPPORT) || \
Expand All @@ -34,22 +39,26 @@

#define LIBSPDM_FIPS_HASH_ALGO_SUPPORT \
((LIBSPDM_SHA2_SUPPORT) || (LIBSPDM_SHA3_SUPPORT))

#define LIBSPDM_FIPS_PQC_ASYM_ALGO_SUPPORT (LIBSPDM_ML_DSA_SUPPORT)

#define LIBSPDM_FIPS_KEM_ALGO_SUPPORT (LIBSPDM_ML_KEM_SUPPORT)
#endif /*LIBSPDM_FIPS_MODE*/

#if (LIBSPDM_ENABLE_CAPABILITY_KEY_EX_CAP) && !LIBSPDM_ASYM_ALGO_SUPPORT
#error If KEY_EX_CAP is enabled then at least one asymmetric algorithm must also be enabled.
#if (LIBSPDM_ENABLE_CAPABILITY_KEY_EX_CAP) && !(LIBSPDM_ASYM_ALGO_SUPPORT || LIBSPDM_PQC_ASYM_ALGO_SUPPORT)
#error If KEY_EX_CAP is enabled then at least one asymmetric or PQC asymmetric algorithm must also be enabled.
#endif

#if (LIBSPDM_ENABLE_CAPABILITY_CERT_CAP) && !LIBSPDM_ASYM_ALGO_SUPPORT
#error If CERT_CAP is enabled then at least one asymmetric algorithm must also be enabled.
#if (LIBSPDM_ENABLE_CAPABILITY_CERT_CAP) && !(LIBSPDM_ASYM_ALGO_SUPPORT || LIBSPDM_PQC_ASYM_ALGO_SUPPORT)
#error If CERT_CAP is enabled then at least one asymmetric or PQC asymmetric algorithm must also be enabled.
#endif

#if (LIBSPDM_ENABLE_CAPABILITY_CHAL_CAP) && !LIBSPDM_ASYM_ALGO_SUPPORT
#error If CHAL_CAP is enabled then at least one asymmetric algorithm must also be enabled.
#if (LIBSPDM_ENABLE_CAPABILITY_CHAL_CAP) && !(LIBSPDM_ASYM_ALGO_SUPPORT || LIBSPDM_PQC_ASYM_ALGO_SUPPORT)
#error If CHAL_CAP is enabled then at least one asymmetric or PQC asymmetric algorithm must also be enabled.
#endif

#if (LIBSPDM_ENABLE_CAPABILITY_KEY_EX_CAP) && !LIBSPDM_DHE_ALGO_SUPPORT
#error If KEY_EX_CAP is enabled then at least one DHE algorithm must also be enabled.
#if (LIBSPDM_ENABLE_CAPABILITY_KEY_EX_CAP) && !(LIBSPDM_DHE_ALGO_SUPPORT || LIBSPDM_KEM_ALGO_SUPPORT)
#error If KEY_EX_CAP is enabled then at least one DHE or KEM algorithm must also be enabled.
#endif

#if (LIBSPDM_ENABLE_CAPABILITY_KEY_EX_CAP) && !LIBSPDM_AEAD_ALGO_SUPPORT
Expand Down Expand Up @@ -110,18 +119,30 @@
#if (LIBSPDM_HASH_ALGO_SUPPORT) && !LIBSPDM_FIPS_HASH_ALGO_SUPPORT
#error HASH algo is cleared after FIPS enforcement.
#endif

#if (LIBSPDM_PQC_ASYM_ALGO_SUPPORT) && !LIBSPDM_FIPS_PQC_ASYM_ALGO_SUPPORT
#error PQC ASYM algo is cleared after FIPS enforcement.
#endif

#if (LIBSPDM_KEM_ALGO_SUPPORT) && !LIBSPDM_FIPS_KEM_ALGO_SUPPORT
#error KEM algo is cleared after FIPS enforcement.
#endif
#endif /*LIBSPDM_FIPS_MODE*/

#undef LIBSPDM_ASYM_ALGO_SUPPORT
#undef LIBSPDM_DHE_ALGO_SUPPORT
#undef LIBSPDM_AEAD_ALGO_SUPPORT
#undef LIBSPDM_HASH_ALGO_SUPPORT
#undef LIBSPDM_PQC_ASYM_ALGO_SUPPORT
#undef LIBSPDM_KEM_ALGO_SUPPORT

#if LIBSPDM_FIPS_MODE
#undef LIBSPDM_FIPS_ASYM_ALGO_SUPPORT
#undef LIBSPDM_FIPS_DHE_ALGO_SUPPORT
#undef LIBSPDM_FIPS_AEAD_ALGO_SUPPORT
#undef LIBSPDM_FIPS_HASH_ALGO_SUPPORT
#undef LIBSPDM_FIPS_PQC_ASYM_ALGO_SUPPORT
#undef LIBSPDM_FIPS_KEM_ALGO_SUPPORT
#endif /*LIBSPDM_FIPS_MODE*/

#endif /* LIBSPDM_MACRO_CHECK_H */
Loading