25 #include <kernel/fs_info.h>
26 #include <kernel/OS.h>
27 #include <kernel/image.h>
45 #define RANDOM_BUFSIZE 4096
58 gettimeofday( &tv, NULL );
65 idleTime = idle_time();
66 addRandomData( randomState, &idleTime,
sizeof( bigtime_t ) );
75 get_system_info( &info );
76 addRandomData( randomState, &info,
sizeof( info ) );
79 endRandomData( randomState, 5 );
82 #define DEVRANDOM_BITS 4096
99 if( ( fd = open(
"/dev/urandom", O_RDONLY ) ) >= 0 )
103 static const int quality = 100;
110 &msgData, CRYPT_IATTRIBUTE_ENTROPY );
116 CRYPT_IATTRIBUTE_ENTROPY_QUALITY );
125 if( get_key_info( &keyInfo ) == B_NO_ERROR )
126 addRandomData( randomState, &keyInfo,
sizeof(
key_info ) );
128 value = is_computer_on();
130 temperature = is_computer_on_fire();
131 addRandomData( randomState, &temperature,
sizeof(
double ) );
137 while( get_next_team_info( &cookie, &teami ) == B_NO_ERROR )
138 addRandomData( randomState, &teami,
sizeof( teami ) );
145 while( get_next_thread_info( 0, &cookie, &threadi ) == B_NO_ERROR )
148 addRandomData( randomState, &threadi,
sizeof( threadi ) );
156 while( get_next_area_info( 0, &cookie, &areai ) == B_NO_ERROR )
157 addRandomData( randomState, &areai,
sizeof( areai ) );
163 while( get_next_port_info( 0, &cookie, &porti ) == B_NO_ERROR )
164 addRandomData( randomState, &porti,
sizeof( porti ) );
170 while( get_next_sem_info( 0, &cookie, &semi ) == B_NO_ERROR )
171 addRandomData( randomState, &semi,
sizeof( semi ) );
180 while( get_next_image_info( 0, &cookie, &imagei ) == B_NO_ERROR )
181 addRandomData( randomState, &imagei,
sizeof( imagei ) );
187 while( next_dev( &devID ) >= 0 )
191 if( fs_stat_dev( devID, &fsInfo ) == B_NO_ERROR )
192 addRandomData( randomState, &fsInfo,
sizeof( fs_info ) );
196 endRandomData( randomState, 100 );