spl: cypto: Bring back SPL_ versions of SHA
authorSimon Glass <sjg@chromium.org>
Sun, 26 Sep 2021 01:43:17 +0000 (19:43 -0600)
committerTom Rini <trini@konsulko.com>
Fri, 8 Oct 2021 19:53:26 +0000 (15:53 -0400)
Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
lib/Kconfig

index 034af72..7899e75 100644 (file)
@@ -373,7 +373,6 @@ config SHA256
          The SHA256 algorithm produces a 256-bit (32-byte) hash value
          (digest).
 
-
 config SHA512
        bool "Enable SHA512 support"
        help
@@ -399,6 +398,48 @@ config SHA_HW_ACCEL
          hashing algorithms. This affects the 'hash' command and also the
          hash_lookup_algo() function.
 
+if SPL
+
+config SPL_SHA1
+       bool "Enable SHA1 support in SPL"
+       default y if SHA1
+       help
+         This option enables support of hashing using SHA1 algorithm.
+         The hash is calculated in software.
+         The SHA1 algorithm produces a 160-bit (20-byte) hash value
+         (digest).
+
+config SPL_SHA256
+       bool "Enable SHA256 support in SPL"
+       default y if SHA256
+       help
+         This option enables support of hashing using SHA256 algorithm.
+         The hash is calculated in software.
+         The SHA256 algorithm produces a 256-bit (32-byte) hash value
+         (digest).
+
+config SPL_SHA512
+       bool "Enable SHA512 support in SPL"
+       default y if SHA512
+       help
+         This option enables support of hashing using SHA512 algorithm.
+         The hash is calculated in software.
+         The SHA512 algorithm produces a 512-bit (64-byte) hash value
+         (digest).
+
+config SPL_SHA384
+       bool "Enable SHA384 support in SPL"
+       default y if SHA384
+       select SPL_SHA512
+       help
+         This option enables support of hashing using SHA384 algorithm.
+         The hash is calculated in software. This is also selects SHA512,
+         because these implementations share the bulk of the code..
+         The SHA384 algorithm produces a 384-bit (48-byte) hash value
+         (digest).
+
+endif
+
 if SHA_HW_ACCEL
 
 config SHA512_HW_ACCEL