moved type and constants for random data to include file;
added consistency check in random; added source of randomness internal to random using timing; only retrieve random bins that are full.
This commit is contained in:
@@ -290,28 +290,6 @@ int proc_type; /* system or user process flag */
|
||||
return(OK);
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* get_randomness *
|
||||
*===========================================================================*/
|
||||
PUBLIC void get_randomness(source)
|
||||
int source;
|
||||
{
|
||||
/* Use architecture-dependent high-resolution clock for
|
||||
* raw entropy gathering.
|
||||
*/
|
||||
int r_next;
|
||||
unsigned long tsc_high, tsc_low;
|
||||
|
||||
source %= RANDOM_SOURCES;
|
||||
r_next= krandom.bin[source].r_next;
|
||||
read_tsc(&tsc_high, &tsc_low);
|
||||
krandom.bin[source].r_buf[r_next] = tsc_low;
|
||||
if (krandom.bin[source].r_size < RANDOM_ELEMENTS) {
|
||||
krandom.bin[source].r_size ++;
|
||||
}
|
||||
krandom.bin[source].r_next = (r_next + 1 ) % RANDOM_ELEMENTS;
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* send_sig *
|
||||
*===========================================================================*/
|
||||
|
||||
Reference in New Issue
Block a user