Skip to content

Add trait impls for core::cmp::Ordering#12

Open
tarcieri wants to merge 1 commit intozkcrypto:mainfrom
tarcieri:subtle-ng/ordering-trait-impls
Open

Add trait impls for core::cmp::Ordering#12
tarcieri wants to merge 1 commit intozkcrypto:mainfrom
tarcieri:subtle-ng/ordering-trait-impls

Conversation

@tarcieri
Copy link
Copy Markdown

core::cmp::Ordering is #[repr(i8)], making it possible to impl the following traits for it by casting to i8 (and back, where appropriate):

  • ConditionallySelectable
  • ConstantTimeEq
  • ConstantTimeGreater
  • ConstantTimeLess

This type is `#[repr(i8)]`, making it possible to impl the following
traits for it by casting to `i8` (and back, where appropriate):

- `ConditionallySelectable`
- `ConstantTimeEq`
- `ConstantTimeGreater`
- `ConstantTimeLess`
@tarcieri
Copy link
Copy Markdown
Author

NOTE: I originally added this to upstream subtle in this PR: dalek-cryptography#102

I am curious about trying to modernize subtle to support things like const fn and asm! backends for emitting constant-time code, and thought perhaps subtle-ng might be an option for that which zkcrypto/ff and zkcrypto/group could potentially migrate to as work on upstream subtle seems stalled: zkcrypto/ff#148

So I thought I'd open this PR to test the waters.

@tarcieri
Copy link
Copy Markdown
Author

It looks like the tests are currently failing due to an old MSRV:

https://github.com/tarcieri/subtle/actions/runs/21077404636/job/60622649261

  Downloaded ppv-lite86 v0.2.21
error: failed to parse manifest at `/home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/ppv-lite86-0.2.21/Cargo.toml`
Error: failed to parse manifest at `/home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/ppv-lite86-0.2.21/Cargo.toml`
Caused by:
  feature `edition2021` is required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant