Home
last modified time | relevance | path

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

12345678910>>...16

/Linux-v6.1/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 …]
/Linux-v6.1/drivers/char/hw_random/
Dcore.c32 /* the current rng has been explicitly chosen by user via sysfs */
39 /* Protects rng read functions, data_avail, rng_buffer and rng_fillbuf */
54 static int hwrng_init(struct hwrng *rng);
57 static inline int rng_get_data(struct hwrng *rng, u8 *buffer, size_t size,
65 static void add_early_randomness(struct hwrng *rng) in add_early_randomness() argument
70 bytes_read = rng_get_data(rng, rng_fillbuf, 32, 0); in add_early_randomness()
78 struct hwrng *rng = container_of(kref, struct hwrng, ref); in cleanup_rng() local
80 if (rng->cleanup) in cleanup_rng()
81 rng->cleanup(rng); in cleanup_rng()
83 complete(&rng->cleanup_done); 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 …]
Dcn10k-rng.c34 static unsigned long reset_rng_health_state(struct cn10k_rng *rng) in reset_rng_health_state() argument
43 static int check_rng_health(struct cn10k_rng *rng) in check_rng_health() argument
49 if (!rng->reg_base) in check_rng_health()
52 status = readq(rng->reg_base + RNM_PF_EBG_HEALTH); in check_rng_health()
54 err = reset_rng_health_state(rng); in check_rng_health()
56 dev_err(&rng->pdev->dev, "HWRNG: Health test failed (status=%llx)\n", in check_rng_health()
58 dev_err(&rng->pdev->dev, "HWRNG: error during reset (error=%lx)\n", in check_rng_health()
66 static void cn10k_read_trng(struct cn10k_rng *rng, u64 *value) in cn10k_read_trng() argument
70 *value = readq(rng->reg_base + RNM_PF_RANDOM); in cn10k_read_trng()
76 upper = readq(rng->reg_base + RNM_PF_RANDOM); 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 …]
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 …]
Dbcm2835-rng.c23 /* enable rng */
32 struct hwrng rng; member
39 static inline struct bcm2835_rng_priv *to_rng_priv(struct hwrng *rng) in to_rng_priv() argument
41 return container_of(rng, struct bcm2835_rng_priv, rng); in to_rng_priv()
64 static int bcm2835_rng_read(struct hwrng *rng, void *buf, size_t max, in bcm2835_rng_read() argument
67 struct bcm2835_rng_priv *priv = to_rng_priv(rng); in bcm2835_rng_read()
74 hwrng_msleep(rng, 1000); in bcm2835_rng_read()
87 static int bcm2835_rng_init(struct hwrng *rng) in bcm2835_rng_init() argument
89 struct bcm2835_rng_priv *priv = to_rng_priv(rng); in bcm2835_rng_init()
115 static void bcm2835_rng_cleanup(struct hwrng *rng) in bcm2835_rng_cleanup() argument
[all …]
Dnpcm-rng.c29 #define to_npcm_rng(p) container_of(p, struct npcm_rng, rng)
33 struct hwrng rng; member
36 static int npcm_rng_init(struct hwrng *rng) in npcm_rng_init() argument
38 struct npcm_rng *priv = to_npcm_rng(rng); in npcm_rng_init()
46 static void npcm_rng_cleanup(struct hwrng *rng) in npcm_rng_cleanup() argument
48 struct npcm_rng *priv = to_npcm_rng(rng); in npcm_rng_cleanup()
53 static int npcm_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) in npcm_rng_read() argument
55 struct npcm_rng *priv = to_npcm_rng(rng); in npcm_rng_read()
59 pm_runtime_get_sync((struct device *)priv->rng.priv); in npcm_rng_read()
81 pm_runtime_mark_last_busy((struct device *)priv->rng.priv); in npcm_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()
35 ctl.s.rng_en = 1; /* Enable the RNG hardware. */ 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()
[all …]
Dmxc-rnga.c3 * RNG driver for Freescale RNGA
11 * This driver is based on other RNG drivers.
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
[all …]
Dpasemi-rng.c7 * Driver for the PWRficient onchip rng
34 static int pasemi_rng_data_present(struct hwrng *rng, int wait) in pasemi_rng_data_present() argument
36 void __iomem *rng_regs = (void __iomem *)rng->priv; in pasemi_rng_data_present()
49 static int pasemi_rng_data_read(struct hwrng *rng, u32 *data) in pasemi_rng_data_read() argument
51 void __iomem *rng_regs = (void __iomem *)rng->priv; in pasemi_rng_data_read()
56 static int pasemi_rng_init(struct hwrng *rng) in pasemi_rng_init() argument
58 void __iomem *rng_regs = (void __iomem *)rng->priv; in pasemi_rng_init()
68 static void pasemi_rng_cleanup(struct hwrng *rng) in pasemi_rng_cleanup() argument
70 void __iomem *rng_regs = (void __iomem *)rng->priv; in pasemi_rng_cleanup()
96 pr_info("Registering PA Semi RNG\n"); in rng_probe()
[all …]
Diproc-rng200.c43 struct hwrng rng; member
47 #define to_rng_priv(rng) container_of(rng, struct iproc_rng200_dev, rng) argument
71 /* Reset RNG and RBG */ in iproc_rng200_restart()
91 static int iproc_rng200_read(struct hwrng *rng, void *buf, size_t max, in iproc_rng200_read() argument
94 struct iproc_rng200_dev *priv = to_rng_priv(rng); in iproc_rng200_read()
106 /* Is RNG sane? If not, reset it. */ in iproc_rng200_read()
152 static int iproc_rng200_init(struct hwrng *rng) in iproc_rng200_init() argument
154 struct iproc_rng200_dev *priv = to_rng_priv(rng); in iproc_rng200_init()
161 static void iproc_rng200_cleanup(struct hwrng *rng) in iproc_rng200_cleanup() argument
163 struct iproc_rng200_dev *priv = to_rng_priv(rng); in iproc_rng200_cleanup()
[all …]
/Linux-v6.1/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 …]
/Linux-v6.1/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 …]
Domap_rng.yaml4 $id: http://devicetree.org/schemas/rng/omap_rng.yaml#
15 - ti,omap2-rng
16 - ti,omap4-rng
20 const: rng
22 description: Name of the hwmod associated with the RNG module
49 - ti,omap4-rng
66 rng: rng@48310000 {
67 compatible = "ti,omap4-rng";
68 ti,hwmods = "rng";
74 trng: rng@f2760000 {
Dsparc_sun_oracle_rng.txt6 RNG versions:
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'
/Linux-v6.1/drivers/crypto/amcc/
Dcrypto4xx_trng.c3 * Generic PowerPC 44x RNG driver
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()
65 { .compatible = "ppc4xx-rng", },
66 { .compatible = "amcc,ppc460ex-rng", },
67 { .compatible = "amcc,ppc440epx-rng", },
75 struct hwrng *rng = NULL; in ppc4xx_trng_probe() local
90 rng = kzalloc(sizeof(*rng), GFP_KERNEL); in ppc4xx_trng_probe()
[all …]
/Linux-v6.1/include/linux/
Dhw_random.h22 * @name: Unique RNG name.
26 * on the RNG. If NULL, it is assumed that
28 * @data_read: Read data from the RNG device.
34 * @priv: Private data, for use by the RNG driver.
35 * @quality: Estimation of true entropy in RNG's bitstream
41 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);
[all …]
/Linux-v6.1/drivers/crypto/caam/
Dcaamrng.c34 /* rng per-device context */
36 struct hwrng rng; member
76 print_hex_dump_debug("rng job desc@: ", DUMP_PREFIX_ADDRESS, in caam_init_desc()
145 static int caam_read(struct hwrng *rng, void *dst, size_t max, bool wait) in caam_read() argument
147 struct caam_rng_ctx *ctx = to_caam_rng_ctx(rng); in caam_read()
164 static void caam_cleanup(struct hwrng *rng) in caam_cleanup() argument
166 struct caam_rng_ctx *ctx = to_caam_rng_ctx(rng); in caam_cleanup()
173 static int caam_init(struct hwrng *rng) in caam_init() argument
175 struct caam_rng_ctx *ctx = to_caam_rng_ctx(rng); in caam_init()
225 /* Check for an instantiated RNG before registration */ in caam_rng_init()
[all …]

12345678910>>...16