Skip to content

Commit cfb51fa

Browse files
panvamarco-ippolito
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 PR-URL: nodejs-private/node-private#831 Refs: https://hackerone.com/reports/3533945 Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> CVE-ID: CVE-2026-21713
1 parent 00ad47a commit cfb51fa

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
@@ -268,7 +268,8 @@ Maybe<bool> HmacTraits::EncodeOutput(
268268
*result = Boolean::New(
269269
env->isolate(),
270270
out->size() > 0 && out->size() == params.signature.size() &&
271-
memcmp(out->data(), params.signature.data(), out->size()) == 0);
271+
CRYPTO_memcmp(
272+
out->data(), params.signature.data(), out->size()) == 0);
272273
break;
273274
default:
274275
UNREACHABLE();

0 commit comments

Comments
 (0)