diff options
author | Tobias Nießen <tniessen@tnie.de> | 2022-03-14 17:23:14 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-14 17:23:14 +0300 |
commit | a718ef91f4625f4369dc4aa201534a49f435d660 (patch) | |
tree | e82b1cdd0834a11bbdac4a39b321e969d8bb42d7 /src | |
parent | 7612fc3ec600553f627786510b36d6fe00ae0642 (diff) |
src: check return value of HMAC_Final
PR-URL: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'src')
-rw-r--r-- | src/crypto/crypto_hmac.cc | 5 |
1 files changed, 4 insertions, 1 deletions
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<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; |