Skip to content

Commit ca5074d

Browse files
committed
bump rand_core from 0.6.4 to 0.9.0
1 parent 9e7faa4 commit ca5074d

22 files changed

+283
-162
lines changed

Cargo.lock

Lines changed: 86 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ readme = "README.md"
1313
rust-version = "1.83"
1414

1515
[dependencies]
16-
rand_core = { version = "0.6.4", default-features = false }
16+
rand_core = { version = "0.9.0", default-features = false }
1717
const-oid = { version = "0.10.0-rc.3", default-features = false }
1818
subtle = { version = "2.6.1", default-features = false }
1919
digest = { version = "=0.11.0-pre.9", default-features = false, features = ["alloc", "oid"] }
2020
pkcs1 = { version = "0.8.0-rc.1", default-features = false, features = ["alloc", "pkcs8"] }
2121
pkcs8 = { version = "0.11.0-rc.1", default-features = false, features = ["alloc"] }
22-
signature = { version = "=2.3.0-pre.4", default-features = false, features = ["alloc", "digest", "rand_core"] }
22+
signature = { version = "=2.3.0-pre.5", default-features = false, features = ["alloc", "digest", "rand_core"] }
2323
spki = { version = "0.8.0-rc.1", default-features = false, features = ["alloc"] }
2424
zeroize = { version = "1.5", features = ["alloc"] }
25-
crypto-bigint = { version = "0.6.0", default-features = false, features = ["zeroize", "alloc"] }
25+
crypto-bigint = { version = "0.7.0-pre", default-features = false, features = ["zeroize", "alloc"] }
2626
crypto-primes = { version = "0.6.0", default-features = false }
2727

2828
# optional dependencies
@@ -37,10 +37,10 @@ base64ct = { version = "1", features = ["alloc"] }
3737
hex-literal = "0.4.1"
3838
proptest = "1"
3939
serde_test = "1.0.89"
40-
rand_xorshift = "0.3"
41-
rand_chacha = "0.3"
42-
rand = "0.8"
43-
rand_core = { version = "0.6", default-features = false }
40+
rand_xorshift = "0.4"
41+
rand_chacha = "0.9"
42+
rand = "0.9"
43+
rand_core = { version = "0.9.0", default-features = false }
4444
sha1 = { version = "=0.11.0-pre.4", default-features = false, features = ["oid"] }
4545
sha2 = { version = "=0.11.0-pre.4", default-features = false, features = ["oid"] }
4646
sha3 = { version = "=0.11.0-pre.4", default-features = false, features = ["oid"] }
@@ -54,7 +54,7 @@ name = "key"
5454
[features]
5555
default = ["std", "pem"]
5656
hazmat = []
57-
getrandom = ["rand_core/getrandom", "crypto-bigint/rand_core"]
57+
getrandom = ["rand_core/os_rng", "crypto-bigint/rand_core"]
5858
serde = ["dep:serde", "dep:serdect", "crypto-bigint/serde"]
5959
pem = ["pkcs1/pem", "pkcs8/pem"]
6060
pkcs5 = ["pkcs8/encryption"]
@@ -70,3 +70,15 @@ opt-level = 2
7070

7171
[profile.bench]
7272
debug = true
73+
74+
[patch.crates-io]
75+
# https://github.com/RustCrypto/crypto-bigint/pull/762
76+
# https://github.com/RustCrypto/crypto-bigint/pull/765
77+
crypto-bigint = { git = "https://github.com/RustCrypto/crypto-bigint.git" }
78+
79+
# https://github.com/entropyxyz/crypto-primes/pull/74
80+
crypto-primes = { git = "https://github.com/baloo/crypto-primes.git", branch = "baloo/rand_core-0.9" }
81+
82+
# https://github.com/RustCrypto/formats/pull/1658
83+
pkcs5 = { git = "https://github.com/baloo/formats.git", branch = "baloo/pkcs/rand-core-0.9" }
84+
pkcs8 = { git = "https://github.com/baloo/formats.git", branch = "baloo/pkcs/rand-core-0.9" }

src/algorithms/generate.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crypto_primes::{
66
hazmat::{SetBits, SmallPrimesSieveFactory},
77
is_prime_with_rng, sieve_and_find,
88
};
9-
use rand_core::CryptoRngCore;
9+
use rand_core::CryptoRng;
1010

1111
use crate::{
1212
algorithms::rsa::{compute_modulus, compute_private_exponent_euler_totient},
@@ -31,7 +31,7 @@ pub struct RsaPrivateKeyComponents {
3131
///
3232
/// [1]: https://patents.google.com/patent/US4405829A/en
3333
/// [2]: http://www.cacr.math.uwaterloo.ca/techreports/2006/cacr2006-16.pdf
34-
pub(crate) fn generate_multi_prime_key_with_exp<R: CryptoRngCore>(
34+
pub(crate) fn generate_multi_prime_key_with_exp<R: CryptoRng>(
3535
rng: &mut R,
3636
nprimes: usize,
3737
bit_size: usize,
@@ -120,7 +120,7 @@ pub(crate) fn generate_multi_prime_key_with_exp<R: CryptoRngCore>(
120120
})
121121
}
122122

123-
fn generate_prime_with_rng<R: CryptoRngCore>(rng: &mut R, bit_length: u32) -> BoxedUint {
123+
fn generate_prime_with_rng<R: CryptoRng>(rng: &mut R, bit_length: u32) -> BoxedUint {
124124
sieve_and_find(
125125
rng,
126126
SmallPrimesSieveFactory::new(bit_length, SetBits::TwoMsb),

src/algorithms/oaep.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use alloc::boxed::Box;
44
use alloc::vec::Vec;
55

66
use digest::{Digest, DynDigest, FixedOutputReset};
7-
use rand_core::CryptoRngCore;
7+
use rand_core::CryptoRng;
88
use subtle::{Choice, ConditionallySelectable, ConstantTimeEq, CtOption};
99
use zeroize::Zeroizing;
1010

@@ -19,7 +19,7 @@ use crate::errors::{Error, Result};
1919
const MAX_LABEL_LEN: u64 = 1 << 61;
2020

2121
#[inline]
22-
fn encrypt_internal<R: CryptoRngCore + ?Sized, MGF: FnMut(&mut [u8], &mut [u8])>(
22+
fn encrypt_internal<R: CryptoRng + ?Sized, MGF: FnMut(&mut [u8], &mut [u8])>(
2323
rng: &mut R,
2424
msg: &[u8],
2525
p_hash: &[u8],
@@ -57,7 +57,7 @@ fn encrypt_internal<R: CryptoRngCore + ?Sized, MGF: FnMut(&mut [u8], &mut [u8])>
5757
///
5858
/// [PKCS#1 OAEP]: https://datatracker.ietf.org/doc/html/rfc8017#section-7.1
5959
#[inline]
60-
pub(crate) fn oaep_encrypt<R: CryptoRngCore + ?Sized>(
60+
pub(crate) fn oaep_encrypt<R: CryptoRng + ?Sized>(
6161
rng: &mut R,
6262
msg: &[u8],
6363
digest: &mut dyn DynDigest,
@@ -90,7 +90,7 @@ pub(crate) fn oaep_encrypt<R: CryptoRngCore + ?Sized>(
9090
/// [PKCS#1 OAEP]: https://datatracker.ietf.org/doc/html/rfc8017#section-7.1
9191
#[inline]
9292
pub(crate) fn oaep_encrypt_digest<
93-
R: CryptoRngCore + ?Sized,
93+
R: CryptoRng + ?Sized,
9494
D: Digest,
9595
MGD: Digest + FixedOutputReset,
9696
>(

src/algorithms/pkcs1v15.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use alloc::vec::Vec;
1010
use digest::Digest;
1111
use pkcs8::AssociatedOid;
12-
use rand_core::CryptoRngCore;
12+
use rand_core::CryptoRng;
1313
use subtle::{Choice, ConditionallySelectable, ConstantTimeEq};
1414
use zeroize::Zeroizing;
1515

@@ -18,7 +18,7 @@ use crate::errors::{Error, Result};
1818
/// Fills the provided slice with random values, which are guaranteed
1919
/// to not be zero.
2020
#[inline]
21-
fn non_zero_random_bytes<R: CryptoRngCore + ?Sized>(rng: &mut R, data: &mut [u8]) {
21+
fn non_zero_random_bytes<R: CryptoRng + ?Sized>(rng: &mut R, data: &mut [u8]) {
2222
rng.fill_bytes(data);
2323

2424
for el in data {
@@ -39,7 +39,7 @@ pub(crate) fn pkcs1v15_encrypt_pad<R>(
3939
k: usize,
4040
) -> Result<Zeroizing<Vec<u8>>>
4141
where
42-
R: CryptoRngCore + ?Sized,
42+
R: CryptoRng + ?Sized,
4343
{
4444
if msg.len() + 11 > k {
4545
return Err(Error::MessageTooLong);

0 commit comments

Comments
 (0)