[PATCH] spl: Convert SYS_MMCSD_RAW_MODE_KERNEL_SECTOR to Kconfig

2021-12-30 Thread Alexandru Gagniuc
to support Falcon mode from NOR but not MMC. In that case, mmc_load_image_raw_os() would not be used. To address this, conditionally compile mmc_load_image_raw_os() when SPL_FALCON_BOOT_MMCSD, instead of SPL_OS_BOOT. Signed-off-by: Alexandru Gagniuc --- This is designed to apply on top of next:

[PATCH v3 13/13] ARM: dts: stm32mp: dts: Don't remove OPTEE nodes for DK2 boards

2021-10-08 Thread Alexandru Gagniuc
the OP-TEE memory nodes to the SPL devicetree. Signed-off-by: Alexandru Gagniuc --- arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi index fb60549f4d..fe347377ba 100644

[PATCH v3 12/13] stm32mp1: spl: Copy optee nodes to target FDT for OP-TEE payloads

2021-10-08 Thread Alexandru Gagniuc
required to copy the optee nodes to he target's FDT. Do this as part of spl_board_prepare_for_optee(). Signed-off-by: Alexandru Gagniuc --- arch/arm/mach-stm32mp/spl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mach-stm32mp/spl.c b/arch/arm/mach-stm32mp/spl.c index d9fdc5926c

[PATCH v3 11/13] ARM: dts: stm32mp: Add OP-TEE "/firmware" node to SPL dtb

2021-10-08 Thread Alexandru Gagniuc
node if it already-exists. Add the "/firmware/optee" node the SPL devicetree. Signed-off-by: Alexandru Gagniuc --- arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi b/arch/arm/dts/stm32mp157a-dk1-u-boot.d

[PATCH v3 10/13] lib: Makefile: Make optee library available in SPL

2021-10-08 Thread Alexandru Gagniuc
We want the optee_copy_fdt_nodes symbols in SPL. This is for cases when booting an OPTEE payload directly. Signed-off-by: Alexandru Gagniuc --- lib/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Makefile b/lib/Makefile index 962470f496..c7dc217e2b 100644 --- a

[PATCH v3 02/13] spl: Move SYS_MMCSD_RAW_MODE_KERNEL_SECTOR to Kconfig

2021-10-08 Thread Alexandru Gagniuc
alcon mode from NOR but not MMC. In that case, it doesn't make sense to have mmc_load_image_raw_os(). Signed-off-by: Alexandru Gagniuc --- README| 4 common/spl/Kconfig| 16 common/spl/spl_mmc.c

[PATCH v3 09/13] stm32mp1: spl: Configure MAC address when booting OP-TEE

2021-10-08 Thread Alexandru Gagniuc
L finagling, and possibly carry security side-effects. Thus, adding "mac-address" nodes to the kernel devicetree is the most economical method in terms of lines of code and complexity. Signed-off-by: Alexandru Gagniuc --- arch/arm/mach-stm32mp/cpu.c | 22 ++

[PATCH v3 08/13] arm: stm32mp: Factor out reading MAC address from OTP

2021-10-08 Thread Alexandru Gagniuc
Move the reading the OTP into a separate function. This is required for a subsequent change which sets the MAC in SPL. Signed-off-by: Alexandru Gagniuc --- arch/arm/mach-stm32mp/cpu.c | 37 +++-- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a

[PATCH v3 07/13] arm: stm32mp: bsec: Update OTP shadow registers in SPL

2021-10-08 Thread Alexandru Gagniuc
when TFABOOT is selected. Thus, do not skip this step for SPL_BUILD. Note that because SPL is now doing this step, we no longer need to do it in u-boot. The new logic is "let the FSBL do it", which is simpler. Signed-off-by: Alexandru Gagniuc --- arch/arm/mach-stm32mp/bsec.c | 4 ++-- 1

[PATCH v3 06/13] fdt_support: Implement fdt_ethernet_set_macaddr()

2021-10-08 Thread Alexandru Gagniuc
s is where fdt_ethernet_set_macaddr() comes in. It is similar in function to fdt_fixup_ethernet(), but only updates one interface, without using the u-boot env, and without string processing. Signed-off-by: Alexandru Gagniuc --- common/fdt_support.c | 30 ++ include/fdt_supp

[PATCH v3 03/13] stm32mp1: Add support for baudrates higher than 115200

2021-10-08 Thread Alexandru Gagniuc
The UART can reliably go up to 200 baud when connected to the on-board st-link. Unfortunately u-boot will fall back to 115200 unless higher rates are declared via CONFIG_SYS_BAUDRATE_TABLE. Signed-off-by: Alexandru Gagniuc Reviewed-by: Patrick Delaunay --- include/configs/stm32mp1.h | 4

[PATCH v3 04/13] stm32mp1: Add support for falcon mode boot from SD card

2021-10-08 Thread Alexandru Gagniuc
et to -dk2. This is because EV1 does not have a crypto-enabled CPU, and thus enabling ECDSA support would have made far less sense. That and all the goodies with FIT in SPL are enabled to give this config some continuous integration TLC. Signed-off-by: Alexandru Gagniuc --- arch/arm/dts/stm32

[PATCH v3 05/13] board: stm32mp1: Implement board_fit_config_name_match() for SPL

2021-10-08 Thread Alexandru Gagniuc
This function is needed when loading a FIT image from SPL. It selects the correct configuration node for the current board. Implement it. Signed-off-by: Alexandru Gagniuc --- board/st/stm32mp1/spl.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/board/st/stm32mp1/spl.c b

[PATCH v3 00/13] stm32mp1: Support falcon mode with OP-TEE payloads

2021-10-08 Thread Alexandru Gagniuc
tions - Use "u-boot,falcon-gpios" instead of "st,fastboot-gpios" - Only update shadow registers in SPL for BSEC .probe() Alexandru Gagniuc (13): spl: Untagle spl_start_uboot() from spl_mmc.c spl: Move SYS_MMCSD_RAW_MODE_KERNEL_SECTOR to Kconfig stm32mp1: Add support fo

[PATCH v3 01/13] spl: Untagle spl_start_uboot() from spl_mmc.c

2021-10-08 Thread Alexandru Gagniuc
() exists in spl/spl.c, so leverage that one and stop defining the symbol in spl_mmc.c. We need the symbol because spl_start_uboot() is called in spl_mmc.c irrespective of the Falcon mode being activated. Signed-off-by: Alexandru Gagniuc --- common/spl/spl.c | 10 ++ common/spl/spl_mmc.c

[RFC PATCH] test/py: Check hashes produced by mkimage against known values

2021-09-15 Thread Alexandru Gagniuc
"). None of the tests caught that CRC32 was broken. Instead of testing hash_calculate() against itself, create a FIT with containing a kernel with pre-calculated hashes. Then check the hashes produced against the known good hashes. Signed-off-by: Alexandru Gagniuc --- Desired: $ ./tes

[PATCH] image: Avoid erroneous double byte-swap in CRC value

2021-09-14 Thread Alexandru Gagniuc
once. Fixes: 92055e138f28 ("image: Drop if/elseif hash selection in calculate_hash()") Tested-by: Tom Rini Signed-off-by: Alexandru Gagniuc --- common/image-fit.c | 9 - 1 file changed, 9 deletions(-) diff --git a/common/image-fit.c b/common/image-fit.c index 92d914

[PATCH 3/3] stm32mp1: Replace STM32MP15x_STM32IMAGE with TFABOOT_FIP_CONTAINER

2021-09-09 Thread Alexandru Gagniuc
r the "falcon" flow. Only remove them for "fip". 3) Makefile logic for .stm32 images Because we've removed CONFIG_STM32MP15x_STM32IMAGE, we can't use it in mach-stm32mp/config.mk to control the creation of u-boot.stm32 images. Instead of complicating the makefile logic, we rev

[PATCH 2/3] arm: Kconfig: Introduce a TFABOOT_FIP_CONTAINER option

2021-09-09 Thread Alexandru Gagniuc
who should patch the FDT optee nodes. This Kconfig can be justified as a natural extension of TFABOOT. Signed-off-by: Alexandru Gagniuc --- arch/arm/Kconfig | 15 +++ 1 file changed, 15 insertions(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 2d59562665..0bfdc2adc4

[PATCH 1/3] stm32mp: Rename FIP config to stm32mp15_tfaboot_fip_defconig

2021-09-09 Thread Alexandru Gagniuc
s are "basic", "trusted", and "tfaboot_fip". To this effect, avoid having a naked config name and rename it to "stm32mp15_tfaboot_fip_defconig". Signed-off-by: Alexandru Gagniuc --- board/st/stm32mp1/MAINTAINERS| 2 +- ...defco

[PATCH 0/3] stm32mp: Attempt to resolve unintended breakage with v2021.10-rc2

2021-09-09 Thread Alexandru Gagniuc
nfusing because it conflates image generation with u-boot behavior. I'm proposing replacing it with TFABOOT_FIP_CONTAINER because I think this new config is much easier to understand in layman's terms. I also thinks it maps more elegantly to what STM is trying to do: add a new boot flow.

[PATCH v2 10/11] ARM: dts: stm32mp: Add OP-TEE "/firmware" node to SPL dtb

2021-09-07 Thread Alexandru Gagniuc
node if it already-exists. Add the "/firmware/optee" node the SPL devicetree. Signed-off-by: Alexandru Gagniuc --- arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi b/arch/arm/dts/stm32mp157a-dk1-u-boot.d

[PATCH v2 11/11] stm32mp1: spl: Copy optee nodes to target FDT for OP-TEE payloads

2021-09-07 Thread Alexandru Gagniuc
required to copy the optee nodes to he target's FDT. Do this as part of spl_board_prepare_for_optee(). Signed-off-by: Alexandru Gagniuc --- arch/arm/mach-stm32mp/spl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mach-stm32mp/spl.c b/arch/arm/mach-stm32mp/spl.c index d9fdc5926c

[PATCH v2 09/11] lib: Makefile: Make optee library available in SPL

2021-09-07 Thread Alexandru Gagniuc
We want the optee_copy_fdt_nodes symbols in SPL. This is for cases when booting an OPTEE payload directly. Signed-off-by: Alexandru Gagniuc --- lib/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Makefile b/lib/Makefile index 8ba745faa0..73dacbb01b 100644 --- a

[PATCH v2 08/11] stm32mp1: spl: Configure MAC address when booting OP-TEE

2021-09-07 Thread Alexandru Gagniuc
L finagling, and possibly carry security side-effects. Thus, adding "mac-address" nodes to the kernel devicetree is the most economical method in terms of lines of code and complexity. Signed-off-by: Alexandru Gagniuc --- arch/arm/mach-stm32mp/cpu.c | 22 ++

[PATCH v2 01/11] spl: Move SYS_MMCSD_RAW_MODE_KERNEL_SECTOR to Kconfig

2021-09-07 Thread Alexandru Gagniuc
said about the wisdom of using a raw sector as opposed to more elegant schemes. However, changing how falcon mode works is beyond the scope of this change. Signed-off-by: Alexandru Gagniuc --- README| 4 common/spl/Kconfig

[PATCH v2 05/11] fdt_support: Implement fdt_ethernet_set_macaddr()

2021-09-07 Thread Alexandru Gagniuc
s is where fdt_ethernet_set_macaddr() comes in. It is similar in function to fdt_fixup_ethernet(), but only updates one interface, without using the u-boot env, and without string processing. Signed-off-by: Alexandru Gagniuc --- common/fdt_support.c | 30 ++ include/fdt_supp

[PATCH v2 07/11] arm: stm32mp: Factor out reading MAC address from OTP

2021-09-07 Thread Alexandru Gagniuc
Move the reading the OTP into a separate function. This is required for a subsequent change which sets the MAC in SPL. Signed-off-by: Alexandru Gagniuc --- arch/arm/mach-stm32mp/cpu.c | 37 +++-- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a

[PATCH v2 06/11] arm: stm32mp: bsec: Update OTP shadow registers in SPL

2021-09-07 Thread Alexandru Gagniuc
when TFABOOT is selected. Thus, do not skip this step for SPL_BUILD. Note that because SPL is now doing this step, we no longer need to do it in u-boot. The new logic is "let the FSBL do it", which is simpler. Signed-off-by: Alexandru Gagniuc --- arch/arm/mach-stm32mp/bsec.c | 4 ++-- 1

[PATCH v2 03/11] stm32mp1: Add support for falcon mode boot from SD card

2021-09-07 Thread Alexandru Gagniuc
et to -dk2. This is because EV1 does not have a crypto-enabled CPU, and thus enabling ECDSA support would have made far less sense. That and all the goodies with FIT in SPL are enabled to give this config some continuous integration TLC. Signed-off-by: Alexandru Gagniuc --- arch/arm/dts/stm32

[PATCH v2 04/11] board: stm32mp1: Implement board_fit_config_name_match() for SPL

2021-09-07 Thread Alexandru Gagniuc
This function is needed when loading a FIT image from SPL. It selects the correct configuration node for the current board. Implement it. Signed-off-by: Alexandru Gagniuc --- board/st/stm32mp1/spl.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/board/st/stm32mp1/spl.c b

[PATCH v2 02/11] stm32mp1: Add support for baudrates higher than 115200

2021-09-07 Thread Alexandru Gagniuc
The UART can reliably go up to 200 baud when connected to the on-board st-link. Unfortunately u-boot will fall back to 115200 unless higher rates are declared via CONFIG_SYS_BAUDRATE_TABLE. Signed-off-by: Alexandru Gagniuc Reviewed-by: Patrick Delaunay --- include/configs/stm32mp1.h | 4

[PATCH v2 00/11] stm32mp1: Support falcon mode with OP-TEE payloads

2021-09-07 Thread Alexandru Gagniuc
- Rework board_fit_config_name_match() per Patrick's suggestions - Use "u-boot,falcon-gpios" instead of "st,fastboot-gpios" - Only update shadow registers in SPL for BSEC .probe() Alexandru Gagniuc (11): spl: Move SYS_MMCSD_RAW_MODE_KERNEL_SECTOR to Kconfig stm3

[PATCH 4/4] arm: imx: mx7: Move CONFIG_OPTEE_TZDRAM_SIZE from lib/optee

2021-09-07 Thread Alexandru Gagniuc
alue. Move it to imx7 for those boards who still make use of it. Signed-off-by: Alexandru Gagniuc --- arch/arm/mach-imx/mx7/Kconfig | 8 lib/optee/Kconfig | 8 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-imx/mx7/Kconfig b/arch/arm/ma

[PATCH 3/4] lib: optee: Remove CONFIG_OPTEE_LOAD_ADDR

2021-09-07 Thread Alexandru Gagniuc
hardcodes a value which is then not used. In fact the load address that u-boot uses is the one derived from the OPTEE image. Confused yet? I sure was. To prevent future confusion, remove CONFIG_OPTEE_LOAD_ADDR. Signed-off-by: Alexandru Gagniuc --- configs/warp7_defconfig | 1 - include/configs/w

[PATCH 2/4] lib: optee: Remove CONFIG_OPTEE_TZDRAM_BASE

2021-09-07 Thread Alexandru Gagniuc
It is no longer used in u-boot. Information about the TZDRAM location is usually available in the devicetree as "/reserved-memory/" nodes. Because this isn't used, remove it. Signed-off-by: Alexandru Gagniuc --- configs/warp7_bl33_defconfig | 1 - configs/warp7_defconfig |

[PATCH 1/4] lib: optee: Avoid CONFIG_TZDRAM_* in optee_verify_bootm_image()

2021-09-07 Thread Alexandru Gagniuc
ion in Kconfig for "bootm". To remedy this, do not use TZDRAM_BASE and TZDRAM_SIZE in the verification of OPTEE images. Signed-off-by: Alexandru Gagniuc --- include/tee/optee.h | 14 -- lib/optee/optee.c | 21 ++--- 2 files changed, 6 insertions(+), 29 deletion

[PATCH 0/4] Repeal and replace TZDRAM_ related config options

2021-09-07 Thread Alexandru Gagniuc
ng. This also resolves the problems with "bootm" mentioned earlier. I hypothesize that one could re-add the removed checks from optee_verify_image() by deriving TZDRAM information from (1) instead of (3). I chose not to implement it because I don't see the value. Alexan

[PATCH v2 4/6] common: Move MD5 hash to hash_algo[] array.

2021-09-02 Thread Alexandru Gagniuc
rogressive_lookup_algo() will catch that, and return -EPROTONOSUPPORT, while hash_lookup_algo() will return the correct pointer. Signed-off-by: Alexandru Gagniuc --- common/hash.c| 13 + include/image.h | 1 + include/u-boot/md5.h | 6 -- lib/md5.c| 4 +

[PATCH v2 3/6] common/spl: Drop [ST]PL_HASH_SUPPORT in favor of [ST]PL_HASH

2021-09-02 Thread Alexandru Gagniuc
All of these configs exist. Stick to using CONFIG_[ST]PL_HASH, and drop all references to CONFIG_[ST]PL_HASH_SUPPORT. This means we need for CHAIN_OF_TRUST to select SPL_HASH now. Signed-off-by: Alexandru Gagniuc [trini: Add TPL case, fix CHAIN_OF_TRUST, other tweaks] Signed-off-by: Tom Rini

[PATCH v2 5/6] image: Drop if/elseif hash selection in calculate_hash()

2021-09-02 Thread Alexandru Gagniuc
akes sense because even basic FITs will have to deal with "hash" nodes. My only concern is that the 'select SPL_HASH' might cause some platform to grow above its SPL size allowance Signed-off-by: Alexandru Gagniuc --- common/Kconfig.boot| 2 ++ c

[PATCH v2 6/6] image: Drop IMAGE_ENABLE_{MD5, CRC32} #defines

2021-09-02 Thread Alexandru Gagniuc
These are no longer used, so drop them. Signed-off-by: Alexandru Gagniuc --- include/image.h | 20 1 file changed, 20 deletions(-) diff --git a/include/image.h b/include/image.h index e4b9cd0df2..98b33d0629 100644 --- a/include/image.h +++ b/include/image.h @@ -60,26 +60,6

[PATCH v2 2/6] lib: Drop SHA512_ALGO in lieu of SHA512

2021-09-02 Thread Alexandru Gagniuc
sha512.c. The latter doesn't make any sense. It's reasonable to say in Kconfig that SHA384 depends on SHA512, and seems to be the more polite way to handle the selection. Thus, automatically select SHA512 when SHA384 is enabled. Signed-off-by: Alexandru Gagniuc --- arch/arm/mach-socfp

[PATCH v2 0/6] Fix FIT hash algos in SPL (Fixes v2021.10-rc3)

2021-09-02 Thread Alexandru Gagniuc
since v1: - Taken in all of Tom's fixes from WIP/30Aug2021 branch - CMD_MVEBU_BUBT: select SHA256 if ARMADA_3700 (sha256_update() reference) - fsl: FSL_CAAM: imply SPL_CRYPTO (Fixes undefined reference to hw_sha1) - Add MD5 to hash_algos[] (Fixes "Can't add hashes to FIT: -93&

[PATCH v2 1/6] common: Remove unused CONFIG_FIT_SHAxxx selectors

2021-09-02 Thread Alexandru Gagniuc
did not manifest before. Note that SHA selection in SPL is broken for this exact reason. There is no corresponding SPL_SHAxxx. Fixing this is is beyond the scope of this change. Signed-off-by: Alexandru Gagniuc --- cmd/mvebu/Kconfig| 1 + common/Kconfig.boot | 28 -

[PATCH] mkimage: Don't disable encryption based on CONFIG_FIT_CIPHER

2021-08-26 Thread Alexandru Gagniuc
ignore the value of CONFIG_FIT_CIPHER for host-only code. Signed-off-by: Alexandru Gagniuc --- include/image.h| 5 - tools/image-host.c | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/include/image.h b/include/image.h index e20f0b69d5..381ee91eb5 100644 --- a/include/ima

[RFC PATCH] stm32mp1: Replace STM32IMAGE config with TFABOOT_FIP

2021-08-26 Thread Alexandru Gagniuc
Hi Patrick, I proposing a better fix fir the issues I outlined earlier, I made a classification of the currently supported boot modes. 1) BL1 -> SPL -> u-boot 2) BL1 -> SPL -> OP-TEE - | 3) BL1 -> TF-A -> u-boot

[PATCH 08/10] lib: Makefile: Make optee library available in SPL

2021-08-26 Thread Alexandru Gagniuc
We want the optee_copy_fdt_nodes symbols in SPL. This is for cases when booting an OPTEE payload directly. Signed-off-by: Alexandru Gagniuc --- lib/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Makefile b/lib/Makefile index 8ba745faa0..73dacbb01b 100644 --- a

[PATCH 10/10] stm32mp1: spl: Copy optee nodes to target FDT for OP-TEE payloads

2021-08-26 Thread Alexandru Gagniuc
optee nodes to he target's FDT. Do this as part of spl_board_prepare_for_optee(). Signed-off-by: Alexandru Gagniuc --- arch/arm/mach-stm32mp/spl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mach-stm32mp/spl.c b/arch/arm/mach-stm32mp/spl.c index d9fdc5926c..94fbb45cf9 10

[PATCH 07/10] stm32mp1: spl: Configure MAC address when booting OP-TEE

2021-08-26 Thread Alexandru Gagniuc
different from setup_mac_address(), which sets the "ethaddr" env variable, and does not work in SPL. Signed-off-by: Alexandru Gagniuc --- arch/arm/mach-stm32mp/cpu.c | 22 +++ .../arm/mach-stm32mp/include/mach/sys_proto.h | 3 +++ arch/arm/mach-stm

[PATCH 06/10] arm: stm32mp: Factor out reading MAC address from OTP

2021-08-26 Thread Alexandru Gagniuc
Move the reading the OTP into a separate function. This is required for a subsequent change which sets the MAC in SPL. Signed-off-by: Alexandru Gagniuc --- arch/arm/mach-stm32mp/cpu.c | 37 +++-- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a

[PATCH 09/10] ARM: dts: stm32mp: Add OP-TEE "/firmware" node to SPL dtb

2021-08-26 Thread Alexandru Gagniuc
This node is required in SPL when booting an OP-TEE payload. Add it to the SPL devicetree. Signed-off-by: Alexandru Gagniuc --- arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi b/arch/arm/dts/stm32mp157a-dk1-u

[PATCH 04/10] fdt_support: Implement fdt_ethernet_set_macaddr()

2021-08-26 Thread Alexandru Gagniuc
s is where fdt_ethernet_set_macaddr() comes in. It is similar in function to fdt_fixup_ethernet(), but only updates one interface, without using the u-boot env, and without string processing. Signed-off-by: Alexandru Gagniuc --- common/fdt_support.c | 30 ++ include/fdt_supp

[PATCH 05/10] arm: stm32mp: bsec: Do not skip .probe() for SPL

2021-08-26 Thread Alexandru Gagniuc
OT is selected. Thus, only skip probe with TFABOOT, but not SPL_BUILD. Signed-off-by: Alexandru Gagniuc --- arch/arm/mach-stm32mp/bsec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-stm32mp/bsec.c b/arch/arm/mach-stm32mp/bsec.c index fe39bd80cf..a02d19c1b9 100644

[PATCH 03/10] board: stm32mp1: Implement board_fit_config_name_match() for SPL

2021-08-26 Thread Alexandru Gagniuc
This function is needed when loading a FIT image from SPL. It selects the correct configuration node for the current board. Implement it. Signed-off-by: Alexandru Gagniuc --- board/st/stm32mp1/spl.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/board/st/stm32mp1/spl.c b/board

[PATCH 02/10] stm32mp1: Add support for falcon mode boot from SD card

2021-08-26 Thread Alexandru Gagniuc
etree node. Offsets for raw MMC loading are defined. These point to the partition after "ssbl". Signed-off-by: Alexandru Gagniuc --- board/st/stm32mp1/spl.c| 39 ++ include/configs/stm32mp1.h | 13 + 2 files changed, 52 insertions(+) d

[PATCH 01/10] stm32mp1: Add support for baudrates higher than 115200

2021-08-26 Thread Alexandru Gagniuc
The UART can reliably go up to 200 baud when connected to the on-board st-link. Unfortunately u-boot will fall back to 115200 unless higher rates are declared via CONFIG_SYS_BAUDRATE_TABLE. Signed-off-by: Alexandru Gagniuc --- include/configs/stm32mp1.h | 4 1 file changed, 4

[PATCH 00/10] stm32mp1: Support falcon mode with OP-TEE payloads

2021-08-26 Thread Alexandru Gagniuc
he boot flow is SPL -> OP-TEE -> Linux Incidentally, these patches are some of the earlier ones I wrote for this project. It didn't make sense to publish them at the time, as the supporting infrastructure was not in place then I decided not to separate these patches into mini-seri

[PATCH 4/5] image: Drop if/elseif hash selection in calculate_hash()

2021-08-23 Thread Alexandru Gagniuc
akes sense because even basic FITs will have to deal with "hash" nodes. My only concern is that the 'select SPL_HASH' might cause some platform to grow above its SPL size allowance Signed-off-by: Alexandru Gagniuc --- common/Kconfig.boot |

[PATCH 5/5] image: Drop IMAGE_ENABLE_{MD5, CRC32} #defines

2021-08-23 Thread Alexandru Gagniuc
These are no longer used, so drop them. Signed-off-by: Alexandru Gagniuc --- include/image.h | 20 1 file changed, 20 deletions(-) diff --git a/include/image.h b/include/image.h index 489b220eba..2d057d445c 100644 --- a/include/image.h +++ b/include/image.h @@ -59,26 +59,6

[PATCH 3/5] common/spl: Drop SPL_HASH_SUPPORT in favor of SPL_HASH

2021-08-23 Thread Alexandru Gagniuc
Both these configs exist. Stick to using CONFIG_SPL_HASH, and drop all references to CONFIG_SPL_HASH_SUPPORT. Signed-off-by: Alexandru Gagniuc --- common/Kconfig.boot | 2 +- common/Makefile | 3 +-- common/spl/Kconfig

[PATCH 2/5] lib: Drop SHA512_ALGO in lieu of SHA512

2021-08-23 Thread Alexandru Gagniuc
sha512.c. The latter doesn't make any sense. It's reasonable to say in Kconfig that SHA384 depends on SHA512, and seems to be the more polite way to handle the selection. Thus, automatically select SHA512 when SHA384 is enabled. Signed-off-by: Alexandru Gagniuc --- arch/arm/mach-socfp

[PATCH 1/5] common: Remove unused CONFIG_FIT_SHAxxx selectors

2021-08-23 Thread Alexandru Gagniuc
, nor needed. Remove them. One defconfig disables FIT_SHA256, which is now changed to 'SHA256'. Note that SHA selection in SPL is broken for this exact reason. There is no corresponding SPL_SHAxxx. Fixing this is is beyond the scope of this change. Signed-off-by: Alexandru Gag

[PATCH 0/5] Fix FIT hash algos in SPL (Fixes v2021.10-rc2)

2021-08-23 Thread Alexandru Gagniuc
uot;sha256"' FIT nodes to work in SPL. This series does not attempt to add individual SHA/CRC/MD5 configs for SPL. Hash algo selection for SPL has been problematic even before. This series is meant as an emergency fix, so it does not attempt to tackle general refactoring issues. Alexandru G

[PATCH] image: rsa: Move padding_algos to linker lists

2021-08-18 Thread Alexandru Gagniuc
necessary. For example ecda-verify makes use of U_BOOT_CRYPTO_ALGO() without any accompanying #ifdefs. The fundamental issue is a lack of separation of host and target code in rsa_verify. Therefore, the declaration of a padding algo with the external #ifdef is more readable and consistent. Signe

[PATCH] lib/rsa: Remove support for OpenSSL < 1.1.0 and libressl < 2.7.0

2021-07-29 Thread Alexandru Gagniuc
pport. Signed-off-by: Alexandru Gagniuc --- I would appreciate if somebody tested the RSA signing functionality with this patch applied, as I am not equipped to test this comprehensively. lib/rsa/rsa-sign.c | 76 +++--- 1 file changed, 4 insertions(+

[PATCH 5/5] test: dm: Add test for ECDSA UCLASS support

2021-07-29 Thread Alexandru Gagniuc
for now. Signed-off-by: Alexandru Gagniuc Reviewed-by: Simon Glass --- configs/sandbox_defconfig | 2 ++ test/dm/Makefile | 1 + test/dm/ecdsa.c | 38 ++ 3 files changed, 41 insertions(+) create mode 100644 test/dm/ecdsa.c

[PATCH 4/5] Kconfig: FIT_SIGNATURE should not select RSA_VERIFY

2021-07-29 Thread Alexandru Gagniuc
FIT signatures can now be implemented with ECDSA. The assumption that all FIT images are signed with RSA is no longer valid. Thus, instead of 'select'ing RSA, only 'imply' it. This doesn't change the defaults, but allows one to explicitly disable RSA support. Signed-

[PATCH 2/5] lib: ecdsa: Implement UCLASS_ECDSA verification on target

2021-07-29 Thread Alexandru Gagniuc
Implement the crypto_algo .verify() function for ecdsa256. Because it backends on UCLASS_ECDSA, this change is focused on parsing the keys from devicetree and passing this information to the specific UCLASS driver. Signed-off-by: Alexandru Gagniuc Reviewed-by: Simon Glass --- lib/Kconfig

[PATCH 3/5] arm: stm32mp1: Implement ECDSA signature verification

2021-07-29 Thread Alexandru Gagniuc
The STM32MP ROM provides several service. One of them is the ability to verify ecdsa256 signatures. Hook the ROM API into the ECDSA uclass. Signed-off-by: Alexandru Gagniuc --- arch/arm/mach-stm32mp/Kconfig| 9 +++ arch/arm/mach-stm32mp/Makefile | 1 + arch/arm/mach-stm32mp

[PATCH 1/5] dm: crypto: Define UCLASS API for ECDSA signature verification

2021-07-29 Thread Alexandru Gagniuc
Define a UCLASS API for verifying ECDSA signatures. Unlike UCLASS_MOD_EXP, which focuses strictly on modular exponentiation, the ECDSA class focuses on verification. This is done so that it better aligns with mach-specific implementations, such as stm32mp. Signed-off-by: Alexandru Gagniuc

[PATCH 0/5] Enable ECDSA FIT verification for stm32mp

2021-07-29 Thread Alexandru Gagniuc
st wrong sig_len in ecdsa_romapi.c - s/U_BOOT_DEVICE/U_BOOT_DRVINFO/ - Use "if(!ret)" instead of "if (ret == 0)" - Use uclass_first_device_err() instead of uclass_fi Alexandru Gagniuc (5): dm: crypto: Define UCLASS API for ECDSA signature verification lib: ecdsa: Implement UC

[PATCH v5 5/5] ARM: dts: stm32mp: Add OP-TEE reserved memory to SPL dtb

2021-07-15 Thread Alexandru Gagniuc
Add the "/reserved-memory/optee" node to the SPL devicetree. The purpose is to allow configuring TZC regions when booting OP-TEE. Signed-off-by: Alexandru Gagniuc Reviewed-by: Simon Glass --- arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 3 +++ 1 file changed, 3 insertions(+) diff --

[PATCH v5 3/5] arm: stm32mp: Implement support for TZC 400 controller

2021-07-15 Thread Alexandru Gagniuc
. Changing TZC permissions needs to be done with care, so as not to cut off access to memory we are currently using. One place where we can use this is at the end of SPL, right before jumping to OP-TEE. Signed-off-by: Alexandru Gagniuc Reviewed-by: Patrick Delaunay --- arch/arm/mach-stm32mp

[PATCH v5 4/5] stm32mp1: spl: Configure TrustZone controller for OP-TEE

2021-07-15 Thread Alexandru Gagniuc
This has to be hardcoded. The rest of the configuration is fairly easy, and only requires 3 TZC regions. Configure them. Signed-off-by: Alexandru Gagniuc --- arch/arm/mach-stm32mp/spl.c | 92 + 1 file changed, 92 insertions(+) diff --git a/arch/arm/mach-st

[PATCH v5 2/5] spl: Introduce spl_board_prepare_for_optee() hook

2021-07-15 Thread Alexandru Gagniuc
solution to avoid the use of weak functions would trivially apply to all these implementations. However, re-designing this is beyond the scope of this patch. Signed-off-by: Alexandru Gagniuc Reviewed-by: Tom Rini Reviewed-by: Simon Glass Reviewed-by: Patrick Delaunay --- common/spl/spl.c | 5

[PATCH v5 1/5] spl: mmc: Support OP-TEE payloads in Falcon mode

2021-07-15 Thread Alexandru Gagniuc
_os() only loading the binary, and leaving the decision of suitability to someone else. However, a rework of the boot flow is beyond the scope of this patch. Accept IH_OS_TEE as a valid OS value. Signed-off-by: Alexandru Gagniuc Reviewed-by: Tom Rini Reviewed-by: Patrick Delaunay --- common/spl

[PATCH v5 0/5] stm32mp: Enable OP-TEE and TZC support in SPL

2021-07-15 Thread Alexandru Gagniuc
v4 branch was reported to have some issues with SPL becoming too big on some platforms (e.g. imx6dl_mamoj) This is fixed by dropping the call to genimg_get_os_name(). Alexandru Gagniuc (5): spl: mmc: Support OP-TEE payloads in Falcon mode spl: Introduce spl_board_prepare_for_optee() hook

[PATCH v3 18/19] image: Add support for relocating crypto_algos in linker lists

2021-07-14 Thread Alexandru Gagniuc
Function pointers from crypto_algos array are relocated, when NEEDS_MANUAL_RELOC is set. This relocation doesn't happen if the algo is placed in a linker list. Implement this relocation. Signed-off-by: Alexandru Gagniuc Reviewed-by: Simon Glass Acked-by: Michal Simek --- common/image-

[PATCH v3 19/19] tools: Use a single target-independent config to enable OpenSSL

2021-07-14 Thread Alexandru Gagniuc
he default build yields the most feature-complete mkimage. Signed-off-by: Alexandru Gagniuc --- tools/Kconfig | 11 +++ tools/Makefile | 48 +++- 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/tools/Kconfig b/tools/Kconfig index b

[PATCH v3 16/19] image: Eliminate IMAGE_ENABLE_VERIFY macro

2021-07-14 Thread Alexandru Gagniuc
This macro is no longer needed for code flow or #ifdefs. Remove it. Signed-off-by: Alexandru Gagniuc Reviewed-by: Simon Glass --- include/image.h | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/include/image.h b/include/image.h index d4c453428c..64663c591b 100644 --- a

[PATCH v3 17/19] image: Eliminate IMAGE_ENABLE_VERIFY_ECDSA macro

2021-07-14 Thread Alexandru Gagniuc
This macro is no longer needed for code flow or #ifdefs. Remove it. Signed-off-by: Alexandru Gagniuc Reviewed-by: Simon Glass --- include/image.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/image.h b/include/image.h index 64663c591b..e20f0b69d5 100644 --- a/include/image.h

[PATCH v3 15/19] lib: rsa: Remove #ifdefs from rsa.h

2021-07-14 Thread Alexandru Gagniuc
It is no longer necessary to implement rsa_() functions as no-ops depending on config options. It is merely sufficient to provide the prototypes, as the rsa code is no longer linked when unused. Signed-off-by: Alexandru Gagniuc Reviewed-by: Simon Glass --- include/u-boot/rsa.h | 47

[PATCH v3 13/19] image: image-sig.c: Remove crypto_algos array

2021-07-14 Thread Alexandru Gagniuc
Crytographic algorithms (currently RSA), are stored in linker lists. The crypto_algos array is unused, so remove it, and any logic associated with it. Signed-off-by: Alexandru Gagniuc Reviewed-by: Simon Glass --- common/image-sig.c | 22 -- 1 file changed, 22 deletions

[PATCH v3 09/19] common: Move host-only logic in image-sig.c to separate file

2021-07-14 Thread Alexandru Gagniuc
, and remove target specific code. Although it looks like we are duplicating code, subsequent patches will change the way target algorithms are searched. Besides we are only duplicating three string to struct mapping functions. This isn't something to fuss about. Signed-off-by: Alexandru Ga

[PATCH v3 14/19] lib: ecdsa: Remove #ifdefs from ecdsa.h

2021-07-14 Thread Alexandru Gagniuc
It is no longer necessary to implement ecdsa_() functions as no-ops depending on config options. It is merely sufficient to provide the prototypes, as the ecdsa code is no longer linked when unused. Signed-off-by: Alexandru Gagniuc Reviewed-by: Simon Glass --- include/u-boot/ecdsa.h | 25

[PATCH v3 11/19] image: Add support for placing crypto_algo in linker lists

2021-07-14 Thread Alexandru Gagniuc
is invoked. NOTE that adding support for manual relocation of crypto_algos within linker lists is beyond the scope of this patch. Signed-off-by: Alexandru Gagniuc Reviewed-by: Simon Glass --- common/image-sig.c | 9 + include/image.h| 5 + 2 files changed, 14 insertions(+) di

[PATCH v3 06/19] image: Drop IMAGE_ENABLE_SHA1

2021-07-14 Thread Alexandru Gagniuc
From: Simon Glass We already have a host Kconfig for SHA1. Use CONFIG_IS_ENABLED(SHA1) directly in the code shared with the host build, so we can drop the unnecessary indirection. Signed-off-by: Simon Glass Reviewed-by: Alexandru Gagniuc Signed-off-by: Alexandru Gagniuc --- common/image

[PATCH v3 03/19] image: Rename CONFIG_FIT_ENABLE_RSASSA_PSS_SUPPORT

2021-07-14 Thread Alexandru Gagniuc
From: Simon Glass Drop the ENABLE and SUPPORT parts of this, which are redundant. Signed-off-by: Simon Glass Reviewed-by: Alexandru Gagniuc Signed-off-by: Alexandru Gagniuc --- common/Kconfig.boot | 2 +- common/image-sig.c | 4 ++-- configs/bcm963158_ram_defconfig

[PATCH v3 10/19] common: image-sig.c: Remove host-specific logic and #ifdefs

2021-07-14 Thread Alexandru Gagniuc
dsa256 support, this is intentional. ecdsa_verify() is a no-op on the target, and is currently only used by host code. Signed-off-by: Alexandru Gagniuc Reviewed-by: Simon Glass --- common/image-sig.c | 39 ++- 1 file changed, 2 insertions(+), 37 deletions(-) diff -

[PATCH v3 07/19] image: Drop IMAGE_ENABLE_SHAxxx

2021-07-14 Thread Alexandru Gagniuc
From: Simon Glass We already have a host Kconfig for these SHA options. Use CONFIG_IS_ENABLED(SHAxxx) directly in the code shared with the host build, so we can drop the unnecessary indirections. Signed-off-by: Simon Glass Reviewed-by: Alexandru Gagniuc Signed-off-by: Alexandru Gagniuc

[PATCH v3 12/19] image: rsa: Move verification algorithm to a linker list

2021-07-14 Thread Alexandru Gagniuc
us to have a single definition of rsa_verify(). Signed-off-by: Alexandru Gagniuc Reviewed-by: Simon Glass --- common/image-sig.c | 9 - lib/rsa/rsa-verify.c | 16 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/common/image-sig.c b/common/image-sig.c

[PATCH v3 08/19] image: Drop IMAGE_ENABLE_BEST_MATCH

2021-07-14 Thread Alexandru Gagniuc
From: Simon Glass This is not needed with Kconfig, since we can use IS_ENABLED() easily enough. Drop it. Signed-off-by: Simon Glass Reviewed-by: Alexandru Gagniuc Signed-off-by: Alexandru Gagniuc --- common/image-fit.c | 2 +- include/image.h| 5 - 2 files changed, 1 insertion(+), 6

[PATCH v3 05/19] Kconfig: Rename SPL_MD5_SUPPORT to SPL_MD5

2021-07-14 Thread Alexandru Gagniuc
From: Simon Glass Drop the _SUPPORT suffix so we can use CONFIG_IS_ENABLED() with this option. Signed-off-by: Simon Glass Reviewed-by: Alexandru Gagniuc Signed-off-by: Alexandru Gagniuc --- common/spl/Kconfig | 2 +- include/image.h| 2 +- 2 files changed, 2 insertions(+), 2 deletions

[PATCH v3 04/19] Kconfig: Rename SPL_CRC32_SUPPORT to SPL_CRC32

2021-07-14 Thread Alexandru Gagniuc
From: Simon Glass Drop the _SUPPORT suffix so we can use CONFIG_IS_ENABLED() with this option. Signed-off-by: Simon Glass Reviewed-by: Alexandru Gagniuc Signed-off-by: Alexandru Gagniuc --- common/spl/Kconfig| 4 ++-- configs/axm_defconfig | 2

[PATCH v3 02/19] image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx

2021-07-14 Thread Alexandru Gagniuc
From: Simon Glass These option are named inconsistently with other SPL options, thus making them incompatible with the CONFIG_IS_ENABLED() macro. Rename them. Signed-off-by: Simon Glass Reviewed-by: Alexandru Gagniuc Signed-off-by: Alexandru Gagniuc --- common/spl/Kconfig | 8

[PATCH v3 01/19] image: Shorten FIT_ENABLE_SHAxxx_SUPPORT

2021-07-14 Thread Alexandru Gagniuc
with other options. Rename FIT_ENABLE_SHAxxx_SUPPORT to FIT_SHAxxx Signed-off-by: Simon Glass Reviewed-by: Alexandru Gagniuc Signed-off-by: Alexandru Gagniuc --- common/Kconfig.boot | 6 +++--- configs/mt8516_pumpkin_defconfig | 2 +- include/image.h | 12

[PATCH v3 00/19] tools: Use a single config for Host OpenSSL (plus dependent patches)

2021-07-14 Thread Alexandru Gagniuc
This series combines [PATCH v2] tools: Use a single target-independent config to enable OpenSSL and its dependencies. Changes since v2: * Replace FIT_OBJS-$(CONFIG_...) with FIT_OBJS-y to resolve rpi buld issue Alexandru Gagniuc (11): common: Move host-only logic in image-sig.c to separate

[PATCH v2] tools: Use a single target-independent config to enable OpenSSL

2021-07-06 Thread Alexandru Gagniuc
he default build yields the most feature-complete mkimage. Signed-off-by: Alexandru Gagniuc --- Changes since v1: * Drop the verb "_USE_" from the Kconfig option name tools/Kconfig | 11 +++ tools/Makefile | 46 ++ 2 files changed, 41

[PATCH v4 4/5] stm32mp1: spl: Configure TrustZone controller for OP-TEE

2021-05-31 Thread Alexandru Gagniuc
This has to be hardcoded. The rest of the configuration is fairly easy, and only requires 3 TZC regions. Configure them. Signed-off-by: Alexandru Gagniuc --- arch/arm/mach-stm32mp/spl.c | 92 + 1 file changed, 92 insertions(+) diff --git a/arch/arm/mach-st

  1   2   3   4   >