@@ -11,19 +11,19 @@ before it's acceptable to upstream, as this patch comments out a couple
1111of tests that upstream probably cares about.
1212
1313diff --git a/test/common/index.js b/test/common/index.js
14- index d1eaf6e69f603b0a7037e44be6ef185283972090..e3f26d32dbad2e4ccb47dea028dbf1a855525cfb 100644
14+ index 92c7294e6f6298f511b5a289e1e0e3a4be68cc77..63a350c5ed912a785b042a238c064c98ed423af4 100644
1515--- a/test/common/index.js
1616+++ b/test/common/index.js
17- @@ -65 ,6 +65 ,8 @@ const opensslVersionNumber = (major = 0, minor = 0, patch = 0) => {
18- return (major << 28) | (minor << 20) | (patch << 4);
19- } ;
17+ @@ -56 ,6 +56 ,8 @@ const hasCrypto = Boolean(process.versions.openssl) &&
18+
19+ const hasQuic = hasCrypto && !!process.config.variables.openssl_quic ;
2020
2121+ const openSSLIsBoringSSL = process.versions.openssl === '0.0.0';
2222+
23- let OPENSSL_VERSION_NUMBER;
24- const hasOpenSSL = (major = 0, minor = 0, patch = 0) => {
25- if (!hasCrypto) return false ;
26- @@ -1008 ,6 +1010 ,7 @@ const common = {
23+ function parseTestFlags(filename = process.argv[1]) {
24+ // The copyright notice is relatively big and the flags could come afterwards.
25+ const bytesToRead = 1500 ;
26+ @@ -889 ,6 +891 ,7 @@ const common = {
2727 mustNotMutateObjectDeep,
2828 mustSucceed,
2929 nodeProcessAborted,
@@ -139,12 +139,12 @@ index 476ca64b4425b5b8b0fa2dc8352ee6f03d563813..2250a8f24a875d6af198426891870b45
139139 }
140140 }
141141diff --git a/test/parallel/test-crypto-dh.js b/test/parallel/test-crypto-dh.js
142- index 9ebe14011eed223994e0901bc22dcc582b4b0739..e78f90eb76380916ce7098fb517c83a954edb053 100644
142+ index d7ffbe5eca92734aa2380f482c7f9bfe7e2a36c7..d8e09f4b2186c2a0688f6c08943b3cd7b522632c 100644
143143--- a/test/parallel/test-crypto-dh.js
144144+++ b/test/parallel/test-crypto-dh.js
145- @@ -55 ,18 +55 ,17 @@ const crypto = require('crypto');
145+ @@ -60 ,18 +60 ,17 @@ const {
146146 let wrongBlockLength;
147- if (common. hasOpenSSL3) {
147+ if (hasOpenSSL3) {
148148 wrongBlockLength = {
149149- message: 'error:1C80006B:Provider routines::wrong final block length',
150150- code: 'ERR_OSSL_WRONG_FINAL_BLOCK_LENGTH',
@@ -169,9 +169,9 @@ index 9ebe14011eed223994e0901bc22dcc582b4b0739..e78f90eb76380916ce7098fb517c83a9
169169 };
170170 }
171171
172- @@ -93,17 +92,23 @@ const crypto = require('crypto');
172+ @@ -98,15 +97,21 @@ const {
173173 dh3.computeSecret('');
174- }, { message: common. hasOpenSSL3 && !hasOpenSSL3WithNewErrorMessage ?
174+ }, { message: hasOpenSSL3 && !hasOpenSSL3WithNewErrorMessage ?
175175 'Unspecified validation error' :
176176- 'Supplied key is too small' });
177177+ 'Supplied key is invalid' });
@@ -182,20 +182,18 @@ index 9ebe14011eed223994e0901bc22dcc582b4b0739..e78f90eb76380916ce7098fb517c83a9
182182 {
183183 const g = 0;
184184- crypto.createDiffieHellman('abcdef', g);
185+ - crypto.createDiffieHellman('abcdef', 'hex', g);
185186+ assert.throws(() => crypto.createDiffieHellman('abcdef', g), {
186187+ code: /ERR_CRYPTO_OPERATION_FAILED/,
187188+ name: 'Error'
188189+ });
189- crypto.createDiffieHellman('abcdef', 'hex', g);
190- }
191-
192- {
193- - crypto.createDiffieHellman('abcdef', Buffer.from([2])); // OK
194190+ assert.throws(() => crypto.createDiffieHellman('abcdef', Buffer.from([2])), {
195191+ code: /ERR_CRYPTO_OPERATION_FAILED/,
196192+ name: 'Error'
197193+ });
198194 }
195+
196+ {
199197diff --git a/test/parallel/test-crypto-getcipherinfo.js b/test/parallel/test-crypto-getcipherinfo.js
200198index 64b79fc36ccf4d38f763fcd8c1930473c82cefd7..1c6717ebd46497384b9b13174b65894ca89e7f2d 100644
201199--- a/test/parallel/test-crypto-getcipherinfo.js
@@ -237,38 +235,32 @@ index d22281abbd5c3cab3aaa3ac494301fa6b4a8a968..5f0c6a4aed2e868a1a1049212edf2187
237235 s.pipe(h).on('data', common.mustCall(function(c) {
238236 assert.strictEqual(c, expect);
239237diff --git a/test/parallel/test-crypto-hash.js b/test/parallel/test-crypto-hash.js
240- index 83218c105a4596e0ae0381136f176bb8d759899e..afb3c8c592d2a8e2a053fd44f455af06c592a85e 100644
238+ index 61145aee0727fbe0b9781acdb3eeb641e7010729..fd7d4bd7d3f86caa30ffd03ea880eeac023bbcbb 100644
241239--- a/test/parallel/test-crypto-hash.js
242240+++ b/test/parallel/test-crypto-hash.js
243- @@ -182,6 +182,7 @@ assert.throws(
241+ @@ -183,7 +183,7 @@ assert.throws(
242+ }
244243
245244 // Test XOF hash functions and the outputLength option.
246- {
247- + /*
248- // Default outputLengths.
249- assert.strictEqual(crypto.createHash('shake128').digest('hex'),
250- '7f9c2ba4e88f827d616045507605853e');
251- @@ -236,6 +237,7 @@ assert.throws(
252- assert.strictEqual(superLongHash.length, 2 * 1024 * 1024);
253- assert.ok(superLongHash.endsWith('193414035ddba77bf7bba97981e656ec'));
254- assert.ok(superLongHash.startsWith('a2a28dbc49cfd6e5d6ceea3d03e77748'));
255- + */
256-
257- // Non-XOF hash functions should accept valid outputLength options as well.
258- assert.strictEqual(crypto.createHash('sha224', { outputLength: 28 })
245+ - {
246+ + if (!common.openSSLIsBoringSSL) {
247+ // Default outputLengths. Since OpenSSL 3.4 an outputLength is mandatory
248+ if (!hasOpenSSL(3, 4)) {
249+ assert.strictEqual(crypto.createHash('shake128').digest('hex'),
250+
259251diff --git a/test/parallel/test-crypto-hkdf.js b/test/parallel/test-crypto-hkdf.js
260- index ff3abdf291efcd076b36e755de4147b0aad0b345..d29854cf0c0ce89f84c912def672e7c4e11427a3 100644
252+ index 3f7e61e9b2ebc0ca7c367d7c229afe9ab87762b8..36bd78105d153b75b42e4736f11d80a257916607 100644
261253--- a/test/parallel/test-crypto-hkdf.js
262254+++ b/test/parallel/test-crypto-hkdf.js
263- @@ -124,8 +124,6 @@ const algorithms = [
255+ @@ -125,7 +125,7 @@ const algorithms = [
264256 ['sha256', '', 'salt', '', 10],
265257 ['sha512', 'secret', 'salt', '', 15],
266258 ];
267- - if (!common.hasOpenSSL3)
268- - algorithms.push(['whirlpool', 'secret', '', 'info', 20]);
259+ - if (!hasOpenSSL3)
260+ + if (!hasOpenSSL3 && !common.openSSLIsBoringSSL)
261+ algorithms.push(['whirlpool', 'secret', '', 'info', 20]);
269262
270263 algorithms.forEach(([ hash, secret, salt, info, length ]) => {
271- {
272264diff --git a/test/parallel/test-crypto-padding.js b/test/parallel/test-crypto-padding.js
273265index f1f14b472997e76bb4100edb1c6cf4fc24d1074d..5057e3f9bc5bb78aceffa5e79530f8ceed84e6f7 100644
274266--- a/test/parallel/test-crypto-padding.js
@@ -302,10 +294,10 @@ index f1f14b472997e76bb4100edb1c6cf4fc24d1074d..5057e3f9bc5bb78aceffa5e79530f8ce
302294
303295 // No-pad encrypted string should return the same:
304296diff --git a/test/parallel/test-crypto-rsa-dsa.js b/test/parallel/test-crypto-rsa-dsa.js
305- index 5f4fafdfffbf726b7cb39c472baa3df25c9794cf..d52376da2cddd90adcdf8a9b7dcd03e348d9f2b4 100644
297+ index dcd5045daaf58c60e27c1e2f7941033302241339..6ac75565792b92a97c622baba73f821d754b8d01 100644
306298--- a/test/parallel/test-crypto-rsa-dsa.js
307299+++ b/test/parallel/test-crypto-rsa-dsa.js
308- @@ -28 ,12 +28 ,11 @@ const dsaPkcs8KeyPem = fixtures.readKey('dsa_private_pkcs8.pem');
300+ @@ -29 ,12 +29 ,11 @@ const dsaPkcs8KeyPem = fixtures.readKey('dsa_private_pkcs8.pem');
309301 const ec = new TextEncoder();
310302
311303 const openssl1DecryptError = {
@@ -322,34 +314,25 @@ index 5f4fafdfffbf726b7cb39c472baa3df25c9794cf..d52376da2cddd90adcdf8a9b7dcd03e3
322314+ library: /digital envelope routines|Cipher functions/,
323315 };
324316
325- const decryptError = common. hasOpenSSL3 ?
326- @@ -222 ,7 +221,8 @@ function test_rsa(padding, encryptOaepHash, decryptOaepHash) {
317+ const decryptError = hasOpenSSL3 ?
318+ @@ -223 ,7 +222,7 @@ function test_rsa(padding, encryptOaepHash, decryptOaepHash) {
327319 }, bufferToEncrypt);
328320
329321
330322- if (padding === constants.RSA_PKCS1_PADDING) {
331- + // BoringSSL does not support RSA_PKCS1_PADDING.
332- + if (false) {
323+ + if (!common.openSSLIsBoringSSL) {
333324 if (!process.config.variables.node_shared_openssl) {
334325 assert.throws(() => {
335326 crypto.privateDecrypt({
336- @@ -466,10 +466,10 @@ assert.throws(() => {
337- assert.strictEqual(verify2.verify(publicKey, signature, 'hex'), true);
338- }
339-
340- -
327+ @@ -471,7 +470,7 @@ assert.throws(() => {
341328 //
342329 // Test DSA signing and verification
343330 //
331+ - {
344332+ if (!common.openSSLIsBoringSSL) {
345- {
346333 const input = 'I AM THE WALRUS';
347334
348- @@ -541,3 +541,4 @@ const input = 'I AM THE WALRUS';
349-
350- assert.strictEqual(verify.verify(dsaPubPem, signature, 'hex'), true);
351- }
352- + }
335+ // DSA signatures vary across runs so there is no static string to verify
353336diff --git a/test/parallel/test-crypto-scrypt.js b/test/parallel/test-crypto-scrypt.js
354337index 338a19b0e88ad6f08d2f6b6a5d38b9980996ce11..a4ee215575d072450ba66c558ddca88bfb23d85f 100644
355338--- a/test/parallel/test-crypto-scrypt.js
@@ -364,10 +347,10 @@ index 338a19b0e88ad6f08d2f6b6a5d38b9980996ce11..a4ee215575d072450ba66c558ddca88b
364347 };
365348 assert.throws(() => crypto.scrypt('pass', 'salt', 1, options, () => {}),
366349diff --git a/test/parallel/test-crypto-sign-verify.js b/test/parallel/test-crypto-sign-verify.js
367- index 8a263ec3350f5540591ac02e70fa2f552b9ac477..dcc4c2ec816d28f1b27df1c358cfce66f1a3a03b 100644
350+ index 0589d60736e377f24dc8550f87a6b7624173fc44..daa6a3d6f62ecfcd4580b3eb54b6f6bb916e93ad 100644
368351--- a/test/parallel/test-crypto-sign-verify.js
369352+++ b/test/parallel/test-crypto-sign-verify.js
370- @@ -29 ,7 +29 ,7 @@ const keySize = 2048;
353+ @@ -33 ,7 +33 ,7 @@ const keySize = 2048;
371354 }
372355
373356 // Test handling of exceptional conditions
@@ -376,25 +359,25 @@ index 8a263ec3350f5540591ac02e70fa2f552b9ac477..dcc4c2ec816d28f1b27df1c358cfce66
376359 const library = {
377360 configurable: true,
378361 set() {
379- @@ -341 ,15 +341,17 @@ assert.throws(
362+ @@ -345 ,15 +345,15 @@ assert.throws(
380363 padding: crypto.constants.RSA_PKCS1_OAEP_PADDING
381364 });
382- }, common. hasOpenSSL3 ? {
365+ }, hasOpenSSL3 ? {
383366- code: 'ERR_OSSL_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE',
384367- message: /illegal or unsupported padding mode/,
385368+ code: /^ERR_OSSL_(RSA|EVP)_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE$/,
386369+ message: /illegal or unsupported padding mode|ILLEGAL_OR_UNSUPPORTED_PADDING_MODE/,
387370 } : {
388371- code: 'ERR_OSSL_RSA_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE',
389372- message: /illegal or unsupported padding mode/,
373+ - opensslErrorStack: [
390374+ code: /^ERR_OSSL_(RSA|EVP)_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE$/,
391375+ message: /illegal or unsupported padding mode|ILLEGAL_OR_UNSUPPORTED_PADDING_MODE/,
392- + /*
393- opensslErrorStack: [
376+ + /*opensslErrorStack: [
394377 'error:06089093:digital envelope routines:EVP_PKEY_CTX_ctrl:' +
395378 'command not supported',
396- ],
397- + */
379+ - ],
380+ + ], */
398381 });
399382 }
400383
0 commit comments