Skip to content

Commit 53a7d8e

Browse files
panvaRafaelGSS
authored andcommitted
test,crypto: update WebCryptoAPI WPT
PR-URL: #55512 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 88c7f5b commit 53a7d8e

File tree

5 files changed

+28
-2
lines changed

5 files changed

+28
-2
lines changed

‎test/fixtures/wpt/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Last update:
3232
- user-timing: https://github.com/web-platform-tests/wpt/tree/5ae85bf826/user-timing
3333
- wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/cde25e7e3c/wasm/jsapi
3434
- wasm/webapi: https://github.com/web-platform-tests/wpt/tree/fd1b23eeaa/wasm/webapi
35-
- WebCryptoAPI: https://github.com/web-platform-tests/wpt/tree/bef6fa3566/WebCryptoAPI
35+
- WebCryptoAPI: https://github.com/web-platform-tests/wpt/tree/75db68b054/WebCryptoAPI
3636
- webidl/ecmascript-binding/es-exceptions: https://github.com/web-platform-tests/wpt/tree/a370aad338/webidl/ecmascript-binding/es-exceptions
3737
- webmessaging/broadcastchannel: https://github.com/web-platform-tests/wpt/tree/6495c91853/webmessaging/broadcastchannel
3838
- webstorage: https://github.com/web-platform-tests/wpt/tree/9dafa89214/webstorage

‎test/fixtures/wpt/WebCryptoAPI/derive_bits_keys/derived_bits_length_testcases.js‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,35 @@
11
vartestCases={
22
"HKDF": [
33
{length: 256,expected: algorithms["HKDF"].derivation},
4+
{length: 384,expected: algorithms["HKDF"].derivation384},
5+
{length: 230,expected: undefined},// should throw an exception, not multiple of 8
46
{length: 0,expected: undefined},// explicitly disallowed, so should throw
57
{length: null,expected: undefined},// should throw an exception
68
{length: undefined,expected: undefined},// should throw an exception
79
{length: "omitted",expected: undefined},// default value is null, so should throw
810
],
911
"PBKDF2": [
1012
{length: 256,expected: algorithms["PBKDF2"].derivation},
13+
{length: 384,expected: algorithms["PBKDF2"].derivation384},
14+
{length: 230,expected: undefined},// should throw an exception, not multiple of 8
1115
{length: 0,expected: undefined},// explicitly disallowed, so should throw
1216
{length: null,expected: undefined},// should throw an exception
1317
{length: undefined,expected: undefined},// should throw an exception
1418
{length: "omitted",expected: undefined},// default value is null, so should throw
1519
],
1620
"ECDH": [
1721
{length: 256,expected: algorithms["ECDH"].derivation},
22+
{length: 384,expected: undefined},// should throw an exception, bigger than the output size
23+
{length: 230,expected: algorithms["ECDH"].derivation230},
1824
{length: 0,expected: emptyArray},
1925
{length: null,expected: algorithms["ECDH"].derivation},
2026
{length: undefined,expected: algorithms["ECDH"].derivation},
2127
{length: "omitted",expected: algorithms["ECDH"].derivation},// default value is null
2228
],
2329
"X25519": [
2430
{length: 256,expected: algorithms["X25519"].derivation},
31+
{length: 384,expected: undefined},// should throw an exception, bigger than the output size
32+
{length: 230,expected: algorithms["X25519"].derivation230},
2533
{length: 0,expected: emptyArray},
2634
{length: null,expected: algorithms["X25519"].derivation},
2735
{length: undefined,expected: algorithms["X25519"].derivation},

‎test/fixtures/wpt/WebCryptoAPI/derive_bits_keys/derived_bits_length_vectors.js‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,33 @@ var algorithms ={
99
privateKey: {format: "raw",data: rawKey},
1010
deriveAlg: {name: "HKDF",salt: salt,hash: "SHA-256",info: info},
1111
derivation: newUint8Array([49,183,214,133,48,168,99,231,23,192,129,202,105,23,182,134,80,179,221,154,41,243,6,6,226,202,209,153,190,193,77,19]),
12+
derivation384: newUint8Array([49,183,214,133,48,168,99,231,23,192,129,202,105,23,182,134,80,179,221,154,41,243,6,6,226,202,209,153,190,193,77,19,165,50,181,8,254,59,122,199,25,224,146,248,105,105,75,84]),
13+
derivation230: undefined,
1214
},
1315
"PBKDF2": {
1416
importAlg: {name: "PBKDF2"},
1517
privateKey: {format: "raw",data: rawKey},
1618
deriveAlg: {name: "PBKDF2",salt: salt,hash: "SHA-256",iterations: 100000},
1719
derivation: newUint8Array([17,153,45,139,129,51,17,36,76,84,75,98,41,41,69,226,8,212,3,206,189,107,149,82,161,165,98,6,93,153,88,234]),
20+
derivation384: newUint8Array([17,153,45,139,129,51,17,36,76,84,75,98,41,41,69,226,8,212,3,206,189,107,149,82,161,165,98,6,93,153,88,234,39,104,8,112,222,57,166,47,102,146,195,59,219,239,238,47]),
21+
derivation230: undefined,
1822
},
1923
"ECDH": {
2024
importAlg: {name: "ECDH",namedCurve: "P-256"},
2125
privateKey: {format: "pkcs8",data: newUint8Array([48,129,135,2,1,0,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,4,109,48,107,2,1,1,4,32,15,247,79,232,241,202,175,97,92,206,241,29,217,53,114,87,98,217,216,65,236,186,185,94,170,38,68,123,52,100,245,113,161,68,3,66,0,4,140,96,11,44,102,25,45,97,158,39,210,37,107,59,151,118,178,141,30,5,246,13,234,189,98,174,123,154,211,157,224,217,59,4,102,109,199,119,14,126,207,13,211,203,203,211,110,221,107,94,220,153,81,7,55,161,237,104,46,205,112,244,10,47])},
2226
publicKey: {format: "spki",data: newUint8Array([48,89,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,3,66,0,4,154,116,32,120,126,95,77,105,211,232,34,114,115,1,109,56,224,71,129,133,223,127,238,156,142,103,60,202,211,79,126,128,254,49,141,182,221,107,119,218,99,32,165,246,151,89,9,68,23,177,52,239,138,139,116,193,101,4,57,198,115,0,90,61])},
2327
deriveAlg: {name: "ECDH",public: newUint8Array([])},
2428
derivation: newUint8Array([14,143,60,77,177,178,162,131,115,90,0,220,87,31,26,232,151,28,227,35,250,17,131,137,203,95,65,196,59,61,181,161]),
29+
derivation384: undefined,
30+
derivation230: newUint8Array([14,143,60,77,177,178,162,131,115,90,0,220,87,31,26,232,151,28,227,35,250,17,131,137,203,95,65,196,56]),
2531
},
2632
"X25519": {
2733
importAlg: {name: "X25519"},
2834
privateKey: {format: "pkcs8",data: newUint8Array([48,46,2,1,0,48,5,6,3,43,101,110,4,34,4,32,200,131,142,118,208,87,223,183,216,201,90,105,225,56,22,10,221,99,115,253,113,164,210,118,187,86,227,168,27,100,255,97])},
2935
publicKey: {format: "spki",data: newUint8Array([48,42,48,5,6,3,43,101,110,3,33,0,28,242,177,230,2,46,197,55,55,30,215,245,62,84,250,17,84,216,62,152,235,100,234,81,250,229,179,48,124,254,151,6])},
3036
deriveAlg: {name: "X25519",public: newUint8Array([])},
3137
derivation: newUint8Array([39,104,64,157,250,185,158,194,59,140,137,185,63,245,136,2,149,247,97,118,8,143,137,228,61,254,190,126,161,149,0,8]),
38+
derivation384: undefined,
39+
derivation230: newUint8Array([39,104,64,157,250,185,158,194,59,140,137,185,63,245,136,2,149,247,97,118,8,143,137,228,61,254,190,126,160]),
3240
}
3341
};

‎test/fixtures/wpt/versions.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
"path": "wasm/webapi"
8989
},
9090
"WebCryptoAPI":{
91-
"commit": "bef6fa3566074bdde49e7ccc95ea0d76d08ed6ba",
91+
"commit": "75db68b05454e7f3a81e063373defd094c176a16",
9292
"path": "WebCryptoAPI"
9393
},
9494
"webidl/ecmascript-binding/es-exceptions":{

‎test/wpt/status/WebCryptoAPI.cjs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ module.exports ={
88
'algorithm-discards-context.https.window.js': {
99
'skip': 'Not relevant in Node.js context',
1010
},
11+
'derive_bits_keys/derived_bits_length.https.any.js': {
12+
'fail': {
13+
// See https://github.com/nodejs/node/pull/55296
14+
// The fix is pending a decision whether truncation in ECDH/X* will be removed from the spec entirely
15+
'expected': [
16+
"ECDH derivation with 230 as 'length' parameter",
17+
"X25519 derivation with 230 as 'length' parameter",
18+
],
19+
},
20+
},
1121
'historical.any.js': {
1222
'skip': 'Not relevant in Node.js context',
1323
},

0 commit comments

Comments
(0)