Skip to content

Commit

Permalink
elliptic-curve: bump crypto-bigint to v0.6.0-pre.8; MSRV 1.73 (#1463)
Browse files Browse the repository at this point in the history
The latest prerelease of `crypto-bigint` includes changes necessary to
also support heap-backed integers (not that we're planning on using
them), but also includes expanded modular arithmetic support including
an implementation of the Bernstein-Yang modular inversion algorithm.

It also includes a migration to `hybrid-array` which will be necessary
for everything to work together correctly.
  • Loading branch information
tarcieri authored Jan 9, 2024
1 parent 1ac412b commit ace5ceb
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 12 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/elliptic-curve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
strategy:
matrix:
rust:
- 1.71.0 # MSRV
- 1.73.0 # MSRV
- stable
target:
- thumbv7em-none-eabi
Expand Down Expand Up @@ -58,6 +58,8 @@ jobs:
- run: cargo build --target ${{ matrix.target }} --release --no-default-features --features alloc,digest,ecdh,hazmat,hash2curve,jwk,pem,pkcs8,sec1,serde,voprf

minimal-versions:
# Temporarily disabled until elliptic-curve 0.13.0-pre.0 is published
if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -74,7 +76,7 @@ jobs:
strategy:
matrix:
rust:
- 1.71.0 # MSRV
- 1.73.0 # MSRV
- stable
- nightly
steps:
Expand Down
30 changes: 29 additions & 1 deletion Cargo.lock

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

4 changes: 2 additions & 2 deletions elliptic-curve/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ readme = "README.md"
categories = ["cryptography", "no-std"]
keywords = ["crypto", "ecc", "elliptic", "weierstrass"]
edition = "2021"
rust-version = "1.71"
rust-version = "1.73"

[dependencies]
base16ct = "0.2"
crypto-bigint = { version = "0.5", default-features = false, features = ["rand_core", "generic-array", "zeroize"] }
crypto-bigint = { version = "=0.6.0-pre.8", default-features = false, features = ["rand_core", "hybrid-array", "zeroize"] }
hybrid-array = { version = "=0.2.0-pre.8", default-features = false, features = ["zeroize"] }
rand_core = { version = "0.6.4", default-features = false }
subtle = { version = "2", default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions elliptic-curve/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ and public/secret keys composed thereof.

## Minimum Supported Rust Version

Requires Rust **1.71** or higher.
Requires Rust **1.73** or higher.

Minimum supported Rust version can be changed in the future, but it will be
done with a minor version bump.
Expand Down Expand Up @@ -49,6 +49,6 @@ dual licensed as above, without any additional terms or conditions.
[build-image]: https://github.com/RustCrypto/traits/actions/workflows/elliptic-curve.yml/badge.svg
[build-link]: https://github.com/RustCrypto/traits/actions/workflows/elliptic-curve.yml
[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.73+-blue.svg
[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg
[chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/260040-elliptic-curves
2 changes: 1 addition & 1 deletion elliptic-curve/src/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
//! the traits in this crate.

use crate::{
array::typenum::U32,
bigint::{Limb, U256},
error::{Error, Result},
hybrid_array::typenum::U32,
ops::{Invert, LinearCombination, MulByGenerator, Reduce, ShrAssign},
pkcs8,
point::AffineCoordinates,
Expand Down
5 changes: 3 additions & 2 deletions elliptic-curve/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ pub use crate::{
secret_key::SecretKey,
};
pub use crypto_bigint as bigint;
pub use hybrid_array::{self, typenum::consts};
pub use hybrid_array as array;
pub use hybrid_array::typenum::consts;
pub use rand_core;
pub use subtle;
pub use zeroize;
Expand Down Expand Up @@ -178,7 +179,7 @@ pub trait Curve: 'static + Copy + Clone + Debug + Default + Eq + Ord + Send + Sy
type Uint: bigint::ArrayEncoding
+ bigint::AddMod<Output = Self::Uint>
+ bigint::Encoding
+ bigint::Integer
+ bigint::FixedInteger
+ bigint::NegMod<Output = Self::Uint>
+ bigint::Random
+ bigint::RandomMod
Expand Down
1 change: 1 addition & 0 deletions elliptic-curve/src/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ mod nonzero;
mod primitive;

pub use self::primitive::ScalarPrimitive;

#[cfg(feature = "arithmetic")]
pub use self::{blinded::BlindedScalar, nonzero::NonZeroScalar};

Expand Down
4 changes: 2 additions & 2 deletions elliptic-curve/src/scalar/primitive.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Generic scalar type with primitive functionality.

use crate::{
array::Array,
bigint::{prelude::*, Limb, NonZero},
scalar::FromUintUnchecked,
scalar::IsHigh,
Expand All @@ -13,7 +14,6 @@ use core::{
ops::{Add, AddAssign, Neg, ShrAssign, Sub, SubAssign},
str,
};
use hybrid_array::Array;
use rand_core::CryptoRngCore;
use subtle::{
Choice, ConditionallySelectable, ConstantTimeEq, ConstantTimeGreater, ConstantTimeLess,
Expand Down Expand Up @@ -357,7 +357,7 @@ where
C: Curve,
{
fn is_high(&self) -> Choice {
let n_2 = C::ORDER >> 1;
let n_2 = C::ORDER >> 1u32;
self.inner.ct_gt(&n_2)
}
}
Expand Down

0 comments on commit ace5ceb

Please sign in to comment.