Changeset 872
- Timestamp:
- 10/17/07 04:21:31
(11 months ago)
- Author:
- raphael
- Message:
Improved entropy pool seeding code
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r871 |
r872 |
|
| 10 | 10 | - MAKEFILES: |
|---|
| 11 | 11 | * Fixed #782: cannot stat `./setup/vhcs2ispcp.pl': No such file or directory |
|---|
| | 12 | - ENGINE: |
|---|
| | 13 | * Improved entropy pool seeding code |
|---|
| 12 | 14 | |
|---|
| 13 | 15 | 2007-10-16 Benedikt Heintel |
|---|
| r855 |
r872 |
|
| 1009 | 1009 | |
|---|
| 1010 | 1010 | my $seed = $len; |
|---|
| 1011 | | while ($seed >= 0 || int(get_file('/proc/sys/kernel/random/entropy_avail')) <= $len) { |
|---|
| 1012 | | save_file('/dev/urandom', rand()); |
|---|
| 1013 | | save_file('/dev/urandom', time ^ ($$ + ($$ << 15))); |
|---|
| | 1011 | while ($seed >= 0 || int(get_file('/proc/sys/kernel/random/entropy_avail')) <= ($len + 10)) { |
|---|
| | 1012 | save_file('/dev/urandom', rand() * rand()); |
|---|
| | 1013 | my $n = 100, $c = undef, $l = 0; |
|---|
| | 1014 | do{$l=int(rand() * 100)); next if($l < 0 || $l > 255);$c .= chr($i}while($n--); |
|---|
| | 1015 | save_file('/dev/urandom', $c); |
|---|
| | 1016 | save_file('/dev/urandom', time ^ ($$ + ($$ << 15)) << (1 ^ rand -$$ )); |
|---|
| 1014 | 1017 | $seed--; |
|---|
| 1015 | 1018 | } |
|---|
|
Download in other formats:
#########################################################################
# Site footer - Contents are automatically inserted after main Trac HTML
?>