Skip to content

Commit

Permalink
Fix docstring and remove unneeded KeepAlive
Browse files Browse the repository at this point in the history
  • Loading branch information
facutuesca committed Apr 13, 2024
1 parent 745b3b3 commit 229038f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/rust/cryptography-keepalive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ pub unsafe trait StableDeref: Deref {}
// slice returned by `deref` remains valid.
unsafe impl<T> StableDeref for Vec<T> {}

// SAFETY: `PyBackedBytes`'s data is on the heap, so as long as it's not mutated, the
// slice returned by `deref` remains valid.
// SAFETY: `PyBackedBytes`'s data is on the heap and `bytes` objects in
// Python are immutable.
unsafe impl StableDeref for PyBackedBytes {}

#[allow(clippy::new_without_default)]
Expand Down
10 changes: 4 additions & 6 deletions src/rust/src/x509/extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::error::{CryptographyError, CryptographyResult};
use crate::x509::{certificate, sct};
use crate::{types, x509};
use pyo3::prelude::PyAnyMethods;
use pyo3::pybacked::PyBackedBytes;

fn encode_general_subtrees<'a>(
py: pyo3::Python<'a>,
Expand Down Expand Up @@ -51,14 +52,11 @@ pub(crate) fn encode_authority_key_identifier<'a>(
} else {
None
};
let ka = cryptography_keepalive::KeepAlive::new();
let serial_bytes: PyBackedBytes;
let authority_cert_serial_number =
if let Some(authority_cert_serial_number) = aki.authority_cert_serial_number {
let serial_bytes = ka.add(py_uint_to_big_endian_bytes(
py,
authority_cert_serial_number,
)?);
Some(asn1::BigUint::new(serial_bytes).unwrap())
serial_bytes = py_uint_to_big_endian_bytes(py, authority_cert_serial_number)?;
Some(asn1::BigUint::new(&serial_bytes).unwrap())
} else {
None
};
Expand Down

0 comments on commit 229038f

Please sign in to comment.