@@ -187,7 +187,6 @@ const kSupportedAlgorithms = {
187
187
'AES-CTR' : 'AesKeyGenParams' ,
188
188
'AES-CBC' : 'AesKeyGenParams' ,
189
189
'AES-GCM' : 'AesKeyGenParams' ,
190
- 'AES-KW' : 'AesKeyGenParams' ,
191
190
'HMAC' : 'HmacKeyGenParams' ,
192
191
'Ed25519' : null ,
193
192
'X25519' : null ,
@@ -202,7 +201,6 @@ const kSupportedAlgorithms = {
202
201
'AES-CTR' : null ,
203
202
'AES-CBC' : null ,
204
203
'AES-GCM' : null ,
205
- 'AES-KW' : null ,
206
204
'Ed25519' : null ,
207
205
'X25519' : null ,
208
206
} ,
@@ -232,7 +230,6 @@ const kSupportedAlgorithms = {
232
230
'AES-CTR' : null ,
233
231
'AES-CBC' : null ,
234
232
'AES-GCM' : null ,
235
- 'AES-KW' : null ,
236
233
'Ed25519' : null ,
237
234
'X25519' : null ,
238
235
} ,
@@ -258,48 +255,69 @@ const kSupportedAlgorithms = {
258
255
'AES-CBC' : 'AesDerivedKeyParams' ,
259
256
'AES-CTR' : 'AesDerivedKeyParams' ,
260
257
'AES-GCM' : 'AesDerivedKeyParams' ,
261
- 'AES-KW' : 'AesDerivedKeyParams' ,
262
258
'HMAC' : 'HmacImportParams' ,
263
259
'HKDF' : null ,
264
260
'PBKDF2' : null ,
265
261
} ,
266
- 'wrapKey' : {
267
- 'AES-KW' : null ,
268
- } ,
269
- 'unwrapKey' : {
270
- 'AES-KW' : null ,
271
- } ,
262
+ 'wrapKey' : { } ,
263
+ 'unwrapKey' : { } ,
272
264
} ;
273
265
274
- const experimentalAlgorithms = ObjectEntries ( {
275
- 'X448' : {
276
- generateKey : null ,
277
- importKey : null ,
278
- deriveBits : 'EcdhKeyDeriveParams' ,
279
- exportKey : null ,
280
- } ,
281
- 'Ed448' : {
282
- generateKey : null ,
283
- sign : 'Ed448Params' ,
284
- verify : 'Ed448Params' ,
285
- importKey : null ,
286
- exportKey : null ,
287
- } ,
288
- 'cSHAKE128' : { digest : 'CShakeParams' } ,
289
- 'cSHAKE256' : { digest : 'CShakeParams' } ,
290
- 'SHA3-256' : { digest : null } ,
291
- 'SHA3-384' : { digest : null } ,
292
- 'SHA3-512' : { digest : null } ,
293
- 'ChaCha20-Poly1305' : {
294
- 'encrypt' : 'AeadParams' ,
295
- 'decrypt' : 'AeadParams' ,
296
- 'generateKey' : null ,
297
- 'importKey' : null ,
266
+ const conditionalAlgorithms = ObjectEntries ( {
267
+ 'AES-KW' : [ {
268
+ 'generateKey' : 'AesKeyGenParams' ,
298
269
'exportKey' : null ,
299
- 'get key length' : null ,
300
- } ,
270
+ 'importKey' : null ,
271
+ 'get key length' : 'AesDerivedKeyParams' ,
272
+ 'wrapKey' : null ,
273
+ 'unwrapKey' : null ,
274
+ } , ! process . features . openssl_is_boringssl ] ,
301
275
} ) ;
302
276
277
+ for ( let i = 0 ; i < conditionalAlgorithms . length ; i ++ ) {
278
+ if ( conditionalAlgorithms [ i ] [ 1 ] [ 1 ] ) {
279
+ const name = conditionalAlgorithms [ i ] [ 0 ] ;
280
+ const ops = ObjectEntries ( conditionalAlgorithms [ i ] [ 1 ] [ 0 ] ) ;
281
+ for ( let j = 0 ; j < ops . length ; j ++ ) {
282
+ const { 0 : op , 1 : dict } = ops [ j ] ;
283
+ kSupportedAlgorithms [ op ] [ name ] = dict ;
284
+ }
285
+ }
286
+ }
287
+
288
+ const experimentalAlgorithms = ObjectEntries ( { } ) ;
289
+
290
+ if ( ! process . features . openssl_is_boringssl ) {
291
+ ArrayPrototypePush ( experimentalAlgorithms ,
292
+ [ 'Ed448' , {
293
+ generateKey : null ,
294
+ sign : 'Ed448Params' ,
295
+ verify : 'Ed448Params' ,
296
+ importKey : null ,
297
+ exportKey : null ,
298
+ } ] ,
299
+ [ 'X448' , {
300
+ generateKey : null ,
301
+ importKey : null ,
302
+ deriveBits : 'EcdhKeyDeriveParams' ,
303
+ exportKey : null ,
304
+ } ] ,
305
+ [ 'cSHAKE128' , { digest : 'CShakeParams' } ] ,
306
+ [ 'cSHAKE256' , { digest : 'CShakeParams' } ] ,
307
+ [ 'ChaCha20-Poly1305' , {
308
+ 'encrypt' : 'AeadParams' ,
309
+ 'decrypt' : 'AeadParams' ,
310
+ 'generateKey' : null ,
311
+ 'importKey' : null ,
312
+ 'exportKey' : null ,
313
+ 'get key length' : null ,
314
+ } ] ,
315
+ [ 'SHA3-256' , { digest : null } ] ,
316
+ [ 'SHA3-384' , { digest : null } ] ,
317
+ [ 'SHA3-512' , { digest : null } ] ,
318
+ ) ;
319
+ }
320
+
303
321
for ( const { 0 : algorithm , 1 : nid } of [
304
322
[ 'ML-DSA-44' , EVP_PKEY_ML_DSA_44 ] ,
305
323
[ 'ML-DSA-65' , EVP_PKEY_ML_DSA_65 ] ,
0 commit comments