From 47e9d89bc89adb31c7c2079dd0824512c6491f67 Mon Sep 17 00:00:00 2001 From: Fabrice Benhamouda Date: Wed, 7 Aug 2024 15:00:33 +0000 Subject: [PATCH] Fix compilation in debug mode Without this fix, we get error in debug mode (when assert is enabled): ``` hkdf.cpp:61:58: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] assert(out_len == EVP_MD_size(digest) && out_len == outputLen); ``` --- csrc/hkdf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csrc/hkdf.cpp b/csrc/hkdf.cpp index 4328b87b..2d0da813 100644 --- a/csrc/hkdf.cpp +++ b/csrc/hkdf.cpp @@ -58,7 +58,7 @@ extern "C" JNIEXPORT void JNICALL Java_com_amazon_corretto_crypto_provider_HkdfS if (HKDF_extract(output.get(), &out_len, digest, secret.get(), secretLen, salt.get(), saltLen) != 1) { throw_openssl(EX_RUNTIME_CRYPTO, "HKDF_extract failed."); } - assert(out_len == EVP_MD_size(digest) && out_len == outputLen); + assert(out_len == EVP_MD_size(digest) && outputLen >= 0 && out_len == (size_t)outputLen); } catch (java_ex& ex) { ex.throw_to_java(env);