Skip to content

Commit

Permalink
Only check unsupported error for OpenSSL 3+ - didn't exist before then
Browse files Browse the repository at this point in the history
  • Loading branch information
pimterry committed Sep 4, 2024
1 parent 48b65f7 commit 468e3e9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/crypto/crypto_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1149,12 +1149,14 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo<Value>& args) {
// TODO(@jasnell): Should this use ThrowCryptoError?
unsigned long err = ERR_get_error(); // NOLINT(runtime/int)

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

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

0 comments on commit 468e3e9

Please sign in to comment.