Skip to content

Commit

Permalink
fix issue rnpgp#2247; use newer kyber _R3 symbols for Botan 3.2.0 upw…
Browse files Browse the repository at this point in the history
…ards
  • Loading branch information
TJ-91 committed Jul 9, 2024
1 parent 6224061 commit b73d4a8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 7 additions & 0 deletions src/lib/crypto/kyber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit b73d4a8

Please sign in to comment.