Fix returning value for uw_crypto_hmac_init_ Change-Id: I5f4c68fb5ca96d3c7db3e4760473837a130bbf66 Reviewed-on: https://weave-review.googlesource.com/1861 Reviewed-by: Vitaly Buka <vitalybuka@google.com>
diff --git a/src/privet/openssl_utils.cc b/src/privet/openssl_utils.cc index f7bee9b..f38fd1a 100644 --- a/src/privet/openssl_utils.cc +++ b/src/privet/openssl_utils.cc
@@ -19,8 +19,8 @@ const std::vector<uint8_t>& data) { std::vector<uint8_t> mac(kSha256OutputSize); uint8_t hmac_state[uw_crypto_hmac_required_buffer_size_()]; - CHECK_EQ(0u, uw_crypto_hmac_init_(hmac_state, sizeof(hmac_state), key.data(), - key.size())); + CHECK(uw_crypto_hmac_init_(hmac_state, sizeof(hmac_state), key.data(), + key.size())); CHECK(uw_crypto_hmac_update_(hmac_state, sizeof(hmac_state), data.data(), data.size())); CHECK(uw_crypto_hmac_final_(hmac_state, sizeof(hmac_state), mac.data(),
diff --git a/third_party/libuweave/src/crypto_hmac.c b/third_party/libuweave/src/crypto_hmac.c index 56bb754..8b75133 100644 --- a/third_party/libuweave/src/crypto_hmac.c +++ b/third_party/libuweave/src/crypto_hmac.c
@@ -24,7 +24,7 @@ } HMAC_CTX* context = (HMAC_CTX*)state_buffer; HMAC_CTX_init(context); - return HMAC_Init(context, key, key_len, EVP_sha256()) ? 0 : sizeof(HMAC_CTX); + return HMAC_Init(context, key, key_len, EVP_sha256()); } bool uw_crypto_hmac_update_(uint8_t* state_buffer,