Skip to content
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/ctutils.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
strategy:
matrix:
rust:
- 1.86.0 # MSRV
- 1.87.0 # MSRV
- stable
target:
- thumbv7em-none-eabi
Expand All @@ -58,7 +58,7 @@ jobs:
strategy:
matrix:
rust:
- 1.86.0 # MSRV
- 1.87.0 # MSRV
- stable
steps:
- uses: actions/checkout@v7
Expand Down
2 changes: 1 addition & 1 deletion ctutils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ categories = ["cryptography", "no-std"]
keywords = ["constant-time", "crypto", "intrinsics"]
readme = "README.md"
edition = "2024"
rust-version = "1.86"
rust-version = "1.87"

[dependencies]
cmov = "0.5.3"
Expand Down
2 changes: 1 addition & 1 deletion ctutils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ dual licensed as above, without any additional terms or conditions.
[docs-image]: https://docs.rs/ctutils/badge.svg
[docs-link]: https://docs.rs/ctutils/
[license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg
[msrv-image]: https://img.shields.io/badge/rustc-1.86+-blue.svg
[msrv-image]: https://img.shields.io/badge/rustc-1.87+-blue.svg
[build-image]: https://github.com/RustCrypto/utils/actions/workflows/ctutils.yml/badge.svg
[build-link]: https://github.com/RustCrypto/utils/actions/workflows/ctutils.yml
[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg
Expand Down
9 changes: 3 additions & 6 deletions ctutils/src/choice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,8 @@ impl Choice {
/// Returns [`Choice::TRUE`] if `x == y`, and [`Choice::FALSE`] otherwise.
#[inline]
#[must_use]
#[allow(clippy::cast_sign_loss)]
pub const fn from_i64_eq(x: i64, y: i64) -> Self {
// TODO(tarcieri): use `cast_unsigned` when MSRV is 1.87
Self::from_u64_nz(x as u64 ^ y as u64).not()
Self::from_u64_nz(x.cast_unsigned() ^ y.cast_unsigned()).not()
}

// u8
Expand Down Expand Up @@ -309,10 +307,9 @@ impl Choice {
/// and can't use the trait. The former will provide better constant-time assurances.
#[inline]
#[must_use]
#[allow(clippy::cast_possible_wrap, clippy::cast_sign_loss)]
pub const fn select_i64(self, a: i64, b: i64) -> i64 {
// TODO(tarcieri): use `cast_signed` when MSRV is 1.87
self.select_u64(a as u64, b as u64) as i64
self.select_u64(a.cast_unsigned(), b.cast_unsigned())
.cast_signed()
}

/// `const fn` helper: return `b` if `self` is [`Choice::TRUE`], otherwise return `a`.
Expand Down
6 changes: 2 additions & 4 deletions ctutils/src/traits/ct_gt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,11 @@ impl CtGt for cmp::Ordering {
#[inline]
#[allow(clippy::arithmetic_side_effects, clippy::cast_sign_loss)]
fn ct_gt(&self, other: &Self) -> Choice {
// No impl of `CtGt` for `i8`, so use `u8`
// TODO(tarcieri): use `cast_signed` when MSRV is 1.87
let a = (*self as i8) + 1;
let b = (*other as i8) + 1;

// TODO(tarcieri): use `cast_unsigned` when MSRV is 1.87
(a as u8).ct_gt(&(b as u8))
// No impl of `CtGt` for `i8`, so use `u8`
a.cast_unsigned().ct_gt(&b.cast_unsigned())
}
}

Expand Down
6 changes: 2 additions & 4 deletions ctutils/src/traits/ct_lt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,11 @@ impl CtLt for cmp::Ordering {
#[inline]
#[allow(clippy::arithmetic_side_effects, clippy::cast_sign_loss)]
fn ct_lt(&self, other: &Self) -> Choice {
// No impl of `CtLt` for `i8`, so use `u8`
// TODO(tarcieri): use `cast_signed` when MSRV is 1.87
let a = (*self as i8) + 1;
let b = (*other as i8) + 1;

// TODO(tarcieri): use `cast_unsigned` when MSRV is 1.87
(a as u8).ct_lt(&(b as u8))
// No impl of `CtLt` for `i8`, so use `u8`
a.cast_unsigned().ct_lt(&b.cast_unsigned())
}
}

Expand Down
Loading