summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crypto/Makefile3
-rw-r--r--include/digest.h2
-rw-r--r--include/pbl.h3
-rw-r--r--pbl/decomp.c6
4 files changed, 8 insertions, 6 deletions
diff --git a/crypto/Makefile b/crypto/Makefile
index 762d7e543b..22035d4f69 100644
--- a/crypto/Makefile
+++ b/crypto/Makefile
@@ -10,8 +10,7 @@ obj-$(CONFIG_DIGEST_MD5_GENERIC) += md5.o
obj-$(CONFIG_DIGEST_SHA1_GENERIC) += sha1.o
obj-$(CONFIG_DIGEST_SHA224_GENERIC) += sha2.o
obj-$(CONFIG_DIGEST_SHA256_GENERIC) += sha2.o
-pbl-$(CONFIG_PBL_VERIFY_PIGGY) += sha2.o
-pbl-$(CONFIG_PBL_VERIFY_PIGGY) += digest.o
+pbl-y += sha2.o digest.o
obj-$(CONFIG_DIGEST_SHA384_GENERIC) += sha4.o
obj-$(CONFIG_DIGEST_SHA512_GENERIC) += sha4.o
obj-y += memneq.o
diff --git a/include/digest.h b/include/digest.h
index e4a5216964..b984d57d77 100644
--- a/include/digest.h
+++ b/include/digest.h
@@ -76,7 +76,7 @@ struct digest {
/*
* digest functions
*/
-#ifdef CONFIG_DIGEST
+#if defined(CONFIG_DIGEST) || defined(__PBL__)
int digest_algo_register(struct digest_algo *d);
void digest_algo_unregister(struct digest_algo *d);
void digest_algo_prints(const char *prefix);
diff --git a/include/pbl.h b/include/pbl.h
index 0dc23c72dc..7dc4fa3092 100644
--- a/include/pbl.h
+++ b/include/pbl.h
@@ -30,4 +30,7 @@ const void *
fdt_device_get_match_data(const void *fdt, const char *nodepath,
const struct fdt_device_id ids[]);
+int pbl_barebox_verify(const void *compressed_start, unsigned int len,
+ const void *hash, unsigned int hash_len);
+
#endif /* __PBL_H__ */
diff --git a/pbl/decomp.c b/pbl/decomp.c
index 1e0ef81ada..553895bac5 100644
--- a/pbl/decomp.c
+++ b/pbl/decomp.c
@@ -54,14 +54,14 @@ static void noinline errorfn(char *error)
extern unsigned char sha_sum[];
extern unsigned char sha_sum_end[];
-static int pbl_barebox_verify(void *compressed_start, unsigned int len, void *hash,
- unsigned int hash_len)
+int pbl_barebox_verify(const void *compressed_start, unsigned int len,
+ const void *hash, unsigned int hash_len)
{
struct sha256_state sha_state = { 0 };
struct digest d = { .ctx = &sha_state };
char computed_hash[SHA256_DIGEST_SIZE];
int i;
- char *char_hash = hash;
+ const char *char_hash = hash;
if (hash_len != SHA256_DIGEST_SIZE)
return -1;