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 <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
  • Loading branch information
tniessen authored and bengl committed Mar 21, 2022
1 parent eb0e1a1 commit 08e2d8a
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 08e2d8a

Please sign in to comment.