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

Leverage core::error::Error; MSRV 1.81 #303

Merged
merged 1 commit into from
Oct 15, 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 .github/workflows/ssh-cipher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
strategy:
matrix:
rust:
- 1.72.0 # MSRV
- 1.81.0 # MSRV
- stable
target:
- thumbv7em-none-eabi
Expand All @@ -49,7 +49,7 @@ jobs:
strategy:
matrix:
rust:
- 1.72.0 # MSRV
- 1.81.0 # MSRV
- stable
steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ssh-encoding.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
strategy:
matrix:
rust:
- 1.71.0 # MSRV
- 1.81.0 # MSRV
- stable
target:
- thumbv7em-none-eabi
Expand All @@ -47,7 +47,7 @@ jobs:
strategy:
matrix:
rust:
- 1.71.0 # MSRV
- 1.81.0 # MSRV
- stable
steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ssh-key.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
strategy:
matrix:
rust:
- 1.73.0 # MSRV
- 1.81.0 # MSRV
- stable
target:
- thumbv7em-none-eabi
Expand All @@ -80,7 +80,7 @@ jobs:
strategy:
matrix:
rust:
- 1.73.0 # MSRV
- 1.81.0 # MSRV
- stable
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ssh-protocol.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
strategy:
matrix:
rust:
- 1.73.0 # MSRV
- 1.81.0 # MSRV
- stable
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/workspace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.80.0
toolchain: 1.81.0
components: clippy
- run: cargo clippy --all-features

Expand Down
28 changes: 14 additions & 14 deletions Cargo.lock

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

4 changes: 1 addition & 3 deletions ssh-cipher/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ categories = ["cryptography", "no-std"]
keywords = ["crypto", "encryption", "openssh", "ssh"]
readme = "README.md"
edition = "2021"
rust-version = "1.72"
rust-version = "1.81"

[dependencies]
cipher = "=0.5.0-pre.6"
Expand All @@ -38,8 +38,6 @@ zeroize = { version = "1", optional = true, default-features = false }
hex-literal = "0.4"

[features]
std = []

aes-cbc = ["dep:aes", "dep:cbc"]
aes-ctr = ["dep:aes", "dep:ctr"]
aes-gcm = ["dep:aead", "dep:aes", "dep:aes-gcm"]
Expand Down
4 changes: 2 additions & 2 deletions ssh-cipher/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Built on the pure Rust cryptography implementations maintained by the

## Minimum Supported Rust Version

This crate requires **Rust 1.60** at a minimum.
This crate requires **Rust 1.81** at a minimum.

We may change the MSRV in the future, but it will be accompanied by a minor
version bump.
Expand All @@ -48,7 +48,7 @@ dual licensed as above, without any additional terms or conditions.
[docs-image]: https://docs.rs/ssh-cipher/badge.svg
[docs-link]: https://docs.rs/ssh-cipher/
[license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg
[rustc-image]: https://img.shields.io/badge/rustc-1.60+-blue.svg
[rustc-image]: https://img.shields.io/badge/rustc-1.81+-blue.svg
[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg
[chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/346919-SSH
[build-image]: https://github.com/RustCrypto/SSH/actions/workflows/ssh-cipher.yml/badge.svg
Expand Down
3 changes: 1 addition & 2 deletions ssh-cipher/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,4 @@ impl fmt::Display for Error {
}
}

#[cfg(feature = "std")]
impl std::error::Error for Error {}
impl core::error::Error for Error {}
3 changes: 0 additions & 3 deletions ssh-cipher/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
unused_qualifications
)]

#[cfg(feature = "std")]
extern crate std;

mod error;

#[cfg(feature = "chacha20poly1305")]
Expand Down
5 changes: 2 additions & 3 deletions ssh-encoding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,19 @@ categories = ["authentication", "cryptography", "encoding", "no-std", "parser-im
keywords = ["crypto", "certificate", "key", "openssh", "ssh"]
readme = "README.md"
edition = "2021"
rust-version = "1.71"
rust-version = "1.81"

[dependencies]
base64ct = { version = "1.4", optional = true }
bytes = { version = "1", optional = true, default-features = false }
digest = { version = "=0.11.0-pre.9", optional = true, default-features = false }
pem-rfc7468 = { version = "1.0.0-rc.1", optional = true }
pem-rfc7468 = { version = "1.0.0-rc.2", optional = true }

[dev-dependencies]
hex-literal = "0.4.1"

[features]
alloc = ["base64ct?/alloc", "pem-rfc7468?/alloc"]
std = ["alloc", "base64ct?/std", "digest?/std", "pem-rfc7468?/std"]

base64 = ["dep:base64ct"]
bytes = ["alloc", "dep:bytes"]
Expand Down
4 changes: 2 additions & 2 deletions ssh-encoding/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ in [RFC4251].

## Minimum Supported Rust Version

This crate requires **Rust 1.71** at a minimum.
This crate requires **Rust 1.81** at a minimum.

We may change the MSRV in the future, but it will be accompanied by a minor
version bump.
Expand All @@ -43,7 +43,7 @@ dual licensed as above, without any additional terms or conditions.
[docs-image]: https://docs.rs/ssh-encoding/badge.svg
[docs-link]: https://docs.rs/ssh-encoding/
[license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg
[rustc-image]: https://img.shields.io/badge/rustc-1.71+-blue.svg
[rustc-image]: https://img.shields.io/badge/rustc-1.81+-blue.svg
[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg
[chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/346919-SSH
[build-image]: https://github.com/RustCrypto/SSH/actions/workflows/ssh-encoding.yml/badge.svg
Expand Down
26 changes: 13 additions & 13 deletions ssh-encoding/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@ pub enum Error {
},
}

impl core::error::Error for Error {
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
match self {
// TODO(tarcieri): re-add support when `base64ct` uses `core::error`
//#[cfg(feature = "base64")]
//Self::Base64(err) => Some(err),
#[cfg(feature = "pem")]
Self::Pem(err) => Some(err),
_ => None,
}
}
}

impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Expand Down Expand Up @@ -101,16 +114,3 @@ impl From<pem_rfc7468::Error> for Error {
Error::Pem(err)
}
}

#[cfg(feature = "std")]
impl std::error::Error for Error {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
#[cfg(feature = "base64")]
Self::Base64(err) => Some(err),
#[cfg(feature = "pem")]
Self::Pem(err) => Some(err),
_ => None,
}
}
}
5 changes: 2 additions & 3 deletions ssh-encoding/src/label.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ impl LabelError {
}
}

impl core::error::Error for LabelError {}

impl fmt::Display for LabelError {
#[cfg(not(feature = "alloc"))]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand All @@ -77,6 +79,3 @@ impl fmt::Display for LabelError {
write!(f, "invalid label: '{}'", self.label)
}
}

#[cfg(feature = "std")]
impl std::error::Error for LabelError {}
2 changes: 0 additions & 2 deletions ssh-encoding/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
#[cfg(feature = "alloc")]
#[macro_use]
extern crate alloc;
#[cfg(feature = "std")]
extern crate std;

mod checked;
mod decode;
Expand Down
9 changes: 4 additions & 5 deletions ssh-key/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ categories = ["authentication", "cryptography", "encoding", "no-std", "parser-im
keywords = ["crypto", "certificate", "openssh", "ssh", "sshsig"]
readme = "README.md"
edition = "2021"
rust-version = "1.73"
rust-version = "1.81"

[dependencies]
cipher = { package = "ssh-cipher", version = "=0.3.0-pre.2", features = ["zeroize"], path = "../ssh-cipher" }
Expand All @@ -28,15 +28,15 @@ zeroize = { version = "1", default-features = false }
# optional dependencies
bcrypt-pbkdf = { version = "=0.11.0-pre.1", optional = true, default-features = false, features = ["alloc"] }
bigint = { package = "num-bigint-dig", version = "0.8", optional = true, default-features = false }
dsa = { version = "=0.7.0-pre.0", optional = true, default-features = false }
dsa = { version = "=0.7.0-pre.1", optional = true, default-features = false }
ed25519-dalek = { version = "=2.2.0-pre", optional = true, default-features = false }
home = { version = "0.5", optional = true }
p256 = { version = "=0.14.0-pre.1", optional = true, default-features = false, features = ["ecdsa"] }
p384 = { version = "=0.14.0-pre.1", optional = true, default-features = false, features = ["ecdsa"] }
p521 = { version = "=0.14.0-pre.1", optional = true, default-features = false, features = ["ecdsa"] }
rand_core = { version = "0.6.4", optional = true, default-features = false }
rsa = { version = "=0.10.0-pre.2", optional = true, default-features = false, features = ["sha2"] }
sec1 = { version = "0.8.0-rc.0", optional = true, default-features = false, features = ["point"] }
rsa = { version = "=0.10.0-pre.3", optional = true, default-features = false, features = ["sha2"] }
sec1 = { version = "0.8.0-rc.3", optional = true, default-features = false, features = ["point"] }
serde = { version = "1", optional = true }
sha1 = { version = "=0.11.0-pre.4", optional = true, default-features = false }

Expand All @@ -53,7 +53,6 @@ alloc = [
]
std = [
"alloc",
"encoding/std",
"p256?/std",
"p384?/std",
"p521?/std",
Expand Down
4 changes: 2 additions & 2 deletions ssh-key/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ functionality for a particular SSH key algorithm.

## Minimum Supported Rust Version

This crate requires **Rust 1.73** at a minimum.
This crate requires **Rust 1.81** at a minimum.

We may change the MSRV in the future, but it will be accompanied by a minor
version bump.
Expand All @@ -113,7 +113,7 @@ dual licensed as above, without any additional terms or conditions.
[docs-image]: https://docs.rs/ssh-key/badge.svg
[docs-link]: https://docs.rs/ssh-key/
[license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg
[rustc-image]: https://img.shields.io/badge/rustc-1.73+-blue.svg
[rustc-image]: https://img.shields.io/badge/rustc-1.81+-blue.svg
[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg
[chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/346919-SSH
[build-image]: https://github.com/RustCrypto/SSH/actions/workflows/ssh-key.yml/badge.svg
Expand Down
Loading