Skip to content

Commit 1113fea

Browse files
committed
elliptic-curve: bump rand_core to 0.9.0
1 parent 0c41df9 commit 1113fea

File tree

8 files changed

+32
-25
lines changed

8 files changed

+32
-25
lines changed

Cargo.lock

+9-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+10
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,13 @@ members = [
1919
crypto-common = { path = "./crypto-common" }
2020
digest = { path = "./digest" }
2121
signature = { path = "./signature" }
22+
23+
# https://github.com/RustCrypto/crypto-bigint/pull/762
24+
# https://github.com/RustCrypto/crypto-bigint/pull/765
25+
crypto-bigint = { git = "https://github.com/RustCrypto/crypto-bigint.git" }
26+
27+
# https://github.com/zkcrypto/ff/pull/122
28+
ff = { git = "https://github.com/pinkforest/ff.git", branch = "bump-rand-core" }
29+
30+
# https://github.com/zkcrypto/group/pull/56
31+
group = { git = "https://github.com/pinkforest/group.git", branch = "bump-rand-0.9" }

elliptic-curve/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ rust-version = "1.83"
1818

1919
[dependencies]
2020
base16ct = "0.2"
21-
crypto-bigint = { version = "0.6", default-features = false, features = ["rand_core", "hybrid-array", "zeroize"] }
21+
crypto-bigint = { version = "0.7.0-pre", default-features = false, features = ["rand_core", "hybrid-array", "zeroize"] }
2222
hybrid-array = { version = "0.2", default-features = false, features = ["zeroize"] }
23-
rand_core = { version = "0.6.4", default-features = false }
23+
rand_core = { version = "0.9.0", default-features = false }
2424
subtle = { version = "2.6", default-features = false }
2525
zeroize = { version = "1.7", default-features = false }
2626

elliptic-curve/src/ecdh.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use core::{borrow::Borrow, fmt};
3434
use digest::{crypto_common::BlockSizeUser, Digest};
3535
use group::Curve as _;
3636
use hkdf::{hmac::SimpleHmac, Hkdf};
37-
use rand_core::CryptoRngCore;
37+
use rand_core::CryptoRng;
3838
use zeroize::{Zeroize, ZeroizeOnDrop};
3939

4040
/// Low-level Elliptic Curve Diffie-Hellman (ECDH) function.
@@ -108,7 +108,7 @@ where
108108
C: CurveArithmetic,
109109
{
110110
/// Generate a cryptographically random [`EphemeralSecret`].
111-
pub fn random(rng: &mut impl CryptoRngCore) -> Self {
111+
pub fn random<R: CryptoRng>(rng: &mut R) -> Self {
112112
Self {
113113
scalar: NonZeroScalar::random(rng),
114114
}

elliptic-curve/src/scalar/blinded.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use super::Scalar;
44
use crate::{ops::Invert, CurveArithmetic};
55
use core::fmt;
66
use group::ff::Field;
7-
use rand_core::CryptoRngCore;
7+
use rand_core::CryptoRng;
88
use subtle::CtOption;
99
use zeroize::Zeroize;
1010

@@ -37,8 +37,8 @@ impl<C> BlindedScalar<C>
3737
where
3838
C: CurveArithmetic,
3939
{
40-
/// Create a new [`BlindedScalar`] from a scalar and a [`CryptoRngCore`].
41-
pub fn new(scalar: Scalar<C>, rng: &mut impl CryptoRngCore) -> Self {
40+
/// Create a new [`BlindedScalar`] from a scalar and a [`CryptoRng`].
41+
pub fn new<R: CryptoRng>(scalar: Scalar<C>, rng: &mut R) -> Self {
4242
Self {
4343
scalar,
4444
mask: Scalar::<C>::random(rng),

elliptic-curve/src/scalar/nonzero.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use core::{
1313
};
1414
use crypto_bigint::{ArrayEncoding, Integer};
1515
use ff::{Field, PrimeField};
16-
use rand_core::CryptoRngCore;
16+
use rand_core::CryptoRng;
1717
use subtle::{Choice, ConditionallySelectable, ConstantTimeEq, CtOption};
1818
use zeroize::Zeroize;
1919

@@ -47,7 +47,7 @@ where
4747
C: CurveArithmetic,
4848
{
4949
/// Generate a random `NonZeroScalar`.
50-
pub fn random(mut rng: &mut impl CryptoRngCore) -> Self {
50+
pub fn random<R: CryptoRng>(mut rng: &mut R) -> Self {
5151
// Use rejection sampling to eliminate zero values.
5252
// While this method isn't constant-time, the attacker shouldn't learn
5353
// anything about unrelated outputs so long as `rng` is a secure `CryptoRng`.

elliptic-curve/src/scalar/primitive.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use core::{
1414
ops::{Add, AddAssign, Neg, ShrAssign, Sub, SubAssign},
1515
str,
1616
};
17-
use rand_core::CryptoRngCore;
17+
use rand_core::CryptoRng;
1818
use subtle::{
1919
Choice, ConditionallySelectable, ConstantTimeEq, ConstantTimeGreater, ConstantTimeLess,
2020
CtOption,
@@ -65,7 +65,7 @@ where
6565
pub const MODULUS: C::Uint = C::ORDER;
6666

6767
/// Generate a random [`ScalarPrimitive`].
68-
pub fn random(rng: &mut impl CryptoRngCore) -> Self {
68+
pub fn random<R: CryptoRng>(rng: &mut R) -> Self {
6969
Self {
7070
inner: C::Uint::random_mod(rng, &NonZero::new(Self::MODULUS).unwrap()),
7171
}

elliptic-curve/src/secret_key.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use subtle::{Choice, ConstantTimeEq};
1515
use zeroize::{Zeroize, ZeroizeOnDrop, Zeroizing};
1616

1717
#[cfg(feature = "arithmetic")]
18-
use crate::{rand_core::CryptoRngCore, CurveArithmetic, NonZeroScalar, PublicKey};
18+
use crate::{rand_core::CryptoRng, CurveArithmetic, NonZeroScalar, PublicKey};
1919

2020
#[cfg(feature = "jwk")]
2121
use crate::jwk::{JwkEcKey, JwkParameters};
@@ -91,7 +91,7 @@ where
9191

9292
/// Generate a random [`SecretKey`].
9393
#[cfg(feature = "arithmetic")]
94-
pub fn random(rng: &mut impl CryptoRngCore) -> Self
94+
pub fn random<R: CryptoRng>(rng: &mut R) -> Self
9595
where
9696
C: CurveArithmetic,
9797
{

0 commit comments

Comments
 (0)