Skip to content

Commit

Permalink
remove the SubjectOwner::None hack
Browse files Browse the repository at this point in the history
Signed-off-by: William Woodruff <[email protected]>
  • Loading branch information
woodruffw committed Feb 11, 2024
1 parent d179b7e commit 6e09ac1
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/rust/src/x509/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,7 @@ impl PolicyBuilder {
None => datetime_now(py)?,
};

let policy = OwnedPolicy::try_new(SubjectOwner::None, |_| {
Ok::<PyCryptoPolicy<'_>, pyo3::PyErr>(PyCryptoPolicy(Policy::client(
PyCryptoOps {},
time,
self.max_chain_depth,
)))
})?;
let policy = PyCryptoPolicy(Policy::client(PyCryptoOps {}, time, self.max_chain_depth));

Ok(PyClientVerifier { policy, store })
}
Expand Down Expand Up @@ -203,7 +197,6 @@ enum SubjectOwner {
// so, which was only stabilized with 3.10.
DNSName(String),
IPAddress(pyo3::Py<pyo3::types::PyBytes>),
None,
}

self_cell::self_cell!(
Expand Down Expand Up @@ -233,14 +226,14 @@ struct PyVerifiedClient {
module = "cryptography.hazmat.bindings._rust.x509"
)]
struct PyClientVerifier {
policy: OwnedPolicy,
policy: PyCryptoPolicy<'static>,
#[pyo3(get)]
store: pyo3::Py<PyStore>,
}

impl PyClientVerifier {
fn as_policy(&self) -> &Policy<'_, PyCryptoOps> {
&self.policy.borrow_dependent().0
&self.policy.0
}
}

Expand Down Expand Up @@ -423,7 +416,6 @@ fn build_subject<'a>(

Ok(Subject::IP(ip_addr))
}
SubjectOwner::None => Err(pyo3::exceptions::PyValueError::new_err("missing subject")),
}
}

Expand Down

0 comments on commit 6e09ac1

Please sign in to comment.