Changeset 8438
- Timestamp:
- May 19, 2009, 8:52:24 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/crypto.c
r8085 r8438 312 312 int val; 313 313 314 assert( upperBound > 0 ); 315 314 316 if( RAND_pseudo_bytes ( (unsigned char *) &noise, sizeof noise ) >= 0 ) 315 317 { … … 329 331 tr_cryptoWeakRandInt( int upperBound ) 330 332 { 331 static int init = 0; 333 int val; 334 static tr_bool init = FALSE; 332 335 333 336 assert( upperBound > 0 ); … … 336 339 { 337 340 srand( tr_date( ) ); 338 init = 1; 339 } 340 341 return rand( ) % upperBound; 341 init = TRUE; 342 } 343 344 345 val = rand( ) % upperBound; 346 assert( val >= 0 ); 347 assert( val < upperBound ); 348 return val; 342 349 } 343 350
Note: See TracChangeset
for help on using the changeset viewer.