diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 34da153128..e4fb66fd56 100755 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -46,6 +46,10 @@ if (CRYPTO_BACKEND_OPENSSL) set(CRYPTO_BACKEND_OPENSSL3 1) endif() endif() +if(BOTAN_VERSION VERSION_GREATER_EQUAL 3.2.0) + # fix referencing deprecated Kyber enum values for version 3.2.0 and upwards + add_definitions(-DENABLE_PQC_NEW_KYBER_ENUM_VALUES) +endif() if(CRYPTO_BACKEND_BOTAN3) set(CMAKE_CXX_STANDARD 20) diff --git a/src/lib/crypto/kyber.cpp b/src/lib/crypto/kyber.cpp index f7e353c949..ad390095e4 100644 --- a/src/lib/crypto/kyber.cpp +++ b/src/lib/crypto/kyber.cpp @@ -38,11 +38,18 @@ rnp_kyber_param_to_botan_kyber_mode(kyber_parameter_e mode) if (mode == kyber_768) { result = Botan::KyberMode::ML_KEM_768_ipd; } +#else +#if defined(ENABLE_PQC_NEW_KYBER_ENUM_VALUES) + Botan::KyberMode result = Botan::KyberMode::Kyber1024_R3; + if (mode == kyber_768) { + result = Botan::KyberMode::Kyber768_R3; + } #else Botan::KyberMode result = Botan::KyberMode::Kyber1024; if (mode == kyber_768) { result = Botan::KyberMode::Kyber768; } +#endif #endif return result; }