File tree Expand file tree Collapse file tree 3 files changed +3
-4
lines changed Expand file tree Collapse file tree 3 files changed +3
-4
lines changed Original file line number Diff line number Diff line change 1
1
use bytes:: buf:: Chain ;
2
2
use bytes:: Bytes ;
3
3
use digest:: Digest ;
4
- use rand:: thread_rng;
5
4
use rsa:: { pkcs8:: DecodePublicKey , Oaep , RsaPublicKey } ;
6
5
use sha1:: Sha1 ;
7
6
use sha2:: Sha256 ;
@@ -150,7 +149,7 @@ async fn encrypt_rsa<'s>(
150
149
// client sends an RSA encrypted password
151
150
let pkey = parse_rsa_pub_key ( rsa_pub_key) ?;
152
151
let padding = Oaep :: new :: < sha1:: Sha1 > ( ) ;
153
- pkey. encrypt ( & mut thread_rng ( ) , padding, & pass[ ..] )
152
+ pkey. encrypt ( & mut rand :: rng ( ) , padding, & pass[ ..] )
154
153
. map_err ( Error :: protocol)
155
154
}
156
155
Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ impl PgConnection {
144
144
transaction_status,
145
145
transaction_depth : 0 ,
146
146
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 ) ) ,
148
148
cache_statement : StatementCache :: new ( options. statement_cache_capacity ) ,
149
149
cache_type_oid : HashMap :: new ( ) ,
150
150
cache_type_info : HashMap :: new ( ) ,
Original file line number Diff line number Diff line change @@ -174,7 +174,7 @@ pub(crate) async fn authenticate(
174
174
175
175
// nonce is a sequence of random printable bytes
176
176
fn gen_nonce ( ) -> String {
177
- let mut rng = rand:: thread_rng ( ) ;
177
+ let mut rng = rand:: rng ( ) ;
178
178
let count = rng. gen_range ( 64 ..128 ) ;
179
179
180
180
// printable = %x21-2B / %x2D-7E
You can’t perform that action at this time.
0 commit comments