Skip to content

Commit

Permalink
Switch from impl std::error to impl core::error for `UnknownCrypt…
Browse files Browse the repository at this point in the history
…oError` (#440)

* errors: Switch from impl std::error to core::error

* bump MSRV to 1.81.0

* CHANGELOG nit
  • Loading branch information
brycx authored Mar 1, 2025
1 parent 70aa193 commit a002691
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- stable
- beta
- nightly
- 1.80.0 # MSRV
- 1.81.0 # MSRV
os:
- ubuntu-latest
- macos-latest
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

**Changelog:**
- Add support for post-quantum ML-KEM from FIPS-203 ([#431](https://github.com/orion-rs/orion/pull/431)).
- Implement `core::error::Error` instead of the `std`-version ([#440](https://github.com/orion-rs/orion/pull/440)).
- Bump MSRV to `1.81.0`.
- Update CI dependencies.


Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = "Usable, easy and safe pure-Rust crypto"
keywords = ["cryptography", "crypto", "aead", "hash", "mac"]
categories = ["cryptography", "no-std"]
edition = "2021"
rust-version = "1.80" # Update CI (MSRV) test along with this.
rust-version = "1.81" # Update CI (MSRV) test + README along with this.
readme = "README.md"
repository = "https://github.com/orion-rs/orion"
documentation = "https://docs.rs/orion"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# orion
[![Tests](https://github.com/orion-rs/orion/workflows/Tests/badge.svg)](https://github.com/orion-rs/orion/actions) [![Daily tests](https://github.com/orion-rs/orion/workflows/Daily%20tests/badge.svg)](https://github.com/orion-rs/orion/actions) [![dudect](https://github.com/orion-rs/orion-dudect/workflows/dudect/badge.svg)](https://github.com/orion-rs/orion-dudect/actions) [![Audit](https://github.com/orion-rs/orion/actions/workflows/audit_check.yml/badge.svg)](https://github.com/orion-rs/orion/actions/workflows/audit_check.yml) [![codecov](https://codecov.io/gh/orion-rs/orion/branch/master/graph/badge.svg)](https://codecov.io/gh/orion-rs/orion) [![Documentation](https://docs.rs/orion/badge.svg)](https://docs.rs/orion/) [![Crates.io](https://img.shields.io/crates/v/orion.svg)](https://crates.io/crates/orion) [![Safety Dance](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance/) [![MSRV](https://img.shields.io/badge/MSRV-1.80-informational.svg)](https://img.shields.io/badge/MSRV-1.80-informational) [![Matrix](https://img.shields.io/matrix/orion-rs:matrix.org.svg?logo=matrix)](https://matrix.to/#/#orion-rs:matrix.org)
[![Tests](https://github.com/orion-rs/orion/workflows/Tests/badge.svg)](https://github.com/orion-rs/orion/actions) [![Daily tests](https://github.com/orion-rs/orion/workflows/Daily%20tests/badge.svg)](https://github.com/orion-rs/orion/actions) [![dudect](https://github.com/orion-rs/orion-dudect/workflows/dudect/badge.svg)](https://github.com/orion-rs/orion-dudect/actions) [![Audit](https://github.com/orion-rs/orion/actions/workflows/audit_check.yml/badge.svg)](https://github.com/orion-rs/orion/actions/workflows/audit_check.yml) [![codecov](https://codecov.io/gh/orion-rs/orion/branch/master/graph/badge.svg)](https://codecov.io/gh/orion-rs/orion) [![Documentation](https://docs.rs/orion/badge.svg)](https://docs.rs/orion/) [![Crates.io](https://img.shields.io/crates/v/orion.svg)](https://crates.io/crates/orion) [![Safety Dance](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance/) [![MSRV](https://img.shields.io/badge/MSRV-1.81-informational.svg)](https://img.shields.io/badge/MSRV-1.81-informational) [![Matrix](https://img.shields.io/matrix/orion-rs:matrix.org.svg?logo=matrix)](https://matrix.to/#/#orion-rs:matrix.org)

### About
Orion is a cryptography library written in pure Rust. It aims to provide easy and usable crypto while trying to minimize the use of unsafe code. You can read more about Orion in the [wiki](https://github.com/orion-rs/orion/wiki).
Expand All @@ -25,7 +25,7 @@ Orion uses formally verified arithmetic, generated by Fiat Crypto, for the X2551
See the [SECURITY.md](https://github.com/orion-rs/orion/blob/master/SECURITY.md) regarding recommendations on correct use, reporting security issues and more. Additional information about security regarding Orion is available in the [wiki](https://github.com/orion-rs/orion/wiki/Security).

### Minimum Supported Rust Version
Rust 1.80 or later is supported however, the majority of testing happens with latest stable Rust.
Rust 1.81 or later is supported however, the majority of testing happens with latest stable Rust.

MSRV may be changed at any point and will not be considered a SemVer breaking change.

Expand Down
8 changes: 3 additions & 5 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ impl fmt::Debug for UnknownCryptoError {
}
}

#[cfg(feature = "safe_api")]
impl std::error::Error for UnknownCryptoError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
impl core::error::Error for UnknownCryptoError {
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
None
}
}
Expand Down Expand Up @@ -95,9 +94,8 @@ fn test_unknown_crypto_from_getrandom() {
}

#[test]
#[cfg(feature = "safe_api")]
fn test_source() {
use std::error::Error;
use core::error::Error;
assert!(UnknownCryptoError.source().is_none());
}

Expand Down

0 comments on commit a002691

Please sign in to comment.