2 * Copyright (c) 2012 The Chromium OS Authors.
3 * See file CREDITS for list of people who contributed to this
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of
9 * the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 #ifdef CONFIG_SHA1SUM_VERIFY
26 #define CONFIG_HASH_VERIFY
30 const char *name; /* Name of algorithm */
31 int digest_size; /* Length of digest */
33 * hash_func_ws: Generic hashing function
35 * This is the generic prototype for a hashing function. We only
36 * have the watchdog version at present.
38 * @input: Input buffer
39 * @ilen: Input buffer length
40 * @output: Checksum result (length depends on algorithm)
41 * @chunk_sz: Trigger watchdog after processing this many bytes
43 void (*hash_func_ws)(const unsigned char *input, unsigned int ilen,
44 unsigned char *output, unsigned int chunk_sz);
45 int chunk_size; /* Watchdog chunk size */
49 * Maximum digest size for all algorithms we support. Having this value
50 * avoids a malloc() or C99 local declaration in common/cmd_hash.c.
52 #define HASH_MAX_DIGEST_SIZE 32
55 * hash_command: Process a hash command for a particular algorithm
57 * This common function is used to implement specific hash commands.
59 * @algo_name: Hash algorithm being used
60 * @verify: Non-zero to enable verify mode
61 * @cmdtp: Pointer to command table entry
62 * @flag: Some flags normally 0 (see CMD_FLAG_.. above)
63 * @argc: Number of arguments (arg 0 must be the command text)
66 int hash_command(const char *algo_name, int verify, cmd_tbl_t *cmdtp, int flag,
67 int argc, char * const argv[]);