]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
c3d2a17c | 2 | /* |
e6e77d35 JH |
3 | * (C) Copyright 2011 |
4 | * Joe Hershberger, National Instruments, [email protected] | |
5 | * | |
c3d2a17c MF |
6 | * (C) Copyright 2000 |
7 | * Wolfgang Denk, DENX Software Engineering, [email protected]. | |
c3d2a17c MF |
8 | */ |
9 | ||
c3d2a17c | 10 | #include <command.h> |
e50b12c9 | 11 | #include <hash.h> |
2b9912e6 | 12 | #include <u-boot/sha1.h> |
c3d2a17c | 13 | |
09140113 | 14 | int do_sha1sum(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) |
e6e77d35 | 15 | { |
d5b76673 | 16 | int flags = HASH_FLAG_ENV; |
e6e77d35 JH |
17 | int ac; |
18 | char * const *av; | |
19 | ||
20 | if (argc < 3) | |
21 | return CMD_RET_USAGE; | |
22 | ||
23 | av = argv + 1; | |
24 | ac = argc - 1; | |
e50b12c9 | 25 | #ifdef CONFIG_SHA1SUM_VERIFY |
e6e77d35 | 26 | if (strcmp(*av, "-v") == 0) { |
d5b76673 | 27 | flags |= HASH_FLAG_VERIFY; |
e6e77d35 JH |
28 | av++; |
29 | ac--; | |
e6e77d35 | 30 | } |
e50b12c9 | 31 | #endif |
e6e77d35 | 32 | |
d5b76673 | 33 | return hash_command("sha1", flags, cmdtp, flag, ac, av); |
c3d2a17c MF |
34 | } |
35 | ||
e6e77d35 JH |
36 | #ifdef CONFIG_SHA1SUM_VERIFY |
37 | U_BOOT_CMD( | |
38 | sha1sum, 5, 1, do_sha1sum, | |
39 | "compute SHA1 message digest", | |
3c210e29 JH |
40 | "address count [[*]sum]\n" |
41 | " - compute SHA1 message digest [save to sum]\n" | |
e6e77d35 JH |
42 | "sha1sum -v address count [*]sum\n" |
43 | " - verify sha1sum of memory area" | |
44 | ); | |
45 | #else | |
c3d2a17c | 46 | U_BOOT_CMD( |
3c210e29 | 47 | sha1sum, 4, 1, do_sha1sum, |
c3d2a17c | 48 | "compute SHA1 message digest", |
3c210e29 JH |
49 | "address count [[*]sum]\n" |
50 | " - compute SHA1 message digest [save to sum]" | |
c3d2a17c | 51 | ); |
e6e77d35 | 52 | #endif |