Home
last modified time | relevance | path

Searched full:rng (Results 1 – 25 of 751) sorted by relevance

12345678910>>...31

/kernel/linux/linux-6.6/drivers/crypto/
Dexynos-rng.c3 * exynos-rng.c - Random Number Generator driver for the Exynos
7 * Loosely based on old driver from drivers/char/hw_random/exynos-rng.c:
21 #include <crypto/internal/rng.h>
66 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()
[all …]
Dqcom-rng.c4 // Based on msm-rng.c and downstream driver
6 #include <crypto/internal/rng.h>
39 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()
[all …]
/kernel/linux/linux-5.10/drivers/crypto/
Dexynos-rng.c3 * exynos-rng.c - Random Number Generator driver for the Exynos
7 * Loosely based on old driver from drivers/char/hw_random/exynos-rng.c:
21 #include <crypto/internal/rng.h>
66 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()
[all …]
Dqcom-rng.c4 // Based on msm-rng.c and downstream driver
6 #include <crypto/internal/rng.h>
38 struct qcom_rng *rng; member
43 static int qcom_rng_read(struct qcom_rng *rng, u8 *data, unsigned int max) in qcom_rng_read() argument
51 ret = readl_poll_timeout(rng->base + PRNG_STATUS, val, in qcom_rng_read()
57 val = readl_relaxed(rng->base + PRNG_DATA_OUT); in qcom_rng_read()
80 struct qcom_rng *rng = ctx->rng; in qcom_rng_generate() local
83 ret = clk_prepare_enable(rng->clk); in qcom_rng_generate()
87 mutex_lock(&rng->lock); in qcom_rng_generate()
89 ret = qcom_rng_read(rng, dstn, dlen); in qcom_rng_generate()
[all …]
/kernel/linux/linux-6.6/drivers/char/hw_random/
Dcore.c34 /* the current rng has been explicitly chosen by user via sysfs */
41 /* Protects rng read functions, data_avail, rng_buffer and rng_fillbuf */
56 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()
[all …]
DMakefile3 # Makefile for HW Random Number Generator (RNG) device drivers.
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
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
[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 …]
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 …]
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 …]
Dcavium-rng.c22 /* Enable the RNG hardware and activate the VF */
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()
33 /*Map the RNG control */ 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()
41 /* Enable the RNG hardware and entropy source */ in cavium_rng_probe()
43 rng->control_status); in cavium_rng_probe()
45 pci_set_drvdata(pdev, rng); in cavium_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 …]
Dingenic-rng.c18 /* RNG register offsets */
36 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()
66 pr_err("%s: Wait for RNG data ready timeout\n", __func__); in ingenic_rng_read()
71 * A delay is required so that the current RNG data is not bit shifted in ingenic_rng_read()
[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()
51 /* care of initial delay time when enabling rng */ in stm32_rng_read()
60 dev_err((struct device *)priv->rng.priv, in stm32_rng_read()
67 "bad RNG status - %x\n", sr)) 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
[all …]
Dbcm2835-rng.c22 /* enable rng */
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
[all …]
/kernel/linux/linux-5.10/drivers/char/hw_random/
DMakefile3 # Makefile for HW Random Number Generator (RNG) device drivers.
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
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
[all …]
Dcore.c35 /* the current rng has been explicitly chosen by user via sysfs */
42 /* Protects rng read functions, data_avail, rng_buffer and rng_fillbuf */
57 static int hwrng_init(struct hwrng *rng);
60 static inline int rng_get_data(struct hwrng *rng, u8 *buffer, size_t size,
68 static void add_early_randomness(struct hwrng *rng) in add_early_randomness() argument
74 bytes_read = rng_get_data(rng, rng_buffer, size, 0); 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()
[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 …]
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 …]
Dcavium-rng.c22 /* Enable the RNG hardware and activate the VF */
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()
33 /*Map the RNG control */ 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()
41 /* Enable the RNG hardware and entropy source */ in cavium_rng_probe()
43 rng->control_status); in cavium_rng_probe()
45 pci_set_drvdata(pdev, rng); in cavium_rng_probe()
[all …]
Dingenic-rng.c18 /* RNG register offsets */
36 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()
66 pr_err("%s: Wait for RNG data ready timeout\n", __func__); in ingenic_rng_read()
71 * A delay is required so that the current RNG data is not bit shifted in ingenic_rng_read()
[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 …]
Dstm32-rng.c31 struct hwrng rng; member
38 static int stm32_rng_read(struct hwrng *rng, void *data, size_t max, bool wait) in stm32_rng_read() argument
41 container_of(rng, struct stm32_rng_private, rng); in stm32_rng_read()
45 pm_runtime_get_sync((struct device *) priv->rng.priv); in stm32_rng_read()
50 /* care of initial delay time when enabling rng */ in stm32_rng_read()
57 dev_err((struct device *)priv->rng.priv, in stm32_rng_read()
64 "bad RNG status - %x\n", sr)) in stm32_rng_read()
76 pm_runtime_mark_last_busy((struct device *) priv->rng.priv); in stm32_rng_read()
77 pm_runtime_put_sync_autosuspend((struct device *) priv->rng.priv); in stm32_rng_read()
82 static int stm32_rng_init(struct hwrng *rng) in stm32_rng_init() argument
[all …]
/kernel/linux/linux-5.10/arch/powerpc/platforms/powernv/
Drng.c6 #define pr_fmt(fmt) "powernv-rng: " fmt
34 struct powernv_rng *rng; in powernv_hwrng_present() local
36 rng = get_cpu_var(powernv_rng); in powernv_hwrng_present()
37 put_cpu_var(rng); in powernv_hwrng_present()
38 return rng != NULL; in powernv_hwrng_present()
41 static unsigned long rng_whiten(struct powernv_rng *rng, unsigned long val) in rng_whiten() argument
53 val ^= rng->mask; in rng_whiten()
56 rng->mask = (rng->mask << 1) | (parity & 1); in rng_whiten()
63 struct powernv_rng *rng; in powernv_get_random_real_mode() local
65 rng = raw_cpu_read(powernv_rng); in powernv_get_random_real_mode()
[all …]
/kernel/linux/linux-6.6/arch/powerpc/platforms/powernv/
Drng.c6 #define pr_fmt(fmt) "powernv-rng: " fmt
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()
[all …]
/kernel/linux/linux-6.6/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 …]

12345678910>>...31