Skip to content

Commit

Permalink
fix things from CI
Browse files Browse the repository at this point in the history
  • Loading branch information
alex committed Apr 15, 2024
1 parent af3f6de commit f5dae96
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/rust/src/backend/ec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ fn curve_from_py_curve(
}

let py_curve_name = py_curve.getattr(pyo3::intern!(py, "name"))?;
let nid = match py_curve_name.extract()? {
let nid = match &*py_curve_name.extract::<pyo3::pybacked::PyBackedStr>()? {
"secp192r1" => openssl::nid::Nid::X9_62_PRIME192V1,
"secp224r1" => openssl::nid::Nid::SECP224R1,
"secp256r1" => openssl::nid::Nid::X9_62_PRIME256V1,
Expand Down
7 changes: 5 additions & 2 deletions src/rust/src/pkcs12.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ impl PKCS12Certificate {
let py_friendly_name_repr;
let friendly_name_repr = match &self.friendly_name {
Some(v) => {
py_friendly_name_repr = v.bind(py).repr()?;
py_friendly_name_repr.extract()?
py_friendly_name_repr = v
.bind(py)
.repr()?
.extract::<pyo3::pybacked::PyBackedStr>()?;
&*py_friendly_name_repr
}
None => "None",
};
Expand Down
6 changes: 3 additions & 3 deletions src/rust/src/pkcs7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,10 @@ fn sign_and_serialize<'p>(
)
};

let digest_alg = x509::ocsp::HASH_NAME_TO_ALGORITHM_IDENTIFIERS[py_hash_alg
let digest_alg = x509::ocsp::HASH_NAME_TO_ALGORITHM_IDENTIFIERS[&*py_hash_alg
.getattr(pyo3::intern!(py, "name"))?
.extract::<&str>()?]
.clone();
.extract::<pyo3::pybacked::PyBackedStr>()?]
.clone();
// Technically O(n^2), but no one will have that many signers.
if !digest_algs.contains(&digest_alg) {
digest_algs.push(digest_alg.clone());
Expand Down
2 changes: 1 addition & 1 deletion src/rust/src/x509/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ fn create_ip_network(
let net = format!(
"{}/{}",
base.getattr(pyo3::intern!(py, "exploded"))?
.extract::<&str>()?,
.extract::<pyo3::pybacked::PyBackedStr>()?,
prefix?
);
let addr = types::IPADDRESS_IPNETWORK.get(py)?.call1((net,))?;
Expand Down
6 changes: 3 additions & 3 deletions src/rust/src/x509/ocsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ pub(crate) fn certid_new<'p>(
)?;

Ok(CertID {
hash_algorithm: HASH_NAME_TO_ALGORITHM_IDENTIFIERS[hash_algorithm
hash_algorithm: HASH_NAME_TO_ALGORITHM_IDENTIFIERS[&*hash_algorithm
.getattr(pyo3::intern!(py, "name"))?
.extract::<&str>()?]
.clone(),
.extract::<pyo3::pybacked::PyBackedStr>()?]
.clone(),
issuer_name_hash,
issuer_key_hash,
serial_number: cert.raw.borrow_dependent().tbs_cert.serial,
Expand Down
4 changes: 2 additions & 2 deletions src/rust/src/x509/sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ fn identify_hash_type(
));
}

match hash_algorithm
match &*hash_algorithm
.getattr(pyo3::intern!(py, "name"))?
.extract()?
.extract::<pyo3::pybacked::PyBackedStr>()?
{
"sha224" => Ok(HashType::Sha224),
"sha256" => Ok(HashType::Sha256),
Expand Down

0 comments on commit f5dae96

Please sign in to comment.