Skip to content

Commit f4db363

Browse files
committed
Only check unsupported error for OpenSSL 3+ - didn't exist before then
1 parent 48b65f7 commit f4db363

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

src/crypto/crypto_context.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,12 +1149,14 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo<Value>& args) {
11491149
// TODO(@jasnell): Should this use ThrowCryptoError?
11501150
unsigned long err = ERR_get_error(); // NOLINT(runtime/int)
11511151

1152+
#if OPENSSL_VERSION_MAJOR >= 3
11521153
if (ERR_GET_REASON(err) == ERR_R_UNSUPPORTED) {
11531154
// OpenSSL's "unsupported" error without any context is very
11541155
// common and not very helpful, so we override it:
11551156
return THROW_ERR_CRYPTO_UNSUPPORTED_OPERATION(
11561157
env, "Unsupported PKCS12 PFX data");
11571158
}
1159+
#endif
11581160

11591161
const char* str = ERR_reason_error_string(err);
11601162
str = str != nullptr ? str : "Unknown error";

test/parallel/test-tls-legacy-pfx.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
const common = require('../common');
33
if (!common.hasCrypto)
44
common.skip('missing crypto');
5+
if (!common.hasOpenSSL3)
6+
common.skip('OpenSSL legacy failures are only testable with OpenSSL 3+');
7+
58
const fixtures = require('../common/fixtures');
69

710
const {

0 commit comments

Comments
 (0)