Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #10294 -- correct accidental change to exchange kwarg (#10295) #10296

Merged
merged 1 commit into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/rust/src/backend/dh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ impl DHPrivateKey {
fn exchange<'p>(
&self,
py: pyo3::Python<'p>,
public_key: &DHPublicKey,
peer_public_key: &DHPublicKey,
) -> CryptographyResult<&'p pyo3::types::PyBytes> {
let mut deriver = openssl::derive::Deriver::new(&self.pkey)?;
deriver
.set_peer(&public_key.pkey)
.set_peer(&peer_public_key.pkey)
.map_err(|_| pyo3::exceptions::PyValueError::new_err("Error computing shared key."))?;

Ok(pyo3::types::PyBytes::new_with(py, deriver.len()?, |b| {
Expand Down
6 changes: 3 additions & 3 deletions src/rust/src/backend/ec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ impl ECPrivateKey {
&self,
py: pyo3::Python<'p>,
algorithm: &pyo3::PyAny,
public_key: &ECPublicKey,
peer_public_key: &ECPublicKey,
) -> CryptographyResult<&'p pyo3::types::PyBytes> {
if !algorithm.is_instance(types::ECDH.get(py)?)? {
return Err(CryptographyError::from(
Expand All @@ -249,12 +249,12 @@ impl ECPrivateKey {
// ECPublicKey object.
#[cfg(CRYPTOGRAPHY_OPENSSL_300_OR_GREATER)]
deriver
.set_peer_ex(&public_key.pkey, false)
.set_peer_ex(&peer_public_key.pkey, false)
.map_err(|_| pyo3::exceptions::PyValueError::new_err("Error computing shared key."))?;

#[cfg(not(CRYPTOGRAPHY_OPENSSL_300_OR_GREATER))]
deriver
.set_peer(&public_key.pkey)
.set_peer(&peer_public_key.pkey)
.map_err(|_| pyo3::exceptions::PyValueError::new_err("Error computing shared key."))?;

Ok(pyo3::types::PyBytes::new_with(py, deriver.len()?, |b| {
Expand Down
4 changes: 2 additions & 2 deletions src/rust/src/backend/x25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ impl X25519PrivateKey {
fn exchange<'p>(
&self,
py: pyo3::Python<'p>,
public_key: &X25519PublicKey,
peer_public_key: &X25519PublicKey,
) -> CryptographyResult<&'p pyo3::types::PyBytes> {
let mut deriver = openssl::derive::Deriver::new(&self.pkey)?;
deriver.set_peer(&public_key.pkey)?;
deriver.set_peer(&peer_public_key.pkey)?;

Ok(pyo3::types::PyBytes::new_with(py, deriver.len()?, |b| {
let n = deriver.derive(b).map_err(|_| {
Expand Down
4 changes: 2 additions & 2 deletions src/rust/src/backend/x448.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ impl X448PrivateKey {
fn exchange<'p>(
&self,
py: pyo3::Python<'p>,
public_key: &X448PublicKey,
peer_public_key: &X448PublicKey,
) -> CryptographyResult<&'p pyo3::types::PyBytes> {
let mut deriver = openssl::derive::Deriver::new(&self.pkey)?;
deriver.set_peer(&public_key.pkey)?;
deriver.set_peer(&peer_public_key.pkey)?;

Ok(pyo3::types::PyBytes::new_with(py, deriver.len()?, |b| {
let n = deriver.derive(b).map_err(|_| {
Expand Down
Loading