From bdcf37ffddaf4a5c5a9eeba47de1bc906d0ee6bb Mon Sep 17 00:00:00 2001 From: Vlad Gheorghiu Date: Wed, 15 Jan 2025 10:16:28 -0500 Subject: [PATCH 1/3] Update test_kem exception logic Signed-off-by: Vlad Gheorghiu --- unit_tests/tests/test_kem.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/unit_tests/tests/test_kem.cpp b/unit_tests/tests/test_kem.cpp index 3a67c60..4b3c028 100644 --- a/unit_tests/tests/test_kem.cpp +++ b/unit_tests/tests/test_kem.cpp @@ -52,18 +52,20 @@ void test_kem_wrong_ciphertext(const std::string& kem_name) { oqs::bytes wrong_ciphertext = oqs::rand::randombytes(ciphertext.size()); oqs::bytes shared_secret_client; try { + // this line should throw shared_secret_client = client.decap_secret(wrong_ciphertext); + // if not, test should fail + bool is_valid = (shared_secret_client == shared_secret_server); + if (is_valid) + std::cerr << kem_name << ": shared secrets should not coincide" + << std::endl; + EXPECT_FALSE(is_valid); } catch (std::exception& e) { if (e.what() == std::string{"Can not decapsulate secret"}) return; else throw; // this is another un-expected exception } - bool is_valid = (shared_secret_client == shared_secret_server); - if (is_valid) - std::cerr << kem_name << ": shared secrets should not coincide" - << std::endl; - EXPECT_FALSE(is_valid); } TEST(oqs_KeyEncapsulation, Correctness) { From 38018ca24e724da293862ab86ac53338122cdcff Mon Sep 17 00:00:00 2001 From: Vlad Gheorghiu Date: Wed, 15 Jan 2025 11:48:11 -0500 Subject: [PATCH 2/3] Dilithium2 -> ML-DSA-44 Signed-off-by: Vlad Gheorghiu --- examples/sig.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/sig.cpp b/examples/sig.cpp index 2b0a511..eecbeb4 100644 --- a/examples/sig.cpp +++ b/examples/sig.cpp @@ -14,7 +14,7 @@ int main() { std::cout << "Enabled signatures:\n" << oqs::Sigs::get_enabled_sigs(); oqs::bytes message = "This is the message to sign"_bytes; - std::string sig_name = "Dilithium2"; + std::string sig_name = "ML-DSA-44"; oqs::Signature signer{sig_name}; std::cout << "\n\nSignature details:\n" << signer.get_details(); From a9c7e6b30356a112eb92a00f684d7a66ce59ec00 Mon Sep 17 00:00:00 2001 From: Vlad Gheorghiu Date: Wed, 15 Jan 2025 11:50:41 -0500 Subject: [PATCH 3/3] Kyber512 -> ML-KEM-512 Signed-off-by: Vlad Gheorghiu --- examples/kem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/kem.cpp b/examples/kem.cpp index d10e60d..a575149 100644 --- a/examples/kem.cpp +++ b/examples/kem.cpp @@ -14,7 +14,7 @@ int main() { std::cout << "liboqs-cpp version: " << oqs::oqs_cpp_version() << '\n'; std::cout << "Enabled KEMs:\n" << oqs::KEMs::get_enabled_KEMs(); - std::string kem_name = "Kyber512"; + std::string kem_name = "ML-KEM-512"; oqs::KeyEncapsulation client{kem_name}; std::cout << "\n\nKEM details:\n" << client.get_details();