1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2012 The Chromium OS Authors.
6 * Joe Hershberger, National Instruments, joe.hershberger@ni.com
9 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
15 #include <linux/ctype.h>
17 static int do_hash(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
20 int flags = HASH_FLAG_ENV;
22 #ifdef CONFIG_HASH_VERIFY
25 if (!strcmp(argv[1], "-v")) {
26 flags |= HASH_FLAG_VERIFY;
31 /* Move forward to 'algorithm' parameter */
34 for (s = *argv; *s; s++)
36 return hash_command(*argv, flags, cmdtp, flag, argc - 1, argv + 1);
39 #ifdef CONFIG_HASH_VERIFY
46 hash, HARGS, 1, do_hash,
47 "compute hash message digest",
48 "algorithm address count [[*]hash_dest]\n"
49 " - compute message digest [save to env var / *address]"
50 #ifdef CONFIG_HASH_VERIFY
51 "\nhash -v algorithm address count [*]hash\n"
52 " - verify message digest of memory area to immediate value, \n"
53 " env var or *address"