Skip to content

Commit

Permalink
Bump pyo3 to 0.22 (pyca#11150)
Browse files Browse the repository at this point in the history
* Bump pyo3 from 0.21.2 to 0.22.0 in /src/rust

Bumps [pyo3](https://github.com/pyo3/pyo3) from 0.21.2 to 0.22.0.
- [Release notes](https://github.com/pyo3/pyo3/releases)
- [Changelog](https://github.com/PyO3/pyo3/blob/main/CHANGELOG.md)
- [Commits](PyO3/pyo3@v0.21.2...v0.22.0)

---
updated-dependencies:
- dependency-name: pyo3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Fix compilation errors in building for pyo3 0.22

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
alex and dependabot[bot] authored Jun 25, 2024
1 parent afc90a8 commit 47aced2
Show file tree
Hide file tree
Showing 19 changed files with 55 additions and 137 deletions.
144 changes: 13 additions & 131 deletions src/rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ rust-version.workspace = true
[dependencies]
once_cell = "1"
cfg-if = "1"
pyo3 = { version = "0.21.2", features = ["abi3"] }
pyo3 = { version = "0.22.0", features = ["abi3"] }
asn1 = { version = "0.16.2", default-features = false }
cryptography-cffi = { path = "cryptography-cffi" }
cryptography-keepalive = { path = "cryptography-keepalive" }
Expand Down
2 changes: 1 addition & 1 deletion src/rust/cryptography-cffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ publish.workspace = true
rust-version.workspace = true

[dependencies]
pyo3 = { version = "0.21.2", features = ["abi3"] }
pyo3 = { version = "0.22.0", features = ["abi3"] }
openssl-sys = "0.9.102"

[build-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion src/rust/cryptography-keepalive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ publish.workspace = true
rust-version.workspace = true

[dependencies]
pyo3 = { version = "0.21.2", features = ["abi3"] }
pyo3 = { version = "0.22.0", features = ["abi3"] }
7 changes: 7 additions & 0 deletions src/rust/src/backend/aead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ impl ChaCha20Poly1305 {
Ok(types::OS_URANDOM.get(py)?.call1((32,))?)
}

#[pyo3(signature = (nonce, data, associated_data))]
fn encrypt<'p>(
&self,
py: pyo3::Python<'p>,
Expand All @@ -556,6 +557,7 @@ impl ChaCha20Poly1305 {
.encrypt(py, data.as_bytes(), aad, Some(nonce_bytes))
}

#[pyo3(signature = (nonce, data, associated_data))]
fn decrypt<'p>(
&self,
py: pyo3::Python<'p>,
Expand Down Expand Up @@ -651,6 +653,7 @@ impl AesGcm {
Ok(types::OS_URANDOM.get(py)?.call1((bit_length / 8,))?)
}

#[pyo3(signature = (nonce, data, associated_data))]
fn encrypt<'p>(
&self,
py: pyo3::Python<'p>,
Expand All @@ -671,6 +674,7 @@ impl AesGcm {
.encrypt(py, data.as_bytes(), aad, Some(nonce_bytes))
}

#[pyo3(signature = (nonce, data, associated_data))]
fn decrypt<'p>(
&self,
py: pyo3::Python<'p>,
Expand Down Expand Up @@ -704,6 +708,7 @@ struct AesCcm {
#[pyo3::prelude::pymethods]
impl AesCcm {
#[new]
#[pyo3(signature = (key, tag_length=None))]
fn new(
py: pyo3::Python<'_>,
key: pyo3::Py<pyo3::PyAny>,
Expand Down Expand Up @@ -762,6 +767,7 @@ impl AesCcm {
Ok(types::OS_URANDOM.get(py)?.call1((bit_length / 8,))?)
}

#[pyo3(signature = (nonce, data, associated_data))]
fn encrypt<'p>(
&self,
py: pyo3::Python<'p>,
Expand Down Expand Up @@ -795,6 +801,7 @@ impl AesCcm {
self.ctx.encrypt(py, data_bytes, aad, Some(nonce_bytes))
}

#[pyo3(signature = (nonce, data, associated_data))]
fn decrypt<'p>(
&self,
py: pyo3::Python<'p>,
Expand Down
1 change: 1 addition & 0 deletions src/rust/src/backend/cmac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ impl Cmac {
#[pyo3::pymethods]
impl Cmac {
#[new]
#[pyo3(signature = (algorithm, backend=None))]
fn new(
py: pyo3::Python<'_>,
algorithm: pyo3::Bound<'_, pyo3::PyAny>,
Expand Down
7 changes: 7 additions & 0 deletions src/rust/src/backend/dh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ struct DHParameters {
}

#[pyo3::prelude::pyfunction]
#[pyo3(signature = (generator, key_size, backend=None))]
fn generate_parameters(
generator: u32,
key_size: u32,
Expand Down Expand Up @@ -87,6 +88,7 @@ fn pkey_from_dh<T: openssl::pkey::HasParams>(
}

#[pyo3::prelude::pyfunction]
#[pyo3(signature = (data, backend=None))]
fn from_der_parameters(
data: &[u8],
backend: Option<pyo3::Bound<'_, pyo3::PyAny>>,
Expand All @@ -107,6 +109,7 @@ fn from_der_parameters(
}

#[pyo3::prelude::pyfunction]
#[pyo3(signature = (data, backend=None))]
fn from_pem_parameters(
data: &[u8],
backend: Option<pyo3::Bound<'_, pyo3::PyAny>>,
Expand Down Expand Up @@ -410,6 +413,7 @@ impl DHPrivateNumbers {
}

#[cfg(not(CRYPTOGRAPHY_IS_BORINGSSL))]
#[pyo3(signature = (backend=None))]
fn private_key(
&self,
py: pyo3::Python<'_>,
Expand Down Expand Up @@ -462,6 +466,7 @@ impl DHPublicNumbers {
}

#[cfg(not(CRYPTOGRAPHY_IS_BORINGSSL))]
#[pyo3(signature = (backend=None))]
fn public_key(
&self,
py: pyo3::Python<'_>,
Expand Down Expand Up @@ -494,6 +499,7 @@ impl DHPublicNumbers {
#[pyo3::prelude::pymethods]
impl DHParameterNumbers {
#[new]
#[pyo3(signature = (p, g, q=None))]
fn new(
py: pyo3::Python<'_>,
p: pyo3::Py<pyo3::types::PyLong>,
Expand All @@ -520,6 +526,7 @@ impl DHParameterNumbers {
Ok(DHParameterNumbers { p, g, q })
}

#[pyo3(signature = (backend=None))]
fn parameters(
&self,
py: pyo3::Python<'_>,
Expand Down
3 changes: 3 additions & 0 deletions src/rust/src/backend/dsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ impl DsaPrivateNumbers {
DsaPrivateNumbers { x, public_numbers }
}

#[pyo3(signature = (backend=None))]
fn private_key(
&self,
py: pyo3::Python<'_>,
Expand Down Expand Up @@ -406,6 +407,7 @@ impl DsaPublicNumbers {
}
}

#[pyo3(signature = (backend=None))]
fn public_key(
&self,
py: pyo3::Python<'_>,
Expand Down Expand Up @@ -460,6 +462,7 @@ impl DsaParameterNumbers {
DsaParameterNumbers { p, q, g }
}

#[pyo3(signature = (backend=None))]
fn parameters(
&self,
py: pyo3::Python<'_>,
Expand Down
Loading

0 comments on commit 47aced2

Please sign in to comment.