Home
last modified time | relevance | path

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

12345678910>>...17

/linux/drivers/crypto/
H A 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 …]
H A Dqcom-rng.c4 // Based on msm-rng.c and downstream driver
6 #include <crypto/internal/rng.h>
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()
[all …]
/linux/drivers/char/hw_random/
H A 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,
69 struct hwrng *rng = container_of(kref, struct hwrng, ref); in cleanup_rng() local
71 if (rng->cleanup) in cleanup_rng()
72 rng->cleanup(rng); in cleanup_rng()
74 complete(&rng->cleanup_done); in cleanup_rng()
77 static int set_current_rng(struct hwrng *rng) in set_current_rng() argument
83 err = hwrng_init(rng); in set_current_rng()
[all …]
H A 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 …]
H A 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 …]
H A 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 …]
H A 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 …]
H A 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 …]
H A 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 …]
H A 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 …]
H A 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 …]
H A Drockchip-rng.c3 * rockchip-rng.c True Random Number Generator driver for Rockchip RK3568 SoC
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
[all …]
H A 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 …]
H A Dpic32-rng.c3 * PIC32 RNG driver
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()
[all …]
H A 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 …]
H A 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 …]
H A Dstm32-rng.c59 * struct stm32_rng_config - RNG configuration data
61 * @cr: RNG configuration. 0 means default hardware RNG configuration
72 struct hwrng rng; member
84 * Extracts from the STM32 RNG specification when RNG supports CONDRST.
86 * When a noise source (or seed) error occurs, the RNG stops generating
92 * Indeed, when SEIS is set and SECS is cleared it means RNG performed
99 * cleared by RNG. The random number generation is now back to normal.
113 /* RNG auto-reset (step 2.) */ in stm32_rng_conceal_seed_error_cond_reset()
141 * Extracts from the STM32 RNG specification, when CONDRST is not supported
143 * When a noise source (or seed) error occurs, the RNG stops generating
[all …]
H A Diproc-rng200.c42 struct hwrng rng; member
46 #define to_rng_priv(rng) container_of(rng, struct iproc_rng200_dev, rng) argument
70 /* Reset RNG and RBG */ in iproc_rng200_restart()
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()
105 /* Is RNG sane? If not, reset it. */ 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()
[all …]
/linux/drivers/gpu/drm/msm/registers/
H A Drules-fd.xsd4 xmlns:rng="http://nouveau.freedesktop.org/"
22 <element name="database" type="rng:databaseType" />
23 <element name="import" type="rng:importType" />
24 <element name="copyright" type="rng:copyrightType" />
25 <element name="domain" type="rng:domainType" />
26 <element name="array" type="rng:arrayType" />
27 <element name="stripe" type="rng:stripeType" />
28 <element name="reg64" type="rng:registerType" />
29 <element name="reg32" type="rng:registerType" />
30 <element name="bitset" type="rng:bitsetType" />
[all …]
/linux/arch/powerpc/platforms/powernv/
H A 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/drivers/crypto/caam/
H A Dcaamrng.c36 /* rng per-device context */
38 struct hwrng rng; member
78 print_hex_dump_debug("rng job desc@: ", DUMP_PREFIX_ADDRESS, in caam_init_desc()
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()
[all …]
/linux/Documentation/devicetree/bindings/rng/
H A 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 …]
H A 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/include/linux/
H A Dhw_random.h21 * @name: Unique RNG name.
25 * on the RNG. If NULL, it is assumed that
27 * @data_read: Read data from the RNG device.
33 * @priv: Private data, for use by the RNG driver.
34 * @quality: Estimation of true entropy in RNG's bitstream
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);
[all …]
/linux/drivers/crypto/amcc/
H A 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 …]

12345678910>>...17