1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2012 The Chromium OS Authors.
15 #include <linux/ctype.h>
17 #if IS_ENABLED(CONFIG_HASH_VERIFY)
23 static int do_hash(struct cmd_tbl *cmdtp, int flag, int argc,
27 int flags = HASH_FLAG_ENV;
29 if (argc < (HARGS - 1))
32 #if IS_ENABLED(CONFIG_HASH_VERIFY)
33 if (!strcmp(argv[1], "-v")) {
34 flags |= HASH_FLAG_VERIFY;
39 /* Move forward to 'algorithm' parameter */
42 for (s = *argv; *s; s++)
44 return hash_command(*argv, flags, cmdtp, flag, argc - 1, argv + 1);
48 hash, HARGS, 1, do_hash,
49 "compute hash message digest",
50 "algorithm address count [[*]hash_dest]\n"
51 " - compute message digest [save to env var / *address]"
52 #if IS_ENABLED(CONFIG_HASH_VERIFY)
53 "\nhash -v algorithm address count [*]hash\n"
54 " - verify message digest of memory area to immediate value, \n"
55 " env var or *address"