s390/zcrypt: enable s390 hwrng to seed kernel entropy
Set the 'quality' property in the zcrypt rng device structure to enable the zcrypt hwrng device to take part in the kernel entropy seeding process. A module parameter named hwrng_seed will be introduced to disable the participation. By default this parameter is set to 1 (enabled). Signed-off-by: Ingo Tuchscherer <ingo.tuchscherer@de.ibm.com> Signed-off-by: Harald Freudenberger <freude@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
parent
05a8256c58
commit
db490cb9ae
@ -54,6 +54,10 @@ MODULE_DESCRIPTION("Cryptographic Coprocessor interface, " \
|
|||||||
"Copyright IBM Corp. 2001, 2012");
|
"Copyright IBM Corp. 2001, 2012");
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
|
|
||||||
|
static int zcrypt_hwrng_seed = 1;
|
||||||
|
module_param_named(hwrng_seed, zcrypt_hwrng_seed, int, S_IRUSR|S_IRGRP);
|
||||||
|
MODULE_PARM_DESC(hwrng_seed, "Turn on/off hwrng auto seed, default is 1 (on).");
|
||||||
|
|
||||||
static DEFINE_SPINLOCK(zcrypt_device_lock);
|
static DEFINE_SPINLOCK(zcrypt_device_lock);
|
||||||
static LIST_HEAD(zcrypt_device_list);
|
static LIST_HEAD(zcrypt_device_list);
|
||||||
static int zcrypt_device_count = 0;
|
static int zcrypt_device_count = 0;
|
||||||
@ -1373,6 +1377,7 @@ static int zcrypt_rng_data_read(struct hwrng *rng, u32 *data)
|
|||||||
static struct hwrng zcrypt_rng_dev = {
|
static struct hwrng zcrypt_rng_dev = {
|
||||||
.name = "zcrypt",
|
.name = "zcrypt",
|
||||||
.data_read = zcrypt_rng_data_read,
|
.data_read = zcrypt_rng_data_read,
|
||||||
|
.quality = 990,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int zcrypt_rng_device_add(void)
|
static int zcrypt_rng_device_add(void)
|
||||||
@ -1387,6 +1392,8 @@ static int zcrypt_rng_device_add(void)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
zcrypt_rng_buffer_index = 0;
|
zcrypt_rng_buffer_index = 0;
|
||||||
|
if (!zcrypt_hwrng_seed)
|
||||||
|
zcrypt_rng_dev.quality = 0;
|
||||||
rc = hwrng_register(&zcrypt_rng_dev);
|
rc = hwrng_register(&zcrypt_rng_dev);
|
||||||
if (rc)
|
if (rc)
|
||||||
goto out_free;
|
goto out_free;
|
||||||
|
Loading…
Reference in New Issue
Block a user