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 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.