1. 28 5月, 2022 1 次提交
  2. 08 5月, 2022 1 次提交
    • I
      efi_loader: add sha384/512 on certificate revocation · b436cc6a
      Ilias Apalodimas 提交于
      Currently we don't support sha384/512 for the X.509 certificate
      in dbx.  Moreover if we come across such a hash we skip the check
      and approve the image,  although the image might needs to be rejected.
      
      Rework the code a bit and fix it by adding an array of structs with the
      supported GUIDs, len and literal used in the U-Boot crypto APIs instead
      of hardcoding the GUID types.
      
      It's worth noting here that efi_hash_regions() can now be reused from
      efi_signature_lookup_digest() and add sha348/512 support there as well
      Signed-off-by: NIlias Apalodimas <ilias.apalodimas@linaro.org>
      b436cc6a
  3. 04 5月, 2022 1 次提交
  4. 24 4月, 2022 2 次提交
    • A
      efi_loader: disk: a helper function to create efi_disk objects from udevice · a9bf024b
      AKASHI Takahiro 提交于
      Add efi_disk_probe() function.
      This function creates an efi_disk object for a raw disk device (UCLASS_BLK)
      and additional objects for related partitions (UCLASS_PARTITION).
      
      So this function is expected to be called through driver model's "probe"
      interface every time one raw disk device is detected and activated.
      We assume that partition devices (UCLASS_PARTITION) have been created
      when this function is invoked.
      Signed-off-by: NAKASHI Takahiro <takahiro.akashi@linaro.org>
      a9bf024b
    • A
      efi_loader: split efi_init_obj_list() into two stages · a57ad20d
      AKASHI Takahiro 提交于
      In the next commit, CONFIG_EFI_SETUP_EARLY will become mandated
      in order to support dynamic enumeration of efi_disk objects.
      
      This can, however, be problematic particularly in case of file-based
      variable storage (efi_variable.c, default).
      Non-volatile variables are to be restored from EFI system partition
      by efi_init_variables() in efi_init_obj_list(). When efi_init_obj_list()
      is called in board_init_r(), we don't know yet what disk devices
      we have since none of device probing commands (say, scsi rescan) has not
      been executed at that stage.
      
      So in this commit, a preparatory change is made; efi_init_obj_list() is
      broken into the two functions;
         * efi_init_early(), and
         * new efi_init_obj_list()
      
      Only efi_init_early() will be called in board_init_r(), which allows
      us to execute any of device probing commands, either though "preboot"
      variable or normal command line, before calling efi_init_obj_list() which
      is to be invoked at the first execution of an efi-related command
      (or at efi_launch_capsules()) as used to be.
      Signed-off-by: NAKASHI Takahiro <takahiro.akashi@linaro.org>
      a57ad20d
  5. 15 4月, 2022 1 次提交
    • S
      capsule: board: Add information needed for capsule updates · 741ef867
      Sughosh Ganu 提交于
      Add a structure which defines the information that is needed for
      executing capsule updates on a platform. Some information in the
      structure like the dfu string is used for making the update process
      more robust while some information like the per platform image GUIDs
      is used for fixing issues. Initialise this structure in the board
      file, and use the information for the capsule updates.
      Signed-off-by: NSughosh Ganu <sughosh.ganu@linaro.org>
      741ef867
  6. 20 3月, 2022 5 次提交
  7. 12 3月, 2022 1 次提交
  8. 06 2月, 2022 1 次提交
  9. 04 2月, 2022 1 次提交
  10. 29 1月, 2022 2 次提交
  11. 20 1月, 2022 1 次提交
  12. 15 1月, 2022 1 次提交
    • I
      efi_loader: Get rid of kaslr-seed if EFI_RNG_PROTOCOL is installed · a2f1482f
      Ilias Apalodimas 提交于
      U-Boot, in some occasions, injects a 'kaslr-seed' property on the /chosen
      node. That would be problematic in case we want to measure the DTB we
      install in the configuration table, since it would change across reboots.
      
      The Linux kernel EFI-stub completely ignores it and only relies on
      EFI_RNG_PROTOCOL for it's own randomness needs (i.e the randomization
      of the physical placement of the kernel). In fact it (blindly) overwrites
      the existing seed if the protocol is installed. However it still uses it
      for randomizing it's virtual placement.
      So let's get rid of it in the presence of the RNG protocol.
      
      It's worth noting that TPMs also provide an RNG.  So if we tweak our
      EFI_RNG_PROTOCOL slightly and install the protocol when a TPM device
      is present the 'kaslr-seed' property will always be removed, allowing
      us to reliably measure our DTB.
      Acked-by: NArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: NIlias Apalodimas <ilias.apalodimas@linaro.org>
      Reviewed-by: NMark Kettenis <kettenis@openbsd.org>
      a2f1482f
  13. 10 12月, 2021 1 次提交
  14. 30 11月, 2021 1 次提交
  15. 27 10月, 2021 1 次提交
  16. 26 10月, 2021 2 次提交
    • M
      efi_loader: add SMBIOS table measurement · 3d49ee85
      Masahisa Kojima 提交于
      TCG PC Client Platform Firmware Profile Specification
      requires to measure the SMBIOS table that contains static
      configuration information (e.g. Platform Manufacturer
      Enterprise Number assigned by IANA, platform model number,
      Vendor and Device IDs for each SMBIOS table).
      
      The device- and environment-dependent information such as
      serial number is cleared to zero or space character for
      the measurement.
      
      Existing smbios_string() function returns pointer to the string
      with const qualifier, but exisintg use case is updating version
      string and const qualifier must be removed.
      This commit removes const qualifier from smbios_string()
      return value and reuses to clear the strings for the measurement.
      
      This commit also fixes the following compiler warning:
      
      lib/smbios-parser.c:59:39: warning: cast to pointer from integer of
      different size [-Wint-to-pointer-cast]
        const struct smbios_header *header = (struct smbios_header *)entry->struct_table_address;
      Signed-off-by: NMasahisa Kojima <masahisa.kojima@linaro.org>
      3d49ee85
    • H
      efi_loader: treat UEFI variable name as const · d47671c6
      Heinrich Schuchardt 提交于
      UEFI variable names are typically constants and hence should be defined as
      const. Unfortunately some of our API functions do not define the parameters
      for UEFI variable names as const. This requires unnecessary conversions.
      
      Adjust parameters of several internal functions to tre UEFI variable names
      as const.
      Signed-off-by: NHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
      Reviewed-by: NIlias Apalodimas <ilias.apalodimas@linaro.org>
      d47671c6
  17. 21 10月, 2021 3 次提交
  18. 17 8月, 2021 1 次提交
  19. 15 8月, 2021 2 次提交
    • M
      efi_loader: add ExitBootServices() measurement · fdff03e5
      Masahisa Kojima 提交于
      TCG PC Client PFP spec requires to measure
      "Exit Boot Services Invocation" if ExitBootServices() is invoked.
      Depending upon the return code from the ExitBootServices() call,
      "Exit Boot Services Returned with Success" or "Exit Boot Services
      Returned with Failure" is also measured.
      Signed-off-by: NMasahisa Kojima <masahisa.kojima@linaro.org>
      
      Swap two ifs in efi_exit_boot_services().
      efi_tcg2_notify_exit_boot_services must have EFIAPI signature.
      Signed-off-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
      fdff03e5
    • M
      efi_loader: add boot variable measurement · 8fc4e0b4
      Masahisa Kojima 提交于
      TCG PC Client PFP spec requires to measure "Boot####"
      and "BootOrder" variables, EV_SEPARATOR event prior
      to the Ready to Boot invocation.
      Since u-boot does not implement Ready to Boot event,
      these measurements are performed when efi_start_image() is called.
      
      TCG spec also requires to measure "Calling EFI Application from
      Boot Option" for each boot attempt, and "Returning from EFI
      Application from Boot Option" if a boot device returns control
      back to the Boot Manager.
      Signed-off-by: NMasahisa Kojima <masahisa.kojima@linaro.org>
      8fc4e0b4
  20. 29 7月, 2021 1 次提交
    • S
      Allow efi_loader header to be included always · 6e3c6544
      Simon Glass 提交于
      It is bad practice to put function declarations behind an #ifdef since
      it makes it impossible to use IS_ENABLED() in the C code. The main reason
      for doing this is when an empty static inline function is desired when
      the feature is disabled.
      
      To this end, this header provides two different versions of various
      functions and macros. Collect them together in one place for clarity.
      Allow all the rest of the header to be included, regardless of the
      setting of EFI_LOADER.
      
      With the inclusion of blk.h the 'struct blk_desc' declaration is
      unnecessary. Drop it while we are here.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      6e3c6544
  21. 24 7月, 2021 1 次提交
  22. 02 7月, 2021 1 次提交
  23. 28 5月, 2021 1 次提交
  24. 25 5月, 2021 4 次提交
  25. 26 3月, 2021 3 次提交
    • J
      efi: Add ESRT to the EFI system table · 64a8aae1
      Jose Marinho 提交于
      The ESRT is initialised during efi_init_objlist after
      efi_initialize_system_table().
      
      The ESRT is recreated from scratch at the following events:
      - successful UpdateCapsule;
      - FMP instance install.
      
      The code ensures that every ESRT entry has a unique fw_class value.
      
      Limitations:
      - The ESRT is not updated if an FMP instance is uninstalled;
      - the fields image_type and flags are in the current implementation left
      undefined. Setting these values will require a per-platform function
      that returns the image_type/flags as a function of the image fw_class.
      
      CC: Heinrich Schuchardt	<xypron.glpk@gmx.de>
      CC: Sughosh Ganu <sughosh.ganu@linaro.org>
      CC: AKASHI Takahiro <takahiro.akashi@linaro.org>
      CC: Ilias Apalodimas <ilias.apalodimas@linaro.org>
      CC: Andre Przywara <andre.przywara@arm.com>
      CC: Alexander Graf <agraf@csgraf.de>
      CC: nd@arm.com
      Signed-off-by: NJose Marinho <jose.marinho@arm.com>
      
      Remove two EFI_CALL() indirections.
      Move ESRT GUID in efidebug's list of GUIDs.
      Reviewed-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
      64a8aae1
    • I
      efi_loader: Replace config option for initrd loading · 53f6a5aa
      Ilias Apalodimas 提交于
      Up to now we install EFI_LOAD_FILE2_PROTOCOL to load an initrd
      unconditionally. Although we correctly return various EFI exit codes
      depending on the file status (i.e EFI_NO_MEDIA, EFI_NOT_FOUND etc), the
      kernel loader, only falls back to the cmdline interpreted initrd if the
      protocol is not installed.
      
      This creates a problem for EFI installers, since they won't be able to
      load their own initrd and continue the installation. It also makes the
      feature hard to use, since we can either have a single initrd or we have
      to recompile u-boot if the filename changes.
      
      So let's introduce a different logic that will decouple the initrd
      path from the config option we currently have.
      When defining a UEFI BootXXXX we can use the filepathlist and store
      a file path pointing to our initrd. Specifically the EFI spec describes:
      
      "The first element of the array is a device path that describes the device
      and location of the Image for this load option. Other device paths may
      optionally exist in the FilePathList, but their usage is OSV specific"
      
      When the EFI application is launched through the bootmgr, we'll try to
      interpret the extra device path. If that points to a file that exists on
      our disk, we'll now install the load_file2 and the efi-stub will be able
      to use it.
      
      This opens up another path using U-Boot and defines a new boot flow.
      A user will be able to control the kernel/initrd pairs without explicit
      cmdline args or GRUB.
      Signed-off-by: NIlias Apalodimas <ilias.apalodimas@linaro.org>
      Reviewed-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
      53f6a5aa
    • I
      efi_loader: Add helper functions for EFI · 37c3ca5c
      Ilias Apalodimas 提交于
      A following patch introduces a different logic for loading initrd's
      based on the EFI_LOAD_FILE2_PROTOCOL.
      Since similar logic can be applied in the future for other system files
      (i.e DTBs), let's add some helper functions which will retrieve and
      parse file paths stored in EFI variables.
      Signed-off-by: NIlias Apalodimas <ilias.apalodimas@linaro.org>
      37c3ca5c