summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2021-09-08 21:23:55 -0400
committerTom Rini <[email protected]>2021-09-08 21:23:55 -0400
commit4412fd8ba2ce5945d04f4b181a96e05576c46bf2 (patch)
tree68d860b82ae6b1023a52810481bd0263883505f9 /lib
parent1c02fd4686e7bc17b583b55cc6f2e3e83f38b381 (diff)
parent0b905e25813a0b4e368730a147dadc7f55150edc (diff)
Merge branch '2021-09-08-fix-FIT-hash-algos-in-SPL'
- Merge some fixes to how we enable hash algorithms for FIT images in SPL. This fixes a few cases where we should have had some options enabled, but did not. This also removes otherwise unused options in a few other cases.
Diffstat (limited to 'lib')
-rw-r--r--lib/Kconfig12
-rw-r--r--lib/Makefile4
-rw-r--r--lib/crypt/Kconfig2
-rw-r--r--lib/efi_loader/Kconfig2
-rw-r--r--lib/md5.c4
-rw-r--r--lib/sha512.c2
6 files changed, 10 insertions, 16 deletions
diff --git a/lib/Kconfig b/lib/Kconfig
index c535147aeaa..48565a4169d 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -375,14 +375,9 @@ config SHA256
The SHA256 algorithm produces a 256-bit (32-byte) hash value
(digest).
-config SHA512_ALGO
- bool "Enable SHA512 algorithm"
- help
- This option enables support of internal SHA512 algorithm.
config SHA512
bool "Enable SHA512 support"
- depends on SHA512_ALGO
help
This option enables support of hashing using SHA512 algorithm.
The hash is calculated in software.
@@ -391,10 +386,11 @@ config SHA512
config SHA384
bool "Enable SHA384 support"
- depends on SHA512_ALGO
+ select SHA512
help
This option enables support of hashing using SHA384 algorithm.
- The hash is calculated in software.
+ 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).
@@ -409,7 +405,7 @@ if SHA_HW_ACCEL
config SHA512_HW_ACCEL
bool "Enable hardware acceleration for SHA512"
- depends on SHA512_ALGO
+ depends on SHA512
help
This option enables hardware acceleration for the SHA384 and SHA512
hashing algorithms. This affects the 'hash' command and also the
diff --git a/lib/Makefile b/lib/Makefile
index 8ba745faa08..93be86c34a0 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -65,7 +65,7 @@ obj-$(CONFIG_$(SPL_)RSA) += rsa/
obj-$(CONFIG_HASH) += hash-checksum.o
obj-$(CONFIG_SHA1) += sha1.o
obj-$(CONFIG_SHA256) += sha256.o
-obj-$(CONFIG_SHA512_ALGO) += sha512.o
+obj-$(CONFIG_SHA512) += sha512.o
obj-$(CONFIG_CRYPT_PW) += crypt/
obj-$(CONFIG_$(SPL_)ZLIB) += zlib/
@@ -87,7 +87,7 @@ endif
ifdef CONFIG_SPL_BUILD
obj-$(CONFIG_SPL_YMODEM_SUPPORT) += crc16.o
-obj-$(CONFIG_$(SPL_TPL_)HASH_SUPPORT) += crc16.o
+obj-$(CONFIG_$(SPL_TPL_)HASH) += crc16.o
obj-y += net_utils.o
endif
obj-$(CONFIG_ADDR_MAP) += addr_map.o
diff --git a/lib/crypt/Kconfig b/lib/crypt/Kconfig
index 5495ae8d4cd..6a500296422 100644
--- a/lib/crypt/Kconfig
+++ b/lib/crypt/Kconfig
@@ -20,7 +20,7 @@ config CRYPT_PW_SHA256
config CRYPT_PW_SHA512
bool "Provide sha512crypt"
select SHA512
- select SHA512_ALGO
+ select SHA512
help
Enables support for the sha512crypt password-hashing algorithm.
The prefix is "$6$".
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index dacc3b58810..08463251cdf 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -323,7 +323,7 @@ config EFI_TCG2_PROTOCOL
depends on TPM_V2
select SHA1
select SHA256
- select SHA512_ALGO
+ select SHA512
select SHA384
select SHA512
select HASH
diff --git a/lib/md5.c b/lib/md5.c
index 2ae4a06319c..e2ba622ea4e 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -284,12 +284,12 @@ md5 (unsigned char *input, int len, unsigned char output[16])
* watchdog every 'chunk_sz' bytes of input processed.
*/
void
-md5_wd (unsigned char *input, int len, unsigned char output[16],
+md5_wd(const unsigned char *input, unsigned int len, unsigned char output[16],
unsigned int chunk_sz)
{
struct MD5Context context;
#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
- unsigned char *end, *curr;
+ const unsigned char *end, *curr;
int chunk;
#endif
diff --git a/lib/sha512.c b/lib/sha512.c
index 35f31e3dc5f..a421f249ba2 100644
--- a/lib/sha512.c
+++ b/lib/sha512.c
@@ -320,7 +320,6 @@ void sha384_csum_wd(const unsigned char *input, unsigned int ilen,
#endif
-#if defined(CONFIG_SHA512)
void sha512_starts(sha512_context * ctx)
{
ctx->state[0] = SHA512_H0;
@@ -381,4 +380,3 @@ void sha512_csum_wd(const unsigned char *input, unsigned int ilen,
sha512_finish(&ctx, output);
}
-#endif