1. 08 Sep, 2021 1 commit
    • 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: Tom Rini's avatarTom Rini <trini@konsulko.com>
      fe54aeaa
  2. 02 Aug, 2021 2 commits
  3. 18 May, 2021 1 commit
    • Heinrich Schuchardt's avatar
      hash: Kconfig option for SHA512 hardware acceleration · e2ae483c
      Heinrich Schuchardt authored
      Commit a479f103 ("hash: Allow for SHA512 hardware implementations")
      defined function definitions for hardware accelerated SHA384 and SHA512.
      If CONFIG_SHA_HW_ACCEL=y, these functions are used.
      
      We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
      new functions hw_sha384() and hw_sha512().
      
      For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
      missing hardware acceleration functions lead to build errors on boards like
      peach-pi_defconfig.
      
      Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
      functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
      and SHA512 algorithms.
      
      Fixes: a479f103
      
       ("hash: Allow for SHA512 hardware implementations")
      Signed-off-by: Heinrich Schuchardt's avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      e2ae483c
  4. 12 Apr, 2021 1 commit
  5. 02 Feb, 2021 1 commit
    • Simon Glass's avatar
      common: Drop asm/global_data.h from common header · 401d1c4f
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      
      Move this out of the common header and include it only where needed.  In
      a number of cases this requires adding "struct udevice;" to avoid adding
      another large header or in other cases replacing / adding missing header
      files that had been pulled in, very indirectly.   Finally, we have a few
      cases where we did not need to include <asm/global_data.h> at all, so
      remove that include.
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      Signed-off-by: Tom Rini's avatarTom Rini <trini@konsulko.com>
      401d1c4f
  6. 16 Jun, 2020 1 commit
  7. 12 Jun, 2020 1 commit
  8. 19 May, 2020 1 commit
  9. 18 May, 2020 3 commits
  10. 02 Dec, 2019 1 commit
  11. 24 Oct, 2019 1 commit
  12. 11 Aug, 2019 1 commit
  13. 09 Dec, 2018 1 commit
    • Philipp Tomsich's avatar
      Roll CRC16-CCITT into the hash infrastructure · 51c2345b
      Philipp Tomsich authored and Tom Rini's avatar Tom Rini committed
      
      
      The CRC16-CCITT checksum function is useful for space-constrained
      applications (such as obtaining a checksum across a 2KBit or 4KBit
      EEPROM) in boot applications. It has not been accessible from boot
      scripts until now (due to not having a dedicated command and not being
      supported by the hash infrstructure) limiting its applicability
      outside of custom commands.
      
      This adds the CRC16-CCITT (poly 0x1021, init 0x0) algorithm to the
      list of available hashes and adds a new crc16_ccitt_wd_buf() to make
      this possible.
      Signed-off-by: Philipp Tomsich's avatarPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>
      [trini: Fix building crc16.o for SPL/TPL]
      Signed-off-by: Tom Rini's avatarTom Rini <trini@konsulko.com>
      51c2345b
  14. 07 May, 2018 1 commit
    • Tom Rini's avatar
      SPDX: Convert all of our single license tags to Linux Kernel style · 83d290c5
      Tom Rini authored
      
      
      When U-Boot started using SPDX tags we were among the early adopters and
      there weren't a lot of other examples to borrow from.  So we picked the
      area of the file that usually had a full license text and replaced it
      with an appropriate SPDX-License-Identifier: entry.  Since then, the
      Linux Kernel has adopted SPDX tags and they place it as the very first
      line in a file (except where shebangs are used, then it's second line)
      and with slightly different comment styles than us.
      
      In part due to community overlap, in part due to better tag visibility
      and in part for other minor reasons, switch over to that style.
      
      This commit changes all instances where we have a single declared
      license in the tag as both the before and after are identical in tag
      contents.  There's also a few places where I found we did not have a tag
      and have introduced one.
      Signed-off-by: Tom Rini's avatarTom Rini <trini@konsulko.com>
      83d290c5
  15. 23 Jan, 2018 1 commit
    • Breno Lima's avatar
      crypto/fsl: Fix HW accelerated hash commands · d7af2baa
      Breno Lima authored
      The hash command function were not flushing the dcache before passing data
      to CAAM/DMA and not invalidating the dcache when getting data back.
      
      Due the data cache incoherency, HW accelerated hash commands used to fail
      with CAAM errors like "Invalid KEY Command".
      
      Check if pbuf and pout buffers are properly aligned to the cache line size
      and flush/invalidate the memory regions to address this issue.
      
      This solution is based in a previous work from Clemens Gruber in
      commit 598e9dcc
      
       ("crypto/fsl: fix BLOB encapsulation and
      decapsulation")
      Reported-by: Anatolij Gustschin's avatarAnatolij Gustschin <agust@denx.de>
      Signed-off-by: default avatarBreno Lima <breno.lima@nxp.com>
      Reviewed-by: default avatarYork Sun <york.sun@nxp.com>
      d7af2baa
  16. 20 Aug, 2017 1 commit
    • Tom Rini's avatar
      hash: Compile only hardware or software versions of SHA algorithms · 78eda89e
      Tom Rini authored
      Commit 089df18b
      
       ("lib: move hash CONFIG options to Kconfig") moved
      CONFIG_SHA1, CONFIG_SHA256, CONFIG_SHA_HW_ACCEL, and
      CONFIG_SHA_PROG_HW_ACCEL config options to Kconfig. So in the case of
      SPL, CONFIG_SPL_HASH_SUPPORT enables CONFIG_SHA1 and CONFIG_SHA256 which
      enables SHA SW library by default.  But in the case of platforms with
      SHA HW library support, SHA SW library becomes redundant and increases
      size of SPL by approx 18K.  Rework the code so that we have named
      members and only have either software or hardware versions of the
      algorithm, depending on the relevant config options.  Update the comment
      around hash_algo to reflect this as well.
      Reported-by: default avatarSumit Garg <sumit.garg@nxp.com>
      Cc: Sumit Garg <sumit.garg@nxp.com>
      Signed-off-by: Tom Rini's avatarTom Rini <trini@konsulko.com>
      Reviewed-by: default avatarSumit Garg <sumit.garg@nxp.com>
      78eda89e
  17. 16 Aug, 2017 2 commits
  18. 31 May, 2017 1 commit
  19. 22 May, 2017 1 commit
  20. 23 Sep, 2016 1 commit
  21. 14 Jan, 2016 1 commit
    • Tom Rini's avatar
      hash.c: Conditionally compile hash_command, static hash_show · 48ad68de
      Tom Rini authored
      
      
      The function hash_show is now only called by hash_command, so mark it as
      static (and drop from hash.h).  We only call hash_command when any of
      CONFIG_CMD_CRC32, CONFIG_CMD_SHA1SUM or CONFIG_CMD_HASH are set.  Since
      hash.c is linked in unconditionally we must take extra care with
      functions that bring in read-only strings as these will not be
      discarded.
      Signed-off-by: Tom Rini's avatarTom Rini <trini@konsulko.com>
      48ad68de
  22. 08 Jun, 2015 1 commit
  23. 18 Apr, 2015 1 commit
  24. 25 Feb, 2015 1 commit
  25. 30 Jan, 2015 2 commits
  26. 29 Dec, 2014 1 commit
  27. 19 Jun, 2014 2 commits
  28. 11 Jun, 2014 2 commits
  29. 21 Mar, 2014 1 commit
  30. 25 Nov, 2013 1 commit
    • Tom Rini's avatar
      hash.c: Correct non-hash subcommand crc32 addr-save support · 4b756b01
      Tom Rini authored
      
      
      In the case of not having CONFIG_CMD_HASH but having CONFIG_CMD_CRC32
      enabled (and not CONFIG_CRC32_VERIFY), we end up in this part of the
      code path on hash_command().  However, we will only have exactly 3 args
      here, and 3 > 3 is false, and we will not try and store the hash at the
      address given as arg #3.  The next problem however is that we've been
      moving argv around so the third value is now in argv[0] not argv[3].
      
      Confirmed on AM335x Beaglebone White.
      Signed-off-by: default avatarTom Rini <trini@ti.com>
      4b756b01
  31. 24 Jul, 2013 1 commit
  32. 14 May, 2013 1 commit
  33. 29 Mar, 2013 1 commit