Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f69ed4b

Browse filesBrowse files
panvaaduh95
authored andcommitted
crypto: rename CShakeParams and KmacParams length to outputLength
PR-URL: #61875 Refs: web-platform-tests/wpt#57802 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
1 parent 4f4ff15 commit f69ed4b
Copy full SHA for f69ed4b

14 files changed

+98-90Lines changed: 98 additions & 90 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/webcrypto.md‎

Copy file name to clipboardExpand all lines: doc/api/webcrypto.md
+29-21Lines changed: 29 additions & 21 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1869,19 +1869,27 @@ the message.
18691869
18701870
<!-- YAML
18711871
added: v24.7.0
1872+
changes:
1873+
- version: REPLACEME
1874+
pr-url: https://github.com/nodejs/node/pull/61875
1875+
description: Renamed `cShakeParams.length` to `cShakeParams.outputLength`.
18721876
-->
18731877
1874-
#### `cShakeParams.customization`
1878+
#### `cShakeParams.name`
18751879
18761880
<!-- YAML
18771881
added: v24.7.0
18781882
-->
18791883
1880-
* Type: {ArrayBuffer|TypedArray|DataView|Buffer|undefined}
1884+
* Type: {string} Must be `'cSHAKE128'`[^modern-algos] or `'cSHAKE256'`[^modern-algos]
18811885
1882-
The `customization` member represents the customization string.
1883-
The Node.js Web Crypto API implementation only supports zero-length customization
1884-
which is equivalent to not providing customization at all.
1886+
#### `cShakeParams.outputLength`
1887+
1888+
<!-- YAML
1889+
added: REPLACEME
1890+
-->
1891+
1892+
* Type: {number} represents the requested output length in bits.
18851893
18861894
#### `cShakeParams.functionName`
18871895
@@ -1896,21 +1904,17 @@ functions based on cSHAKE.
18961904
The Node.js Web Crypto API implementation only supports zero-length functionName
18971905
which is equivalent to not providing functionName at all.
18981906
1899-
#### `cShakeParams.length`
1907+
#### `cShakeParams.customization`
19001908
19011909
<!-- YAML
19021910
added: v24.7.0
19031911
-->
19041912
1905-
* Type: {number} represents the requested output length in bits.
1906-
1907-
#### `cShakeParams.name`
1908-
1909-
<!-- YAML
1910-
added: v24.7.0
1911-
-->
1913+
* Type: {ArrayBuffer|TypedArray|DataView|Buffer|undefined}
19121914
1913-
* Type: {string} Must be `'cSHAKE128'`[^modern-algos] or `'cSHAKE256'`[^modern-algos]
1915+
The `customization` member represents the customization string.
1916+
The Node.js Web Crypto API implementation only supports zero-length customization
1917+
which is equivalent to not providing customization at all.
19141918
19151919
### Class: `EcdhKeyDeriveParams`
19161920
@@ -2387,6 +2391,10 @@ added: v24.8.0
23872391
23882392
<!-- YAML
23892393
added: v24.8.0
2394+
changes:
2395+
- version: REPLACEME
2396+
pr-url: https://github.com/nodejs/node/pull/61875
2397+
description: Renamed `kmacParams.length` to `kmacParams.outputLength`.
23902398
-->
23912399
23922400
#### `kmacParams.algorithm`
@@ -2397,25 +2405,25 @@ added: v24.8.0
23972405
23982406
* Type: {string} Must be `'KMAC128'` or `'KMAC256'`.
23992407
2400-
#### `kmacParams.customization`
2408+
#### `kmacParams.outputLength`
24012409
24022410
<!-- YAML
2403-
added: v24.8.0
2411+
added: REPLACEME
24042412
-->
24052413
2406-
* Type: {ArrayBuffer|TypedArray|DataView|Buffer|undefined}
2414+
* Type: {number}
24072415
2408-
The `customization` member represents the optional customization string.
2416+
The length of the output in bytes. This must be a positive integer.
24092417
2410-
#### `kmacParams.length`
2418+
#### `kmacParams.customization`
24112419
24122420
<!-- YAML
24132421
added: v24.8.0
24142422
-->
24152423
2416-
* Type: {number}
2424+
* Type: {ArrayBuffer|TypedArray|DataView|Buffer|undefined}
24172425
2418-
The length of the output in bytes. This must be a positive integer.
2426+
The `customization` member represents the optional customization string.
24192427
24202428
### Class: `Pbkdf2Params`
24212429
Collapse file

‎lib/internal/crypto/hash.js‎

Copy file name to clipboardExpand all lines: lib/internal/crypto/hash.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ async function asyncDigest(algorithm, data) {
223223
kCryptoJobAsync,
224224
normalizeHashName(algorithm.name),
225225
data,
226-
algorithm.length));
226+
algorithm.outputLength));
227227
}
228228

229229
throw lazyDOMException('Unrecognized algorithm name', 'NotSupportedError');
Collapse file

‎lib/internal/crypto/mac.js‎

Copy file name to clipboardExpand all lines: lib/internal/crypto/mac.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ function kmacSignVerify(key, data, algorithm, signature) {
234234
key[kKeyObject][kHandle],
235235
algorithm.name,
236236
algorithm.customization,
237-
algorithm.length / 8,
237+
algorithm.outputLength / 8,
238238
data,
239239
signature));
240240
}
Collapse file

‎lib/internal/crypto/webidl.js‎

Copy file name to clipboardExpand all lines: lib/internal/crypto/webidl.js
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -591,14 +591,14 @@ converters.CShakeParams = createDictionaryConverter(
591591
'CShakeParams', [
592592
...new SafeArrayIterator(dictAlgorithm),
593593
{
594-
key: 'length',
594+
key: 'outputLength',
595595
converter: (V, opts) =>
596596
converters['unsigned long'](V, { ...opts, enforceRange: true }),
597597
validator: (V, opts) => {
598598
// The Web Crypto spec allows for SHAKE output length that are not multiples of
599599
// 8. We don't.
600600
if (V % 8)
601-
throw lazyDOMException('Unsupported CShakeParams length', 'NotSupportedError');
601+
throw lazyDOMException('Unsupported CShakeParams outputLength', 'NotSupportedError');
602602
},
603603
required: true,
604604
},
@@ -881,13 +881,13 @@ converters.KmacParams = createDictionaryConverter(
881881
'KmacParams', [
882882
...new SafeArrayIterator(dictAlgorithm),
883883
{
884-
key: 'length',
884+
key: 'outputLength',
885885
converter: (V, opts) =>
886886
converters['unsigned long'](V, { ...opts, enforceRange: true }),
887887
validator: (V, opts) => {
888888
// The Web Crypto spec allows for KMAC output length that are not multiples of 8. We don't.
889889
if (V % 8)
890-
throw lazyDOMException('Unsupported KmacParams length', 'NotSupportedError');
890+
throw lazyDOMException('Unsupported KmacParams outputLength', 'NotSupportedError');
891891
},
892892
required: true,
893893
},
Collapse file

‎test/fixtures/crypto/kmac.js‎

Copy file name to clipboardExpand all lines: test/fixtures/crypto/kmac.js
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = function() {
1313
]),
1414
data: Buffer.from([0x00, 0x01, 0x02, 0x03]),
1515
customization: undefined,
16-
length: 256,
16+
outputLength: 256,
1717
expected: Buffer.from([
1818
0xe5, 0x78, 0x0b, 0x0d, 0x3e, 0xa6, 0xf7, 0xd3, 0xa4, 0x29, 0xc5, 0x70,
1919
0x6a, 0xa4, 0x3a, 0x00, 0xfa, 0xdb, 0xd7, 0xd4, 0x96, 0x28, 0x83, 0x9e,
@@ -30,7 +30,7 @@ module.exports = function() {
3030
]),
3131
data: Buffer.from([0x00, 0x01, 0x02, 0x03]),
3232
customization: Buffer.from('My Tagged Application'),
33-
length: 256,
33+
outputLength: 256,
3434
expected: Buffer.from([
3535
0x3b, 0x1f, 0xba, 0x96, 0x3c, 0xd8, 0xb0, 0xb5, 0x9e, 0x8c, 0x1a, 0x6d,
3636
0x71, 0x88, 0x8b, 0x71, 0x43, 0x65, 0x1a, 0xf8, 0xba, 0x0a, 0x70, 0x70,
@@ -47,7 +47,7 @@ module.exports = function() {
4747
]),
4848
data: Buffer.from(Array.from({ length: 200 }, (_, i) => i)), // 0x00-0xC7
4949
customization: Buffer.from('My Tagged Application'),
50-
length: 256,
50+
outputLength: 256,
5151
expected: Buffer.from([
5252
0x1f, 0x5b, 0x4e, 0x6c, 0xca, 0x02, 0x20, 0x9e, 0x0d, 0xcb, 0x5c, 0xa6,
5353
0x35, 0xb8, 0x9a, 0x15, 0xe2, 0x71, 0xec, 0xc7, 0x60, 0x07, 0x1d, 0xfd,
@@ -64,7 +64,7 @@ module.exports = function() {
6464
]),
6565
data: Buffer.from([0x00, 0x01, 0x02, 0x03]),
6666
customization: Buffer.from('My Tagged Application'),
67-
length: 512,
67+
outputLength: 512,
6868
expected: Buffer.from([
6969
0x20, 0xc5, 0x70, 0xc3, 0x13, 0x46, 0xf7, 0x03, 0xc9, 0xac, 0x36, 0xc6,
7070
0x1c, 0x03, 0xcb, 0x64, 0xc3, 0x97, 0x0d, 0x0c, 0xfc, 0x78, 0x7e, 0x9b,
@@ -84,7 +84,7 @@ module.exports = function() {
8484
]),
8585
data: Buffer.from(Array.from({ length: 200 }, (_, i) => i)), // 0x00-0xC7
8686
customization: undefined,
87-
length: 512,
87+
outputLength: 512,
8888
expected: Buffer.from([
8989
0x75, 0x35, 0x8c, 0xf3, 0x9e, 0x41, 0x49, 0x4e, 0x94, 0x97, 0x07, 0x92,
9090
0x7c, 0xee, 0x0a, 0xf2, 0x0a, 0x3f, 0xf5, 0x53, 0x90, 0x4c, 0x86, 0xb0,
@@ -104,7 +104,7 @@ module.exports = function() {
104104
]),
105105
data: Buffer.from(Array.from({ length: 200 }, (_, i) => i)), // 0x00-0xC7
106106
customization: Buffer.from('My Tagged Application'),
107-
length: 512,
107+
outputLength: 512,
108108
expected: Buffer.from([
109109
0xb5, 0x86, 0x18, 0xf7, 0x1f, 0x92, 0xe1, 0xd5, 0x6c, 0x1b, 0x8c, 0x55,
110110
0xdd, 0xd7, 0xcd, 0x18, 0x8b, 0x97, 0xb4, 0xca, 0x4d, 0x99, 0x83, 0x1e,
Collapse file

‎test/fixtures/webcrypto/supports-modern-algorithms.mjs‎

Copy file name to clipboardExpand all lines: test/fixtures/webcrypto/supports-modern-algorithms.mjs
+12-12Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ const X25519 = await subtle.generateKey('X25519', false, ['deriveBits', 'deriveK
1717
export const vectors = {
1818
'digest': [
1919
[false, 'cSHAKE128'],
20-
[shake128, { name: 'cSHAKE128', length: 128 }],
21-
[shake128, { name: 'cSHAKE128', length: 128, functionName: Buffer.alloc(0), customization: Buffer.alloc(0) }],
22-
[false, { name: 'cSHAKE128', length: 128, functionName: Buffer.alloc(1) }],
23-
[false, { name: 'cSHAKE128', length: 128, customization: Buffer.alloc(1) }],
24-
[false, { name: 'cSHAKE128', length: 127 }],
20+
[shake128, { name: 'cSHAKE128', outputLength: 128 }],
21+
[shake128, { name: 'cSHAKE128', outputLength: 128, functionName: Buffer.alloc(0), customization: Buffer.alloc(0) }],
22+
[false, { name: 'cSHAKE128', outputLength: 128, functionName: Buffer.alloc(1) }],
23+
[false, { name: 'cSHAKE128', outputLength: 128, customization: Buffer.alloc(1) }],
24+
[false, { name: 'cSHAKE128', outputLength: 127 }],
2525
[false, 'cSHAKE256'],
26-
[shake256, { name: 'cSHAKE256', length: 256 }],
27-
[shake256, { name: 'cSHAKE256', length: 256, functionName: Buffer.alloc(0), customization: Buffer.alloc(0) }],
28-
[false, { name: 'cSHAKE256', length: 256, functionName: Buffer.alloc(1) }],
29-
[false, { name: 'cSHAKE256', length: 256, customization: Buffer.alloc(1) }],
30-
[false, { name: 'cSHAKE256', length: 255 }],
26+
[shake256, { name: 'cSHAKE256', outputLength: 256 }],
27+
[shake256, { name: 'cSHAKE256', outputLength: 256, functionName: Buffer.alloc(0), customization: Buffer.alloc(0) }],
28+
[false, { name: 'cSHAKE256', outputLength: 256, functionName: Buffer.alloc(1) }],
29+
[false, { name: 'cSHAKE256', outputLength: 256, customization: Buffer.alloc(1) }],
30+
[false, { name: 'cSHAKE256', outputLength: 255 }],
3131
],
3232
'sign': [
3333
[pqc, 'ML-DSA-44'],
@@ -44,8 +44,8 @@ export const vectors = {
4444
[false, 'Argon2id'],
4545
[false, 'KMAC128'],
4646
[false, 'KMAC256'],
47-
[kmac, { name: 'KMAC128', length: 256 }],
48-
[kmac, { name: 'KMAC256', length: 256 }],
47+
[kmac, { name: 'KMAC128', outputLength: 256 }],
48+
[kmac, { name: 'KMAC256', outputLength: 256 }],
4949
],
5050
'generateKey': [
5151
[pqc, 'ML-DSA-44'],
Collapse file

‎test/fixtures/wpt/README.md‎

Copy file name to clipboardExpand all lines: test/fixtures/wpt/README.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Last update:
3434
- wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/cde25e7e3c/wasm/jsapi
3535
- wasm/webapi: https://github.com/web-platform-tests/wpt/tree/fd1b23eeaa/wasm/webapi
3636
- web-locks: https://github.com/web-platform-tests/wpt/tree/10a122a6bc/web-locks
37-
- WebCryptoAPI: https://github.com/web-platform-tests/wpt/tree/6a1c545d77/WebCryptoAPI
37+
- WebCryptoAPI: https://github.com/web-platform-tests/wpt/tree/0acea989ac/WebCryptoAPI
3838
- webidl: https://github.com/web-platform-tests/wpt/tree/63ca529a02/webidl
3939
- webidl/ecmascript-binding/es-exceptions: https://github.com/web-platform-tests/wpt/tree/2f96fa1996/webidl/ecmascript-binding/es-exceptions
4040
- webmessaging/broadcastchannel: https://github.com/web-platform-tests/wpt/tree/6495c91853/webmessaging/broadcastchannel
Collapse file

‎test/fixtures/wpt/WebCryptoAPI/digest/cshake.tentative.https.any.js‎

Copy file name to clipboardExpand all lines: test/fixtures/wpt/WebCryptoAPI/digest/cshake.tentative.https.any.js
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ Object.keys(digestedData).forEach(function (alg) {
162162
Object.keys(sourceData).forEach(function (size) {
163163
promise_test(function (test) {
164164
return crypto.subtle
165-
.digest({ name: alg, length: length }, sourceData[size])
165+
.digest({ name: alg, outputLength: length }, sourceData[size])
166166
.then(function (result) {
167167
assert_true(
168168
equalBuffers(result, digestedData[alg][length][size]),
@@ -183,7 +183,7 @@ Object.keys(digestedData).forEach(function (alg) {
183183
buffer[0] = sourceData[size][0];
184184
return alg;
185185
},
186-
length
186+
outputLength: length
187187
}, buffer)
188188
.then(function (result) {
189189
assert_true(
@@ -196,7 +196,7 @@ Object.keys(digestedData).forEach(function (alg) {
196196
promise_test(function (test) {
197197
var buffer = new Uint8Array(sourceData[size]);
198198
var promise = crypto.subtle
199-
.digest({ name: alg, length: length }, buffer)
199+
.digest({ name: alg, outputLength: length }, buffer)
200200
.then(function (result) {
201201
assert_true(
202202
equalBuffers(result, digestedData[alg][length][size]),
@@ -217,7 +217,7 @@ Object.keys(digestedData).forEach(function (alg) {
217217
buffer.buffer.transfer();
218218
return alg;
219219
},
220-
length
220+
outputLength: length
221221
}, buffer)
222222
.then(function (result) {
223223
assert_true(
@@ -230,7 +230,7 @@ Object.keys(digestedData).forEach(function (alg) {
230230
promise_test(function (test) {
231231
var buffer = new Uint8Array(sourceData[size]);
232232
var promise = crypto.subtle
233-
.digest({ name: alg, length: length }, buffer)
233+
.digest({ name: alg, outputLength: length }, buffer)
234234
.then(function (result) {
235235
assert_true(
236236
equalBuffers(result, digestedData[alg][length][size]),

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.