[PATCH 5/5] command/digest: add sha224 support

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Sat Oct 8 10:41:59 EDT 2011


Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
 commands/Kconfig  |    6 ++++++
 commands/digest.c |   20 ++++++++++++++++++++
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/commands/Kconfig b/commands/Kconfig
index 39bdb0f..095c1b2 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -252,6 +252,12 @@ config CMD_SHA256SUM
 	select SHA256
 	prompt "sha256sum"
 
+config CMD_SHA224SUM
+	tristate
+	select CMD_DIGEST
+	select SHA224
+	prompt "sha224sum"
+
 config CMD_MTEST
 	tristate
 	prompt "mtest"
diff --git a/commands/digest.c b/commands/digest.c
index 1fbffb6..fbeadf9 100644
--- a/commands/digest.c
+++ b/commands/digest.c
@@ -116,6 +116,26 @@ BAREBOX_CMD_END
 
 #endif /* CMD_CMD_SHA1SUM */
 
+#ifdef CONFIG_CMD_SHA224SUM
+
+static int do_sha224(struct command *cmdtp, int argc, char *argv[])
+{
+	return do_digest("sha224", argc, argv);
+}
+
+BAREBOX_CMD_HELP_START(sha224sum)
+BAREBOX_CMD_HELP_USAGE("sha224sum [[FILE] [AREA]]...\n")
+BAREBOX_CMD_HELP_SHORT("Calculate a sha224 checksum of a memory area.\n")
+BAREBOX_CMD_HELP_END
+
+BAREBOX_CMD_START(sha224sum)
+	.cmd		= do_sha224,
+	.usage		= "sha224 checksum calculation",
+	BAREBOX_CMD_HELP(cmd_sha224sum_help)
+BAREBOX_CMD_END
+
+#endif /* CMD_CMD_SHA224SUM */
+
 #ifdef CONFIG_CMD_SHA256SUM
 
 static int do_sha256(struct command *cmdtp, int argc, char *argv[])
-- 
1.7.6.3




More information about the barebox mailing list