]> Git Repo - J-u-boot.git/blame - cmd/hash.c
.gitlab-ci.yml: add Qemu tests for MIPS Malta board
[J-u-boot.git] / cmd / hash.c
CommitLineData
83d290c5 1// SPDX-License-Identifier: GPL-2.0+
bf36c5d5
SG
2/*
3 * Copyright (c) 2012 The Chromium OS Authors.
4 *
5 * (C) Copyright 2011
6 * Joe Hershberger, National Instruments, [email protected]
7 *
8 * (C) Copyright 2000
9 * Wolfgang Denk, DENX Software Engineering, [email protected].
bf36c5d5
SG
10 */
11
12#include <common.h>
13#include <command.h>
14#include <hash.h>
218da0f3 15#include <linux/ctype.h>
bf36c5d5 16
09140113
SG
17static int do_hash(struct cmd_tbl *cmdtp, int flag, int argc,
18 char *const argv[])
bf36c5d5 19{
218da0f3 20 char *s;
d5b76673 21 int flags = HASH_FLAG_ENV;
bf36c5d5 22
3ef46a99 23#ifdef CONFIG_HASH_VERIFY
6b3ff98d
SG
24 if (argc < 4)
25 return CMD_RET_USAGE;
bf36c5d5 26 if (!strcmp(argv[1], "-v")) {
d5b76673 27 flags |= HASH_FLAG_VERIFY;
bf36c5d5
SG
28 argc--;
29 argv++;
30 }
31#endif
32 /* Move forward to 'algorithm' parameter */
33 argc--;
34 argv++;
218da0f3
SG
35 for (s = *argv; *s; s++)
36 *s = tolower(*s);
d5b76673 37 return hash_command(*argv, flags, cmdtp, flag, argc - 1, argv + 1);
bf36c5d5
SG
38}
39
40#ifdef CONFIG_HASH_VERIFY
3ef46a99 41#define HARGS 6
bf36c5d5 42#else
3ef46a99
ND
43#define HARGS 5
44#endif
45
bf36c5d5 46U_BOOT_CMD(
3ef46a99
ND
47 hash, HARGS, 1, do_hash,
48 "compute hash message digest",
49 "algorithm address count [[*]hash_dest]\n"
bf36c5d5 50 " - compute message digest [save to env var / *address]"
3ef46a99
ND
51#ifdef CONFIG_HASH_VERIFY
52 "\nhash -v algorithm address count [*]hash\n"
53 " - verify message digest of memory area to immediate value, \n"
54 " env var or *address"
bf36c5d5 55#endif
3ef46a99 56);
This page took 0.326939 seconds and 4 git commands to generate.