Skip to content

Commit

Permalink
src: check return value of HMAC_Final
Browse files Browse the repository at this point in the history
PR-URL: #42303
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
  • Loading branch information
tniessen authored and danielleadams committed Apr 24, 2022
1 parent 7636370 commit 5eaa591
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/crypto/crypto_hmac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,11 @@ void Hmac::HmacDigest(const FunctionCallbackInfo<Value>& 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<Value> error;
Expand Down

0 comments on commit 5eaa591

Please sign in to comment.