Skip to content

Commit 468e3e9

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

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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";

0 commit comments

Comments
 (0)