/linux/include/linux/ |
H A D | hw_random.h | 20 * struct hwrng - Hardware Random Number Generator driver 38 struct hwrng { struct 40 int (*init)(struct hwrng *rng); argument 41 void (*cleanup)(struct hwrng *rng); argument 42 int (*data_present)(struct hwrng *rng, int wait); argument 43 int (*data_read)(struct hwrng *rng, u32 *data); argument 44 int (*read)(struct hwrng *rng, void *data, size_t max, bool wait); argument 58 extern int hwrng_register(struct hwrng *rng); argument 59 extern int devm_hwrng_register(struct device *dev, struct hwrng *rng); 61 extern void hwrng_unregister(struct hwrng *rng); [all …]
|
/linux/drivers/crypto/ |
H A D | atmel-sha204a.c | 25 struct hwrng *rng = areq; in atmel_sha204a_rng_done() 36 static int atmel_sha204a_rng_read_nonblocking(struct hwrng *rng, void *data, in atmel_sha204a_rng_read_nonblocking() 42 i2c_priv = container_of(rng, struct atmel_i2c_client_priv, hwrng); in atmel_sha204a_rng_read_nonblocking() 70 static int atmel_sha204a_rng_read(struct hwrng *rng, void *data, size_t max, in atmel_sha204a_rng_read() 80 i2c_priv = container_of(rng, struct atmel_i2c_client_priv, hwrng); in atmel_sha204a_rng_read() 161 memset(&i2c_priv->hwrng, 0, sizeof(i2c_priv->hwrng)); in atmel_sha204a_probe() 163 i2c_priv->hwrng.name = dev_name(&client->dev); in atmel_sha204a_probe() 164 i2c_priv->hwrng.read = atmel_sha204a_rng_read; in atmel_sha204a_probe() 167 * According to review by Bill Cox [1], this HWRNG has very low entropy. in atmel_sha204a_probe() 170 i2c_priv->hwrng.quality = 1; in atmel_sha204a_probe() [all …]
|
H A D | qcom-rng.c | 38 struct hwrng hwrng; member 116 static int qcom_hwrng_read(struct hwrng *hwrng, void *data, size_t max, bool wait) in qcom_hwrng_read() argument 118 struct qcom_rng *qrng = container_of(hwrng, struct qcom_rng, hwrng); in qcom_hwrng_read() 210 rng->hwrng.name = "qcom_hwrng"; in qcom_rng_probe() 211 rng->hwrng.read = qcom_hwrng_read; in qcom_rng_probe() 212 rng->hwrng.quality = QCOM_TRNG_QUALITY; in qcom_rng_probe() 213 ret = devm_hwrng_register(&pdev->dev, &rng->hwrng); in qcom_rng_probe() 215 dev_err(&pdev->dev, "Register hwrng failed: %d\n", ret); in qcom_rng_probe()
|
/linux/drivers/char/hw_random/ |
H A D | bcm2835-rng.c | 31 struct hwrng rng; 38 static inline struct bcm2835_rng_priv *to_rng_priv(struct hwrng *rng) in to_rng_priv() 63 static int bcm2835_rng_read(struct hwrng *rng, void *buf, size_t max, in bcm2835_rng_read() 86 static int bcm2835_rng_init(struct hwrng *rng) in bcm2835_rng_init() 116 static void bcm2835_rng_cleanup(struct hwrng *rng) in bcm2835_rng_cleanup() 187 dev_err(dev, "hwrng registration failed\n"); in bcm2835_rng_probe() 189 dev_info(dev, "hwrng registered\n"); in bcm2835_rng_probe()
|
H A D | mpfs-rng.c | 24 struct hwrng rng; 27 static int mpfs_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) in mpfs_rng_read() 77 "Failed to register system controller hwrng sub device\n"); in mpfs_rng_probe() 84 return dev_err_probe(&pdev->dev, ret, "Failed to register MPFS hwrng\n"); in mpfs_rng_probe() 86 dev_info(&pdev->dev, "Registered MPFS hwrng\n"); in mpfs_rng_probe()
|
H A D | octeon-rng.c | 23 struct hwrng ops; 28 static int octeon_rng_init(struct hwrng *rng) in octeon_rng_init() 40 static void octeon_rng_cleanup(struct hwrng *rng) in octeon_rng_cleanup() 50 static int octeon_rng_data_read(struct hwrng *rng, u32 *data) in octeon_rng_data_read() 64 struct hwrng ops = { in octeon_rng_probe()
|
H A D | pasemi-rng.c | 33 static int pasemi_rng_data_present(struct hwrng *rng, int wait) in pasemi_rng_data_present() 48 static int pasemi_rng_data_read(struct hwrng *rng, u32 *data) in pasemi_rng_data_read() 55 static int pasemi_rng_init(struct hwrng *rng) in pasemi_rng_init() 67 static void pasemi_rng_cleanup(struct hwrng *rng) in pasemi_rng_cleanup() 77 static struct hwrng pasemi_rng = {
|
H A D | cn10k-rng.c | 32 struct hwrng ops; 91 dev_err(&rng->pdev->dev, "HWRNG: Health test failed (status=%llx)\n", in check_rng_health() 93 dev_err(&rng->pdev->dev, "HWRNG: error during reset (error=%lx)\n", in check_rng_health() 137 static int cn10k_rng_read(struct hwrng *hwrng, void *data, in cn10k_rng_read() argument 140 struct cn10k_rng *rng = (struct cn10k_rng *)hwrng->priv; in cn10k_rng_read() 207 return dev_err_probe(&pdev->dev, err, "Could not register hwrng device.\n"); in cn10k_rng_probe()
|
H A D | hisi-rng.c | 31 struct hwrng rng; 34 static int hisi_rng_init(struct hwrng *rng) in hisi_rng_init() 57 static void hisi_rng_cleanup(struct hwrng *rng) in hisi_rng_cleanup() 64 static int hisi_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) in hisi_rng_read() 93 return dev_err_probe(&pdev->dev, ret, "failed to register hwrng\n"); in hisi_rng_probe()
|
H A D | powernv-rng.c | 16 static int powernv_rng_read(struct hwrng *rng, void *data, size_t max, bool wait) in powernv_rng_read() 32 static struct hwrng powernv_hwrng = { 50 pr_info("Registered powernv hwrng.\n"); in powernv_rng_probe() 71 MODULE_DESCRIPTION("Bare metal HWRNG driver for POWER7+ and above");
|
H A D | ingenic-trng.c | 32 struct hwrng rng; 35 static int ingenic_trng_init(struct hwrng *rng) in ingenic_trng_init() 47 static void ingenic_trng_cleanup(struct hwrng *rng) in ingenic_trng_cleanup() 57 static int ingenic_trng_read(struct hwrng *rng, void *buf, size_t max, bool wait) in ingenic_trng_read() 103 return dev_err_probe(&pdev->dev, ret, "Failed to register hwrng\n"); in ingenic_trng_probe()
|
H A D | iproc-rng200.c | 42 struct hwrng rng; 90 static int iproc_rng200_read(struct hwrng *rng, void *buf, size_t max, in iproc_rng200_read() 151 static int iproc_rng200_init(struct hwrng *rng) in iproc_rng200_init() 160 static void iproc_rng200_cleanup(struct hwrng *rng) in iproc_rng200_cleanup() 194 dev_err(dev, "hwrng registration failed\n"); in iproc_rng200_probe() 198 dev_info(dev, "hwrng registered\n"); in iproc_rng200_probe()
|
H A D | cavium-rng-vf.c | 30 struct hwrng ops; 95 dev_err(&rng->pdev->dev, "HWRNG: Startup health test failed\n"); in check_rng_health() 133 dev_err(&rng->pdev->dev, "HWRNG failure detected\n"); in check_rng_health() 146 static int cavium_rng_read(struct hwrng *rng, void *dat, size_t max, bool wait) in cavium_rng_read() 202 /* Map Cavium RNG to an HWRNG object */ 238 dev_err(&pdev->dev, "Error registering device as HWRNG.\n"); in cavium_rng_probe_vf()
|
H A D | mxc-rnga.c | 56 struct hwrng rng; 61 static int mxc_rnga_data_present(struct hwrng *rng, int wait) in mxc_rnga_data_present() 77 static int mxc_rnga_data_read(struct hwrng *rng, u32 * data) in mxc_rnga_data_read() 100 static int mxc_rnga_init(struct hwrng *rng) in mxc_rnga_init() 123 static void mxc_rnga_cleanup(struct hwrng *rng) in mxc_rnga_cleanup()
|
H A D | pic32-rng.c | 30 struct hwrng rng; 40 static int pic32_rng_init(struct hwrng *rng) in pic32_rng_init() 49 static int pic32_rng_read(struct hwrng *rng, void *buf, size_t max, in pic32_rng_read() 70 static void pic32_rng_cleanup(struct hwrng *rng) in pic32_rng_cleanup()
|
H A D | optee-rng.c | 67 struct hwrng optee_rng; 115 static int optee_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) in optee_rng_read() 143 static int optee_rng_init(struct hwrng *rng) in optee_rng_init() 160 static void optee_rng_cleanup(struct hwrng *rng) in optee_rng_cleanup() 228 /* Open session with hwrng Trusted App */ in optee_rng_probe() 248 dev_err(dev, "hwrng registration failed (%d)\n", err); in optee_rng_probe()
|
H A D | s390-trng.c | 116 "hwrng: %llu\n" in trng_counter_show() 163 static int trng_hwrng_data_read(struct hwrng *rng, u32 *data) in trng_hwrng_data_read() 174 static int trng_hwrng_read(struct hwrng *rng, void *data, size_t max, bool wait) in trng_hwrng_read() 186 * hwrng register struct 191 static struct hwrng trng_hwrng_dev = {
|
H A D | amd-rng.c | 34 #define DRV_NAME "AMD768-HWRNG" 62 static int amd_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) in amd_rng_read() 95 static int amd_rng_init(struct hwrng *rng) in amd_rng_init() 111 static void amd_rng_cleanup(struct hwrng *rng) in amd_rng_cleanup() 121 static struct hwrng amd_rng = {
|
H A D | meson-rng.c | 26 int (*read)(struct hwrng *rng, void *buf, size_t max, bool wait); 31 struct hwrng rng; 35 static int meson_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) in meson_rng_read() 59 static int meson_s4_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) in meson_s4_rng_read()
|
/linux/drivers/crypto/caam/ |
H A D | caamrng.c | 38 struct hwrng rng; 52 static struct caam_rng_ctx *to_caam_rng_ctx(struct hwrng *r) in to_caam_rng_ctx() 147 static int caam_read(struct hwrng *rng, void *dst, size_t max, bool wait) in caam_read() 166 static void caam_cleanup(struct hwrng *rng) in caam_cleanup() 176 static inline void test_len(struct hwrng *rng, size_t len, bool wait) in test_len() 205 static inline void test_mode_once(struct hwrng *rng, bool wait) in test_mode_once() 212 static void self_test(struct hwrng *rng) in self_test() 219 static int caam_init(struct hwrng *rng) in caam_init()
|
/linux/drivers/hid/ |
H A D | hid-u2fzero.c | 83 struct hwrng hwrng; /* Embedded struct for hwrng */ member 197 static int u2fzero_rng_read(struct hwrng *rng, void *data, in u2fzero_rng_read() 201 struct u2fzero_device, hwrng); in u2fzero_rng_read() 262 dev->hwrng.name = dev->rng_name; in u2fzero_init_hwrng() 263 dev->hwrng.read = u2fzero_rng_read; in u2fzero_init_hwrng() 265 return devm_hwrng_register(&dev->hdev->dev, &dev->hwrng); in u2fzero_init_hwrng()
|
/linux/drivers/firmware/ |
H A D | turris-mox-rwtm.c | 73 * @hwrng: RNG driver structure 90 struct hwrng hwrng; member 252 static int mox_hwrng_read(struct hwrng *rng, void *data, size_t max, bool wait) in mox_hwrng_read() 254 struct mox_rwtm *rwtm = container_of(rng, struct mox_rwtm, hwrng); in mox_hwrng_read() 475 rwtm->hwrng.name = DRIVER_NAME "_hwrng"; in turris_mox_rwtm_probe() 476 rwtm->hwrng.read = mox_hwrng_read; in turris_mox_rwtm_probe() 478 ret = devm_hwrng_register(dev, &rwtm->hwrng); in turris_mox_rwtm_probe() 480 return dev_err_probe(dev, ret, "Cannot register HWRNG!\n"); in turris_mox_rwtm_probe() 482 dev_info(dev, "HWRNG successfully registered\n"); in turris_mox_rwtm_probe()
|
/linux/drivers/crypto/amcc/ |
H A D | crypto4xx_trng.c | 28 static int ppc4xx_trng_data_present(struct hwrng *rng, int wait) in ppc4xx_trng_data_present() 45 static int ppc4xx_trng_data_read(struct hwrng *rng, u32 *data) in ppc4xx_trng_data_read() 75 struct hwrng *rng = NULL; in ppc4xx_trng_probe() 104 dev_err(core_dev->device, "failed to register hwrng (%d).\n", in ppc4xx_trng_probe()
|
/linux/Documentation/admin-guide/ |
H A D | hw_random.rst | 11 a core providing the /dev/hwrng character device and its 21 Those tools use /dev/hwrng to fill the kernel entropy pool, 40 /dev/hwrng is char device major 10, minor 183. 46 connected to /dev/hwrng. If your system has more than one
|
/linux/drivers/crypto/ccp/ |
H A D | ccp-dev.c | 188 ccp->hwrng.name = ccp->rngname; in ccp_register_rng() 189 ccp->hwrng.read = ccp_trng_read; in ccp_register_rng() 190 ret = hwrng_register(&ccp->hwrng); in ccp_register_rng() 192 dev_err(ccp->dev, "error registering hwrng (%d)\n", ret); in ccp_register_rng() 199 if (ccp->hwrng.name) in ccp_unregister_rng() 200 hwrng_unregister(&ccp->hwrng); in ccp_unregister_rng() 506 int ccp_trng_read(struct hwrng *rng, void *data, size_t max, bool wait) in ccp_trng_read() 508 struct ccp_device *ccp = container_of(rng, struct ccp_device, hwrng); in ccp_trng_read() 513 * hwrng-related fields safely in ccp_trng_read()
|