Skip to content
Snippets Groups Projects
  1. Sep 23, 2021
    • Marek Vasut's avatar
      lmb: Add generic arch_lmb_reserve_generic() · 1274698d
      Marek Vasut authored and Tom Rini's avatar Tom Rini committed
      
      The arc/arm/m68k/microblaze/mips/ppc arch_lmb_reserve() implementations
      are all mostly the same, except for a couple of details. Implement a
      generic arch_lmb_reserve_generic() function which can be parametrized
      enough to cater for those differences between architectures. This can
      also be parametrized enough so it can handle cases where U-Boot is not
      relocated to the end of DRAM e.g. because there is some other reserved
      memory past U-Boot (e.g. unmovable firmware for coprocessor), it is not
      relocated at all, and other such use cases.
      
      Signed-off-by: default avatarMarek Vasut <marek.vasut+renesas@gmail.com>
      Cc: Alexey Brodkin <alexey.brodkin@synopsys.com>
      Cc: Angelo Dureghello <angelo@sysam.it>
      Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
      Cc: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
      Cc: Hai Pham <hai.pham.ud@renesas.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
      Cc: Tom Rini <trini@konsulko.com>
      Cc: Wolfgang Denk <wd@denx.de>
      Reviewed-by: default avatarTom Rini <trini@konsulko.com>
      1274698d
    • Marek Vasut's avatar
      crc32: Add crc32 implementation using __builtin_aarch64_crc32b · 270f8710
      Marek Vasut authored and Tom Rini's avatar Tom Rini committed
      
      ARMv8.0 has optional crc32 instruction for crc32 calculation. The
      instruction is mandatory since ARMv8.1. The crc32 calculation is
      faster using the dedicated instruction, e.g. 1.4 GHz iMX8MN gives:
      
        => time crc32 0x50000000 0x2000000
        time: 0.126 seconds # crc32 instruction
        time: 0.213 seconds # software crc32
      
      Add implementation using the compiler builtin wrapper for the crc32
      instruction and enable it by default, since we don't support any
      platforms which do not implement this instruction.
      
      Signed-off-by: default avatarMarek Vasut <marex@denx.de>
      Cc: Simon Glass <sjg@chromium.org>
      [trini: Make crc32_table guarded by CONFIG_ARM64_CRC32]
      Signed-off-by: default avatarTom Rini <trini@konsulko.com>
      270f8710
  2. Sep 17, 2021
  3. Sep 14, 2021
    • Alexandru Gagniuc's avatar
      image: rsa: Move padding_algos to linker lists · de41f0ee
      Alexandru Gagniuc authored and Tom Rini's avatar Tom Rini committed
      
      We are not guaranteed to have the padding_pkcs_15_verify symbol since
      commit 92c960bc ("lib: rsa: Remove #ifdefs from rsa.h"), and
      commit 61416fe9 ("Kconfig: FIT_SIGNATURE should not select RSA_VERIFY")
      
      The padding_algos only make sense with RSA verification, which can now
      be disabled in lieu of ECDSA. In fact this will lead to build failures
      because of the missing symbol mentioned earlier.
      
      To resolve this, move the padding_algos to a linker list, with
      declarations moved to rsa_verify.c. This is consistent with commit
      6909edb4 ("image: rsa: Move verification algorithm to a linker list")
      
      One could argue that the added #ifdef USE_HOSTCC is ugly, and should
      be hidden within the U_BOOT_PADDING_ALGO() macro. However, this would
      be inconsistent with the "cryptos" list. This logic for was not
      previously explored:
      
      Without knowledge of the U_BOOT_PADDING_ALGO() macro, its use is
      similar to something being declared. However, should #ifndef
      USE_HOSTCC be part of the macro, it would not be obvious that it
      behaves differently on host code and target code. Having the #ifndef
      outside the macro makes this obvious.
      
      Also, the #ifdef is not always 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.
      
      Signed-off-by: default avatarAlexandru Gagniuc <mr.nuke.me@gmail.com>
      de41f0ee
    • Oleksandr Suvorov's avatar
      lib: fix typos in Kconfig · 5145bc73
      Oleksandr Suvorov authored and Tom Rini's avatar Tom Rini committed
      
      There are trivial typos in the Kconfig file. Fixed them.
      Also, fixed grammar in the descriptions with typos.
      
      Fixes: d56b4b19 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
      Fixes: 7264f292 ("spl: fit: Eanble GZIP support for image decompression")
      Signed-off-by: default avatarOleksandr Suvorov <oleksandr.suvorov@foundries.io>
      Reviewed-by: Bin Meng's avatarBin Meng <bmeng.cn@gmail.com>
      5145bc73
    • Heinrich Schuchardt's avatar
      lib/rsa: don't use NULL as key_id · d607dfd8
      Heinrich Schuchardt authored and Tom Rini's avatar Tom Rini committed
      
      If keydir is not provided but name is we want to use name as key_id.
      
      But with the current coding name is only used on its own if it is NULL
      and keydir is provided which never occurs.
      
      Fixes: 824ee745 ("lib/rsa: Use the 'keyfile' argument from mkimage")
      Signed-off-by: Heinrich Schuchardt's avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      d607dfd8
  4. Sep 13, 2021
  5. Sep 11, 2021
  6. Sep 09, 2021
  7. Sep 08, 2021
    • Alexandru Gagniuc's avatar
      common: Move MD5 hash to hash_algo[] array. · fe54aeaa
      Alexandru Gagniuc authored and Tom Rini's avatar Tom Rini committed
      
      MD5 is being called directly in some places, but it is not available
      via hash_lookup_algo("md5"). This is inconsistent with other hasing
      routines. To resolve this, add an "md5" entry to hash_algos[].
      
      The #ifdef clause looks funnier than those for other entries. This is
      because both MD5 and SPL_MD5 configs exist, whereas the other hashes
      do not have "SPL_" entries. The long term plan is to get rid of the
      ifdefs, so those should not be expected to survive much longer.
      
      The md5 entry does not have .hash_init/update/finish members. That's
      okay because hash_progressive_lookup_algo() will catch that, and
      return -EPROTONOSUPPORT, while hash_lookup_algo() will return the
      correct pointer.
      
      Signed-off-by: default avatarAlexandru Gagniuc <mr.nuke.me@gmail.com>
      [trini: Use CONFIG_IS_ENABLED not IS_ENABLED for MD5 check]
      Signed-off-by: default avatarTom Rini <trini@konsulko.com>
      fe54aeaa
    • Alexandru Gagniuc's avatar
      common/spl: Drop [ST]PL_HASH_SUPPORT in favor of [ST]PL_HASH · 07212096
      Alexandru Gagniuc authored and Tom Rini's avatar Tom Rini committed
      
      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: default avatarAlexandru Gagniuc <mr.nuke.me@gmail.com>
      [trini: Add TPL case, fix CHAIN_OF_TRUST, other tweaks]
      Signed-off-by: default avatarTom Rini <trini@konsulko.com>
      07212096
    • Alexandru Gagniuc's avatar
      lib: Drop SHA512_ALGO in lieu of SHA512 · e60e4499
      Alexandru Gagniuc authored and Tom Rini's avatar Tom Rini committed
      
      SHA512_ALGO was used as a "either SHA512 or SHA384", although the
      implementations of these two algorithms share a majority of code.
      
      From a Kconfig interface perspective, it makes sense to present two
      distinct options. This requires #ifdefing out the SHA512
      implementation from 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: default avatarAlexandru Gagniuc <mr.nuke.me@gmail.com>
      e60e4499
  8. Sep 04, 2021
  9. Sep 02, 2021
    • Andreas Schwab's avatar
      lib: add crc16.o if CONFIG_MMC_SPI_CRC_ON for SPL build · c8291f53
      Andreas Schwab authored and Tom Rini's avatar Tom Rini committed
      CONFIG_MMC_SPI_CRC_ON needs the crc16 functions, but it was not included
      in an SPL build.  For non-SPL builds, crc16.o is already added
      unconditionally.  This also removes CONFIG_SPL_YMODEM_SUPPORT from the
      sifive board configs, which is only relevant for some ARM boards and was
      only set for its side effect of adding crc16.o.
      c8291f53
  10. Sep 01, 2021
    • Heinrich Schuchardt's avatar
      lib: -Wformat-truncation in rsa_engine_get_priv_key · 295ab733
      Heinrich Schuchardt authored and Tom Rini's avatar Tom Rini committed
      
      With glibc 2.33 (Ubuntu package glibc6 2.33-0ubuntu9) building
      sifive_unmatched_defconfig results in:
      
      In file included from /usr/include/stdio.h:866,
                        from ././include/compiler.h:26,
                        from <command-line>:
      In function ‘snprintf’,
           inlined from ‘rsa_engine_get_priv_key’ at ./tools/../^:273:4:
      /usr/include/riscv64-linux-gnu/bits/stdio2.h:71:10: warning:
      ‘%s’ directive argument is null [-Wformat-truncation=]
          71 |   return __builtin___snprintf_chk (__s, __n,
      __USE_FORTIFY_LEVEL - 1,
             |
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          72 |        __glibc_objsize (__s), __fmt,
             |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          73 |        __va_arg_pack ());
             |        ~~~~~~~~~~~~~~~~~
      
      Avoid passing a NULL string.
      
      Signed-off-by: default avatarHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      295ab733
    • Chia-Wei Wang's avatar
      lib/md5: Export progressive APIs · 74bda4fe
      Chia-Wei Wang authored and Tom Rini's avatar Tom Rini committed
      
      Export the MD5 hash init/update/finish progressive APIs
      for better flexibility.
      
      Signed-off-by: default avatarChia-Wei Wang <chiawei_wang@aspeedtech.com>
      74bda4fe
    • Alexandru Gagniuc's avatar
      lib/rsa: Remove support for OpenSSL < 1.1.0 and libressl < 2.7.0 · fe68a67a
      Alexandru Gagniuc authored and Tom Rini's avatar Tom Rini committed
      
      Older OpenSSL and libressl versions have a slightly different API.
      This require #ifdefs to support. However, we still can't support it
      because the ECDSA path does not compile with these older versions.
      These #ifdefs are truly a vestigial appendage.
      
      Alternatively, the ECDSA path could be updated for older libraries,
      but this requires significant extra code, and #ifdefs. Those libraries
      are over three years old, and there concerns whether it makes sense to
      build modern software for real world use against such old libraries.
      
      Thusly, remove #ifdefs and code for old OpenSSL and LibreSSL support.
      
      Signed-off-by: default avatarAlexandru Gagniuc <mr.nuke.me@gmail.com>
      fe68a67a
  11. Aug 31, 2021
  12. Aug 21, 2021
    • Matwey V. Kornilov's avatar
      display_options: Do not use %llu in print_size · f52352f6
      Matwey V. Kornilov authored and Tom Rini's avatar Tom Rini committed
      
      tiny-printf variant doesn't know how to handle %llu format string, but both
      tiny-printf and print_size can meet in SPL when TFTP is used to obtain main
      u-boot image. This is known to lead to critical boot issue at AM335x platform
      when printf is catched in infinite loop.
      
      To avoid such issues and make print_size function tiny-printf friendly, use %u
      instead of %luu. Note, that the size value is guaranteed to be less than 1024
      in this conditional branch, so the cast to unsigned int is safe.
      
      Signed-off-by: default avatarMatwey V. Kornilov <matwey.kornilov@gmail.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      f52352f6
    • Matwey V. Kornilov's avatar
      tiny-printf: Handle %pM format when CONFIG_SPL_NET_SUPPORT is enabled · c091f652
      Matwey V. Kornilov authored and Tom Rini's avatar Tom Rini committed
      
      %pM format string is used to print MAC-address and this is required while SPL
      network boot.
      
      This patch fixes the SPL boot issues like the following:
      
          Trying to boot from USB eth
          ## Error: flags type check failure for "ethaddr" <= "40309614M" (type: m)
          ## Error inserting "ethaddr" variable, errno=1
          eth0: eth_cpsw## Error: flags type check failure for "eth1addr" <=
          "81f01114M" (type: m)
          ## Error inserting "eth1addr" variable, errno=1
          , eth1: usb_ether
          eth_cpsw Waiting for PHY auto negotiation to complete......... TIMEOUT !
          Problem booting with BOOTP
          SPL: failed to boot from all boot devices
          ### ERROR ### Please RESET the board ###
      
      Signed-off-by: default avatarMatwey V. Kornilov <matwey.kornilov@gmail.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      c091f652
  13. Aug 17, 2021
  14. Aug 16, 2021
  15. Aug 14, 2021
Loading