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