Skip to content

Commit acbc3ff

Browse files
committed
test,benchmark: drop OpenSSL 1.x-only coverage
Delete test-crypto-ecb.js, which can no longer run anywhere: Blowfish is available only from OpenSSL's legacy provider and is absent from BoringSSL. The addon and cctest version guards become OPENSSL_IS_BORINGSSL checks. Remove legacy digest-alias coverage and unreachable OpenSSL 1.x branches. JavaScript test and benchmark gates, skip reasons, and TLS error expectations that distinguished OpenSSL 1.x from provider-backed OpenSSL now distinguish BoringSSL, including PKCS12 parsing, named DH groups, private-key serialization, RSA-PSS parameters, consolidated provider caches, FIPS availability, and empty KMAC output. Keep the CCM alternate finalization error only for BoringSSL. Provider-only test skips use version-neutral terminology or state the actual minimum OpenSSL version. Signed-off-by: Filip Skokan <panva.ip@gmail.com> Assisted-by: Codex PR-URL: #64777 Fixes: #56733 Refs: #64211 Refs: #63966 Refs: #53329 Refs: #48950 Refs: #45465 Refs: #42827 Refs: #47076 Refs: #62862 Refs: #38512 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <richard.lau@ibm.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
1 parent 8be36fb commit acbc3ff

104 files changed

Lines changed: 338 additions & 614 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎benchmark/crypto/kem.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ if (hasOpenSSL(3, 2)) {
3535
keyFixtures.x25519 = readKeyPair('x25519_public', 'x25519_private');
3636
keyFixtures.x448 = readKeyPair('x448_public', 'x448_private');
3737
}
38-
if (hasOpenSSL(3, 0)) {
38+
if (!isBoringSSL) {
3939
keyFixtures.rsa = readKeyPair('rsa_public_2048', 'rsa_private_2048');
4040
}
4141

4242
if (Object.keys(keyFixtures).length === 0) {
43-
console.log('no supported key types available for this OpenSSL version');
43+
console.log('no supported key types available for this crypto implementation');
4444
process.exit(0);
4545
}
4646

‎benchmark/crypto/mac.js‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
'use strict';
22

33
const common = require('../common.js');
4-
const { hasOpenSSL, isBoringSSL } = require('../../test/common/crypto.js');
4+
const { isBoringSSL } = require('../../test/common/crypto.js');
55
const assert = require('node:assert');
66
const {
77
createHmac,
88
createMac,
99
getMacs,
1010
} = require('node:crypto');
1111

12-
if (!hasOpenSSL(3) ||
13-
isBoringSSL ||
12+
if (isBoringSSL ||
1413
typeof createMac !== 'function' ||
1514
typeof getMacs !== 'function') {
16-
console.log('Skipping: generic MAC API requires OpenSSL >= 3');
15+
console.log('Skipping: generic MAC API requires OpenSSL EVP_MAC support');
1716
process.exit(0);
1817
}
1918

‎test/addons/openssl-providers/binding.cc‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#include <assert.h>
22
#include <node.h>
33

4-
#include <openssl/opensslv.h>
5-
#if OPENSSL_VERSION_MAJOR >= 3
4+
// BoringSSL declares OPENSSL_IS_BORINGSSL in crypto.h.
5+
#include <openssl/crypto.h>
6+
#ifndef OPENSSL_IS_BORINGSSL
67
#include <openssl/provider.h>
78
#endif
89

@@ -18,7 +19,7 @@ using v8::Object;
1819
using v8::String;
1920
using v8::Value;
2021

21-
#if OPENSSL_VERSION_MAJOR >= 3
22+
#ifndef OPENSSL_IS_BORINGSSL
2223
int collectProviders(OSSL_PROVIDER* provider, void* cbdata) {
2324
static_cast<std::vector<OSSL_PROVIDER*>*>(cbdata)->push_back(provider);
2425
return 1;
@@ -28,7 +29,7 @@ int collectProviders(OSSL_PROVIDER* provider, void* cbdata) {
2829
inline void GetProviders(const FunctionCallbackInfo<Value>& args) {
2930
Isolate* isolate = args.GetIsolate();
3031
LocalVector<Value> arr(isolate, 0);
31-
#if OPENSSL_VERSION_MAJOR >= 3
32+
#ifndef OPENSSL_IS_BORINGSSL
3233
std::vector<OSSL_PROVIDER*> providers;
3334
OSSL_PROVIDER_do_all(nullptr, &collectProviders, &providers);
3435
for (auto provider : providers) {

‎test/addons/openssl-providers/providers.cjs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ const common = require('../../common');
44
if (!common.hasCrypto) {
55
common.skip('missing crypto');
66
}
7-
const { hasOpenSSL } = require('../../common/crypto');
7+
const { isBoringSSL } = require('../../common/crypto');
88

9-
if (!hasOpenSSL(3)) {
10-
common.skip('this test requires OpenSSL 3.x');
9+
if (isBoringSSL) {
10+
common.skip('OpenSSL provider support is required');
1111
}
1212
const assert = require('node:assert');
1313
const {

‎test/cctest/test_node_crypto_env.cc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ TEST_F(NodeCryptoEnv, LoadBIO) {
2626
// just put a random string into BIO
2727
Local<String> key = String::NewFromUtf8(isolate_, "abcdef").ToLocalChecked();
2828
ncrypto::BIOPointer bio(node::crypto::LoadBIO(*env, key));
29-
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
29+
#ifndef OPENSSL_IS_BORINGSSL
3030
const int ofs = 2;
3131
ASSERT_EQ(BIO_seek(bio.get(), ofs), ofs);
3232
ASSERT_EQ(BIO_tell(bio.get()), ofs);

‎test/common/crypto.js‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,6 @@ module.exports = {
147147
hasOpenSSL,
148148
hasFIPS,
149149
isBoringSSL,
150-
get hasOpenSSL3() {
151-
return hasOpenSSL(3);
152-
},
153150
// opensslCli defined lazily to reduce overhead of spawnSync
154151
get opensslCli() {
155152
if (opensslCli !== null) return opensslCli;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ const shake128 = crypto.getHashes().includes('shake128');
1313
const shake256 = crypto.getHashes().includes('shake256');
1414
const cshake128 = crypto.getHashes().includes('cshake128');
1515
const cshake256 = crypto.getHashes().includes('cshake256');
16-
const ocb = hasOpenSSL(3) && crypto.getCiphers().includes('aes-128-ocb');
17-
const kmac = hasOpenSSL(3) && crypto.getMacs().includes('kmac128');
16+
const ocb = !isBoringSSL && crypto.getCiphers().includes('aes-128-ocb');
17+
const kmac = !isBoringSSL && crypto.getMacs().includes('kmac128');
1818
const hybridKems = !fips && pqc && (!boringSSL || shake256);
1919

2020

‎test/parallel/test-cli-node-options.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const { Worker } = require('worker_threads');
1212

1313
const fixtures = require('../common/fixtures');
1414
const tmpdir = require('../common/tmpdir');
15-
const { hasOpenSSL } = require('../common/crypto');
15+
const { isBoringSSL } = require('../common/crypto');
1616
tmpdir.refresh();
1717

1818
const printA = path.relative(tmpdir.path, fixtures.path('printA.js'));
@@ -65,7 +65,7 @@ if (common.isLinux) {
6565
if (common.hasCrypto) {
6666
expectNoWorker('--use-openssl-ca', 'B\n');
6767
expectNoWorker('--use-bundled-ca', 'B\n');
68-
if (!hasOpenSSL(3))
68+
if (isBoringSSL)
6969
expectNoWorker('--openssl-config=_ossl_cfg', 'B\n');
7070
if (common.isMacOS) {
7171
expect('--use-system-ca', 'B\n');

‎test/parallel/test-config-json-schema.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ if (!common.hasCrypto) {
1010
common.skip('missing crypto');
1111
}
1212

13-
const { hasOpenSSL } = require('../common/crypto');
13+
const { isBoringSSL } = require('../common/crypto');
1414

15-
if (!hasOpenSSL(3)) {
16-
common.skip('this test requires OpenSSL 3.x');
15+
if (isBoringSSL) {
16+
common.skip('this test is not supported with BoringSSL');
1717
}
1818

1919
if (!common.hasIntl) {

‎test/parallel/test-crypto-async-sign-verify.js‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const common = require('../common');
33
if (!common.hasCrypto)
44
common.skip('missing crypto');
55

6-
const { hasOpenSSL, hasFIPS, isBoringSSL } = require('../common/crypto');
6+
const { hasFIPS, isBoringSSL } = require('../common/crypto');
77
const assert = require('assert');
88
const util = require('util');
99
const crypto = require('crypto');
@@ -132,7 +132,7 @@ if (!isBoringSSL) {
132132
common.printSkipMessage('Skipping unsupported ed448/secp256k1/dsa test cases');
133133
}
134134

135-
// Test Parallel Execution w/ KeyObject is threadsafe in openssl3
135+
// Test Parallel Execution w/ KeyObject is threadsafe in OpenSSL
136136
{
137137
const publicKey = {
138138
key: crypto.createPublicKey(
@@ -171,12 +171,10 @@ MCowBQYDK2VuAyEA6pwGRbadNQAI/tYN8+/p/0/hbsdHfOEGr1ADiLVk/Gc=
171171
const data = crypto.randomBytes(32);
172172
const signature = crypto.randomBytes(16);
173173

174-
let expected = /no default digest/;
175-
let expectedCode = 'ERR_OSSL_EVP_NO_DEFAULT_DIGEST';
176-
if (hasOpenSSL(3) || isBoringSSL) {
177-
expected = /operation[\s_]not[\s_]supported[\s_]for[\s_]this[\s_]keytype/i;
178-
expectedCode = 'ERR_OSSL_EVP_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE';
179-
}
174+
const expected =
175+
/operation[\s_]not[\s_]supported[\s_]for[\s_]this[\s_]keytype/i;
176+
const expectedCode =
177+
'ERR_OSSL_EVP_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE';
180178

181179
crypto.verify(undefined, data, untrustedKey, signature, common.mustCall((err) => {
182180
assert.ok(err);

0 commit comments

Comments
 (0)