Skip to content

[v24.x backport] more (web)crypto#64629

Open
panva wants to merge 163 commits into
nodejs:v24.x-stagingfrom
panva:backport-webcrypto-24
Open

[v24.x backport] more (web)crypto#64629
panva wants to merge 163 commits into
nodejs:v24.x-stagingfrom
panva:backport-webcrypto-24

Conversation

pimterry and others added 30 commits June 25, 2026 16:07
Signed-off-by: Tim Perry <pimterry@gmail.com>
PR-URL: nodejs#63874
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Signed-off-by: haramjeong <04harams77@gmail.com>
PR-URL: nodejs#63261
Fixes: nodejs#63258
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
CreateString() and Parse() in node_cjs_lexer.cc unconditionally called
ToLocalChecked() on the results of String::NewFromOneByte(),
String::NewFromUtf8() and Set::Add(). If string or handle allocation
fails or an exception is pending on the isolate, these return an empty
MaybeLocal and ToLocalChecked() aborts the process with
"FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal".

Since Parse() is on the hot path of every ESM import of a CJS module
(cjsPreparseModuleExports), propagate the failure as a regular pending
JavaScript exception instead so callers can recover.

Fixes: nodejs#63323
Refs: nodejs#61456
Signed-off-by: Yagiz Nizipli <yagiz@nizipli.com>
PR-URL: nodejs#63885
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com>
PR-URL: nodejs#63815
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com>
PR-URL: nodejs#63883
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Deokjin Kim <deokjin81.kim@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Ensure the debugger CLI waits for post-connect initialization before
resolving the run and restart commands. This prevents tests and users
from observing a prompt before Runtime.runIfWaitingForDebugger() has
released the new debuggee.

Refs: nodejs#61762

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
PR-URL: nodejs#63607
Refs: nodejs#61762
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
PR-URL: nodejs#63898
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com>
PR-URL: nodejs#63823
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com>
PR-URL: nodejs#63833
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Mattias Buelens <mattias@buelens.com>
PR-URL: nodejs#63899
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Co-authored-by: Matteo Collina <hello@matteocollina.com>
PR-URL: nodejs#63909
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Mattias Buelens <mattias@buelens.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
The helper no longer treats every raw alias the
same way and unintended values were accepted for
some algorithms.

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: nodejs#63910
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
When sqlite3_open_v2() fails, SQLite still assigns a database handle
in a "sick" state. Such a handle may only be used to retrieve the
error and must then be released with sqlite3_close(). Keeping it in
connection_ meant that after a failed open():

- isOpen incorrectly reported true,
- every method passed the "database is not open" check and called
  SQLite APIs on the sick handle, which is an API misuse,
- registering a user-defined function leaked its user data in builds
  with SQLITE_ENABLE_API_ARMOR, because SQLite rejects the call
  before taking ownership of the user data,
- open() could not be retried since the database appeared open.

Close and reset the connection handle when open() fails at any point
so that the database remains closed and open() can be retried.

Fixes: nodejs#63831
Signed-off-by: Yagiz Nizipli <yagiz@nizipli.com>
PR-URL: nodejs#63854
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com>
The CJS mock.timers.setTime example asserted the timer ran right after
setTime() with no tick() call, which contradicts the documented behavior
and the ESM example above it. The mock.module example called .fn() on an
export named foo. Both threw if run.

Signed-off-by: Emmanuel Yusufu Kimaswa <kimaswaemma36@gmail.com>
PR-URL: nodejs#63656
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Jacob Smith <jacob@frende.me>
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: nodejs#63924
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Add micro-benchmarks that isolate the hot paths targeted by the
JavaScript-to-C++ migration of child_process:

- child-process-spawn-options.js scales the env vars and args that
  ProcessWrap::Spawn must marshal across the JS/C++ boundary.
- child-process-ipc-roundtrip.js measures IPC throughput for both the
  json and advanced serializers across a range of payload sizes.
- child-process-exec-maxbuffer.js measures stdout accumulation and
  maxBuffer handling in execFile().

These establish the baseline that later migration PRs are compared
against. There is no runtime behavior change.

Signed-off-by: Yagiz Nizipli <yagiz@nizipli.com>
PR-URL: nodejs#63929
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: nodejs#63822
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Tim Perry <pimterry@gmail.com>
Keep the initial --inspect-brk pause held until probe breakpoints are
bound and probe mode explicitly releases the target. This prevents the
generic pause handler from resuming user code before probes are ready.

Refs: https://github.com/nodejs/node/actions/runs/26482141780/job/77981519238

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
PR-URL: nodejs#63608
Refs: https://github.com/nodejs/node/actions/runs/26482141780/job/77981519238
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: nodejs#63939
Fixes: nodejs/security-wg#1568
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
The `advanced` IPC serialization codec was implemented in JavaScript
(ChildProcessSerializer / ChildProcessDeserializer in
lib/internal/child_process/serialization.js). It allocated a wrapper
serializer/deserializer per message and crossed the JS/C++ boundary
several times for every message (writeHeader, writeValue, releaseBuffer,
readHeader, readValue and friends).

Move the codec into a native `ipc_serdes` binding that drives the V8
ValueSerializer/ValueDeserializer with a C++ delegate. The wire format
is preserved byte-for-byte: a big-endian uint32 length prefix followed
by the V8 payload, with ArrayBufferViews tagged as host objects so that
Node Buffers round-trip as Buffers rather than plain Uint8Arrays. The
JSON codec is left unchanged.

A cctest (test/cctest/test_node_ipc_serdes.cc) exercises the binding
directly, covering round-trips of primitives, objects, typed arrays and
Buffers (including the Buffer-vs-Uint8Array distinction) and asserting
the big-endian length-prefix framing.

Round-trip throughput
(benchmark/child_process/child-process-ipc-roundtrip):

  payload   before     after      change
  64 B      ~300k/s    ~800k/s    +166%
  1 KiB     ~272k/s    ~616k/s    +126%
  16 KiB    ~91k/s     ~120k/s    +32%
  64 KiB    ~30k/s     ~35k/s     +16%

The gain is largest for small messages, where per-message JavaScript
overhead dominated, and tapers for large messages, where the actual
serialization (already native) dominates.

Signed-off-by: Yagiz Nizipli <yagiz@nizipli.com>
PR-URL: nodejs#63933
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Closes: nodejs#59493
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: nodejs#63942
Fixes: nodejs#59493
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: nodejs#63819
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
This notable includes stream/iter (since they're closely related and
rapidly evolving together) and ngtcp2, nghttp3 & openssl deps.

Based on test-linux.yml, the main differences are simplifications: PRs
only, filtered to specific paths, just one build (ARM only), no unusual
characters test.

Signed-off-by: Tim Perry <pimterry@gmail.com>
PR-URL: nodejs#63875
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
This changes `BignumPointer::GetWord` such that it does not hide errors
from the caller. In the context of RSA keys within X.509 certificates,
we should eventually compute the public exponent correctly regardless of
its size. This patch, however, is designed to be a minimal change that
prevents callers from using erroneous return values of `BN_get_word`.

Signed-off-by: Tobias Nießen <tniessen@tnie.de>
PR-URL: nodejs#63895
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Signed-off-by: Tim Perry <pimterry@gmail.com>
PR-URL: nodejs#62217
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This changes enables compression within OpenSSL *without* enabling
record compression, so this only affects compression of certificates
delivered within the TLS handshake. This certificate compression remains
disabled by default for now, but becomes available via the new
certificateCompression option in TLS context APIs.

Enabling this shrinks handshakes significantly, and also reduces
fingerprintability of Node.js client handshakes, as these are enabled in
all modern browsers by default.

Signed-off-by: Tim Perry <pimterry@gmail.com>
PR-URL: nodejs#62217
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
The `inspector.close()` forcefully terminates all active connections,
allowing the process to exit cleanly, without waiting for the devtool
client to disconnect.

Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
PR-URL: nodejs#63837
Reviewed-By: James M Snell <jasnell@gmail.com>
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: nodejs#64009
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com>
PR-URL: nodejs#63964
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com>
PR-URL: nodejs#63961
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
aduh95 pushed a commit that referenced this pull request Jul 21, 2026
Move KeyObject.prototype.toCryptoKey() onto the base KeyObject
class and dispatch from the cached native key type. Both secret and
asymmetric conversions now pass a KeyObjectHandle through the Web
Crypto import paths.

Expose KeyObjectHandle.prototype.getKeyType() so asymmetric importers
can validate public/private usages without wrapping the handle back
into a KeyObject. Secret importers likewise consume KeyObjectHandle
directly.

Use the shared asymmetric conversion helper to derive public
CryptoKeys for SubtleCrypto.getPublicKey(), avoiding the temporary
PrivateKeyObject/createPublicKey round trip while keeping usage
validation in the import path.

Update getPublicKey and KeyObject.toCryptoKey tests to be driven from
the Web Crypto supported-algorithm registry so new algorithms require
either coverage or an explicit skip.

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #63622
Backport-PR-URL: #64629
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95 pushed a commit that referenced this pull request Jul 21, 2026
PR-URL: #63900
Backport-PR-URL: #64629
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95 pushed a commit that referenced this pull request Jul 21, 2026
Introduce prepareSubtleMethod() and convertSubtleArgument() for the
common SubtleCrypto call prelude. Methods now reuse the same receiver
check, required-argument check, error prefix construction, argument
context selection, and WebIDL conversion path.

Introduce WebCrypto key usage helpers for common usage validation and
key pair usage splitting. Algorithm modules now define their allowed
public, private, and key generation usages once, then call the shared
helpers from generateKey() and importKey() paths.

This removes repeated function-invocation setup in webcrypto.js and
repeated key usage checks across the WebCrypto algorithm modules while
preserving the existing validation behavior.

Mark normalized-algorithm fallback branches as unreachable assertions.

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #63975
Backport-PR-URL: #64629
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95 pushed a commit that referenced this pull request Jul 21, 2026
Add shared bit-length helpers for WebCrypto operations that accept bit
sequences whose length is not byte-aligned.

Use the helpers for cSHAKE output, ECDH-derived bits, HMAC/KMAC key
generation/import/derivation, and KMAC sign/verify output. Preserve the
requested bit length in CryptoKey algorithm metadata while storing and
exporting rounded-up byte material with unused low bits cleared.

Keep byte-multiple validation for algorithms whose specs require it.

Extend the lower-end of KMAC's key length support.

Enable cSHAKE customization and functionName parameters.

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #63988
Backport-PR-URL: #64629
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95 pushed a commit that referenced this pull request Jul 21, 2026
Return false for Ed25519 and Ed448 one-shot verification when the public
key or signature R component is a known low-order point. This keeps key
import behavior unchanged while making WebCrypto verification match WPT
expectations across OpenSSL variants.

Remove the stale WPT expected-failure entry and add focused regression
coverage for both curves.

Closes: #54572

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #64026
Backport-PR-URL: #64629
Fixes: #54572
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95 pushed a commit that referenced this pull request Jul 21, 2026
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #64033
Backport-PR-URL: #64629
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. and removed commit-queue-rebase Add this label to allow the Commit Queue to land a PR in several commits. labels Jul 21, 2026
aduh95 pushed a commit to aduh95/node that referenced this pull request Jul 22, 2026
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: nodejs#63104
Backport-PR-URL: nodejs#64629
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95 pushed a commit to aduh95/node that referenced this pull request Jul 22, 2026
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: nodejs#63134
Backport-PR-URL: nodejs#64629
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95 pushed a commit to aduh95/node that referenced this pull request Jul 22, 2026
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: nodejs#63556
Backport-PR-URL: nodejs#64629
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95 pushed a commit to aduh95/node that referenced this pull request Jul 22, 2026
Move KeyObject.prototype.toCryptoKey() onto the base KeyObject
class and dispatch from the cached native key type. Both secret and
asymmetric conversions now pass a KeyObjectHandle through the Web
Crypto import paths.

Expose KeyObjectHandle.prototype.getKeyType() so asymmetric importers
can validate public/private usages without wrapping the handle back
into a KeyObject. Secret importers likewise consume KeyObjectHandle
directly.

Use the shared asymmetric conversion helper to derive public
CryptoKeys for SubtleCrypto.getPublicKey(), avoiding the temporary
PrivateKeyObject/createPublicKey round trip while keeping usage
validation in the import path.

Update getPublicKey and KeyObject.toCryptoKey tests to be driven from
the Web Crypto supported-algorithm registry so new algorithms require
either coverage or an explicit skip.

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: nodejs#63622
Backport-PR-URL: nodejs#64629
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95 pushed a commit to aduh95/node that referenced this pull request Jul 22, 2026
PR-URL: nodejs#63900
Backport-PR-URL: nodejs#64629
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95 pushed a commit to aduh95/node that referenced this pull request Jul 22, 2026
Introduce prepareSubtleMethod() and convertSubtleArgument() for the
common SubtleCrypto call prelude. Methods now reuse the same receiver
check, required-argument check, error prefix construction, argument
context selection, and WebIDL conversion path.

Introduce WebCrypto key usage helpers for common usage validation and
key pair usage splitting. Algorithm modules now define their allowed
public, private, and key generation usages once, then call the shared
helpers from generateKey() and importKey() paths.

This removes repeated function-invocation setup in webcrypto.js and
repeated key usage checks across the WebCrypto algorithm modules while
preserving the existing validation behavior.

Mark normalized-algorithm fallback branches as unreachable assertions.

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: nodejs#63975
Backport-PR-URL: nodejs#64629
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95 pushed a commit to aduh95/node that referenced this pull request Jul 22, 2026
Add shared bit-length helpers for WebCrypto operations that accept bit
sequences whose length is not byte-aligned.

Use the helpers for cSHAKE output, ECDH-derived bits, HMAC/KMAC key
generation/import/derivation, and KMAC sign/verify output. Preserve the
requested bit length in CryptoKey algorithm metadata while storing and
exporting rounded-up byte material with unused low bits cleared.

Keep byte-multiple validation for algorithms whose specs require it.

Extend the lower-end of KMAC's key length support.

Enable cSHAKE customization and functionName parameters.

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: nodejs#63988
Backport-PR-URL: nodejs#64629
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95 pushed a commit to aduh95/node that referenced this pull request Jul 22, 2026
Return false for Ed25519 and Ed448 one-shot verification when the public
key or signature R component is a known low-order point. This keeps key
import behavior unchanged while making WebCrypto verification match WPT
expectations across OpenSSL variants.

Remove the stale WPT expected-failure entry and add focused regression
coverage for both curves.

Closes: nodejs#54572

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: nodejs#64026
Backport-PR-URL: nodejs#64629
Fixes: nodejs#54572
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95 pushed a commit to aduh95/node that referenced this pull request Jul 22, 2026
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: nodejs#64033
Backport-PR-URL: nodejs#64629
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
@aduh95
aduh95 requested a review from a team as a code owner July 22, 2026 13:20
aduh95 pushed a commit that referenced this pull request Jul 22, 2026
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #63104
Backport-PR-URL: #64629
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95 pushed a commit that referenced this pull request Jul 22, 2026
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #63134
Backport-PR-URL: #64629
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95 pushed a commit that referenced this pull request Jul 22, 2026
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #63556
Backport-PR-URL: #64629
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95 pushed a commit that referenced this pull request Jul 22, 2026
Move KeyObject.prototype.toCryptoKey() onto the base KeyObject
class and dispatch from the cached native key type. Both secret and
asymmetric conversions now pass a KeyObjectHandle through the Web
Crypto import paths.

Expose KeyObjectHandle.prototype.getKeyType() so asymmetric importers
can validate public/private usages without wrapping the handle back
into a KeyObject. Secret importers likewise consume KeyObjectHandle
directly.

Use the shared asymmetric conversion helper to derive public
CryptoKeys for SubtleCrypto.getPublicKey(), avoiding the temporary
PrivateKeyObject/createPublicKey round trip while keeping usage
validation in the import path.

Update getPublicKey and KeyObject.toCryptoKey tests to be driven from
the Web Crypto supported-algorithm registry so new algorithms require
either coverage or an explicit skip.

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #63622
Backport-PR-URL: #64629
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95 pushed a commit that referenced this pull request Jul 22, 2026
PR-URL: #63900
Backport-PR-URL: #64629
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95 pushed a commit that referenced this pull request Jul 22, 2026
Introduce prepareSubtleMethod() and convertSubtleArgument() for the
common SubtleCrypto call prelude. Methods now reuse the same receiver
check, required-argument check, error prefix construction, argument
context selection, and WebIDL conversion path.

Introduce WebCrypto key usage helpers for common usage validation and
key pair usage splitting. Algorithm modules now define their allowed
public, private, and key generation usages once, then call the shared
helpers from generateKey() and importKey() paths.

This removes repeated function-invocation setup in webcrypto.js and
repeated key usage checks across the WebCrypto algorithm modules while
preserving the existing validation behavior.

Mark normalized-algorithm fallback branches as unreachable assertions.

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #63975
Backport-PR-URL: #64629
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95 pushed a commit that referenced this pull request Jul 22, 2026
Add shared bit-length helpers for WebCrypto operations that accept bit
sequences whose length is not byte-aligned.

Use the helpers for cSHAKE output, ECDH-derived bits, HMAC/KMAC key
generation/import/derivation, and KMAC sign/verify output. Preserve the
requested bit length in CryptoKey algorithm metadata while storing and
exporting rounded-up byte material with unused low bits cleared.

Keep byte-multiple validation for algorithms whose specs require it.

Extend the lower-end of KMAC's key length support.

Enable cSHAKE customization and functionName parameters.

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #63988
Backport-PR-URL: #64629
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95 pushed a commit that referenced this pull request Jul 22, 2026
Return false for Ed25519 and Ed448 one-shot verification when the public
key or signature R component is a known low-order point. This keeps key
import behavior unchanged while making WebCrypto verification match WPT
expectations across OpenSSL variants.

Remove the stale WPT expected-failure entry and add focused regression
coverage for both curves.

Closes: #54572

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #64026
Backport-PR-URL: #64629
Fixes: #54572
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
aduh95 pushed a commit that referenced this pull request Jul 22, 2026
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: #64033
Backport-PR-URL: #64629
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. v24.x Issues that can be reproduced on v24.x or PRs targeting the v24.x-staging branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.