| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -88,18 +88,21 @@ test('rsa_public.pem', 'rsa_private.pem', 'sha256', false, | |||
| 88 | 88 | ||
| 89 | 89 | // ED25519 | |
| 90 | 90 | test('ed25519_public.pem', 'ed25519_private.pem', undefined, true); | |
| 91 | - // ED448 | ||
| 92 | - test('ed448_public.pem', 'ed448_private.pem', undefined, true); | ||
| 93 | 91 | ||
| 94 | - // ECDSA w/ der signature encoding | ||
| 95 | - test('ec_secp256k1_public.pem', 'ec_secp256k1_private.pem', 'sha384', | ||
| 96 | - false); | ||
| 97 | - test('ec_secp256k1_public.pem', 'ec_secp256k1_private.pem', 'sha384', | ||
| 98 | - false, { dsaEncoding: 'der' }); | ||
| 92 | + if (!process.features.openssl_is_boringssl) { | ||
| 93 | + // ED448 | ||
| 94 | + test('ed448_public.pem', 'ed448_private.pem', undefined, true); | ||
| 99 | 95 | ||
| 100 | - // ECDSA w/ ieee-p1363 signature encoding | ||
| 101 | - test('ec_secp256k1_public.pem', 'ec_secp256k1_private.pem', 'sha384', false, | ||
| 102 | - { dsaEncoding: 'ieee-p1363' }); | ||
| 96 | + // ECDSA w/ der signature encoding | ||
| 97 | + test('ec_secp256k1_public.pem', 'ec_secp256k1_private.pem', 'sha384', | ||
| 98 | + false); | ||
| 99 | + test('ec_secp256k1_public.pem', 'ec_secp256k1_private.pem', 'sha384', | ||
| 100 | + false, { dsaEncoding: 'der' }); | ||
| 101 | + | ||
| 102 | + // ECDSA w/ ieee-p1363 signature encoding | ||
| 103 | + test('ec_secp256k1_public.pem', 'ec_secp256k1_private.pem', 'sha384', false, | ||
| 104 | + { dsaEncoding: 'ieee-p1363' }); | ||
| 105 | + } | ||
| 103 | 106 | ||
| 104 | 107 | // DSA w/ der signature encoding | |
| 105 | 108 | test('dsa_public.pem', 'dsa_private.pem', 'sha256', | |
@@ -150,7 +153,10 @@ MCowBQYDK2VuAyEA6pwGRbadNQAI/tYN8+/p/0/hbsdHfOEGr1ADiLVk/Gc= | |||
| 150 | 153 | const data = crypto.randomBytes(32); | |
| 151 | 154 | const signature = crypto.randomBytes(16); | |
| 152 | 155 | ||
| 153 | - const expected = hasOpenSSL3 ? /operation not supported for this keytype/ : /no default digest/; | ||
| 156 | + let expected = /no default digest/; | ||
| 157 | + if (hasOpenSSL3 || process.features.openssl_is_boringssl) { | ||
| 158 | + expected = /operation[\s_]not[\s_]supported[\s_]for[\s_]this[\s_]keytype/i; | ||
| 159 | + } | ||
| 154 | 160 | ||
| 155 | 161 | crypto.verify(undefined, data, untrustedKey, signature, common.mustCall((err) => { | |
| 156 | 162 | assert.ok(err); | |
@@ -164,6 +170,6 @@ MCowBQYDK2VuAyEA6pwGRbadNQAI/tYN8+/p/0/hbsdHfOEGr1ADiLVk/Gc= | |||
| 164 | 170 | }); | |
| 165 | 171 | crypto.sign('sha512', 'message', privateKey, common.mustCall((err) => { | |
| 166 | 172 | assert.ok(err); | |
| 167 | - assert.match(err.message, /digest too big for rsa key/); | ||
| 173 | + assert.match(err.message, /digest[\s_]too[\s_]big[\s_]for[\s_]rsa[\s_]key/i); | ||
| 168 | 174 | })); | |
| 169 | 175 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -41,7 +41,8 @@ function copyArrayBuffer(buf) { | |||
| 41 | 41 | ||
| 42 | 42 | function checkMethods(certificate) { | |
| 43 | 43 | ||
| 44 | - assert.strictEqual(certificate.verifySpkac(spkacValid), true); | ||
| 44 | + if (!process.features.openssl_is_boringssl) | ||
| 45 | + assert.strictEqual(certificate.verifySpkac(spkacValid), true); | ||
| 45 | 46 | assert.strictEqual(certificate.verifySpkac(spkacFail), false); | |
| 46 | 47 | ||
| 47 | 48 | assert.strictEqual( | |
@@ -56,10 +57,12 @@ function checkMethods(certificate) { | |||
| 56 | 57 | ); | |
| 57 | 58 | assert.strictEqual(certificate.exportChallenge(spkacFail), ''); | |
| 58 | 59 | ||
| 59 | - const ab = copyArrayBuffer(spkacValid); | ||
| 60 | - assert.strictEqual(certificate.verifySpkac(ab), true); | ||
| 61 | - assert.strictEqual(certificate.verifySpkac(new Uint8Array(ab)), true); | ||
| 62 | - assert.strictEqual(certificate.verifySpkac(new DataView(ab)), true); | ||
| 60 | + if (!process.features.openssl_is_boringssl) { | ||
| 61 | + const ab = copyArrayBuffer(spkacValid); | ||
| 62 | + assert.strictEqual(certificate.verifySpkac(ab), true); | ||
| 63 | + assert.strictEqual(certificate.verifySpkac(new Uint8Array(ab)), true); | ||
| 64 | + assert.strictEqual(certificate.verifySpkac(new DataView(ab)), true); | ||
| 65 | + } | ||
| 63 | 66 | } | |
| 64 | 67 | ||
| 65 | 68 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -35,7 +35,7 @@ for (const bits of [-1, 0, 1]) { | |||
| 35 | 35 | assert.throws(() => crypto.createDiffieHellman(bits), { | |
| 36 | 36 | code: 'ERR_OSSL_BN_BITS_TOO_SMALL', | |
| 37 | 37 | name: 'Error', | |
| 38 | - message: /bits too small/, | ||
| 38 | + message: /bits[\s_]too[\s_]small/i, | ||
| 39 | 39 | }); | |
| 40 | 40 | } | |
| 41 | 41 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -60,18 +60,17 @@ const { | |||
| 60 | 60 | let wrongBlockLength; | |
| 61 | 61 | if (hasOpenSSL3) { | |
| 62 | 62 | wrongBlockLength = { | |
| 63 | - message: 'error:1C80006B:Provider routines::wrong final block length', | ||
| 64 | - code: 'ERR_OSSL_WRONG_FINAL_BLOCK_LENGTH', | ||
| 65 | - library: 'Provider routines', | ||
| 66 | - reason: 'wrong final block length' | ||
| 63 | + message: /wrong[\s_]final[\s_]block[\s_]length/i, | ||
| 64 | + code: /ERR_OSSL_(EVP_)?WRONG_FINAL_BLOCK_LENGTH/, | ||
| 65 | + library: /Provider routines|Cipher functions/, | ||
| 66 | + reason: /wrong[\s_]final[\s_]block[\s_]length/i, | ||
| 67 | 67 | }; | |
| 68 | 68 | } else { | |
| 69 | 69 | wrongBlockLength = { | |
| 70 | - message: 'error:0606506D:digital envelope' + | ||
| 71 | - ' routines:EVP_DecryptFinal_ex:wrong final block length', | ||
| 72 | - code: 'ERR_OSSL_EVP_WRONG_FINAL_BLOCK_LENGTH', | ||
| 73 | - library: 'digital envelope routines', | ||
| 74 | - reason: 'wrong final block length' | ||
| 70 | + message: /wrong[\s_]final[\s_]block[\s_]length/i, | ||
| 71 | + code: /ERR_OSSL_(EVP_)?WRONG_FINAL_BLOCK_LENGTH/, | ||
| 72 | + library: /digital envelope routines|Cipher functions/, | ||
| 73 | + reason: /wrong[\s_]final[\s_]block[\s_]length/i, | ||
| 75 | 74 | }; | |
| 76 | 75 | } | |
| 77 | 76 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -191,7 +191,7 @@ assert.throws( | |||
| 191 | 191 | } | |
| 192 | 192 | ||
| 193 | 193 | // Test XOF hash functions and the outputLength option. | |
| 194 | - { | ||
| 194 | + if (!process.features.openssl_is_boringssl) { | ||
| 195 | 195 | // Default outputLengths. | |
| 196 | 196 | assert.strictEqual(crypto.createHash('shake128').digest('hex'), | |
| 197 | 197 | '7f9c2ba4e88f827d616045507605853e'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -84,14 +84,13 @@ assert.throws(function() { | |||
| 84 | 84 | // Input must have block length %. | |
| 85 | 85 | enc(ODD_LENGTH_PLAIN, false); | |
| 86 | 86 | }, hasOpenSSL3 ? { | |
| 87 | - message: 'error:1C80006B:Provider routines::wrong final block length', | ||
| 88 | - code: 'ERR_OSSL_WRONG_FINAL_BLOCK_LENGTH', | ||
| 89 | - reason: 'wrong final block length', | ||
| 87 | + message: /wrong[\s_]final[\s_]block[\s_]length/i, | ||
| 88 | + code: /ERR_OSSL(_EVP)?_WRONG_FINAL_BLOCK_LENGTH/, | ||
| 89 | + reason: /wrong[\s_]final[\s_]block[\s_]length/i, | ||
| 90 | 90 | } : { | |
| 91 | - message: 'error:0607F08A:digital envelope routines:EVP_EncryptFinal_ex:' + | ||
| 92 | - 'data not multiple of block length', | ||
| 93 | - code: 'ERR_OSSL_EVP_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH', | ||
| 94 | - reason: 'data not multiple of block length', | ||
| 91 | + message: /data[\s_]not[\s_]multiple[\s_]of[\s_]block[\s_]length/i, | ||
| 92 | + code: /ERR_OSSL(_EVP)?_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH/, | ||
| 93 | + reason: /data[\s_]not[\s_]multiple[\s_]of[\s_]block[\s_]length/i, | ||
| 95 | 94 | } | |
| 96 | 95 | ); | |
| 97 | 96 | ||
@@ -110,15 +109,10 @@ assert.strictEqual(dec(EVEN_LENGTH_ENCRYPTED, false).length, 48); | |||
| 110 | 109 | assert.throws(function() { | |
| 111 | 110 | // Must have at least 1 byte of padding (PKCS): | |
| 112 | 111 | assert.strictEqual(dec(EVEN_LENGTH_ENCRYPTED_NOPAD, true), EVEN_LENGTH_PLAIN); | |
| 113 | - }, hasOpenSSL3 ? { | ||
| 114 | - message: 'error:1C800064:Provider routines::bad decrypt', | ||
| 115 | - reason: 'bad decrypt', | ||
| 116 | - code: 'ERR_OSSL_BAD_DECRYPT', | ||
| 117 | - } : { | ||
| 118 | - message: 'error:06065064:digital envelope routines:EVP_DecryptFinal_ex:' + | ||
| 119 | - 'bad decrypt', | ||
| 120 | - reason: 'bad decrypt', | ||
| 121 | - code: 'ERR_OSSL_EVP_BAD_DECRYPT', | ||
| 112 | + }, { | ||
| 113 | + message: /bad[\s_]decrypt/i, | ||
| 114 | + reason: /bad[\s_]decrypt/i, | ||
| 115 | + code: /ERR_OSSL(_EVP)?_BAD_DECRYPT/, | ||
| 122 | 116 | }); | |
| 123 | 117 | ||
| 124 | 118 | // No-pad encrypted string should return the same: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -73,9 +73,9 @@ const cipher = crypto.createCipheriv('aes-128-cbc', key, iv); | |||
| 73 | 73 | const decipher = crypto.createDecipheriv('aes-128-cbc', badkey, iv); | |
| 74 | 74 | ||
| 75 | 75 | cipher.pipe(decipher) | |
| 76 | - .on('error', common.expectsError(hasOpenSSL3 ? { | ||
| 77 | - message: /bad[\s_]decrypt/, | ||
| 78 | - library: 'Provider routines', | ||
| 76 | + .on('error', common.expectsError((hasOpenSSL3 || process.features.openssl_is_boringssl) ? { | ||
| 77 | + message: /bad[\s_]decrypt/i, | ||
| 78 | + library: /Provider routines|Cipher functions/, | ||
| 79 | 79 | reason: /bad[\s_]decrypt/i, | |
| 80 | 80 | } : { | |
| 81 | 81 | message: /bad[\s_]decrypt/i, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -43,7 +43,8 @@ const errorHandler = common.mustCall((err) => { | |||
| 43 | 43 | ||
| 44 | 44 | assert.strictEqual(err.code, expectedErrorCode); | |
| 45 | 45 | assert.strictEqual(err.library, 'SSL routines'); | |
| 46 | - if (!hasOpenSSL3) assert.strictEqual(err.function, 'ssl3_get_record'); | ||
| 46 | + if (!hasOpenSSL3 && !process.features.openssl_is_boringssl) | ||
| 47 | + assert.strictEqual(err.function, 'ssl3_get_record'); | ||
| 47 | 48 | assert.match(err.reason, expectedErrorReason); | |
| 48 | 49 | errorReceived = true; | |
| 49 | 50 | if (canCloseServer()) | |
@@ -105,7 +106,7 @@ function sendBADTLSRecord() { | |||
| 105 | 106 | } | |
| 106 | 107 | assert.strictEqual(err.code, expectedErrorCode); | |
| 107 | 108 | assert.strictEqual(err.library, 'SSL routines'); | |
| 108 | - if (!hasOpenSSL3) | ||
| 109 | + if (!hasOpenSSL3 && !process.features.openssl_is_boringssl) | ||
| 109 | 110 | assert.strictEqual(err.function, 'ssl3_read_bytes'); | |
| 110 | 111 | assert.match(err.reason, expectedErrorReason); | |
| 111 | 112 | })); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -438,7 +438,7 @@ const { hasOpenSSL3 } = require('../common/crypto'); | |||
| 438 | 438 | const cert = fixtures.readKey('incorrect_san_correct_subject-cert.pem'); | |
| 439 | 439 | ||
| 440 | 440 | // The hostname is the CN, but not a SAN entry. | |
| 441 | - const servername = 'good.example.com'; | ||
| 441 | + const servername = process.features.openssl_is_boringssl ? undefined : 'good.example.com'; | ||
| 442 | 442 | const certX509 = new X509Certificate(cert); | |
| 443 | 443 | assert.strictEqual(certX509.subject, `CN=${servername}`); | |
| 444 | 444 | assert.strictEqual(certX509.subjectAltName, 'DNS:evil.example.com'); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments