Skip to content

Commit e873d92

Browse files
authored
chore(deps): bump rand_core to 0.10.0-rc-5 (#108)
* chore(deps): bump `rand_core` to `0.10.0-rc-5` * chore(deps): bump `crypto-bigint` to `0.7.0-pre.21`
1 parent 41b60a9 commit e873d92

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

Cargo.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ categories = ["cryptography", "no-std"]
1010
rust-version = "1.85"
1111

1212
[dependencies]
13-
crypto-bigint = { version = "0.7.0-rc.16", default-features = false, features = ["rand_core"] }
13+
crypto-bigint = { version = "0.7.0-rc.21", default-features = false, features = ["rand_core"] }
1414
libm = { version = "0.2.13", default-features = false, features = ["arch"] }
15-
rand_core = { version = "0.10.0-rc-3", default-features = false }
15+
rand_core = { version = "0.10.0-rc-5", default-features = false }
1616
rayon = { version = "1", optional = true, default-features = false }
1717

1818
# Optional dependencies used in tests and benchmarks
@@ -23,7 +23,7 @@ glass_pumpkin = { version = "1", optional = true }
2323
[dev-dependencies]
2424
rand = { version = "0.10.0-rc.6", features = ["chacha"] }
2525
# need `crypto-bigint` with `alloc` to test `BoxedUint`
26-
crypto-bigint = { version = "0.7.0-pre.16", default-features = false, features = ["alloc"] }
26+
crypto-bigint = { version = "0.7.0-pre.21", default-features = false, features = ["alloc"] }
2727
criterion = { version = "0.5", features = ["html_reports"] }
2828
num-modular = { version = "0.5", features = ["num-bigint"] }
2929
num-bigint = "0.4"
@@ -61,3 +61,6 @@ harness = false
6161
[[bench]]
6262
name = "cctv"
6363
harness = false
64+
65+
[patch.crates-io]
66+
rand = { git = "https://github.com/rust-random/rand.git" }

src/fips.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ where
140140
// Safe primes are always of the form 4k + 3 (i.e. n ≡ 3 mod 4)
141141
// The last two digits of a binary number give you its value modulo 4.
142142
// Primes p=4n+3 will always end in 11 in binary because p ≡ 3 mod 4.
143-
if candidate.as_ref()[0].0 & 3 != 3 {
143+
if candidate.as_limbs()[0].0 & 3 != 3 {
144144
return false;
145145
}
146146

src/hazmat/gcd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ where
2323
} else {
2424
// In this branch `n` is `Word::BITS` bits or shorter,
2525
// so we can safely take the first limb.
26-
let n = n.as_ref()[0].0;
26+
let n = n.as_limbs()[0].0;
2727
if n > m { (n, m) } else { (m, n) }
2828
};
2929

src/hazmat/jacobi.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn reduce_numerator_long<T>(j: JacobiSymbol, a: Word, p: &T) -> (JacobiSymbol, W
2424
where
2525
T: Unsigned,
2626
{
27-
apply_reduce_numerator(j, a, p.as_ref()[0].0)
27+
apply_reduce_numerator(j, a, p.as_limbs()[0].0)
2828
}
2929

3030
fn reduce_numerator_short(j: JacobiSymbol, a: Word, p: Word) -> (JacobiSymbol, Word) {
@@ -39,7 +39,7 @@ fn apply_swap(j: JacobiSymbol, a: Word, p: Word) -> JacobiSymbol {
3939
}
4040

4141
fn swap_long<T: Unsigned>(j: JacobiSymbol, a: Word, p: &Odd<T>) -> (JacobiSymbol, &Odd<T>, Word) {
42-
let j = apply_swap(j, a, p.as_ref().as_ref()[0].0);
42+
let j = apply_swap(j, a, p.as_ref().as_limbs()[0].0);
4343
(j, p, a)
4444
}
4545

@@ -59,7 +59,7 @@ where
5959
// (-a/n) = (-1/n) * (a/n)
6060
// = (-1)^((n-1)/2) * (a/n)
6161
// = (-1 if n = 3 mod 4 else 1) * (a/n)
62-
let result = if a_is_negative && p_long.as_ref().as_ref()[0].0 & 3 == 3 {
62+
let result = if a_is_negative && p_long.as_ref().as_limbs()[0].0 & 3 == 3 {
6363
-result
6464
} else {
6565
result
@@ -75,7 +75,7 @@ where
7575
// Normalize input: at the end we want `a < p`, `p` odd, and both fitting into a `Word`.
7676
let (result, a, p): (JacobiSymbol, Word, Word) = if p_long.bits_vartime() <= Limb::BITS {
7777
let a = a_limb.0;
78-
let p = p_long.as_ref().as_ref()[0].0;
78+
let p = p_long.as_ref().as_limbs()[0].0;
7979
(result, a % p, p)
8080
} else {
8181
let (result, a) = reduce_numerator_long(result, a_limb.0, p_long.as_ref());

src/hazmat/lucas.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl LucasBase for SelfridgeBase {
4949
let mut abs_d = 5;
5050
let mut d_is_negative = false;
5151
let n_is_small = n.bits_vartime() < Word::BITS; // if true, `n` fits into one `Word`
52-
let small_n = n.as_ref().as_ref()[0].0;
52+
let small_n = n.as_ref().as_limbs()[0].0;
5353
let mut attempts = 0;
5454
loop {
5555
if attempts >= MAX_ATTEMPTS {

src/hazmat/sieve.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ pub(crate) fn equals_primitive<T>(num: &T, primitive: Word) -> bool
8484
where
8585
T: Unsigned,
8686
{
87-
num.bits_vartime() <= Word::BITS && num.as_ref()[0].0 == primitive
87+
num.bits_vartime() <= Word::BITS && num.as_limbs()[0].0 == primitive
8888
}
8989

9090
// The type we use to calculate incremental residues.
@@ -202,10 +202,7 @@ where
202202
}
203203

204204
// Find the increment limit.
205-
let max_value = match T::one_like(&self.base)
206-
.overflowing_shl_vartime(self.max_bit_length)
207-
.into()
208-
{
205+
let max_value = match T::one_like(&self.base).overflowing_shl_vartime(self.max_bit_length) {
209206
Some(val) => val,
210207
None => T::one_like(&self.base),
211208
};
@@ -218,7 +215,7 @@ where
218215
self.last_round = true;
219216
// Can unwrap here since we just checked above that `incr_limit <= INCR_LIMIT`,
220217
// and `INCR_LIMIT` fits into `Residue`.
221-
let incr_limit_small: Residue = incr_limit.as_ref()[0]
218+
let incr_limit_small: Residue = incr_limit.as_limbs()[0]
222219
.0
223220
.try_into()
224221
.expect("the increment limit should fit within `Residue`");
@@ -427,7 +424,7 @@ where
427424
};
428425
let start_limit: SmallPrime = if start_bits <= max_prime_bits {
429426
// Can convert since we just checked the bit size
430-
start.as_ref()[0].0.try_into().expect("The number is in range")
427+
start.as_limbs()[0].0.try_into().expect("The number is in range")
431428
} else {
432429
SmallPrime::MAX
433430
};

src/presets.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ where
106106
// Safe primes are always of the form 4k + 3 (i.e. n ≡ 3 mod 4)
107107
// The last two digits of a binary number give you its value modulo 4.
108108
// Primes p=4n+3 will always end in 11 in binary because p ≡ 3 mod 4.
109-
if candidate.as_ref()[0].0 & 3 != 3 {
109+
if candidate.as_limbs()[0].0 & 3 != 3 {
110110
return false;
111111
}
112112

0 commit comments

Comments
 (0)