Home
last modified time | relevance | path

Searched refs:rng (Results 1 – 25 of 303) sorted by relevance

12345678910>>...13

/linux-6.6.21/drivers/crypto/
Dexynos-rng.c66 struct exynos_rng_dev *rng; member
87 static u32 exynos_rng_readl(struct exynos_rng_dev *rng, u32 offset) in exynos_rng_readl() argument
89 return readl_relaxed(rng->mem + offset); in exynos_rng_readl()
92 static void exynos_rng_writel(struct exynos_rng_dev *rng, u32 val, u32 offset) in exynos_rng_writel() argument
94 writel_relaxed(val, rng->mem + offset); in exynos_rng_writel()
97 static int exynos_rng_set_seed(struct exynos_rng_dev *rng, in exynos_rng_set_seed() argument
117 exynos_rng_writel(rng, val, EXYNOS_RNG_SEED(seed_reg)); in exynos_rng_set_seed()
120 val = exynos_rng_readl(rng, EXYNOS_RNG_STATUS); in exynos_rng_set_seed()
122 dev_warn(rng->dev, "Seed setting not finished\n"); in exynos_rng_set_seed()
126 rng->last_seeding = jiffies; in exynos_rng_set_seed()
[all …]
Dqcom-rng.c39 struct qcom_rng *rng; member
44 static int qcom_rng_read(struct qcom_rng *rng, u8 *data, unsigned int max) in qcom_rng_read() argument
52 ret = readl_poll_timeout(rng->base + PRNG_STATUS, val, in qcom_rng_read()
58 val = readl_relaxed(rng->base + PRNG_DATA_OUT); in qcom_rng_read()
81 struct qcom_rng *rng = ctx->rng; in qcom_rng_generate() local
84 ret = clk_prepare_enable(rng->clk); in qcom_rng_generate()
88 mutex_lock(&rng->lock); in qcom_rng_generate()
90 ret = qcom_rng_read(rng, dstn, dlen); in qcom_rng_generate()
92 mutex_unlock(&rng->lock); in qcom_rng_generate()
93 clk_disable_unprepare(rng->clk); in qcom_rng_generate()
[all …]
/linux-6.6.21/drivers/char/hw_random/
Dcore.c56 static int hwrng_init(struct hwrng *rng);
59 static inline int rng_get_data(struct hwrng *rng, u8 *buffer, size_t size,
67 static void add_early_randomness(struct hwrng *rng) in add_early_randomness() argument
72 bytes_read = rng_get_data(rng, rng_fillbuf, 32, 0); in add_early_randomness()
75 size_t entropy = bytes_read * 8 * rng->quality / 1024; in add_early_randomness()
82 struct hwrng *rng = container_of(kref, struct hwrng, ref); in cleanup_rng() local
84 if (rng->cleanup) in cleanup_rng()
85 rng->cleanup(rng); in cleanup_rng()
87 complete(&rng->cleanup_done); in cleanup_rng()
90 static int set_current_rng(struct hwrng *rng) in set_current_rng() argument
[all …]
DMakefile6 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
11 obj-$(CONFIG_HW_RANDOM_ATMEL) += atmel-rng.o
12 obj-$(CONFIG_HW_RANDOM_BA431) += ba431-rng.o
13 obj-$(CONFIG_HW_RANDOM_GEODE) += geode-rng.o
14 obj-$(CONFIG_HW_RANDOM_N2RNG) += n2-rng.o
15 n2-rng-y := n2-drv.o n2-asm.o
[all …]
Dcavium-rng-vf.c82 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 …]
Dcn10k-rng.c69 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 …]
Dhisi-rng.c23 #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 …]
Dmtk-rng.c33 #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 …]
Docteon-rng.c28 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 …]
Dstm32-rng.c32 struct hwrng rng; member
39 static int stm32_rng_read(struct hwrng *rng, void *data, size_t max, bool wait) in stm32_rng_read() argument
42 container_of(rng, struct stm32_rng_private, rng); in stm32_rng_read()
46 pm_runtime_get_sync((struct device *) priv->rng.priv); in stm32_rng_read()
60 dev_err((struct device *)priv->rng.priv, in stm32_rng_read()
79 pm_runtime_mark_last_busy((struct device *) priv->rng.priv); in stm32_rng_read()
80 pm_runtime_put_sync_autosuspend((struct device *) priv->rng.priv); in stm32_rng_read()
85 static int stm32_rng_init(struct hwrng *rng) in stm32_rng_init() argument
88 container_of(rng, struct stm32_rng_private, rng); in stm32_rng_init()
107 static void stm32_rng_cleanup(struct hwrng *rng) in stm32_rng_cleanup() argument
[all …]
Dpic32-rng.c30 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 …]
Dmxc-rnga.c56 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 …]
Dnpcm-rng.c30 #define to_npcm_rng(p) container_of(p, struct npcm_rng, rng)
34 struct hwrng rng; member
38 static int npcm_rng_init(struct hwrng *rng) in npcm_rng_init() argument
40 struct npcm_rng *priv = to_npcm_rng(rng); in npcm_rng_init()
47 static void npcm_rng_cleanup(struct hwrng *rng) in npcm_rng_cleanup() argument
49 struct npcm_rng *priv = to_npcm_rng(rng); in npcm_rng_cleanup()
54 static int npcm_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) in npcm_rng_read() argument
56 struct npcm_rng *priv = to_npcm_rng(rng); in npcm_rng_read()
60 pm_runtime_get_sync((struct device *)priv->rng.priv); in npcm_rng_read()
82 pm_runtime_mark_last_busy((struct device *)priv->rng.priv); in npcm_rng_read()
[all …]
Dingenic-rng.c36 struct hwrng rng; member
39 static int ingenic_rng_init(struct hwrng *rng) in ingenic_rng_init() argument
41 struct ingenic_rng *priv = container_of(rng, struct ingenic_rng, rng); in ingenic_rng_init()
48 static void ingenic_rng_cleanup(struct hwrng *rng) in ingenic_rng_cleanup() argument
50 struct ingenic_rng *priv = container_of(rng, struct ingenic_rng, rng); in ingenic_rng_cleanup()
55 static int ingenic_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) in ingenic_rng_read() argument
57 struct ingenic_rng *priv = container_of(rng, struct ingenic_rng, rng); in ingenic_rng_read()
100 priv->rng.name = pdev->name; in ingenic_rng_probe()
101 priv->rng.init = ingenic_rng_init; in ingenic_rng_probe()
102 priv->rng.cleanup = ingenic_rng_cleanup; in ingenic_rng_probe()
[all …]
Dcavium-rng.c26 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 …]
Dingenic-trng.c32 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 …]
Diproc-rng200.c42 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 …]
Dbcm2835-rng.c31 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()
114 static void bcm2835_rng_cleanup(struct hwrng *rng) in bcm2835_rng_cleanup() argument
116 struct bcm2835_rng_priv *priv = to_rng_priv(rng); in bcm2835_rng_cleanup()
[all …]
/linux-6.6.21/arch/powerpc/platforms/powernv/
Drng.c32 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-6.6.21/Documentation/devicetree/bindings/rng/
Dmtk-rng.yaml4 $id: http://devicetree.org/schemas/rng/mtk-rng.yaml#
14 pattern: "^rng@[0-9a-f]+$"
19 - mediatek,mt7623-rng
22 - mediatek,mt7622-rng
23 - mediatek,mt7629-rng
24 - mediatek,mt7986-rng
25 - mediatek,mt8365-rng
26 - mediatek,mt8516-rng
27 - const: mediatek,mt7623-rng
37 - const: rng
[all …]
Dbrcm,bcm2835.yaml4 $id: http://devicetree.org/schemas/rng/brcm,bcm2835.yaml#
17 - brcm,bcm2835-rng
18 - brcm,bcm-nsp-rng
19 - brcm,bcm5301x-rng
20 - brcm,bcm6368-rng
48 - brcm,bcm6368-rng
60 rng@7e104000 {
61 compatible = "brcm,bcm2835-rng";
67 rng@18033000 {
68 compatible = "brcm,bcm-nsp-rng";
[all …]
/linux-6.6.21/crypto/
Djitterentropy-kcapi.c192 struct jitterentropy *rng = crypto_tfm_ctx(tfm); in jent_kcapi_cleanup() local
194 spin_lock(&rng->jent_lock); in jent_kcapi_cleanup()
196 if (rng->sdesc) { in jent_kcapi_cleanup()
197 shash_desc_zero(rng->sdesc); in jent_kcapi_cleanup()
198 kfree(rng->sdesc); in jent_kcapi_cleanup()
200 rng->sdesc = NULL; in jent_kcapi_cleanup()
202 if (rng->tfm) in jent_kcapi_cleanup()
203 crypto_free_shash(rng->tfm); in jent_kcapi_cleanup()
204 rng->tfm = NULL; in jent_kcapi_cleanup()
206 if (rng->entropy_collector) in jent_kcapi_cleanup()
[all …]
/linux-6.6.21/include/linux/
Dhw_random.h41 int (*init)(struct hwrng *rng);
42 void (*cleanup)(struct hwrng *rng);
43 int (*data_present)(struct hwrng *rng, int wait);
44 int (*data_read)(struct hwrng *rng, u32 *data);
45 int (*read)(struct hwrng *rng, void *data, size_t max, bool wait);
59 extern int hwrng_register(struct hwrng *rng);
60 extern int devm_hwrng_register(struct device *dev, struct hwrng *rng);
62 extern void hwrng_unregister(struct hwrng *rng);
63 extern void devm_hwrng_unregister(struct device *dve, struct hwrng *rng);
65 extern long hwrng_msleep(struct hwrng *rng, unsigned int msecs);
[all …]
/linux-6.6.21/drivers/crypto/caam/
Dcaamrng.c38 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-6.6.21/drivers/crypto/amcc/
Dcrypto4xx_trng.c28 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 …]

12345678910>>...13