Data Co-processor RNG Driver
Subsystems (4)
v2 cover Data Co-processor RNG Driver
Implemented Data Co-Processor random number generation driver.
usage command:
rng <number of bytes>
Kshitiz Varshney (3):
Uboot RNG Driver using Data Co-processor
Added dcp_rng driver initialization code
Added configs required for dcp_rng driver
arch/arm/mach-imx/mx6/soc.c | 10 ++ configs/mx6ull_14x14_evk_defconfig | 4 + configs/mx6ull_14x14_evk_plugin_defconfig | 4 + drivers/crypto/fsl/Kconfig | 10 ++ drivers/crypto/fsl/Makefile | 1 + drivers/crypto/fsl/dcp_rng.c | 182 ++++++++++++++++++++++ 6 files changed, 211 insertions(+) create mode 100644 drivers/crypto/fsl/dcp_rng.c
Signature · 1 line
2.25.1
PATCH v2 1/3 Uboot RNG Driver using Data Co-processor
This commit introduces Random number generator to uboot. It uses DCP driver for number generation.
RNG driver can be invoked by using below command on uboot prompt:-
rng <number of bytes>
--- drivers/crypto/fsl/Kconfig | 10 ++ drivers/crypto/fsl/Makefile | 1 + drivers/crypto/fsl/dcp_rng.c | 182 +++++++++++++++++++++++++++++++++++ 3 files changed, 193 insertions(+) create mode 100644 drivers/crypto/fsl/dcp_rng.c
drivers/crypto/fsl/Kconfig +10 -0
@@ -73,3 +73,13 @@ config FSL_CAAM_RNG reseeded from the TRNG every time random data is generated. endif + +config FSL_DCP_RNG + bool "Enable Random Number Generator support" + depends on DM_RNG + default n + help + Enable support for the hardware based random number generator + module of the DCP. It uses the True Random Number Generator (TRNG) + and a Pseudo-Random Number Generator (PRNG) to achieve a true + randomness and cryptographic strength.
drivers/crypto/fsl/Makefile +1 -0
@@ -7,4 +7,5 @@ obj-$(CONFIG_FSL_CAAM) += jr.o fsl_hash.o jobdesc.o error.o obj-$(CONFIG_CMD_BLOB)$(CONFIG_IMX_CAAM_DEK_ENCAP) += fsl_blob.o obj-$(CONFIG_RSA_FREESCALE_EXP) += fsl_rsa.o obj-$(CONFIG_FSL_CAAM_RNG) += rng.o +obj-$(CONFIG_FSL_DCP_RNG) += dcp_rng.o obj-$(CONFIG_FSL_MFGPROT) += fsl_mfgprot.o
drivers/crypto/fsl/dcp_rng.c new file +182 -0
182 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH v2 1/3] Uboot RNG Driver using Data Co-processor
Quoted 8 lines · Kshitiz Varshney
This commit introduces Random number generator to uboot. It uses DCP driver for number generation.
RNG driver can be invoked by using below command on uboot prompt:-
rng <number of bytes>Signed-off-by Kshitiz Varshney <[email protected]>Reviewed-by Ye Li <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH v2 2/3 Added dcp_rng driver initialization code
In reply to Kshitiz VarshneyThis commit initializes dcp_rng device driver inside arch_misc_init() function.
--- arch/arm/mach-imx/mx6/soc.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/mach-imx/mx6/soc.c +10 -0
@@ -746,6 +746,16 @@ int arch_misc_init(void)if (ret)printf ("Failed to initialize caam_jr: %d\n" , ret); } + +if (IS_ENABLED (CONFIG_FSL_DCP_RNG )) { +struct udevice *dev; +int ret; + + ret =uclass_get_device_by_driver (UCLASS_RNG ,DM_DRIVER_GET (dcp_rng), &dev); +if (ret) +printf ("Failed to initialize dcp rng: %d\n" , ret); + } +setup_serial_number ();return 0 ; }
Signature · 1 line
2.25.1
Re: [PATCH v2 2/3] Added dcp_rng driver initialization code
Quoted 5 lines · Kshitiz Varshney
This commit initializes
dcp_rngdevice driver insidearch_misc_init()function.Signed-off-by Kshitiz Varshney <[email protected]>Reviewed-by Ye Li <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH v2 3/3 Added configs required for dcp_rng driver
In reply to Kshitiz VarshneyThis commit adds configs required for using dcp_rng driver in imx6ull defconfig files.
--- configs/mx6ull_14x14_evk_defconfig | 4 ++++ configs/mx6ull_14x14_evk_plugin_defconfig | 4 ++++ 2 files changed, 8 insertions(+)
configs/mx6ull_14x14_evk_defconfig +4 -0
@@ -65,3 +65,7 @@ CONFIG_DM_SPI=y CONFIG_FSL_QSPI=y CONFIG_SOFT_SPI=y CONFIG_IMX_THERMAL=y +CONFIG_ARCH_MISC_INIT=y +CONFIG_DM_RNG=y +CONFIG_CMD_RNG=y +CONFIG_FSL_DCP_RNG=y
configs/mx6ull_14x14_evk_plugin_defconfig +4 -0
@@ -64,3 +64,7 @@ CONFIG_DM_SPI=y CONFIG_FSL_QSPI=y CONFIG_SOFT_SPI=y CONFIG_IMX_THERMAL=y +CONFIG_ARCH_MISC_INIT=y +CONFIG_DM_RNG=y +CONFIG_CMD_RNG=y +CONFIG_FSL_DCP_RNG=y
Signature · 1 line
2.25.1
Re: [PATCH v2 3/3] Added configs required for dcp_rng driver
Quoted 5 lines · Kshitiz Varshney
This commit adds configs required for using
dcp_rngdriver in imx6ull defconfig files.Signed-off-by Kshitiz Varshney <[email protected]>Reviewed-by Ye Li <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
Quoted 5 lines · Kshitiz Varshney
Implemented Data Co-Processor random number generation driver.
usage command:
rng <number of bytes>
Quoted 8 lines
Kshitiz Varshney (3):
Uboot RNG Driver using Data Co-processor
Addeddcp_rngdriver initialization code
Added configs required fordcp_rngdriverarch/arm/mach-imx/mx6/soc.c | 10 ++ configs/mx6ull_14x14_evk_defconfig | 4 + configs/mx6ull_14x14_evk_plugin_defconfig | 4 +
Do these boards lack the CAAM RNG supported by drivers/crypto/fsl/rng.c?
Best regards
Heinrich
Quoted 6 lines
drivers/crypto/fsl/Kconfig | 10 ++ drivers/crypto/fsl/Makefile | 1 + drivers/crypto/fsl/dcp_rng.c | 182 ++++++++++++++++++++++ 6 files changed, 211 insertions(+)create mode 100644
drivers/crypto/fsl/dcp_rng.c
Fabio Estevam
reviewerHi Heinrich,
Quoted 4 lines · Heinrich Schuchardt
Quoted 2 lines
configs/mx6ull_14x14_evk_defconfig | 4 + configs/mx6ull_14x14_evk_plugin_defconfig | 4 +Do these boards lack the CAAM RNG supported by
drivers/crypto/fsl/rng.c?
imx6ull does not have CAAM.