diff --git a/src/crypto/crypto_hmac.cc b/src/crypto/crypto_hmac.cc index 38503ac8ac3..d6a652ff8f5 100644 --- a/src/crypto/crypto_hmac.cc +++ b/src/crypto/crypto_hmac.cc @@ -124,8 +124,11 @@ void Hmac::HmacDigest(const FunctionCallbackInfo& args) { unsigned int md_len = 0; if (hmac->ctx_) { - HMAC_Final(hmac->ctx_.get(), md_value, &md_len); + bool ok = HMAC_Final(hmac->ctx_.get(), md_value, &md_len); hmac->ctx_.reset(); + if (!ok) { + return ThrowCryptoError(env, ERR_get_error(), "Failed to finalize HMAC"); + } } Local error;