Skip to content

Commit

Permalink
Version 0.12.0
Browse files Browse the repository at this point in the history
Signed-off-by: Vlad Gheorghiu <[email protected]>
  • Loading branch information
vsoftco committed Jan 14, 2025
1 parent e82b6f5 commit 189b4d5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Version 0.12.0 - 14 January, 2025
# Version 0.12.0 - January 14, 2025

- Fixes https://github.com/open-quantum-safe/liboqs-cpp/issues/21. The API that
NIST has introduced in [FIPS 204](https://csrc.nist.gov/pubs/fips/204/final)
Expand Down
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ install(FILES "${CMAKE_SOURCE_DIR}/cmake/liboqs-cpp_dependencies.cmake"

# Uninstall
# https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#can-i-do-make-uninstall-with-cmake
# UNIX/Linux: sudo cmake --build build --target uninstall Windows: cmake
# --build build --target uninstall
#
# UNIX/Linux: sudo cmake --build build --target uninstall
#
# Windows: cmake --build build --target uninstall
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/liboqs-cpp_uninstall.cmake.in"
Expand Down
30 changes: 15 additions & 15 deletions include/oqs_cpp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -676,48 +676,48 @@ class Signature {
}

/**
* \brief Verify signature with context string
* \brief Verify signature
* \param message Message
* \param signature Signature
* \param context Context string
* \param public_key Public key
* \return True if the signature is valid, false otherwise
*/
bool verify_with_ctx_str(const bytes& message, const bytes& signature,
const bytes& context,
const bytes& public_key) const {
bool verify(const bytes& message, const bytes& signature,
const bytes& public_key) const {
if (public_key.size() != alg_details_.length_public_key)
throw std::runtime_error("Incorrect public key length");

if (signature.size() > alg_details_.max_length_signature)
throw std::runtime_error("Incorrect signature size");

OQS_STATUS rv_ = C::OQS_SIG_verify_with_ctx_str(
sig_.get(), message.data(), message.size(), signature.data(),
signature.size(), context.data(), context.size(),
public_key.data());
OQS_STATUS rv_ = C::OQS_SIG_verify(sig_.get(), message.data(),
message.size(), signature.data(),
signature.size(), public_key.data());

return rv_ == OQS_STATUS::OQS_SUCCESS;
}

/**
* \brief Verify signature
* \brief Verify signature with context string
* \param message Message
* \param signature Signature
* \param context Context string
* \param public_key Public key
* \return True if the signature is valid, false otherwise
*/
bool verify(const bytes& message, const bytes& signature,
const bytes& public_key) const {
bool verify_with_ctx_str(const bytes& message, const bytes& signature,
const bytes& context,
const bytes& public_key) const {
if (public_key.size() != alg_details_.length_public_key)
throw std::runtime_error("Incorrect public key length");

if (signature.size() > alg_details_.max_length_signature)
throw std::runtime_error("Incorrect signature size");

OQS_STATUS rv_ = C::OQS_SIG_verify(sig_.get(), message.data(),
message.size(), signature.data(),
signature.size(), public_key.data());
OQS_STATUS rv_ = C::OQS_SIG_verify_with_ctx_str(
sig_.get(), message.data(), message.size(), signature.data(),
signature.size(), context.data(), context.size(),
public_key.data());

return rv_ == OQS_STATUS::OQS_SUCCESS;
}
Expand Down

0 comments on commit 189b4d5

Please sign in to comment.