s390: add system information as device randomness
The virtual-machine cpu information data block and the cpu-id of the boot cpu can be used as source of device randomness. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
parent
852ffd0f4e
commit
bcfcbb6bae
@ -24,6 +24,7 @@
|
|||||||
#include <linux/stddef.h>
|
#include <linux/stddef.h>
|
||||||
#include <linux/unistd.h>
|
#include <linux/unistd.h>
|
||||||
#include <linux/ptrace.h>
|
#include <linux/ptrace.h>
|
||||||
|
#include <linux/random.h>
|
||||||
#include <linux/user.h>
|
#include <linux/user.h>
|
||||||
#include <linux/tty.h>
|
#include <linux/tty.h>
|
||||||
#include <linux/ioport.h>
|
#include <linux/ioport.h>
|
||||||
@ -61,6 +62,7 @@
|
|||||||
#include <asm/diag.h>
|
#include <asm/diag.h>
|
||||||
#include <asm/os_info.h>
|
#include <asm/os_info.h>
|
||||||
#include <asm/sclp.h>
|
#include <asm/sclp.h>
|
||||||
|
#include <asm/sysinfo.h>
|
||||||
#include "entry.h"
|
#include "entry.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -766,6 +768,7 @@ static void __init setup_hwcaps(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
get_cpu_id(&cpu_id);
|
get_cpu_id(&cpu_id);
|
||||||
|
add_device_randomness(&cpu_id, sizeof(cpu_id));
|
||||||
switch (cpu_id.machine) {
|
switch (cpu_id.machine) {
|
||||||
case 0x9672:
|
case 0x9672:
|
||||||
#if !defined(CONFIG_64BIT)
|
#if !defined(CONFIG_64BIT)
|
||||||
@ -803,6 +806,19 @@ static void __init setup_hwcaps(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add system information as device randomness
|
||||||
|
*/
|
||||||
|
static void __init setup_randomness(void)
|
||||||
|
{
|
||||||
|
struct sysinfo_3_2_2 *vmms;
|
||||||
|
|
||||||
|
vmms = (struct sysinfo_3_2_2 *) alloc_page(GFP_KERNEL);
|
||||||
|
if (vmms && stsi(vmms, 3, 2, 2) == 0 && vmms->count)
|
||||||
|
add_device_randomness(&vmms, vmms->count);
|
||||||
|
free_page((unsigned long) vmms);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Setup function called from init/main.c just after the banner
|
* Setup function called from init/main.c just after the banner
|
||||||
* was printed.
|
* was printed.
|
||||||
@ -901,6 +917,9 @@ void __init setup_arch(char **cmdline_p)
|
|||||||
|
|
||||||
/* Setup zfcpdump support */
|
/* Setup zfcpdump support */
|
||||||
setup_zfcpdump();
|
setup_zfcpdump();
|
||||||
|
|
||||||
|
/* Add system specific data to the random pool */
|
||||||
|
setup_randomness();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_32BIT
|
#ifdef CONFIG_32BIT
|
||||||
|
Loading…
Reference in New Issue
Block a user