aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-04-14lib/rsa: Use the 'keyfile' argument from mkimageAlexandru Gagniuc1-8/+26
Keys can be derived from keydir, and the "key-name-hint" property of the FIT. They can also be specified ad-literam via 'keyfile'. Update the RSA signing path to use the appropriate one. Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-04-14mkimage: Add a 'keyfile' argument for image signingAlexandru Gagniuc5-32/+52
It's not always desirable to use 'keydir' and some ad-hoc heuristics to get the filename of the signing key. More often, just passing the filename is the simpler, easier, and logical thing to do. Since mkimage doesn't use long options, we're slowly running out of letters. I've chosen '-G' because it was available. Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-04-14doc: signature.txt: Document the keydir and keyfile argumentsAlexandru Gagniuc1-0/+13
After lots of debating, this documents how we'd like mkimage to treat 'keydir' and 'keyfile' arguments. The rest is in the docs. Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-04-14test/py: ecdsa: Add test for mkimage ECDSA signingAlexandru Gagniuc1-0/+111
Add a test to make sure that the ECDSA signatures generated by mkimage can be verified successfully. pyCryptodomex was chosen as the crypto library because it integrates much better with python code. Using openssl would have been unnecessarily painful. Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-04-14test/py: Add pycryptodomex to list of required pakagesAlexandru Gagniuc1-0/+1
We wish to use pycryptodomex to verify code paths involving ECDSA signatures. Add it to requirements.txt so that they get picked up automatically .gitlab and .azure tasks Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-04-14doc: signature.txt: Document devicetree format for ECDSA keysAlexandru Gagniuc1-1/+6
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-04-14lib: Add support for ECDSA image signingAlexandru Gagniuc5-2/+415
mkimage supports rsa2048, and rsa4096 signatures. With newer silicon now supporting hardware-accelerated ECDSA, it makes sense to expand signing support to elliptic curves. Implement host-side ECDSA signing and verification with libcrypto. Device-side implementation of signature verification is beyond the scope of this patch. Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-04-14lib/rsa: Make fdt_add_bignum() available outside of RSA codeAlexandru Gagniuc4-64/+105
fdt_add_bignum() is useful for algorithms other than just RSA. To allow its use for ECDSA, move it to a common file under lib/. The new file is suffixed with '-libcrypto' because it has a direct dependency on openssl. This is due to the use of the "BIGNUM *" type. Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-04-14lib: Rename rsa-checksum.c to hash-checksum.cAlexandru Gagniuc10-8/+11
rsa-checksum.c sontains the hash_calculate() implementations. Despite the "rsa-" file prefix, this function is useful for other algorithms. To prevent confusion, move this file to lib/, and rename it to hash-checksum.c, to give it a more "generic" feel. Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-04-13Merge https://source.denx.de/u-boot/custodians/u-boot-shTom Rini5-4/+65
- arm: mach-rmobile: Add CPU info support for RZ/G2
2021-04-13arm: mach-rmobile: Add CPU info support for RZ/G2Biju Das5-4/+65
Add CPU info support for RZ/G2 SoC's. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
2021-04-13Merge branch '2021-04-13-assorted-improvements'Tom Rini81-739/+2142
- A large assortment of bug fixes, code cleanups and a few feature enhancements.
2021-04-12cmd: exit: Fix return valueMarek Vasut1-5/+2
In case exit is called in a script without parameter, the command returns -2 ; in case exit is called with a numerical parameter, the command returns -2 and lower. This leads to the following problem: => setenv foo 'echo bar ; exit 1' ; run foo ; echo $? bar 0 => setenv foo 'echo bar ; exit 0' ; run foo ; echo $? bar 0 => setenv foo 'echo bar ; exit -2' ; run foo ; echo $? bar 0 That is, no matter what the 'exit' command argument is, the return value is always 0 and so it is not possible to use script return value in subsequent tests. Fix this and simplify the exit command such that if exit is called with no argument, the command returns 0, just like 'true' in cmd/test.c. In case the command is called with any argument that is positive integer, the argument is set as return value. => setenv foo 'echo bar ; exit 1' ; run foo ; echo $? bar 1 => setenv foo 'echo bar ; exit 0' ; run foo ; echo $? bar 0 => setenv foo 'echo bar ; exit -2' ; run foo ; echo $? bar 0 Note that this does change ABI established in 2004 , although it is unclear whether that ABI was originally OK or not. Fixes: c26e454dfc6 Signed-off-by: Marek Vasut <marex@denx.de> Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Cc: Tom Rini <trini@konsulko.com>
2021-04-12scmi: translate the resource only when livetree is not activatedPatrick Delaunay1-2/+7
Call the translation function on the ofnode_read_resource result only when the livetree is not activated. Today of_address_to_resource() calls ofnode_read_resource() for livetree support and fdt_get_resource() when livetree is not supported. The fdt_get_resource() doesn't do the address translation so when it is required when livetree is activated but this address translation is already done by ofnode_read_resource(). Fixes: 240720e9052f ("firmware: scmi: mailbox/smt agent device") Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2021-04-12gpio: Drop dm_gpio_set_dir()Simon Glass2-22/+0
This function is not used. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2021-04-12gpio: i2c-gpio: Drop use of dm_gpio_set_dir()Simon Glass1-10/+9
This is the only driver that uses this function. Update it to use the alternative which is dm_gpio_clrset_flags(). Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Harm Berntsen <harm.berntsen@nedap.com>
2021-04-12qemu: arm: select QFW, MMIO on qemu-armAsherah Connor1-0/+2
Select CMD_QFW and QFW_MMIO in the qemu-arm board (covers arm and arm64). Signed-off-by: Asherah Connor <ashe@kivikakk.ee> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2021-04-12qemu: add MMIO driver for QFWAsherah Connor3-0/+127
Add MMIO driver for QFW. Note that there is no consumer as of this patch. Signed-off-by: Asherah Connor <ashe@kivikakk.ee> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2021-04-12test: qemu: add qfw sandbox driver, dm tests, qemu testsAsherah Connor7-2/+197
A sandbox driver and test are added for the qfw uclass, and a test in QEMU added for qfw functionality to confirm it doesn't break in real world use. Signed-off-by: Asherah Connor <ashe@kivikakk.ee> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2021-04-12x86: qemu: move QFW to its own uclassAsherah Connor13-272/+489
We move qfw into its own uclass and split the PIO functions into a specific driver for that uclass. The PIO driver is selected in the qemu-x86 board config (this covers x86 and x86_64). include/qfw.h is cleaned up and documentation added. Signed-off-by: Asherah Connor <ashe@kivikakk.ee> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
2021-04-12scmi: correctly configure MMU for SCMI bufferPatrick Delaunay1-2/+4
Align the MMU area for SCMI shared buffer on section size; use the ALIGN macro in mmu_set_region_dcache_behaviour call. Since commit d877f8fd0f09 ("arm: provide a function for boards init code to modify MMU virtual-physical map") the parameter of mmu_set_region_dcache_behaviour need to be MMU_SECTION_SIZE aligned. Fixes: 240720e9052f ("firmware: scmi: mailbox/smt agent device") Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
2021-04-12moveconfig.py: add to the "do not process" listTrevor Woerner1-1/+1
Skip the processing of *.aml and *.dat files while iterating through the source in order to process header files. Signed-off-by: Trevor Woerner <twoerner@gmail.com>
2021-04-12checkpatch: Add warnings for using strn(cat|cpy)Sean Anderson2-1/+19
strn(cat|cpy) has a bad habit of not nul-terminating the destination, resulting in constructions like strncpy(foo, bar, sizeof(foo) - 1); foo[sizeof(foo) - 1] = '\0'; However, it is very easy to forget about this behavior and accidentally leave a string unterminated. This has shown up in some recent coverity scans [1, 2] (including code recently touched by yours truly). Fortunately, the guys at OpenBSD came up with strl(cat|cpy), which always nul-terminate strings. These functions are already in U-Boot, so we should encourage new code to use them instead of strn(cat|cpy). [1] https://lists.denx.de/pipermail/u-boot/2021-March/442888.html [2] https://lists.denx.de/pipermail/u-boot/2021-January/438073.html Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-04-12fastboot: Fix possible buffer overrunSean Anderson1-3/+3
This fixes several uses of strn(cpy|cat) which did not terminate their destinations properly. Fixes de1728ce4c ("fastboot: Allow u-boot-style partitions") Reported-by: Coverity Scan Signed-off-by: Sean Anderson <seanga2@gmail.com>
2021-04-12test: Add test for strlcatSean Anderson2-0/+127
This test is adapted from glibc, which is very concerned about alignment. It also tests strlcpy by dependency. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-04-12lib: string: Implement strlcatSean Anderson3-6/+22
This introduces strlcat, which provides a safer interface than strncat. It never copies more than its size bytes, including the terminating nul. In addition, it never reads past dest[size - 1], even if dest is not nul-terminated. This also removes the stub for dwc3 now that we have a proper implementation. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-04-12lib: string: Fix strlcpy return valueSean Anderson1-4/+8
strlcpy should always return the number of bytes copied. We were accidentally missing the nul-terminator. We also always used to return a non-zero value, even if we did not actually copy anything. Fixes: 23cd138503 ("Integrate USB gadget layer and USB CDC driver layer") Signed-off-by: Sean Anderson <seanga2@gmail.com>
2021-04-12tee: optee: Change printing during optee_probeIlias Apalodimas1-3/+3
Right now the error messages when optee has a version mismatch or shared memory is not configured are done with a debug(). That's not very convenient since you have to enable debugging to figure out what's going on, although this is an actual error. So let's switch the debug() -> dev_err() and report those explicitly. Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2021-04-12terminal: only serial_reinit_all if availableAsherah Connor1-1/+3
serial_reinit_all() is only available if CONFIG_SERIAL is defined (i.e. !CONFIG_DM_SERIAL). Signed-off-by: Asherah Connor <ashe@kivikakk.ee> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-04-12terminal: correct stdio_dev invocationsAsherah Connor1-6/+6
stdio_dev methods have taken a pointer to themselves since 709ea543 (nearly 7 years ago). Signed-off-by: Asherah Connor <ashe@kivikakk.ee> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-04-12rtc: add support for rv3028 rtcHeiko Schocher3-0/+215
Add support for rtc3028 rtc from microcrystal. based on linux dirver: commit a38fd8748464: ("Linux 5.12-rc2") Signed-off-by: Heiko Schocher <hs@denx.de> Reviewed-by: Stefan Roese <sr@denx.de>
2021-04-12test: scmi: add local variables for scmi agent referenceEtienne Carriere1-45/+55
Add local variables agent0/agent1 to refer to SCMI sandbox context agent and ease readability of the test. For consistency, rename regul_dev to regul0_dev and remove sandbox_voltd in dm_test_scmi_voltage_domains(). Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-04-12firmware: scmi: fix inline comments and minor coding style issuesEtienne Carriere3-17/+7
Fix inline comments and empty line in scmi driver and test files. Remove test on IS_ENABLED(CONFIG_*_SCMI) in test/dm/scmi.c since these configuration are expected enabled when CONFIG_FIRMWARE_SCMI is enabled in sandbox configuration. Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2021-04-12firmware: scmi: sandbox test for voltage regulatorEtienne Carriere6-3/+327
Implement sandbox regulator devices for SCMI voltage domains and test them in DM scmi tests. Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2021-04-12firmware: scmi: voltage regulatorEtienne Carriere6-0/+361
Implement voltage regulators interfaced by the SCMI voltage domain protocol. The DT bindings are defined in the Linux kernel since SCMI voltage domain and regulators patches [1] and [2] integration in v5.11-rc7. Link: [1] https://github.com/torvalds/linux/commit/0f80fcec08e9c50b8d2992cf26495673765ebaba Link: [2] https://github.com/torvalds/linux/commit/2add5cacff3531e54c50b0832128299faa9f0563 Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2021-04-12disk: gpt: verify alternate LBA points to last usable LBAStefan Herbrechtsmeier1-0/+9
The gpt command require the GPT backup header at the standard location at the end of the device. Check the alternate LBA value before reading the GPT backup header from the last usable LBA of the device. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-04-12cmd: xtrace: Convert to boolSean Anderson3-3/+3
This variable is a boolean, not a string. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-04-12pci: Mark 64bit Memory BARs as suchPhil Sutter1-1/+2
Just a bit more info to the reader. Signed-off-by: Phil Sutter <phil@nwl.cc> Reviewed-by: Stefan Roese <sr@denx.de>
2021-04-12hush: Fix assignments being misinterpreted as commandsSean Anderson2-1/+3
If there were no variable substitutions in a command, then initial assignments would be misinterpreted as commands, instead of being skipped over. This is demonstrated by the following example: => foo=bar echo baz Unknown command 'foo=bar' - try 'help' Signed-off-by: Sean Anderson <seanga2@gmail.com>
2021-04-12mtd: Update fail_addr when erase fails due to bad blocksFarhan Ali1-0/+2
For all other erase failures, the fail_addr is updated with the failing address. Only in the case of erase failure due to bad block detection, the fail_addr is not updated. This change simply updates the fail_addr for this specific scenario so that it is consistent with the rest of the code. Signed-off-by: Farhan Ali <farhan.ali@broadcom.com>
2021-04-12Tegra: remove e2220-1170 boardPeter Robinson9-207/+0
It's an old bringup board with out upstream Linux or L4T support Signed-off-by: Peter Robinson <pbrobinson@gmail.com> Cc: Stephen Warren <swarren@nvidia.com> Cc: Tom Warren <twarren@nvidia.com> Acked-by: Stephen Warren <swarren@nvidia.com>
2021-04-12bootm: do not hang on failureHeinrich Schuchardt1-5/+2
On ARMv8 systems load mmc 0:1 $loadaddr vmlinuz-5.10.0-3-arm64 booti leads to a hanging system requiring to physically reset the system: FDT and ATAGS support not compiled in - hanging ### ERROR ### Please RESET the board ### For systems where physical access is difficult hanging is a poor choice. It is preferable to reset the system when U-Boot reaches a state that is not recoverable. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-04-12hash: Allow for SHA512 hardware implementationsJoel Stanley3-10/+55
Similar to support for SHA1 and SHA256, allow the use of hardware hashing engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL / CONFIG_SHA_PROG_HW_ACCEL. Signed-off-by: Joel Stanley <joel@jms.id.au>
2021-04-12hw_sha: Fix coding style errorsJoel Stanley1-6/+6
Checkpatch complains about: ERROR: "foo * bar" should be "foo *bar" and CHECK: Alignment should match open parenthesis Signed-off-by: Joel Stanley <joel@jms.id.au>
2021-04-12lib: optee: migration optee_copy_fdt_nodes for OF_LIVE supportPatrick Delaunay3-30/+21
The optee_copy_fdt_nodes is only used to copy op-tee nodes of U-Boot device tree (from gd->fdt_blob when OF_LIVE is not activated) to external device tree but it is not compatible with OF_LIVE. This patch migrates all used function fdt_ functions to read node on old_blob to ofnode functions, compatible with OF_LIVE and remove this parameter "old_blob". The generated "device tree" is checked on stm32mp platform with OF_LIVE activated. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2021-04-12power: pmic: remove pmic_max77696.c fileJaehoon Chung3-91/+0
Remove pmic_max77696.c file. The maintaining pmic_max77696.c file is useless. Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2021-04-12board: warp: add power_max77696_init() functionJaehoon Chung2-2/+67
Add power_max77696_init() function. Since warp doesn't support DM, the keeping its code in board file is better than maintainig the file of driver. Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2021-04-11Merge branch '2021-04-11-remove-non-migrated-boards'WIP/11Apr2021Tom Rini428-39732/+21
- Remove a large number of boards that have not migrated to DM_MMC, for which the migration deadline with 2 years ago at v2019.04.
2021-04-11Merge tag 'video-2021-07-rc1' of ↵Tom Rini22-71/+370
https://source.denx.de/u-boot/custodians/u-boot-video - rk3399 eDP support - pwm backlight without a known period_ns - add Chrome OS EC PWM driver - Kconfig SIMPLE_PANEL DM_GPIO dependency - remove mb862xx driver remnants - fix KiB format in reserve_video() debug trace - fix tegra124 sor CSTM LVDS_EN_ENABLE/DISABLE config - fix line padding calculation for 16 and 24 BPP bitmaps
2021-04-10Merge tag 'efi-2021-07-rc1' of ↵WIP/10Apr2021Tom Rini14-117/+360
https://source.denx.de/u-boot/custodians/u-boot-efi Pull request for efi-2021-07-rc1 Bug fixes: * support EFI, HOST, VIRTIO in fsinfo command * simplify efi_get_device_path_text() * add missing EFI_UNACCEPTED_MEMORY_TYPE * mkeficapsule: improve online help * avoid several build warnings Documentation: * UEFI documentation for initrd loading options * describe building OP-TEE with for UEFI variables * mmc man-page