Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Ingo Tuchscherer and committed by
Martin Schwidefsky
db490cb9 05a8256c

+7
+7
drivers/s390/crypto/zcrypt_api.c
··· 54 54 "Copyright IBM Corp. 2001, 2012"); 55 55 MODULE_LICENSE("GPL"); 56 56 57 + static int zcrypt_hwrng_seed = 1; 58 + module_param_named(hwrng_seed, zcrypt_hwrng_seed, int, S_IRUSR|S_IRGRP); 59 + MODULE_PARM_DESC(hwrng_seed, "Turn on/off hwrng auto seed, default is 1 (on)."); 60 + 57 61 static DEFINE_SPINLOCK(zcrypt_device_lock); 58 62 static LIST_HEAD(zcrypt_device_list); 59 63 static int zcrypt_device_count = 0; ··· 1377 1373 static struct hwrng zcrypt_rng_dev = { 1378 1374 .name = "zcrypt", 1379 1375 .data_read = zcrypt_rng_data_read, 1376 + .quality = 990, 1380 1377 }; 1381 1378 1382 1379 static int zcrypt_rng_device_add(void) ··· 1392 1387 goto out; 1393 1388 } 1394 1389 zcrypt_rng_buffer_index = 0; 1390 + if (!zcrypt_hwrng_seed) 1391 + zcrypt_rng_dev.quality = 0; 1395 1392 rc = hwrng_register(&zcrypt_rng_dev); 1396 1393 if (rc) 1397 1394 goto out_free;