Skip to content

Commit 8733269

Browse files
committed
rand rng update
1 parent bf00167 commit 8733269

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

sqlx-core/src/mysql/connection/auth.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use bytes::buf::Chain;
22
use bytes::Bytes;
33
use digest::Digest;
4-
use rand::thread_rng;
54
use rsa::{pkcs8::DecodePublicKey, Oaep, RsaPublicKey};
65
use sha1::Sha1;
76
use sha2::Sha256;
@@ -150,7 +149,7 @@ async fn encrypt_rsa<'s>(
150149
// client sends an RSA encrypted password
151150
let pkey = parse_rsa_pub_key(rsa_pub_key)?;
152151
let padding = Oaep::new::<sha1::Sha1>();
153-
pkey.encrypt(&mut thread_rng(), padding, &pass[..])
152+
pkey.encrypt(&mut rand::rng(), padding, &pass[..])
154153
.map_err(Error::protocol)
155154
}
156155

sqlx-core/src/postgres/connection/establish.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ impl PgConnection {
144144
transaction_status,
145145
transaction_depth: 0,
146146
pending_ready_for_query_count: 0,
147-
next_statement_id: Oid(rand::random()),
147+
next_statement_id: Oid(rand::rng().gen_range(0..u32::MAX)),
148148
cache_statement: StatementCache::new(options.statement_cache_capacity),
149149
cache_type_oid: HashMap::new(),
150150
cache_type_info: HashMap::new(),

sqlx-core/src/postgres/connection/sasl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ pub(crate) async fn authenticate(
174174

175175
// nonce is a sequence of random printable bytes
176176
fn gen_nonce() -> String {
177-
let mut rng = rand::thread_rng();
177+
let mut rng = rand::rng();
178178
let count = rng.gen_range(64..128);
179179

180180
// printable = %x21-2B / %x2D-7E

0 commit comments

Comments
 (0)