Skip to content

crypto: support non-byte WebCrypto lengths and cSHAKE - #63988

Closed
panva wants to merge 1 commit into
nodejs:mainfrom
panva:webcrypto-non-byte-lengths
Closed

crypto: support non-byte WebCrypto lengths and cSHAKE#63988
panva wants to merge 1 commit into
nodejs:mainfrom
panva:webcrypto-non-byte-lengths

Conversation

@panva

@panvapanva commented Jun 18, 2026

Copy link
Copy Markdown
Member

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.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/crypto

@nodejs-github-botnodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Jun 18, 2026
@panvapanva added crypto Issues and PRs related to the crypto subsystem. webcrypto labels Jun 18, 2026
@panva
panvaforce-pushed the webcrypto-non-byte-lengths branch 3 times, most recently from f27f79a to b9e0073CompareJune 18, 2026 20:25
@panva
panva marked this pull request as draft June 18, 2026 22:02
@panvapanva changed the title crypto: support non-byte WebCrypto lengthscrypto: support non-byte WebCrypto lengths and cSHAKEJun 18, 2026
@panva
panvaforce-pushed the webcrypto-non-byte-lengths branch from b9e0073 to ffa0349CompareJune 18, 2026 22:05
@panva
panva marked this pull request as ready for review June 18, 2026 22:07
Comment threadlib/internal/crypto/util.js Outdated
@nodejs-github-bot

This comment was marked as outdated.

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>
@panva
panvaforce-pushed the webcrypto-non-byte-lengths branch from 86c6e6d to ee1069cCompareJune 19, 2026 09:00
@panvapanva added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jun 19, 2026
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@panvapanva added commit-queue Add this label to land a pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Jun 20, 2026
panva added a commit that referenced this pull request Jun 20, 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
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
@panva

Copy link
Copy Markdown
MemberAuthor

Landed in 8ec37eb

@panvapanva closed this Jun 20, 2026
@panva
panva deleted the webcrypto-non-byte-lengths branch June 20, 2026 16:42
aduh95 pushed a commit that referenced this pull request Jun 20, 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
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
@panvapanva added the backport-open-v24.x Indicate that the PR has an open backport label Jul 20, 2026
panva added a commit to panva/node 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: nodejs#63988
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.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 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 30, 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>
@panvapanva added backported-to-v24.x PRs backported to the v24.x-staging branch. and removed backport-open-v24.x Indicate that the PR has an open backport labels Aug 3, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.backported-to-v24.xPRs backported to the v24.x-staging branch.cryptoIssues and PRs related to the crypto subsystem.lib / srcIssues and PRs related to general changes in the lib or src directory.needs-ciPRs that need a full CI run.webcrypto

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@panva@nodejs-github-bot@jasnell@anonrig