You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// As of OpenSSL 3.0.0 we must register a legacy cipher provider
58
60
// to get RC2 (needed for junk asymmetric private key
59
61
// serialization), RC4, Blowfish, IDEA, SEED, etc. These things
60
62
// are ugly legacy, but we aren't going to get rid of them
61
63
// any time soon.
62
-
let load_legacy = env::var("CRYPTOGRAPHY_OPENSSL_NO_LEGACY")
63
-
.map(|v| v.is_empty() || v == "0")
64
-
.unwrap_or(true);
64
+
65
+
let load_legacy = !cfg!(CRYPTOGRAPHY_BUILD_OPENSSL_NO_LEGACY)
66
+
&& !env::var("CRYPTOGRAPHY_OPENSSL_NO_LEGACY").map_or(false, |v| !v.is_empty() && v != "0");
67
+
65
68
let legacy = if load_legacy {
66
69
let legacy_result = provider::Provider::load(None,"legacy");
67
-
_legacy_provider_error(legacy_result.is_ok())?;
68
-
Some(legacy_result?)
70
+
if legacy_result.is_err(){
71
+
let message = crate::utils::cstr_from_literal!("OpenSSL 3's legacy provider failed to load. Legacy algorithms will not be available. If you need those algorithms, check your OpenSSL configuration.");
72
+
let warning_cls = pyo3::exceptions::PyWarning::type_object(py).into_any();
"OpenSSL 3.0's legacy provider failed to load. This is a fatal error by default, but cryptography supports running without legacy algorithms by setting the environment variable CRYPTOGRAPHY_OPENSSL_NO_LEGACY. If you did not expect this error, you have likely made a mistake with your OpenSSL configuration."
0 commit comments