mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
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>
This commit is contained in:
parent
7612fc3ec6
commit
a718ef91f4
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user