summaryrefslogtreecommitdiffstats
path: root/common/image-sig.c
diff options
context:
space:
mode:
authorReuben Dowle <reubendowle0@gmail.com>2020-04-16 17:36:52 +1200
committerTom Rini <trini@konsulko.com>2020-06-12 13:14:07 -0400
commitd16b38f42704fe3cc94fbee1601be96045013151 (patch)
treeabd95e88387701d92c5319565ed4a6aaf9c02a1b /common/image-sig.c
parentf191f3a1027ede56e2501920e3e8a8acd7033e77 (diff)
downloadu-boot-d16b38f42704fe3cc94fbee1601be96045013151.tar.gz
u-boot-d16b38f42704fe3cc94fbee1601be96045013151.tar.xz
u-boot-d16b38f42704fe3cc94fbee1601be96045013151.zip
Add support for SHA384 and SHA512
The current recommendation for best security practice from the US government is to use SHA384 for TOP SECRET [1]. This patch adds support for SHA384 and SHA512 in the hash command, and also allows FIT images to be hashed with these algorithms, and signed with sha384,rsaXXXX and sha512,rsaXXXX The SHA implementation is adapted from the linux kernel implementation. [1] Commercial National Security Algorithm Suite http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
Diffstat (limited to 'common/image-sig.c')
-rw-r--r--common/image-sig.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/common/image-sig.c b/common/image-sig.c
index 498969d641..f3c209ae8b 100644
--- a/common/image-sig.c
+++ b/common/image-sig.c
@@ -40,7 +40,31 @@ struct checksum_algo checksum_algos[] = {
.calculate_sign = EVP_sha256,
#endif
.calculate = hash_calculate,
- }
+ },
+#ifdef CONFIG_SHA384
+ {
+ .name = "sha384",
+ .checksum_len = SHA384_SUM_LEN,
+ .der_len = SHA384_DER_LEN,
+ .der_prefix = sha384_der_prefix,
+#if IMAGE_ENABLE_SIGN
+ .calculate_sign = EVP_sha384,
+#endif
+ .calculate = hash_calculate,
+ },
+#endif
+#ifdef CONFIG_SHA512
+ {
+ .name = "sha512",
+ .checksum_len = SHA512_SUM_LEN,
+ .der_len = SHA512_DER_LEN,
+ .der_prefix = sha512_der_prefix,
+#if IMAGE_ENABLE_SIGN
+ .calculate_sign = EVP_sha512,
+#endif
+ .calculate = hash_calculate,
+ },
+#endif
};