Skip to content

Commit

Permalink
Merge tag 'u-boot-imx-master-20240505' of https://gitlab.denx.de/u-bo…
Browse files Browse the repository at this point in the history
…ot/custodians/u-boot-imx

CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/20614

- Add SPL variant of DM_RNG so that the DM_RNG can be disabled in SPL if
  necessary. This may be necessary due to e.g. size constraints of the SPL.
- dd SPL variant of SPL_FSL_CAAM_RNG so that the SPL_FSL_CAAM_RNG can be
  disabled in SPL if necessary. This may be necessary due to e.g.  size
  constraints of the SPL.
- Differentiate between CAAM and DCP in Kconfig entry.
  • Loading branch information
trini committed May 5, 2024
2 parents 2f1e76b + cecb5fb commit 6114b86
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 14 deletions.
4 changes: 1 addition & 3 deletions boot/pxe_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
#include <errno.h>
#include <linux/list.h>

#ifdef CONFIG_DM_RNG
#include <rng.h>
#endif

#include <splash.h>
#include <asm/io.h>
Expand Down Expand Up @@ -323,7 +321,7 @@ static int label_localboot(struct pxe_label *label)

static void label_boot_kaslrseed(void)
{
#ifdef CONFIG_DM_RNG
#if CONFIG_IS_ENABLED(DM_RNG)
ulong fdt_addr;
struct fdt_header *working_fdt;
size_t n = 0x8;
Expand Down
2 changes: 1 addition & 1 deletion boot/vbe_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static int handle_random_req(ofnode node, int default_size,
u32 size;
int ret;

if (!IS_ENABLED(CONFIG_DM_RNG))
if (!CONFIG_IS_ENABLED(DM_RNG))
return -ENOTSUPP;

if (ofnode_read_u32(node, "vbe,size", &size)) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ obj-$(CONFIG_W1_EEPROM) += w1-eeprom/
obj-$(CONFIG_MACH_PIC32) += ddr/microchip/
obj-$(CONFIG_FUZZ) += fuzz/
obj-$(CONFIG_DM_HWSPINLOCK) += hwspinlock/
obj-$(CONFIG_DM_RNG) += rng/
obj-$(CONFIG_$(SPL_TPL_)DM_RNG) += rng/
endif

obj-y += soc/
11 changes: 9 additions & 2 deletions drivers/crypto/fsl/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ config FSL_CAAM_JR_NTZ_ACCESS
driver is used.

config FSL_CAAM_RNG
bool "Enable Random Number Generator support"
bool "Enable CAAM Random Number Generator support"
depends on DM_RNG
default y
help
Expand All @@ -78,10 +78,17 @@ config FSL_CAAM_RNG
using the prediction resistance flag which means the DRGB is
reseeded from the TRNG every time random data is generated.

config SPL_FSL_CAAM_RNG
bool "Enable CAAM Random Number Generator support in SPL"
depends on SPL_DM_RNG
help
This option is an SPL-variant of the FSL_CAAM_RNG option.
See the help of FSL_CAAM_RNG for details.

endif

config FSL_DCP_RNG
bool "Enable Random Number Generator support"
bool "Enable DCP Random Number Generator support"
depends on DM_RNG
help
Enable support for the hardware based random number generator
Expand Down
2 changes: 1 addition & 1 deletion drivers/crypto/fsl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ obj-y += sec.o
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_$(SPL_TPL_)FSL_CAAM_RNG) += rng.o
obj-$(CONFIG_FSL_DCP_RNG) += dcp_rng.o
obj-$(CONFIG_FSL_MFGPROT) += fsl_mfgprot.o
4 changes: 2 additions & 2 deletions drivers/crypto/fsl/jr.c
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ int sec_init_idx(uint8_t sec_idx)
}
#if CONFIG_IS_ENABLED(OF_CONTROL)
if (ofnode_valid(scu_node)) {
if (IS_ENABLED(CONFIG_DM_RNG)) {
if (CONFIG_IS_ENABLED(DM_RNG)) {
ret = device_bind_driver(NULL, "caam-rng", "caam-rng", NULL);
if (ret)
printf("Couldn't bind rng driver (%d)\n", ret);
Expand All @@ -810,7 +810,7 @@ int sec_init_idx(uint8_t sec_idx)
return -1;
}

if (IS_ENABLED(CONFIG_DM_RNG)) {
if (CONFIG_IS_ENABLED(DM_RNG)) {
ret = device_bind_driver(NULL, "caam-rng", "caam-rng",
NULL);
if (ret)
Expand Down
7 changes: 7 additions & 0 deletions drivers/rng/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ config DM_RNG
This interface is used to initialise the rng device and to
read the random seed from the device.

config SPL_DM_RNG
bool "Driver support for Random Number Generator devices in SPL"
depends on SPL_DM
help
This option is an SPL-variant of the DM_RNG option.
See the help of DM_RNG for details.

if DM_RNG

config RNG_MESON
Expand Down
2 changes: 1 addition & 1 deletion drivers/rng/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright (c) 2019, Linaro Limited
#

obj-$(CONFIG_DM_RNG) += rng-uclass.o
obj-$(CONFIG_$(SPL_TPL_)DM_RNG) += rng-uclass.o
obj-$(CONFIG_RNG_MESON) += meson-rng.o
obj-$(CONFIG_RNG_SANDBOX) += sandbox_rng.o
obj-$(CONFIG_RNG_MSM) += msm_rng.o
Expand Down
2 changes: 1 addition & 1 deletion lib/uuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ void gen_rand_uuid(unsigned char *uuid_bin)
struct udevice *devp;
u32 randv = 0;

if (IS_ENABLED(CONFIG_DM_RNG)) {
if (CONFIG_IS_ENABLED(DM_RNG)) {
ret = uclass_get_device(UCLASS_RNG, 0, &devp);
if (!ret) {
ret = dm_rng_read(devp, &randv, sizeof(randv));
Expand Down
2 changes: 1 addition & 1 deletion net/net_rand.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static inline void srand_mac(void)
struct udevice *devp;
u32 randv = 0;

if (IS_ENABLED(CONFIG_DM_RNG)) {
if (CONFIG_IS_ENABLED(DM_RNG)) {
ret = uclass_get_device(UCLASS_RNG, 0, &devp);
if (ret) {
ret = dm_rng_read(devp, &randv, sizeof(randv));
Expand Down
2 changes: 1 addition & 1 deletion test/dm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ obj-$(CONFIG_DM_RESET) += reset.o
obj-$(CONFIG_SYSRESET) += sysreset.o
obj-$(CONFIG_DM_REGULATOR) += regulator.o
obj-$(CONFIG_CMD_RKMTD) += rkmtd.o
obj-$(CONFIG_DM_RNG) += rng.o
obj-$(CONFIG_$(SPL_TPL_)DM_RNG) += rng.o
obj-$(CONFIG_DM_RTC) += rtc.o
obj-$(CONFIG_SCMI_FIRMWARE) += scmi.o
obj-$(CONFIG_SCSI) += scsi.o
Expand Down

0 comments on commit 6114b86

Please sign in to comment.