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 11use  bytes:: buf:: Chain ; 
22use  bytes:: Bytes ; 
33use  digest:: Digest ; 
4- use  rand:: thread_rng; 
54use  rsa:: { pkcs8:: DecodePublicKey ,  Oaep ,  RsaPublicKey } ; 
65use  sha1:: Sha1 ; 
76use  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
Original file line number Diff line number Diff 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 ( ) , 
Original file line number Diff line number Diff line change @@ -174,7 +174,7 @@ pub(crate) async fn authenticate(
174174
175175// nonce is a sequence of random printable bytes 
176176fn  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 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments