2011-05-18 07:18:20 +00:00
|
|
|
/*
|
|
|
|
* digest.c - Calculate a md5/sha1/sha256 checksum of a memory area
|
|
|
|
*
|
|
|
|
* Copyright (c) 2011 Peter Korsgaard <jacmet@sunsite.dk>
|
|
|
|
*
|
|
|
|
* See file CREDITS for list of people who contributed to this
|
|
|
|
* project.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <command.h>
|
|
|
|
#include <fs.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <xfuncs.h>
|
|
|
|
#include <malloc.h>
|
|
|
|
#include <digest.h>
|
2015-03-11 16:53:09 +00:00
|
|
|
#include <getopt.h>
|
2011-05-18 07:18:20 +00:00
|
|
|
|
2015-03-17 11:53:16 +00:00
|
|
|
#include "internal.h"
|
|
|
|
|
|
|
|
static int do_hash(char *algo, int argc, char *argv[])
|
2011-05-18 07:18:20 +00:00
|
|
|
{
|
|
|
|
struct digest *d;
|
2015-03-11 16:53:09 +00:00
|
|
|
unsigned char *key = NULL;
|
|
|
|
size_t keylen = 0;
|
2015-03-25 11:56:12 +00:00
|
|
|
int opt, ret;
|
2011-05-18 07:18:20 +00:00
|
|
|
|
2015-03-27 16:23:04 +00:00
|
|
|
while ((opt = getopt(argc, argv, "h:")) > 0) {
|
2015-03-11 16:53:09 +00:00
|
|
|
switch(opt) {
|
|
|
|
case 'h':
|
|
|
|
key = optarg;
|
|
|
|
keylen = strlen(key);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (key) {
|
2016-04-11 14:52:10 +00:00
|
|
|
char *tmp = basprintf("hmac(%s)", algo);
|
2015-03-11 16:53:09 +00:00
|
|
|
d = digest_alloc(tmp);
|
|
|
|
free(tmp);
|
2015-03-25 11:56:12 +00:00
|
|
|
BUG_ON(!d);
|
|
|
|
|
|
|
|
ret = digest_set_key(d, key, keylen);
|
|
|
|
if (ret) {
|
|
|
|
perror("set_key");
|
|
|
|
return ret;
|
|
|
|
}
|
2015-03-11 16:53:09 +00:00
|
|
|
} else {
|
2015-03-17 11:53:16 +00:00
|
|
|
d = digest_alloc(algo);
|
2015-03-25 11:56:12 +00:00
|
|
|
BUG_ON(!d);
|
2011-05-18 07:18:20 +00:00
|
|
|
}
|
|
|
|
|
2015-03-17 11:53:16 +00:00
|
|
|
argc -= optind;
|
|
|
|
argv += optind;
|
2011-10-08 14:41:56 +00:00
|
|
|
|
2015-03-25 11:56:12 +00:00
|
|
|
return __do_digest(d, NULL, argc, argv);
|
2011-05-18 07:18:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_CMD_MD5SUM
|
|
|
|
|
2011-12-21 13:18:57 +00:00
|
|
|
static int do_md5(int argc, char *argv[])
|
2011-05-18 07:18:20 +00:00
|
|
|
{
|
2015-03-17 11:53:16 +00:00
|
|
|
return do_hash("md5", argc, argv);
|
2011-05-18 07:18:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BAREBOX_CMD_HELP_START(md5sum)
|
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:
* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
is listed by character in this (short) option string (the long
description is in the long help text, as before)
* help texts have been reworked, to make them
- sometimes smaller
- sometimes describe the options better
- more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
compiled long help texts
* 'help -v' gives a list of commands with their short description, this
is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 08:28:42 +00:00
|
|
|
BAREBOX_CMD_HELP_TEXT("Calculate a MD5 digest over a FILE or a memory area.")
|
2011-05-18 07:18:20 +00:00
|
|
|
BAREBOX_CMD_HELP_END
|
|
|
|
|
|
|
|
BAREBOX_CMD_START(md5sum)
|
|
|
|
.cmd = do_md5,
|
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:
* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
is listed by character in this (short) option string (the long
description is in the long help text, as before)
* help texts have been reworked, to make them
- sometimes smaller
- sometimes describe the options better
- more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
compiled long help texts
* 'help -v' gives a list of commands with their short description, this
is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 08:28:42 +00:00
|
|
|
BAREBOX_CMD_DESC("calculate MD5 checksum")
|
|
|
|
BAREBOX_CMD_OPTS("FILE|AREA...")
|
commands: group 'help' output
The old output of "help" was just producing a long list, that usually
scrolled of the screen (even on a X11 terminal). This list is more
compact, and also sorted by groups.
The old output format (plus grouping) is now available with 'help -v'.
Example:
Information commands:
?, devinfo, help, iomem, meminfo, version
Boot commands:
boot, bootm, go, loadb, loads, loadx, loady, saves, uimage
...
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 14:14:05 +00:00
|
|
|
BAREBOX_CMD_GROUP(CMD_GRP_FILE)
|
2011-05-18 07:18:20 +00:00
|
|
|
BAREBOX_CMD_HELP(cmd_md5sum_help)
|
|
|
|
BAREBOX_CMD_END
|
|
|
|
|
|
|
|
#endif /* CMD_CMD_MD5SUM */
|
|
|
|
|
|
|
|
#ifdef CONFIG_CMD_SHA1SUM
|
|
|
|
|
2011-12-21 13:18:57 +00:00
|
|
|
static int do_sha1(int argc, char *argv[])
|
2011-05-18 07:18:20 +00:00
|
|
|
{
|
2015-03-17 11:53:16 +00:00
|
|
|
return do_hash("sha1", argc, argv);
|
2011-05-18 07:18:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BAREBOX_CMD_HELP_START(sha1sum)
|
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:
* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
is listed by character in this (short) option string (the long
description is in the long help text, as before)
* help texts have been reworked, to make them
- sometimes smaller
- sometimes describe the options better
- more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
compiled long help texts
* 'help -v' gives a list of commands with their short description, this
is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 08:28:42 +00:00
|
|
|
BAREBOX_CMD_HELP_TEXT("Calculate a SHA1 digest over a FILE or a memory area.")
|
2011-05-18 07:18:20 +00:00
|
|
|
BAREBOX_CMD_HELP_END
|
|
|
|
|
|
|
|
BAREBOX_CMD_START(sha1sum)
|
|
|
|
.cmd = do_sha1,
|
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:
* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
is listed by character in this (short) option string (the long
description is in the long help text, as before)
* help texts have been reworked, to make them
- sometimes smaller
- sometimes describe the options better
- more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
compiled long help texts
* 'help -v' gives a list of commands with their short description, this
is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 08:28:42 +00:00
|
|
|
BAREBOX_CMD_DESC("calculate SHA1 digest")
|
|
|
|
BAREBOX_CMD_OPTS("FILE|AREA")
|
commands: group 'help' output
The old output of "help" was just producing a long list, that usually
scrolled of the screen (even on a X11 terminal). This list is more
compact, and also sorted by groups.
The old output format (plus grouping) is now available with 'help -v'.
Example:
Information commands:
?, devinfo, help, iomem, meminfo, version
Boot commands:
boot, bootm, go, loadb, loads, loadx, loady, saves, uimage
...
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 14:14:05 +00:00
|
|
|
BAREBOX_CMD_GROUP(CMD_GRP_FILE)
|
2011-05-18 07:18:20 +00:00
|
|
|
BAREBOX_CMD_HELP(cmd_sha1sum_help)
|
|
|
|
BAREBOX_CMD_END
|
|
|
|
|
|
|
|
#endif /* CMD_CMD_SHA1SUM */
|
|
|
|
|
2011-10-08 14:41:59 +00:00
|
|
|
#ifdef CONFIG_CMD_SHA224SUM
|
|
|
|
|
2011-12-21 13:18:57 +00:00
|
|
|
static int do_sha224(int argc, char *argv[])
|
2011-10-08 14:41:59 +00:00
|
|
|
{
|
2015-03-17 11:53:16 +00:00
|
|
|
return do_hash("sha224", argc, argv);
|
2011-10-08 14:41:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BAREBOX_CMD_HELP_START(sha224sum)
|
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:
* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
is listed by character in this (short) option string (the long
description is in the long help text, as before)
* help texts have been reworked, to make them
- sometimes smaller
- sometimes describe the options better
- more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
compiled long help texts
* 'help -v' gives a list of commands with their short description, this
is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 08:28:42 +00:00
|
|
|
BAREBOX_CMD_HELP_TEXT("Calculate a SHA224 digest over a FILE or a memory area.")
|
2011-10-08 14:41:59 +00:00
|
|
|
BAREBOX_CMD_HELP_END
|
|
|
|
|
|
|
|
BAREBOX_CMD_START(sha224sum)
|
|
|
|
.cmd = do_sha224,
|
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:
* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
is listed by character in this (short) option string (the long
description is in the long help text, as before)
* help texts have been reworked, to make them
- sometimes smaller
- sometimes describe the options better
- more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
compiled long help texts
* 'help -v' gives a list of commands with their short description, this
is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 08:28:42 +00:00
|
|
|
BAREBOX_CMD_DESC("calculate SHA224 digest")
|
|
|
|
BAREBOX_CMD_OPTS("FILE|AREA")
|
commands: group 'help' output
The old output of "help" was just producing a long list, that usually
scrolled of the screen (even on a X11 terminal). This list is more
compact, and also sorted by groups.
The old output format (plus grouping) is now available with 'help -v'.
Example:
Information commands:
?, devinfo, help, iomem, meminfo, version
Boot commands:
boot, bootm, go, loadb, loads, loadx, loady, saves, uimage
...
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 14:14:05 +00:00
|
|
|
BAREBOX_CMD_GROUP(CMD_GRP_FILE)
|
2011-10-08 14:41:59 +00:00
|
|
|
BAREBOX_CMD_HELP(cmd_sha224sum_help)
|
|
|
|
BAREBOX_CMD_END
|
|
|
|
|
|
|
|
#endif /* CMD_CMD_SHA224SUM */
|
|
|
|
|
2011-05-18 07:18:20 +00:00
|
|
|
#ifdef CONFIG_CMD_SHA256SUM
|
|
|
|
|
2011-12-21 13:18:57 +00:00
|
|
|
static int do_sha256(int argc, char *argv[])
|
2011-05-18 07:18:20 +00:00
|
|
|
{
|
2015-03-17 11:53:16 +00:00
|
|
|
return do_hash("sha256", argc, argv);
|
2011-05-18 07:18:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BAREBOX_CMD_HELP_START(sha256sum)
|
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:
* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
is listed by character in this (short) option string (the long
description is in the long help text, as before)
* help texts have been reworked, to make them
- sometimes smaller
- sometimes describe the options better
- more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
compiled long help texts
* 'help -v' gives a list of commands with their short description, this
is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 08:28:42 +00:00
|
|
|
BAREBOX_CMD_HELP_TEXT("Calculate a SHA256 digest over a FILE or a memory area.")
|
2011-05-18 07:18:20 +00:00
|
|
|
BAREBOX_CMD_HELP_END
|
|
|
|
|
|
|
|
BAREBOX_CMD_START(sha256sum)
|
|
|
|
.cmd = do_sha256,
|
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:
* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
is listed by character in this (short) option string (the long
description is in the long help text, as before)
* help texts have been reworked, to make them
- sometimes smaller
- sometimes describe the options better
- more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
compiled long help texts
* 'help -v' gives a list of commands with their short description, this
is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 08:28:42 +00:00
|
|
|
BAREBOX_CMD_DESC("calculate SHA256 digest")
|
|
|
|
BAREBOX_CMD_OPTS("FILE|AREA")
|
commands: group 'help' output
The old output of "help" was just producing a long list, that usually
scrolled of the screen (even on a X11 terminal). This list is more
compact, and also sorted by groups.
The old output format (plus grouping) is now available with 'help -v'.
Example:
Information commands:
?, devinfo, help, iomem, meminfo, version
Boot commands:
boot, bootm, go, loadb, loads, loadx, loady, saves, uimage
...
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-13 14:14:05 +00:00
|
|
|
BAREBOX_CMD_GROUP(CMD_GRP_FILE)
|
2011-05-18 07:18:20 +00:00
|
|
|
BAREBOX_CMD_HELP(cmd_sha256sum_help)
|
|
|
|
BAREBOX_CMD_END
|
|
|
|
|
|
|
|
#endif /* CMD_CMD_SHA256SUM */
|
2015-03-11 16:53:06 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_CMD_SHA384SUM
|
|
|
|
|
|
|
|
static int do_sha384(int argc, char *argv[])
|
|
|
|
{
|
2015-03-17 11:53:16 +00:00
|
|
|
return do_hash("sha384", argc, argv);
|
2015-03-11 16:53:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BAREBOX_CMD_HELP_START(sha384sum)
|
|
|
|
BAREBOX_CMD_HELP_TEXT("Calculate a SHA384 digest over a FILE or a memory area.")
|
|
|
|
BAREBOX_CMD_HELP_END
|
|
|
|
|
|
|
|
BAREBOX_CMD_START(sha384sum)
|
|
|
|
.cmd = do_sha384,
|
|
|
|
BAREBOX_CMD_DESC("calculate SHA384 digest")
|
|
|
|
BAREBOX_CMD_OPTS("FILE|AREA")
|
|
|
|
BAREBOX_CMD_GROUP(CMD_GRP_FILE)
|
|
|
|
BAREBOX_CMD_HELP(cmd_sha384sum_help)
|
|
|
|
BAREBOX_CMD_END
|
|
|
|
|
|
|
|
#endif /* CMD_CMD_SHA384SUM */
|
|
|
|
|
|
|
|
#ifdef CONFIG_CMD_SHA512SUM
|
|
|
|
|
|
|
|
static int do_sha512(int argc, char *argv[])
|
|
|
|
{
|
2015-03-17 11:53:16 +00:00
|
|
|
return do_hash("sha512", argc, argv);
|
2015-03-11 16:53:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BAREBOX_CMD_HELP_START(sha512sum)
|
|
|
|
BAREBOX_CMD_HELP_TEXT("Calculate a SHA512 digest over a FILE or a memory area.")
|
|
|
|
BAREBOX_CMD_HELP_END
|
|
|
|
|
|
|
|
BAREBOX_CMD_START(sha512sum)
|
|
|
|
.cmd = do_sha512,
|
|
|
|
BAREBOX_CMD_DESC("calculate SHA512 digest")
|
|
|
|
BAREBOX_CMD_OPTS("FILE|AREA")
|
|
|
|
BAREBOX_CMD_GROUP(CMD_GRP_FILE)
|
|
|
|
BAREBOX_CMD_HELP(cmd_sha512sum_help)
|
|
|
|
BAREBOX_CMD_END
|
|
|
|
|
|
|
|
#endif /* CMD_CMD_SHA512SUM */
|