/linux/drivers/char/hw_random/ |
H A D | Makefile | 6 obj-$(CONFIG_HW_RANDOM) += rng-core.o 7 rng-core-y := core.o 8 obj-$(CONFIG_HW_RANDOM_TIMERIOMEM) += timeriomem-rng.o 9 obj-$(CONFIG_HW_RANDOM_INTEL) += intel-rng.o 10 obj-$(CONFIG_HW_RANDOM_AMD) += amd-rng.o 12 obj-$(CONFIG_HW_RANDOM_ATMEL) += atmel-rng.o 13 obj-$(CONFIG_HW_RANDOM_BA431) += ba431-rng.o 14 obj-$(CONFIG_HW_RANDOM_GEODE) += geode-rng.o 15 obj-$(CONFIG_HW_RANDOM_N2RNG) += n2-rng.o 16 n2-rng-y := n2-drv.o n2-asm.o [all …]
|
H A D | cavium-rng-vf.c | 82 static int check_rng_health(struct cavium_rng *rng) in check_rng_health() argument 90 if (!rng->pf_regbase) in check_rng_health() 93 status = readq(rng->pf_regbase + HEALTH_STATUS_REG); in check_rng_health() 95 dev_err(&rng->pdev->dev, "HWRNG: Startup health test failed\n"); in check_rng_health() 110 cur_err = (cycles * 1000000000) / rng->clock_rate; /* In nanosec */ in check_rng_health() 116 rng->prev_error = 0; in check_rng_health() 117 rng->prev_time = 0; in check_rng_health() 121 if (rng->prev_error) { in check_rng_health() 125 time_elapsed = (cur_time - rng->prev_time) * 10; in check_rng_health() 126 time_elapsed += rng->prev_error; in check_rng_health() [all …]
|
H A D | cn10k-rng.c | 69 static unsigned long reset_rng_health_state(struct cn10k_rng *rng) in reset_rng_health_state() argument 78 static int check_rng_health(struct cn10k_rng *rng) in check_rng_health() argument 84 if (!rng->reg_base) in check_rng_health() 87 status = readq(rng->reg_base + RNM_PF_EBG_HEALTH); in check_rng_health() 89 err = reset_rng_health_state(rng); in check_rng_health() 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() 102 static bool cn10k_read_trng(struct cn10k_rng *rng, u64 *value) in cn10k_read_trng() argument 108 if (rng->extended_trng_regs) { in cn10k_read_trng() 110 *value = readq(rng->reg_base + RNM_PF_TRNG_DAT); in cn10k_read_trng() [all …]
|
H A D | hisi-rng.c | 23 #define to_hisi_rng(p) container_of(p, struct hisi_rng, rng) 31 struct hwrng rng; member 34 static int hisi_rng_init(struct hwrng *rng) in hisi_rng_init() argument 36 struct hisi_rng *hrng = to_hisi_rng(rng); in hisi_rng_init() 57 static void hisi_rng_cleanup(struct hwrng *rng) in hisi_rng_cleanup() argument 59 struct hisi_rng *hrng = to_hisi_rng(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() argument 66 struct hisi_rng *hrng = to_hisi_rng(rng); in hisi_rng_read() 75 struct hisi_rng *rng; in hisi_rng_probe() local 78 rng = devm_kzalloc(&pdev->dev, sizeof(*rng), GFP_KERNEL); in hisi_rng_probe() [all …]
|
H A D | rockchip-rng.c | 53 struct hwrng rng; member 60 static void rk_rng_write_ctl(struct rk_rng *rng, u32 val, u32 mask) in rk_rng_write_ctl() argument 62 writel((mask << 16) | val, rng->base + TRNG_RNG_CTL); in rk_rng_write_ctl() 65 static int rk_rng_init(struct hwrng *rng) in rk_rng_init() argument 67 struct rk_rng *rk_rng = container_of(rng, struct rk_rng, rng); in rk_rng_init() 73 dev_err((struct device *) rk_rng->rng.priv, in rk_rng_init() 90 static void rk_rng_cleanup(struct hwrng *rng) in rk_rng_cleanup() argument 92 struct rk_rng *rk_rng = container_of(rng, struct rk_rng, rng); in rk_rng_cleanup() 101 static int rk_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) in rk_rng_read() argument 103 struct rk_rng *rk_rng = container_of(rng, struct rk_rng, rng); in rk_rng_read() [all …]
|
H A D | mtk-rng.c | 33 #define to_mtk_rng(p) container_of(p, struct mtk_rng, rng) 38 struct hwrng rng; member 41 static int mtk_rng_init(struct hwrng *rng) in mtk_rng_init() argument 43 struct mtk_rng *priv = to_mtk_rng(rng); in mtk_rng_init() 58 static void mtk_rng_cleanup(struct hwrng *rng) in mtk_rng_cleanup() argument 60 struct mtk_rng *priv = to_mtk_rng(rng); in mtk_rng_cleanup() 70 static bool mtk_rng_wait_ready(struct hwrng *rng, bool wait) in mtk_rng_wait_ready() argument 72 struct mtk_rng *priv = to_mtk_rng(rng); in mtk_rng_wait_ready() 83 static int mtk_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) in mtk_rng_read() argument 85 struct mtk_rng *priv = to_mtk_rng(rng); in mtk_rng_read() [all …]
|
H A D | octeon-rng.c | 28 static int octeon_rng_init(struct hwrng *rng) in octeon_rng_init() argument 31 struct octeon_rng *p = container_of(rng, struct octeon_rng, ops); in octeon_rng_init() 40 static void octeon_rng_cleanup(struct hwrng *rng) in octeon_rng_cleanup() argument 43 struct octeon_rng *p = container_of(rng, struct octeon_rng, ops); in octeon_rng_cleanup() 50 static int octeon_rng_data_read(struct hwrng *rng, u32 *data) in octeon_rng_data_read() argument 52 struct octeon_rng *p = container_of(rng, struct octeon_rng, ops); in octeon_rng_data_read() 62 struct octeon_rng *rng; in octeon_rng_probe() local 71 rng = devm_kzalloc(&pdev->dev, sizeof(*rng), GFP_KERNEL); in octeon_rng_probe() 72 if (!rng) in octeon_rng_probe() 84 rng->control_status = devm_ioremap(&pdev->dev, in octeon_rng_probe() [all …]
|
H A D | mxc-rnga.c | 56 struct hwrng rng; member 61 static int mxc_rnga_data_present(struct hwrng *rng, int wait) in mxc_rnga_data_present() argument 64 struct mxc_rng *mxc_rng = container_of(rng, struct mxc_rng, rng); in mxc_rnga_data_present() 77 static int mxc_rnga_data_read(struct hwrng *rng, u32 * data) in mxc_rnga_data_read() argument 81 struct mxc_rng *mxc_rng = container_of(rng, struct mxc_rng, rng); in mxc_rnga_data_read() 100 static int mxc_rnga_init(struct hwrng *rng) in mxc_rnga_init() argument 103 struct mxc_rng *mxc_rng = container_of(rng, struct mxc_rng, rng); in mxc_rnga_init() 123 static void mxc_rnga_cleanup(struct hwrng *rng) in mxc_rnga_cleanup() argument 126 struct mxc_rng *mxc_rng = container_of(rng, struct mxc_rng, rng); in mxc_rnga_cleanup() 144 mxc_rng->rng.name = "mxc-rnga"; in mxc_rnga_probe() [all …]
|
H A D | pic32-rng.c | 30 struct hwrng rng; member 40 static int pic32_rng_init(struct hwrng *rng) in pic32_rng_init() argument 42 struct pic32_rng *priv = container_of(rng, struct pic32_rng, rng); in pic32_rng_init() 49 static int pic32_rng_read(struct hwrng *rng, void *buf, size_t max, in pic32_rng_read() argument 52 struct pic32_rng *priv = container_of(rng, struct pic32_rng, rng); in pic32_rng_read() 70 static void pic32_rng_cleanup(struct hwrng *rng) in pic32_rng_cleanup() argument 72 struct pic32_rng *priv = container_of(rng, struct pic32_rng, rng); in pic32_rng_cleanup() 94 priv->rng.name = pdev->name; in pic32_rng_probe() 95 priv->rng.init = pic32_rng_init; in pic32_rng_probe() 96 priv->rng.read = pic32_rng_read; in pic32_rng_probe() [all …]
|
H A D | cavium-rng.c | 26 struct cavium_rng_pf *rng; in cavium_rng_probe() local 29 rng = devm_kzalloc(&pdev->dev, sizeof(*rng), GFP_KERNEL); in cavium_rng_probe() 30 if (!rng) in cavium_rng_probe() 34 rng->control_status = pcim_iomap(pdev, 0, 0); in cavium_rng_probe() 35 if (!rng->control_status) { in cavium_rng_probe() 43 rng->control_status); in cavium_rng_probe() 45 pci_set_drvdata(pdev, rng); in cavium_rng_probe() 51 writeq(0, rng->control_status); in cavium_rng_probe() 64 struct cavium_rng_pf *rng; in cavium_rng_remove() local 66 rng = pci_get_drvdata(pdev); in cavium_rng_remove() [all …]
|
H A D | ingenic-trng.c | 32 struct hwrng rng; member 35 static int ingenic_trng_init(struct hwrng *rng) in ingenic_trng_init() argument 37 struct ingenic_trng *trng = container_of(rng, struct ingenic_trng, rng); in ingenic_trng_init() 47 static void ingenic_trng_cleanup(struct hwrng *rng) in ingenic_trng_cleanup() argument 49 struct ingenic_trng *trng = container_of(rng, struct ingenic_trng, 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() argument 59 struct ingenic_trng *trng = container_of(rng, struct ingenic_trng, rng); in ingenic_trng_read() 96 trng->rng.name = pdev->name; in ingenic_trng_probe() 97 trng->rng.init = ingenic_trng_init; in ingenic_trng_probe() 98 trng->rng.cleanup = ingenic_trng_cleanup; in ingenic_trng_probe() [all …]
|
H A D | iproc-rng200.c | 42 struct hwrng rng; member 46 #define to_rng_priv(rng) container_of(rng, struct iproc_rng200_dev, rng) argument 90 static int iproc_rng200_read(struct hwrng *rng, void *buf, size_t max, in iproc_rng200_read() argument 93 struct iproc_rng200_dev *priv = to_rng_priv(rng); in iproc_rng200_read() 151 static int iproc_rng200_init(struct hwrng *rng) in iproc_rng200_init() argument 153 struct iproc_rng200_dev *priv = to_rng_priv(rng); in iproc_rng200_init() 160 static void iproc_rng200_cleanup(struct hwrng *rng) in iproc_rng200_cleanup() argument 162 struct iproc_rng200_dev *priv = to_rng_priv(rng); in iproc_rng200_cleanup() 186 priv->rng.name = "iproc-rng200"; in iproc_rng200_probe() 187 priv->rng.read = iproc_rng200_read; in iproc_rng200_probe() [all …]
|
H A D | bcm2835-rng.c | 31 struct hwrng rng; member 38 static inline struct bcm2835_rng_priv *to_rng_priv(struct hwrng *rng) in to_rng_priv() argument 40 return container_of(rng, struct bcm2835_rng_priv, rng); in to_rng_priv() 63 static int bcm2835_rng_read(struct hwrng *rng, void *buf, size_t max, in bcm2835_rng_read() argument 66 struct bcm2835_rng_priv *priv = to_rng_priv(rng); in bcm2835_rng_read() 73 hwrng_yield(rng); in bcm2835_rng_read() 86 static int bcm2835_rng_init(struct hwrng *rng) in bcm2835_rng_init() argument 88 struct bcm2835_rng_priv *priv = to_rng_priv(rng); in bcm2835_rng_init() 116 static void bcm2835_rng_cleanup(struct hwrng *rng) in bcm2835_rng_cleanup() argument 118 struct bcm2835_rng_priv *priv = to_rng_priv(rng); in bcm2835_rng_cleanup() [all …]
|
H A D | ba431-rng.c | 42 struct hwrng rng; member 115 static int ba431_trng_read(struct hwrng *rng, void *buf, size_t max, bool wait) in ba431_trng_read() argument 117 struct ba431_trng *ba431 = container_of(rng, struct ba431_trng, rng); in ba431_trng_read() 155 static void ba431_trng_cleanup(struct hwrng *rng) in ba431_trng_cleanup() argument 157 struct ba431_trng *ba431 = container_of(rng, struct ba431_trng, rng); in ba431_trng_cleanup() 163 static int ba431_trng_init(struct hwrng *rng) in ba431_trng_init() argument 165 struct ba431_trng *ba431 = container_of(rng, struct ba431_trng, rng); in ba431_trng_init() 187 ba431->rng.name = pdev->name; in ba431_trng_probe() 188 ba431->rng.init = ba431_trng_init; in ba431_trng_probe() 189 ba431->rng.cleanup = ba431_trng_cleanup; in ba431_trng_probe() [all …]
|
H A D | meson-rng.c | 26 int (*read)(struct hwrng *rng, void *buf, size_t max, bool wait); 31 struct hwrng rng; member 35 static int meson_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) in meson_rng_read() argument 38 container_of(rng, struct meson_rng_data, rng); 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() argument 62 container_of(rng, struct meson_rng_data, rng); in meson_s4_rng_read() 110 data->rng.name = pdev->name; in meson_rng_probe() 111 data->rng.read = priv->read; in meson_rng_probe() 115 return devm_hwrng_register(dev, &data->rng); in meson_rng_probe()
|
H A D | imx-rngc.c | 64 struct hwrng rng; member 122 static int imx_rngc_read(struct hwrng *rng, void *data, size_t max, bool wait) in imx_rngc_read() argument 124 struct imx_rngc *rngc = container_of(rng, struct imx_rngc, rng); in imx_rngc_read() 168 static int imx_rngc_init(struct hwrng *rng) in imx_rngc_init() argument 170 struct imx_rngc *rngc = container_of(rng, struct imx_rngc, rng); in imx_rngc_init() 220 static void imx_rngc_cleanup(struct hwrng *rng) in imx_rngc_cleanup() argument 222 struct imx_rngc *rngc = container_of(rng, struct imx_rngc, rng); in imx_rngc_cleanup() 262 rngc->rng.name = pdev->name; in imx_rngc_probe() 263 rngc->rng.init = imx_rngc_init; in imx_rngc_probe() 264 rngc->rng.read = imx_rngc_read; in imx_rngc_probe() [all …]
|
H A D | pasemi-rng.c | 33 static int pasemi_rng_data_present(struct hwrng *rng, int wait) in pasemi_rng_data_present() argument 35 void __iomem *rng_regs = (void __iomem *)rng->priv; in pasemi_rng_data_present() 48 static int pasemi_rng_data_read(struct hwrng *rng, u32 *data) in pasemi_rng_data_read() argument 50 void __iomem *rng_regs = (void __iomem *)rng->priv; in pasemi_rng_data_read() 55 static int pasemi_rng_init(struct hwrng *rng) in pasemi_rng_init() argument 57 void __iomem *rng_regs = (void __iomem *)rng->priv; in pasemi_rng_init() 67 static void pasemi_rng_cleanup(struct hwrng *rng) in pasemi_rng_cleanup() argument 69 void __iomem *rng_regs = (void __iomem *)rng->priv; in pasemi_rng_cleanup()
|
H A D | xiphera-trng.c | 32 struct hwrng rng; member 35 static int xiphera_trng_read(struct hwrng *rng, void *buf, size_t max, bool wait) in xiphera_trng_read() argument 37 struct xiphera_trng *trng = container_of(rng, struct xiphera_trng, rng); in xiphera_trng_read() 114 trng->rng.name = pdev->name; in xiphera_trng_probe() 115 trng->rng.read = xiphera_trng_read; in xiphera_trng_probe() 116 trng->rng.quality = 900; in xiphera_trng_probe() 118 ret = devm_hwrng_register(dev, &trng->rng); in xiphera_trng_probe()
|
/linux/drivers/crypto/ |
H A D | qcom-rng.c | 43 struct qcom_rng *rng; member 53 static int qcom_rng_read(struct qcom_rng *rng, u8 *data, unsigned int max) in qcom_rng_read() argument 61 ret = readl_poll_timeout(rng->base + PRNG_STATUS, val, in qcom_rng_read() 67 val = readl_relaxed(rng->base + PRNG_DATA_OUT); in qcom_rng_read() 90 struct qcom_rng *rng = ctx->rng; in qcom_rng_generate() local 93 ret = clk_prepare_enable(rng->clk); in qcom_rng_generate() 97 mutex_lock(&rng->lock); in qcom_rng_generate() 99 ret = qcom_rng_read(rng, dstn, dlen); in qcom_rng_generate() 101 mutex_unlock(&rng->lock); in qcom_rng_generate() 102 clk_disable_unprepare(rng->clk); in qcom_rng_generate() [all …]
|
/linux/arch/powerpc/platforms/powernv/ |
H A D | rng.c | 32 static unsigned long rng_whiten(struct pnv_rng *rng, unsigned long val) in rng_whiten() argument 44 val ^= rng->mask; in rng_whiten() 47 rng->mask = (rng->mask << 1) | (parity & 1); in rng_whiten() 86 struct pnv_rng *rng; in pnv_get_random_long() local 89 rng = get_cpu_var(pnv_rng); in pnv_get_random_long() 90 *v = rng_whiten(rng, in_be64(rng->regs)); in pnv_get_random_long() 91 put_cpu_var(rng); in pnv_get_random_long() 93 rng = raw_cpu_read(pnv_rng); in pnv_get_random_long() 94 *v = rng_whiten(rng, __raw_rm_readq(rng->regs_real)); in pnv_get_random_long() 100 static __init void rng_init_per_cpu(struct pnv_rng *rng, in rng_init_per_cpu() argument [all …]
|
/linux/crypto/ |
H A D | jitterentropy-kcapi.c | 202 struct jitterentropy *rng = crypto_tfm_ctx(tfm); in jent_kcapi_cleanup() local 204 spin_lock(&rng->jent_lock); in jent_kcapi_cleanup() 206 if (rng->sdesc) { in jent_kcapi_cleanup() 207 shash_desc_zero(rng->sdesc); in jent_kcapi_cleanup() 208 kfree(rng->sdesc); in jent_kcapi_cleanup() 210 rng->sdesc = NULL; in jent_kcapi_cleanup() 212 if (rng->tfm) in jent_kcapi_cleanup() 213 crypto_free_shash(rng->tfm); in jent_kcapi_cleanup() 214 rng->tfm = NULL; in jent_kcapi_cleanup() 216 if (rng->entropy_collector) in jent_kcapi_cleanup() [all …]
|
/linux/drivers/crypto/caam/ |
H A D | caamrng.c | 38 struct hwrng rng; member 147 static int caam_read(struct hwrng *rng, void *dst, size_t max, bool wait) in caam_read() argument 149 struct caam_rng_ctx *ctx = to_caam_rng_ctx(rng); in caam_read() 166 static void caam_cleanup(struct hwrng *rng) in caam_cleanup() argument 168 struct caam_rng_ctx *ctx = to_caam_rng_ctx(rng); in caam_cleanup() 176 static inline void test_len(struct hwrng *rng, size_t len, bool wait) in test_len() argument 180 struct caam_rng_ctx *ctx = to_caam_rng_ctx(rng); in test_len() 186 read_len = rng->read(rng, buf, len, wait); in test_len() 205 static inline void test_mode_once(struct hwrng *rng, bool wait) in test_mode_once() argument 207 test_len(rng, 32, wait); in test_mode_once() [all …]
|
/linux/include/linux/ |
H A D | hw_random.h | 40 int (*init)(struct hwrng *rng); 41 void (*cleanup)(struct hwrng *rng); 42 int (*data_present)(struct hwrng *rng, int wait); 43 int (*data_read)(struct hwrng *rng, u32 *data); 44 int (*read)(struct hwrng *rng, void *data, size_t max, bool wait); 58 extern int hwrng_register(struct hwrng *rng); 59 extern int devm_hwrng_register(struct device *dev, struct hwrng *rng); 61 extern void hwrng_unregister(struct hwrng *rng); 62 extern void devm_hwrng_unregister(struct device *dve, struct hwrng *rng); 64 extern long hwrng_msleep(struct hwrng *rng, unsigned int msecs); [all …]
|
/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() argument 30 struct crypto4xx_device *dev = (void *)rng->priv; in ppc4xx_trng_data_present() 45 static int ppc4xx_trng_data_read(struct hwrng *rng, u32 *data) in ppc4xx_trng_data_read() argument 47 struct crypto4xx_device *dev = (void *)rng->priv; in ppc4xx_trng_data_read() 75 struct hwrng *rng = NULL; in ppc4xx_trng_probe() local 90 rng = kzalloc(sizeof(*rng), GFP_KERNEL); in ppc4xx_trng_probe() 91 if (!rng) in ppc4xx_trng_probe() 94 rng->name = KBUILD_MODNAME; in ppc4xx_trng_probe() 95 rng->data_present = ppc4xx_trng_data_present; in ppc4xx_trng_probe() 96 rng->data_read = ppc4xx_trng_data_read; in ppc4xx_trng_probe() [all …]
|
/linux/Documentation/devicetree/bindings/rng/ |
H A D | sparc_sun_oracle_rng.txt | 7 - 'SUNW,n2-rng' for Niagara 2 Platform (SUN UltraSPARC T2 CPU) 8 - 'SUNW,vf-rng' for Victoria Falls Platform (SUN UltraSPARC T2 Plus CPU) 9 …- 'SUNW,kt-rng' for Rainbow/Yosemite Falls Platform (SUN SPARC T3/T4), (UltraSPARC KT/Niagara 3 - … 11 - 'ORCL,m4-rng' for SPARC T5/M5 12 - 'ORCL,m7-rng' for SPARC T7/M7 18 rng-#units: 00000002 19 compatible: 'ORCL,m4-rng' 25 rng-#units: 00000003 26 compatible: 'ORCL,m7-rng'
|