From e645d2de6b55629742f6b88df9b35f2a0f836f1c Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Wed, 18 Feb 2026 12:05:02 +0100 Subject: [PATCH] crypto: rename CShakeParams and KmacParams length to outputLength --- doc/api/webcrypto.md | 50 +++++++++++-------- lib/internal/crypto/hash.js | 2 +- lib/internal/crypto/mac.js | 2 +- lib/internal/crypto/webidl.js | 8 +-- test/fixtures/crypto/kmac.js | 12 ++--- .../webcrypto/supports-modern-algorithms.mjs | 24 ++++----- test/fixtures/wpt/README.md | 2 +- .../digest/cshake.tentative.https.any.js | 10 ++-- .../wpt/WebCryptoAPI/sign_verify/kmac.js | 36 ++++++------- .../WebCryptoAPI/sign_verify/kmac_vectors.js | 12 ++--- test/fixtures/wpt/versions.json | 2 +- test/parallel/test-webcrypto-digest.js | 14 +++--- .../test-webcrypto-sign-verify-kmac.js | 10 ++-- test/parallel/test-webcrypto-sign-verify.js | 4 +- 14 files changed, 98 insertions(+), 90 deletions(-) diff --git a/doc/api/webcrypto.md b/doc/api/webcrypto.md index 56383228cf0a73..6a1a8a43375645 100644 --- a/doc/api/webcrypto.md +++ b/doc/api/webcrypto.md @@ -1873,19 +1873,27 @@ the message. -#### `cShakeParams.customization` +#### `cShakeParams.name` -* Type: {ArrayBuffer|TypedArray|DataView|Buffer|undefined} +* Type: {string} Must be `'cSHAKE128'`[^modern-algos] or `'cSHAKE256'`[^modern-algos] -The `customization` member represents the customization string. -The Node.js Web Crypto API implementation only supports zero-length customization -which is equivalent to not providing customization at all. +#### `cShakeParams.outputLength` + + + +* Type: {number} represents the requested output length in bits. #### `cShakeParams.functionName` @@ -1900,21 +1908,17 @@ functions based on cSHAKE. The Node.js Web Crypto API implementation only supports zero-length functionName which is equivalent to not providing functionName at all. -#### `cShakeParams.length` +#### `cShakeParams.customization` -* Type: {number} represents the requested output length in bits. - -#### `cShakeParams.name` - - +* Type: {ArrayBuffer|TypedArray|DataView|Buffer|undefined} -* Type: {string} Must be `'cSHAKE128'`[^modern-algos] or `'cSHAKE256'`[^modern-algos] +The `customization` member represents the customization string. +The Node.js Web Crypto API implementation only supports zero-length customization +which is equivalent to not providing customization at all. ### Class: `EcdhKeyDeriveParams` @@ -2391,6 +2395,10 @@ added: v24.8.0 #### `kmacParams.algorithm` @@ -2401,25 +2409,25 @@ added: v24.8.0 * Type: {string} Must be `'KMAC128'` or `'KMAC256'`. -#### `kmacParams.customization` +#### `kmacParams.outputLength` -* Type: {ArrayBuffer|TypedArray|DataView|Buffer|undefined} +* Type: {number} -The `customization` member represents the optional customization string. +The length of the output in bytes. This must be a positive integer. -#### `kmacParams.length` +#### `kmacParams.customization` -* Type: {number} +* Type: {ArrayBuffer|TypedArray|DataView|Buffer|undefined} -The length of the output in bytes. This must be a positive integer. +The `customization` member represents the optional customization string. ### Class: `Pbkdf2Params` diff --git a/lib/internal/crypto/hash.js b/lib/internal/crypto/hash.js index 3f34468e55e99f..e549c72fccc4bc 100644 --- a/lib/internal/crypto/hash.js +++ b/lib/internal/crypto/hash.js @@ -223,7 +223,7 @@ async function asyncDigest(algorithm, data) { kCryptoJobAsync, normalizeHashName(algorithm.name), data, - algorithm.length)); + algorithm.outputLength)); } throw lazyDOMException('Unrecognized algorithm name', 'NotSupportedError'); diff --git a/lib/internal/crypto/mac.js b/lib/internal/crypto/mac.js index a31c3ddb0d9484..1ad4e27c6a8d39 100644 --- a/lib/internal/crypto/mac.js +++ b/lib/internal/crypto/mac.js @@ -234,7 +234,7 @@ function kmacSignVerify(key, data, algorithm, signature) { key[kKeyObject][kHandle], algorithm.name, algorithm.customization, - algorithm.length / 8, + algorithm.outputLength / 8, data, signature)); } diff --git a/lib/internal/crypto/webidl.js b/lib/internal/crypto/webidl.js index 4162d84d426f53..2b8ac167bc3627 100644 --- a/lib/internal/crypto/webidl.js +++ b/lib/internal/crypto/webidl.js @@ -591,14 +591,14 @@ converters.CShakeParams = createDictionaryConverter( 'CShakeParams', [ ...new SafeArrayIterator(dictAlgorithm), { - key: 'length', + key: 'outputLength', converter: (V, opts) => converters['unsigned long'](V, { ...opts, enforceRange: true }), validator: (V, opts) => { // The Web Crypto spec allows for SHAKE output length that are not multiples of // 8. We don't. if (V % 8) - throw lazyDOMException('Unsupported CShakeParams length', 'NotSupportedError'); + throw lazyDOMException('Unsupported CShakeParams outputLength', 'NotSupportedError'); }, required: true, }, @@ -881,13 +881,13 @@ converters.KmacParams = createDictionaryConverter( 'KmacParams', [ ...new SafeArrayIterator(dictAlgorithm), { - key: 'length', + key: 'outputLength', converter: (V, opts) => converters['unsigned long'](V, { ...opts, enforceRange: true }), validator: (V, opts) => { // The Web Crypto spec allows for KMAC output length that are not multiples of 8. We don't. if (V % 8) - throw lazyDOMException('Unsupported KmacParams length', 'NotSupportedError'); + throw lazyDOMException('Unsupported KmacParams outputLength', 'NotSupportedError'); }, required: true, }, diff --git a/test/fixtures/crypto/kmac.js b/test/fixtures/crypto/kmac.js index 86dec424bad9b1..cc1870af2bb04f 100644 --- a/test/fixtures/crypto/kmac.js +++ b/test/fixtures/crypto/kmac.js @@ -13,7 +13,7 @@ module.exports = function() { ]), data: Buffer.from([0x00, 0x01, 0x02, 0x03]), customization: undefined, - length: 256, + outputLength: 256, expected: Buffer.from([ 0xe5, 0x78, 0x0b, 0x0d, 0x3e, 0xa6, 0xf7, 0xd3, 0xa4, 0x29, 0xc5, 0x70, 0x6a, 0xa4, 0x3a, 0x00, 0xfa, 0xdb, 0xd7, 0xd4, 0x96, 0x28, 0x83, 0x9e, @@ -30,7 +30,7 @@ module.exports = function() { ]), data: Buffer.from([0x00, 0x01, 0x02, 0x03]), customization: Buffer.from('My Tagged Application'), - length: 256, + outputLength: 256, expected: Buffer.from([ 0x3b, 0x1f, 0xba, 0x96, 0x3c, 0xd8, 0xb0, 0xb5, 0x9e, 0x8c, 0x1a, 0x6d, 0x71, 0x88, 0x8b, 0x71, 0x43, 0x65, 0x1a, 0xf8, 0xba, 0x0a, 0x70, 0x70, @@ -47,7 +47,7 @@ module.exports = function() { ]), data: Buffer.from(Array.from({ length: 200 }, (_, i) => i)), // 0x00-0xC7 customization: Buffer.from('My Tagged Application'), - length: 256, + outputLength: 256, expected: Buffer.from([ 0x1f, 0x5b, 0x4e, 0x6c, 0xca, 0x02, 0x20, 0x9e, 0x0d, 0xcb, 0x5c, 0xa6, 0x35, 0xb8, 0x9a, 0x15, 0xe2, 0x71, 0xec, 0xc7, 0x60, 0x07, 0x1d, 0xfd, @@ -64,7 +64,7 @@ module.exports = function() { ]), data: Buffer.from([0x00, 0x01, 0x02, 0x03]), customization: Buffer.from('My Tagged Application'), - length: 512, + outputLength: 512, expected: Buffer.from([ 0x20, 0xc5, 0x70, 0xc3, 0x13, 0x46, 0xf7, 0x03, 0xc9, 0xac, 0x36, 0xc6, 0x1c, 0x03, 0xcb, 0x64, 0xc3, 0x97, 0x0d, 0x0c, 0xfc, 0x78, 0x7e, 0x9b, @@ -84,7 +84,7 @@ module.exports = function() { ]), data: Buffer.from(Array.from({ length: 200 }, (_, i) => i)), // 0x00-0xC7 customization: undefined, - length: 512, + outputLength: 512, expected: Buffer.from([ 0x75, 0x35, 0x8c, 0xf3, 0x9e, 0x41, 0x49, 0x4e, 0x94, 0x97, 0x07, 0x92, 0x7c, 0xee, 0x0a, 0xf2, 0x0a, 0x3f, 0xf5, 0x53, 0x90, 0x4c, 0x86, 0xb0, @@ -104,7 +104,7 @@ module.exports = function() { ]), data: Buffer.from(Array.from({ length: 200 }, (_, i) => i)), // 0x00-0xC7 customization: Buffer.from('My Tagged Application'), - length: 512, + outputLength: 512, expected: Buffer.from([ 0xb5, 0x86, 0x18, 0xf7, 0x1f, 0x92, 0xe1, 0xd5, 0x6c, 0x1b, 0x8c, 0x55, 0xdd, 0xd7, 0xcd, 0x18, 0x8b, 0x97, 0xb4, 0xca, 0x4d, 0x99, 0x83, 0x1e, diff --git a/test/fixtures/webcrypto/supports-modern-algorithms.mjs b/test/fixtures/webcrypto/supports-modern-algorithms.mjs index 76d5e805cbc0e7..eafb95c559a0f7 100644 --- a/test/fixtures/webcrypto/supports-modern-algorithms.mjs +++ b/test/fixtures/webcrypto/supports-modern-algorithms.mjs @@ -17,17 +17,17 @@ const X25519 = await subtle.generateKey('X25519', false, ['deriveBits', 'deriveK export const vectors = { 'digest': [ [false, 'cSHAKE128'], - [shake128, { name: 'cSHAKE128', length: 128 }], - [shake128, { name: 'cSHAKE128', length: 128, functionName: Buffer.alloc(0), customization: Buffer.alloc(0) }], - [false, { name: 'cSHAKE128', length: 128, functionName: Buffer.alloc(1) }], - [false, { name: 'cSHAKE128', length: 128, customization: Buffer.alloc(1) }], - [false, { name: 'cSHAKE128', length: 127 }], + [shake128, { name: 'cSHAKE128', outputLength: 128 }], + [shake128, { name: 'cSHAKE128', outputLength: 128, functionName: Buffer.alloc(0), customization: Buffer.alloc(0) }], + [false, { name: 'cSHAKE128', outputLength: 128, functionName: Buffer.alloc(1) }], + [false, { name: 'cSHAKE128', outputLength: 128, customization: Buffer.alloc(1) }], + [false, { name: 'cSHAKE128', outputLength: 127 }], [false, 'cSHAKE256'], - [shake256, { name: 'cSHAKE256', length: 256 }], - [shake256, { name: 'cSHAKE256', length: 256, functionName: Buffer.alloc(0), customization: Buffer.alloc(0) }], - [false, { name: 'cSHAKE256', length: 256, functionName: Buffer.alloc(1) }], - [false, { name: 'cSHAKE256', length: 256, customization: Buffer.alloc(1) }], - [false, { name: 'cSHAKE256', length: 255 }], + [shake256, { name: 'cSHAKE256', outputLength: 256 }], + [shake256, { name: 'cSHAKE256', outputLength: 256, functionName: Buffer.alloc(0), customization: Buffer.alloc(0) }], + [false, { name: 'cSHAKE256', outputLength: 256, functionName: Buffer.alloc(1) }], + [false, { name: 'cSHAKE256', outputLength: 256, customization: Buffer.alloc(1) }], + [false, { name: 'cSHAKE256', outputLength: 255 }], ], 'sign': [ [pqc, 'ML-DSA-44'], @@ -44,8 +44,8 @@ export const vectors = { [false, 'Argon2id'], [false, 'KMAC128'], [false, 'KMAC256'], - [kmac, { name: 'KMAC128', length: 256 }], - [kmac, { name: 'KMAC256', length: 256 }], + [kmac, { name: 'KMAC128', outputLength: 256 }], + [kmac, { name: 'KMAC256', outputLength: 256 }], ], 'generateKey': [ [pqc, 'ML-DSA-44'], diff --git a/test/fixtures/wpt/README.md b/test/fixtures/wpt/README.md index 89f0cefdb6363e..cba3d03b9038fd 100644 --- a/test/fixtures/wpt/README.md +++ b/test/fixtures/wpt/README.md @@ -34,7 +34,7 @@ Last update: - wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/cde25e7e3c/wasm/jsapi - wasm/webapi: https://github.com/web-platform-tests/wpt/tree/fd1b23eeaa/wasm/webapi - web-locks: https://github.com/web-platform-tests/wpt/tree/10a122a6bc/web-locks -- WebCryptoAPI: https://github.com/web-platform-tests/wpt/tree/6a1c545d77/WebCryptoAPI +- WebCryptoAPI: https://github.com/web-platform-tests/wpt/tree/0acea989ac/WebCryptoAPI - webidl: https://github.com/web-platform-tests/wpt/tree/63ca529a02/webidl - webidl/ecmascript-binding/es-exceptions: https://github.com/web-platform-tests/wpt/tree/2f96fa1996/webidl/ecmascript-binding/es-exceptions - webmessaging/broadcastchannel: https://github.com/web-platform-tests/wpt/tree/6495c91853/webmessaging/broadcastchannel diff --git a/test/fixtures/wpt/WebCryptoAPI/digest/cshake.tentative.https.any.js b/test/fixtures/wpt/WebCryptoAPI/digest/cshake.tentative.https.any.js index d0c23c09ada4a9..8be50b56097e89 100644 --- a/test/fixtures/wpt/WebCryptoAPI/digest/cshake.tentative.https.any.js +++ b/test/fixtures/wpt/WebCryptoAPI/digest/cshake.tentative.https.any.js @@ -162,7 +162,7 @@ Object.keys(digestedData).forEach(function (alg) { Object.keys(sourceData).forEach(function (size) { promise_test(function (test) { return crypto.subtle - .digest({ name: alg, length: length }, sourceData[size]) + .digest({ name: alg, outputLength: length }, sourceData[size]) .then(function (result) { assert_true( equalBuffers(result, digestedData[alg][length][size]), @@ -183,7 +183,7 @@ Object.keys(digestedData).forEach(function (alg) { buffer[0] = sourceData[size][0]; return alg; }, - length + outputLength: length }, buffer) .then(function (result) { assert_true( @@ -196,7 +196,7 @@ Object.keys(digestedData).forEach(function (alg) { promise_test(function (test) { var buffer = new Uint8Array(sourceData[size]); var promise = crypto.subtle - .digest({ name: alg, length: length }, buffer) + .digest({ name: alg, outputLength: length }, buffer) .then(function (result) { assert_true( equalBuffers(result, digestedData[alg][length][size]), @@ -217,7 +217,7 @@ Object.keys(digestedData).forEach(function (alg) { buffer.buffer.transfer(); return alg; }, - length + outputLength: length }, buffer) .then(function (result) { assert_true( @@ -230,7 +230,7 @@ Object.keys(digestedData).forEach(function (alg) { promise_test(function (test) { var buffer = new Uint8Array(sourceData[size]); var promise = crypto.subtle - .digest({ name: alg, length: length }, buffer) + .digest({ name: alg, outputLength: length }, buffer) .then(function (result) { assert_true( equalBuffers(result, digestedData[alg][length][size]), diff --git a/test/fixtures/wpt/WebCryptoAPI/sign_verify/kmac.js b/test/fixtures/wpt/WebCryptoAPI/sign_verify/kmac.js index f3cc9b4cd1dbfd..b966c12b4ed07c 100644 --- a/test/fixtures/wpt/WebCryptoAPI/sign_verify/kmac.js +++ b/test/fixtures/wpt/WebCryptoAPI/sign_verify/kmac.js @@ -15,7 +15,7 @@ function run_test() { var promise = importVectorKeys(vector, ["verify", "sign"]) .then(function(vector) { promise_test(function(test) { - var algorithmParams = {name: vector.algorithm, length: vector.length}; + var algorithmParams = {name: vector.algorithm, outputLength: vector.outputLength}; if (vector.customization !== undefined) { algorithmParams.customization = vector.customization; } @@ -48,7 +48,7 @@ function run_test() { var signature = copyBuffer(vector.signature); signature[0] = 255 - signature[0]; var algorithmParams = { - length: vector.length, + outputLength: vector.outputLength, get name() { signature[0] = vector.signature[0]; return vector.algorithm; @@ -81,7 +81,7 @@ function run_test() { .then(function(vector) { promise_test(function(test) { var signature = copyBuffer(vector.signature); - var algorithmParams = {name: vector.algorithm, length: vector.length}; + var algorithmParams = {name: vector.algorithm, outputLength: vector.outputLength}; if (vector.customization !== undefined) { algorithmParams.customization = vector.customization; } @@ -115,7 +115,7 @@ function run_test() { signature.buffer.transfer(); return vector.algorithm; }, - length: vector.length + outputLength: vector.outputLength }; if (vector.customization !== undefined) { algorithmParams.customization = vector.customization; @@ -144,7 +144,7 @@ function run_test() { .then(function(vector) { promise_test(function(test) { var signature = copyBuffer(vector.signature); - var algorithmParams = {name: vector.algorithm, length: vector.length}; + var algorithmParams = {name: vector.algorithm, outputLength: vector.outputLength}; if (vector.customization !== undefined) { algorithmParams.customization = vector.customization; } @@ -175,7 +175,7 @@ function run_test() { var plaintext = copyBuffer(vector.plaintext); plaintext[0] = 255 - plaintext[0]; var algorithmParams = { - length: vector.length, + outputLength: vector.outputLength, get name() { plaintext[0] = vector.plaintext[0]; return vector.algorithm; @@ -208,7 +208,7 @@ function run_test() { .then(function(vector) { promise_test(function(test) { var plaintext = copyBuffer(vector.plaintext); - var algorithmParams = {name: vector.algorithm, length: vector.length}; + var algorithmParams = {name: vector.algorithm, outputLength: vector.outputLength}; if (vector.customization !== undefined) { algorithmParams.customization = vector.customization; } @@ -242,7 +242,7 @@ function run_test() { plaintext.buffer.transfer(); return vector.algorithm; }, - length: vector.length + outputLength: vector.outputLength }; if (vector.customization !== undefined) { algorithmParams.customization = vector.customization; @@ -271,7 +271,7 @@ function run_test() { .then(function(vector) { promise_test(function(test) { var plaintext = copyBuffer(vector.plaintext); - var algorithmParams = {name: vector.algorithm, length: vector.length}; + var algorithmParams = {name: vector.algorithm, outputLength: vector.outputLength}; if (vector.customization !== undefined) { algorithmParams.customization = vector.customization; } @@ -301,7 +301,7 @@ function run_test() { var promise = importVectorKeys(vector, ["sign"]) .then(function(vector) { promise_test(function(test) { - var algorithmParams = {name: vector.algorithm, length: vector.length}; + var algorithmParams = {name: vector.algorithm, outputLength: vector.outputLength}; if (vector.customization !== undefined) { algorithmParams.customization = vector.customization; } @@ -326,7 +326,7 @@ function run_test() { var promise = importVectorKeys(vector, ["verify", "sign"]) .then(function(vectors) { promise_test(function(test) { - var algorithmParams = {name: vector.algorithm, length: vector.length}; + var algorithmParams = {name: vector.algorithm, outputLength: vector.outputLength}; if (vector.customization !== undefined) { algorithmParams.customization = vector.customization; } @@ -363,7 +363,7 @@ function run_test() { return importVectorKeys(vector, ["verify", "sign"]) .then(function(vectors) { promise_test(function(test) { - var algorithmParams = {name: vector.algorithm, length: vector.length}; + var algorithmParams = {name: vector.algorithm, outputLength: vector.outputLength}; if (vector.customization !== undefined) { algorithmParams.customization = vector.customization; } @@ -401,7 +401,7 @@ function run_test() { return importVectorKeys(vector, ["verify", "sign"]) .then(function(vector) { promise_test(function(test) { - var algorithmParams = {name: vector.algorithm, length: vector.length}; + var algorithmParams = {name: vector.algorithm, outputLength: vector.outputLength}; if (vector.customization !== undefined) { algorithmParams.customization = vector.customization; } @@ -438,7 +438,7 @@ function run_test() { var plaintext = copyBuffer(vector.plaintext); plaintext[0] = 255 - plaintext[0]; promise_test(function(test) { - var algorithmParams = {name: vector.algorithm, length: vector.length}; + var algorithmParams = {name: vector.algorithm, outputLength: vector.outputLength}; if (vector.customization !== undefined) { algorithmParams.customization = vector.customization; } @@ -470,7 +470,7 @@ function run_test() { var signature = copyBuffer(vector.signature); signature[0] = 255 - signature[0]; promise_test(function(test) { - var algorithmParams = {name: vector.algorithm, length: vector.length}; + var algorithmParams = {name: vector.algorithm, outputLength: vector.outputLength}; if (vector.customization !== undefined) { algorithmParams.customization = vector.customization; } @@ -501,7 +501,7 @@ function run_test() { .then(function(vector) { var signature = vector.signature.slice(1); // Drop first byte promise_test(function(test) { - var algorithmParams = {name: vector.algorithm, length: vector.length}; + var algorithmParams = {name: vector.algorithm, outputLength: vector.outputLength}; if (vector.customization !== undefined) { algorithmParams.customization = vector.customization; } @@ -531,8 +531,8 @@ function run_test() { var promise = importVectorKeys(vector, ["verify", "sign"]) .then(function(vector) { promise_test(function(test) { - var differentLength = vector.length === 256 ? 512 : 256; - var algorithmParams = {name: vector.algorithm, length: differentLength}; + var differentLength = vector.outputLength === 256 ? 512 : 256; + var algorithmParams = {name: vector.algorithm, outputLength: differentLength}; if (vector.customization !== undefined) { algorithmParams.customization = vector.customization; } diff --git a/test/fixtures/wpt/WebCryptoAPI/sign_verify/kmac_vectors.js b/test/fixtures/wpt/WebCryptoAPI/sign_verify/kmac_vectors.js index 39d0efe71ba3e2..6b35cab168c9c6 100644 --- a/test/fixtures/wpt/WebCryptoAPI/sign_verify/kmac_vectors.js +++ b/test/fixtures/wpt/WebCryptoAPI/sign_verify/kmac_vectors.js @@ -6,7 +6,7 @@ function getTestVectors() { // Sample #1 - KMAC128, no customization name: "KMAC128 with no customization", algorithm: "KMAC128", - length: 256, + outputLength: 256, keyBuffer: new Uint8Array([ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, @@ -25,7 +25,7 @@ function getTestVectors() { // Sample #2 - KMAC128, with customization name: "KMAC128 with customization", algorithm: "KMAC128", - length: 256, + outputLength: 256, keyBuffer: new Uint8Array([ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, @@ -47,7 +47,7 @@ function getTestVectors() { // Sample #3 - KMAC128, large data, with customization name: "KMAC128 with large data and customization", algorithm: "KMAC128", - length: 256, + outputLength: 256, keyBuffer: new Uint8Array([ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, @@ -69,7 +69,7 @@ function getTestVectors() { // Sample #4 - KMAC256, with customization, 512-bit output name: "KMAC256 with customization and 512-bit output", algorithm: "KMAC256", - length: 512, + outputLength: 512, keyBuffer: new Uint8Array([ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, @@ -94,7 +94,7 @@ function getTestVectors() { // Sample #5 - KMAC256, large data, no customization, 512-bit output name: "KMAC256 with large data and no customization", algorithm: "KMAC256", - length: 512, + outputLength: 512, keyBuffer: new Uint8Array([ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, @@ -116,7 +116,7 @@ function getTestVectors() { // Sample #6 - KMAC256, large data, with customization, 512-bit output name: "KMAC256 with large data and customization", algorithm: "KMAC256", - length: 512, + outputLength: 512, keyBuffer: new Uint8Array([ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, diff --git a/test/fixtures/wpt/versions.json b/test/fixtures/wpt/versions.json index ba7488a89a20b9..02c16cd1074435 100644 --- a/test/fixtures/wpt/versions.json +++ b/test/fixtures/wpt/versions.json @@ -96,7 +96,7 @@ "path": "web-locks" }, "WebCryptoAPI": { - "commit": "6a1c545d778f115c84a1c27c25484afd442b89d8", + "commit": "0acea989ac21842d6545d16594f1a05491c6076e", "path": "WebCryptoAPI" }, "webidl": { diff --git a/test/parallel/test-webcrypto-digest.js b/test/parallel/test-webcrypto-digest.js index 4d22006937f8cb..4a28d88dcd72c3 100644 --- a/test/parallel/test-webcrypto-digest.js +++ b/test/parallel/test-webcrypto-digest.js @@ -19,8 +19,8 @@ const kTests = [ if (!process.features.openssl_is_boringssl) { kTests.push( - [{ name: 'cSHAKE128', length: 256 }, ['shake128', { outputLength: 256 >> 3 }], 256], - [{ name: 'cSHAKE256', length: 512 }, ['shake256', { outputLength: 512 >> 3 }], 512], + [{ name: 'cSHAKE128', outputLength: 256 }, ['shake128', { outputLength: 256 >> 3 }], 256], + [{ name: 'cSHAKE256', outputLength: 512 }, ['shake256', { outputLength: 512 >> 3 }], 512], ['SHA3-256', ['sha3-256'], 256], ['SHA3-384', ['sha3-384'], 384], ['SHA3-512', ['sha3-512'], 512], @@ -223,10 +223,10 @@ async function testDigest(size, alg) { function applyXOF(name) { if (name.match(/cshake128/i)) { - return { name, length: 256 }; + return { name, outputLength: 256 }; } if (name.match(/cshake256/i)) { - return { name, length: 512 }; + return { name, outputLength: 512 }; } return name; @@ -259,13 +259,13 @@ function applyXOF(name) { if (getHashes().includes('shake128')) { (async () => { assert.deepStrictEqual( - new Uint8Array(await subtle.digest({ name: 'cSHAKE128', length: 0 }, Buffer.alloc(1))), + new Uint8Array(await subtle.digest({ name: 'cSHAKE128', outputLength: 0 }, Buffer.alloc(1))), new Uint8Array(0), ); - await assert.rejects(subtle.digest({ name: 'cSHAKE128', length: 7 }, Buffer.alloc(1)), { + await assert.rejects(subtle.digest({ name: 'cSHAKE128', outputLength: 7 }, Buffer.alloc(1)), { name: 'NotSupportedError', - message: 'Unsupported CShakeParams length', + message: 'Unsupported CShakeParams outputLength', }); })().then(common.mustCall()); } diff --git a/test/parallel/test-webcrypto-sign-verify-kmac.js b/test/parallel/test-webcrypto-sign-verify-kmac.js index c30196a94d9fb6..d41095e0893d97 100644 --- a/test/parallel/test-webcrypto-sign-verify-kmac.js +++ b/test/parallel/test-webcrypto-sign-verify-kmac.js @@ -19,7 +19,7 @@ async function testVerify({ algorithm, key, data, customization, - length, + outputLength, expected }) { const [ verifyKey, @@ -46,7 +46,7 @@ async function testVerify({ algorithm, const signParams = { name: algorithm, - length, + outputLength, customization, }; @@ -112,7 +112,7 @@ async function testVerify({ algorithm, { assert(!(await subtle.verify({ ...signParams, - length: length === 256 ? 512 : 256, + outputLength: outputLength === 256 ? 512 : 256, }, verifyKey, expected, data))); } } @@ -121,7 +121,7 @@ async function testSign({ algorithm, key, data, customization, - length, + outputLength, expected }) { const [ signKey, @@ -148,7 +148,7 @@ async function testSign({ algorithm, const signParams = { name: algorithm, - length, + outputLength, customization, }; diff --git a/test/parallel/test-webcrypto-sign-verify.js b/test/parallel/test-webcrypto-sign-verify.js index 8b034e005b29a4..26e66d9aa0fa8b 100644 --- a/test/parallel/test-webcrypto-sign-verify.js +++ b/test/parallel/test-webcrypto-sign-verify.js @@ -118,12 +118,12 @@ if (hasOpenSSL(3)) { const signature = await subtle.sign({ name, - length: 256, + outputLength: 256, }, key, ec.encode(data)); assert(await subtle.verify({ name, - length: 256, + outputLength: 256, }, key, signature, ec.encode(data))); }