Skip to content

Commit 1d496d2

Browse files
committed
fix provider loading take two
we previously hoisted this into rust, but we used the try_load feature which supposedly retains fallbacks. Something about that doesn't behave the way we expect though and the machinery in providers is sufficiently complex that we are just going to load the default provider explicitly. this matches our behavior pre-rust.
1 parent b059986 commit 1d496d2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/rust/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ mod x509;
2424
#[pyo3::prelude::pyclass(frozen, module = "cryptography.hazmat.bindings._rust")]
2525
struct LoadedProviders {
2626
legacy: Option<provider::Provider>,
27+
_default: provider::Provider,
2728
}
2829

2930
#[pyo3::prelude::pyfunction]
@@ -52,13 +53,14 @@ fn _initialize_legacy_provider() -> CryptographyResult<LoadedProviders> {
5253
.map(|v| v.is_empty() || v == "0")
5354
.unwrap_or(true);
5455
let legacy = if load_legacy {
55-
let legacy_result = provider::Provider::try_load(None, "legacy", true);
56+
let legacy_result = provider::Provider::load(None, "legacy");
5657
_legacy_provider_error(legacy_result.is_ok())?;
5758
Some(legacy_result?)
5859
} else {
5960
None
6061
};
61-
Ok(LoadedProviders { legacy })
62+
let _default = provider::Provider::load(None, "default")?;
63+
Ok(LoadedProviders { legacy, _default })
6264
}
6365

6466
fn _legacy_provider_error(success: bool) -> pyo3::PyResult<()> {

0 commit comments

Comments
 (0)