aboutsummaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2021-07-28mkimage: use environment variable MKIMAGE_SIGN_PIN to set pin for OpenSSL EngineMarc Kleine-Budde
This patch adds the possibility to pass the PIN the OpenSSL Engine used during signing via the environment variable MKIMAGE_SIGN_PIN. This follows the approach used during kernel module signing ("KBUILD_SIGN_PIN") or UBIFS image signing ("MKIMAGE_SIGN_PIN"). Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-07-28lib: rsa: rsa-sign: Minor bug in debug messageChan, Donald
*sig_size isn't set until later so use the correct variables. Signed-off-by: Donald Chan <hoiho@lab126.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-07-28lib: rsa: rsa-verify: Fix a typo in a debug messageThomas Perrot
Signed-off-by: Thomas Perrot <thomas.perrot@bootlin.com>
2021-07-28lib: Create a new Kconfig option for charset conversionSimon Glass
Rather than looking at two KConfig options in the Makefile, create a new Kconfig option for compiling lib/charset.c Enable it for UFS also, which needs this support. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-07-27lib: strto: add simple_strtoll functionRoland Gaudig
Add simple_strtoll function for converting a string containing digits into a long long int value. Signed-off-by: Roland Gaudig <roland.gaudig@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-07-24efi_loader: remove asm/setjmp.h from efi_api.hAKASHI Takahiro
In the commit c982874e930d ("efi_loader: refactor efi_setup_loaded_image()"), setjmp-related definitions were moved to efi_loaded_image_obj in efi_loader.h. So setjmp.h is no longer refererenced in efi_api.h. This also fixes some error when efi_api.h will be included in mkeficapsule.c. Fixes: c982874e930d ("efi_loader: refactor efi_setup_loaded_image()") Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-07-24efi_loader: capsule: remove authentication dataAKASHI Takahiro
If capsule authentication is disabled and yet a capsule file is signed, its signature must be removed from image data to flush. Otherwise, the firmware will be corrupted after update. Fixes: 04be98bd6bcf ("efi: capsule: Add support for uefi capsule authentication") Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2021-07-24efi_loader: capsule: remove unused guidAKASHI Takahiro
efi_guid_capsule_root_cert_guid is never used. Just remove it. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-07-24smbios: error handling for invalid addressesHeinrich Schuchardt
SMBIOS tables only support 32bit addresses. If we don't have memory here handle the error gracefully: * on x86_64 fail to start U-Boot * during UEFI booting ignore the missing table Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-07-24smbios: Fix calculating BIOS Release DatePali Rohár
BIOS Release Date must be in format mm/dd/yyyy and must be release date. U-Boot currently sets BIOS Release Date from U_BOOT_DMI_DATE macro which is generated from current build timestamp. Fix this issue by setting U_BOOT_DMI_DATE macro to U-Boot version which is better approximation of U-Boot release date than current build timestamp. Current U-Boot versioning is in format yyyy.mm so as a day choose 01. Some operating systems are using BIOS Release Date for detecting when was SMBIOS table filled or if it could support some feature (e.g. BIOS from 1990 cannot support features invented in 2000). So this change also ensures that recompiling U-Boot from same sources but in different year does not change behavior of some operating systems. Macro U_BOOT_DMI_DATE is not used in other file than lib/smbios.c so remove it from global autogenerated files and also from Makefile. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-07-23lib: wrap crypt API to hide errno usageSteffen Jaeckel
In order to prevent using the global errno, replace it with a static version and create a wrapper function which returns the error value. Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heiko Schocher <hs@denx.de>
2021-07-23lib: add crypt subsystemSteffen Jaeckel
Add the basic functionality required to support the standard crypt format. The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and their formatting is therefor retained. The integration is done via a crypt_compare() function in crypt.c. ``` libxcrypt $ git describe --long --always --all tags/v4.4.17-0-g6b110bc ``` Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heiko Schocher <hs@denx.de>
2021-07-18efi_capsule: Move signature from DTB to .rodataIlias Apalodimas
The capsule signature is now part of our DTB. This is problematic when a user is allowed to change/fixup that DTB from U-Boots command line since he can overwrite the signature as well. So Instead of adding the key on the DTB, embed it in the u-boot binary it self as part of it's .rodata. This assumes that the U-Boot binary we load is authenticated by a previous boot stage loader. Reviewed-by: Masami Hiramatsu <masami.hiramatsu@linaro.org> Tested-by: Masami Hiramatsu <masami.hiramatsu@linaro.org> Tested-by: Sughosh Ganu <sughosh.ganu@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2021-07-18efi_loader: increase eventlog buffer sizeMasahisa Kojima
TCG PC Client PFP spec says "The Log Area Minimum Length for the TCG event log MUST be at least 64KB." in ACPI chapter. This commit increase the buffer size to 64KB. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-07-18efi_loader: Use %pD to log device-path instead of local efi_dp_str()Masami Hiramatsu
Use %pD to log device-path instead of using efi_dp_str() and efi_free_pool() locally in find_boot_device(). This is a cleanup patch, no feature update nor fix. Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-07-18efi_loader: set partition GUID in device path for SIG_TYPE_GUIDAlfonso Sánchez-Beato
Previously, the GPT device GUID was being used instead of the partition, which was incorrect. Signed-off-by: Alfonso Sánchez-Beato <alfonso.sanchez-beato@canonical.com> Let EFI_LOADER select CONFIG_PARTITION_UUIDS. Use log_warning() instead of printf() for warning. Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2021-07-16image: rsa: Move verification algorithm to a linker listAlexandru Gagniuc
Move the RSA verification crytpo_algo structure out of the crypto_algos array, and into a linker list. Although it appears we are adding an #ifdef to rsa-verify.c, the gains outweigh this small inconvenience. This is because rsa_verify() is defined differently based on #ifdefs. This change allows us to have a single definition of rsa_verify(). Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-07-16image: Rename CONFIG_FIT_ENABLE_RSASSA_PSS_SUPPORTSimon Glass
Drop the ENABLE and SUPPORT parts of this, which are redundant. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2021-07-15lib/vsprintf.c: remove unused ip6_addr_string()Rasmus Villemoes
There's currently no user of %p[iI]6, so including ip6_addr_string() in the image is a waste of bytes. It's easy enough to have the compiler elide it without removing the code completely. The closest I can find to anybody "handling" ipv6 in U-Boot currently is in efi_net.c which does if (ipv6) { ret = EFI_UNSUPPORTED; As indicated in the comment, it can easily be put back, but preferably under a config knob. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2021-07-15lib/vsprintf.c: remove stale commentRasmus Villemoes
U-Boot doesn't support %pS/%pF or any other kind of kallsyms-like lookups. Remove the comment. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2021-07-15lib/vsprintf.c: implement printf() in terms of vprintf()Rasmus Villemoes
This saves some code, both in terms of #LOC and .text size, and it is also the normal convention that foo(...) is implemented in terms of vfoo(). Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2021-07-15tpm: Check outgoing command sizeSimon Glass
In tpm_sendrecv_command() the command buffer is passed in. If a mistake is somehow made in setting this up, the size could be out of range. Add a sanity check for this. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Coverity (CID: 331152)
2021-07-14lib: move rtc-lib.c to libHeinrich Schuchardt
Function rtc_to_tm() is needed for FAT file system support even if we don't have a real time clock. So move it from drivers/ to lib/. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2021-07-12efi_loader: Fix to set bootdev_root correctly if bootdev foundMasami Hiramatsu
Fix find_boot_device() to set bootdev_root if it finds the bootdev from BootNext. Currently it sets the bootdev_root only when it finds bootdev from BootOrder. Fixes: c74cd8bd08d1 ("efi_loader: capsule: add capsule_on_disk support") Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org> Accked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-07-12efi_loader: set CapsuleLast after each capsuleHeinrich Schuchardt
If multiple capsules are applied, the FMP drivers for the individual capsules can expect the value of CapsuleLast to be accurate. Hence CapsuleLast must be updated after each capsule. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-07-12efi_loader: missing EFI_CALL() in set_capsule_resultHeinrich Schuchardt
efi_set_variable() should be called with EFI_CALL(). Use efi_set_variable_int() instead. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-07-12efi_loader: rework messages for capsule updatesHeinrich Schuchardt
* Use log category LOGC_EFI. This allows to remove 'EFI:' prefixes in messages. * Rephrase some of the messages. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-07-12efi_loader: provide file attributes in EFI_FILE_PROTOCOL.Read()Heinrich Schuchardt
When reading a directory using EFI_FILE_PROTOCOL.Read() provide file attributes and timestamps. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-07-12lib: remove superfluous #ifdefs from date.cHeinrich Schuchardt
We should avoid #ifdef in C modules. Unused functions are eliminated by the linker. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-07-05Merge branch 'next'Tom Rini
2021-07-02efi_loader: Allow capsule update on-disk without checking OsIndicationsIlias Apalodimas
Although U-Boot supports capsule update on-disk, it's lack of support for SetVariable at runtime prevents applications like fwupd from using it. In order to perform the capsule update on-disk the spec says that the OS must copy the capsule to the \EFI\UpdateCapsule directory and set a bit in the OsIndications variable. The firmware then checks for the EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED bit in OsIndications variable, which is set by the submitter to trigger processing of the capsule on the next reboot. Let's add a config option which ignores the bit and just relies on the capsule being present. Since U-Boot deletes the capsule while processing it, we won't end up applying it multiple times. Note that this is allowed for all capsules. In the future, once authenticated capsules are fully supported, we can limit the functionality to those only. Signed-off-by: apalos <ilias.apalodimas@linaro.org> Reword Kconfig description. Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-07-02efi_loader: clear OsIndicationsHeinrich Schuchardt
After each reboot we must clear flag EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED in variable OsIndications. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-07-02efi_loader: Improve the parameter check for QueryVariableInfo()Masami Hiramatsu
Improve efi_query_variable_info() to check the parameter settings and return correct error code according to the UEFI Specification 2.9, and the Self Certification Test (SCT) II Case Specification, June 2017, chapter 4.1.4 QueryVariableInfo(). Reported-by: Kazuhiko Sakamoto <sakamoto.kazuhiko@socionext.com> Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-07-02efi_loader: missing parentheses in query_console_sizeHeinrich Schuchardt
After if we should use parentheses to keep the code readable. Fixes: a95f4c885991 ("efi_loader: NULL dereference in EFI console") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-07-02efi_loader: Always install FMPsIlias Apalodimas
We only install FMPs if a CapsuleUpdate is requested. Since we now have an ESRT table which relies on FMPs to build the required information, it makes more sense to unconditionally install them. This will allow userspace applications (e.g fwupd) to make use of the ERST and provide us with files we can use to run CapsuleUpdate on-disk Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-07-02efi_loader: Force a single FMP instance per hardware storeIlias Apalodimas
Chapter 23 of the EFI spec (rev 2.9) says: "A specific updatable hardware firmware store must be represented by exactly one FMP instance". This is not the case for us, since both of our FMP protocols can be installed at the same time because they are controlled by a single 'dfu_alt_info' env variable. So make the config options depend on each other and allow the user to install one of them at any given time. If we fix the meta-data provided by the 'dfu_alt_info' in the future, to hint about the capsule type (fit or raw) we can revise this and enable both FMPs to be installed, as long as they target different firmware hardware stores Note that we are not using a Kconfig 'choice' on purpose, since we want to allow both of those to be installed and tested in sandbox Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-07-02efi: Fix to use null handle to create new handle for efi_fmp_rawMasami Hiramatsu
When running the efidebug capsule disk-update command, the efi_fmp_raw protocol installation fails with 2 (EFI_INVALID_PARAMETER) as below. This is because the code passes efi_root instead of the handle local var. => efidebug capsule disk-update EFI: Call: efi_install_multiple_protocol_interfaces( &handle, &efi_guid_firmware_management_protocol, &efi_fmp_fit, NULL) EFI: Entry efi_install_multiple_protocol_interfaces(00000000fbaf5988) EFI: Call: efi_install_protocol_interface( handle, protocol, EFI_NATIVE_INTERFACE, protocol_interface) EFI: Entry efi_install_protocol_interface(00000000fbaf5988, 86c77a67-0b97-4633-a187-49104d0685c7, 0, 00000000fbfa6ee8) EFI: new handle 00000000fbb37520 EFI: Exit: efi_install_protocol_interface: 0 EFI: 0 returned by efi_install_protocol_interface( handle, protocol, EFI_NATIVE_INTERFACE, protocol_interface) EFI: Exit: efi_install_multiple_protocol_interfaces: 0 EFI: 0 returned by efi_install_multiple_protocol_interfaces( &handle, &efi_guid_firmware_management_protocol, &efi_fmp_fit, NULL) EFI: Call: efi_install_multiple_protocol_interfaces( &efi_root, &efi_guid_firmware_management_protocol, &efi_fmp_raw, NULL) EFI: Entry efi_install_multiple_protocol_interfaces(00000000fbfec648) EFI: Call: efi_install_protocol_interface( handle, protocol, EFI_NATIVE_INTERFACE, protocol_interface) EFI: Entry efi_install_protocol_interface(00000000fbfec648, 86c77a67-0b97-4633-a187-49104d0685c7, 0, 00000000fbfa6f18) EFI: handle 00000000fbaf8520 EFI: Exit: efi_install_protocol_interface: 2 EFI: 2 returned by efi_install_protocol_interface( handle, protocol, EFI_NATIVE_INTERFACE, protocol_interface) EFI: Exit: efi_install_multiple_protocol_interfaces: 2 EFI: 2 returned by efi_install_multiple_protocol_interfaces( &efi_root, &efi_guid_firmware_management_protocol, &efi_fmp_raw, NULL) Command failed, result=1 To fix this issue, pass the handle local var which is set NULL right before installing efi_fmp_raw as same as the installing efi_fmp_fit. (In both cases, the local reference to the handle will be just discarded) Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-06-29Merge tag 'efi-2021-07-rc5-2' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-efi Pull request for efi-2021-07-rc5-2 Documentation: * man-page for askenv bug fixes * correct display of BootOrder in efidebug command * do not allow TPL_HIGH_LEVEL for CreateEvent(Ex) * correct handling of unknown properties in SMBIOS tables
2021-06-28Merge tag 'v2021.07-rc5' into nextTom Rini
Prepare v2021.07-rc5 # gpg: Signature made Mon 28 Jun 2021 03:39:36 PM EDT # gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C # gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate] # Conflicts: # configs/am64x_evm_r5_defconfig
2021-06-28arm64: Fix relocation of env_addr if POSITION_INDEPENDENT=yKunihiko Hayashi
If both POSITION_INDEPENDENT and SYS_RELOC_GD_ENV_ADDR are enabled, wherever original env is placed anywhere, it should be relocated to the right address. Relocation offset gd->reloc_off is calculated with SYS_TEXT_BASE in setup_reloc() and env address gd->env_addr is relocated by the offset in initr_reloc_global_data(). gd->env_addr = (orig env) + gd->reloc_off = (orig env) + (gd->relocaddr - SYS_TEXT_BASE) However, SYS_TEXT_BASE isn't always runtime base address when POSITION_INDEPENDENT is enabled. So the relocated env_addr might point to wrong address. For example, if SYS_TEXT_BASE is zero, gd->env_addr is out of memory location and memory exception will occur. There is a difference between linked address such as SYS_TEXT_BASE and runtime base address. In _main, the difference is calculated as "run-vs-link" offset. The env_addr should also be added to the offset to fix the address. gd->env_addr = (orig env) + ("run-vs-link" offset) + gd->reloc_off = (orig env) + (SYS_TEXT_BASE - _start) + (gd->relocaddr - SYS_TEXT_BASE) = (orig env) + (gd->relocaddr - _start) Cc: Marek Vasut <marex@denx.de> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com> Acked-by: Marek Vasut <marex@denx.de> Tested-by: Marek Vasut <marex@denx.de>
2021-06-28smbios: Fix SMBIOS tablesIlias Apalodimas
Commit e4f8e543f1a9("smbios: Drop the unused Kconfig options") break SMBIOS tables. The reason is that the patch drops the Kconfig options *after* removing the code using them, but that changes the semantics of the code completely. Prior to the change a non NULL value was used in the 'product' and 'manufacturer ' fields. Chapter 6.2 of the DMTF spec requires Manufacturer and Product Name to be non-null on some of the tables. So let's add sane defaults for Type1/2/3. * Before the patchset: <snip> Handle 0x0002, DMI type 2, 14 bytes Base Board Information Manufacturer: Not Specified Product Name: Not Specified Version: Not Specified Serial Number: Not Specified Asset Tag: Not Specified Features: Board is a hosting board Location In Chassis: Not Specified Chassis Handle: 0x0000 Type: Motherboard Invalid entry length (0). DMI table is broken! Stop. * After the patchset: <snip> Handle 0x0005, DMI type 32, 11 bytes System Boot Information Status: No errors detected Handle 0x0006, DMI type 127, 4 bytes End Of Table Fixes: e4f8e543f1a9 ("smbios: Drop the unused Kconfig options") Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2021-06-28smbios: Fix BIOS Characteristics Extension Byte 2Ilias Apalodimas
We currently define the EFI support of an SMBIOS table as the third bit of "BIOS Characteristics Extension Byte 1". The latest DMTF spec defines it on "BIOS Characteristics Extension Byte 2". Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Remove superfluous assignment. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-06-28smbios: convert function descriptions to Sphinx styleHeinrich Schuchardt
Use 'Return:' instead of '@return:'. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-06-28efi_loader: TPL_HIGH_LEVEL not allowed for CreateEventHeinrich Schuchardt
According to chapter 7.1 "Event, Timer, and Task Priority Services" TPL_HIGH_LEVEL should not be exposed to applications and drivers. According to the discussion with EDK II contributors this implies that CreateEvent() shall not allow to create events with TPL_HIGH_LEVEL. Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Acked-by: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
2021-06-11lib: rational: copy the rational fraction lib routines from LinuxTero Kristo
Copy the best rational approximation calculation routines from Linux. Typical usecase for these routines is to calculate the M/N divider values for PLLs to reach a specific clock rate. This is based on linux kernel commit: "lib/math/rational.c: fix possible incorrect result from rational fractions helper" (sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881) Signed-off-by: Tero Kristo <t-kristo@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com> Signed-off-by: Tero Kristo <kristo@kernel.org>
2021-06-09efi_loader: fix Sphinx warningHeinrich Schuchardt
Brackets '[' need to be escaped to avoid a build warning lib/efi_loader/efi_image_loader.c:223: WARNING: Inline strong start-string without end-string. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Masahisa Kojima <masahisa.kojima@linaro.org>
2021-06-09efi_loader: efi_capsule_delete_file() NULL dereferenceHeinrich Schuchardt
If opening a file fails, the file handle pointer is not valid and must not be dereferenced. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-06-09efi_loader: partition numbers are hexadecimalHeinrich Schuchardt
If we want to address partition 15 of virtio block device 11, we have to write: virtio b:f When calling sprintf() we must use %x for the device and partition numbers. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-06-08display_options: Split print_buffer() into two functionsSimon Glass
At present print_buffer() outputs a hex dump but it is not possible to place this dump in a string. Refactor it into a top-level function which does the printing and a utility function that dumps a line into a string. This makes the code more generally useful. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-06-08hexdump: Allow ctrl-c to interrupt outputSimon Glass
If a long hexdump is initated the user may wish to interrupt it. Add support for this. Signed-off-by: Simon Glass <sjg@chromium.org>