diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d4bd62a..a9de58a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,7 +56,7 @@ include("cmake/BCToolboxCMakeUtils.cmake") list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") if(ENABLE_MBEDTLS AND ENABLE_OPENSSL) - fatal("Cannot build bctoolbox with both openssl and mbedtls enabled") + message(FATAL_ERROR "Cannot build bctoolbox with both openssl and mbedtls enabled") endif() if(NOT CPACK_GENERATOR AND NOT CMAKE_INSTALL_RPATH AND CMAKE_INSTALL_PREFIX) @@ -74,7 +74,7 @@ if(ENABLE_MBEDTLS) if(MbedTLS_FOUND) message(STATUS "Found mbedTLS v${MbedTLS_VERSION}") if(MbedTLS_VERSION LESS 3) - fatal(WARNING "Mbedtls version incompatible (requires v3)") + message(FATAL_ERROR "Mbedtls version incompatible (requires v3)") endif() set(HAVE_MBEDTLS 1) endif() diff --git a/src/crypto/crypto.cc b/src/crypto/crypto.cc index 4465a707..48be6b1e 100644 --- a/src/crypto/crypto.cc +++ b/src/crypto/crypto.cc @@ -46,7 +46,8 @@ std::vector HMAC(BCTBX_UNUSED(const std::vector &key), template <> std::vector HMAC(const std::vector &key, const std::vector &input) { std::vector hmacOutput(SHA1::ssize()); - bctbx_hmacSha1(key.data(), key.size(), input.data(), input.size(), hmacOutput.size(), hmacOutput.data()); + bctbx_hmacSha1(key.data(), key.size(), input.data(), input.size(), static_cast(hmacOutput.size()), + hmacOutput.data()); return hmacOutput; } @@ -54,7 +55,8 @@ std::vector HMAC(const std::vector &key, const std::vect template <> std::vector HMAC(const std::vector &key, const std::vector &input) { std::vector hmacOutput(SHA256::ssize()); - bctbx_hmacSha256(key.data(), key.size(), input.data(), input.size(), hmacOutput.size(), hmacOutput.data()); + bctbx_hmacSha256(key.data(), key.size(), input.data(), input.size(), static_cast(hmacOutput.size()), + hmacOutput.data()); return hmacOutput; } @@ -62,7 +64,8 @@ std::vector HMAC(const std::vector &key, const std::ve template <> std::vector HMAC(const std::vector &key, const std::vector &input) { std::vector hmacOutput(SHA384::ssize()); - bctbx_hmacSha384(key.data(), key.size(), input.data(), input.size(), hmacOutput.size(), hmacOutput.data()); + bctbx_hmacSha384(key.data(), key.size(), input.data(), input.size(), static_cast(hmacOutput.size()), + hmacOutput.data()); return hmacOutput; } @@ -70,7 +73,8 @@ std::vector HMAC(const std::vector &key, const std::ve template <> std::vector HMAC(const std::vector &key, const std::vector &input) { std::vector hmacOutput(SHA512::ssize()); - bctbx_hmacSha512(key.data(), key.size(), input.data(), input.size(), hmacOutput.size(), hmacOutput.data()); + bctbx_hmacSha512(key.data(), key.size(), input.data(), input.size(), static_cast(hmacOutput.size()), + hmacOutput.data()); return hmacOutput; }