Skip to content

Commit 52a52ef

Browse files
panvaaduh95
authored andcommitted
crypto: use timing-safe comparison in Web Cryptography HMAC
Use `CRYPTO_memcmp` instead of `memcmp` in `HMAC` Web Cryptography algorithm implementations. Ref: https://hackerone.com/reports/3533945 Backport-PR-URL: nodejs-private/node-private#830 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: nodejs-private/node-private#822 CVE-ID: CVE-2026-21713
1 parent 91b9708 commit 52a52ef

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/crypto/crypto_hmac.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@ MaybeLocal<Value> HmacTraits::EncodeOutput(Environment* env,
264264
return Boolean::New(
265265
env->isolate(),
266266
out->size() > 0 && out->size() == params.signature.size() &&
267-
memcmp(out->data(), params.signature.data(), out->size()) == 0);
267+
CRYPTO_memcmp(
268+
out->data(), params.signature.data(), out->size()) == 0);
268269
}
269270
UNREACHABLE();
270271
}

0 commit comments

Comments
 (0)