summaryrefslogtreecommitdiff
path: root/include/hash.h
Commit message (Collapse)AuthorAgeLines
* hash: Use uint8_t in preference to u8Simon Glass2014-06-19-1/+2
| | | | | | This type is more readily available on the host compiler, so use it instead. Signed-off-by: Simon Glass <sjg@chromium.org>
* hash: Export the function to show a hashSimon Glass2014-06-11-0/+14
| | | | | | This function is useful for displaying a hash value, so export it. Signed-off-by: Simon Glass <sjg@chromium.org>
* Prevent a buffer overflow in mkimage when signing with SHA256Michael van der Westhuizen2014-06-05-11/+13
| | | | | | | | | | | | | Due to the FIT_MAX_HASH_LEN constant not having been updated to support SHA256 signatures one will always see a buffer overflow in fit_image_process_hash when signing images that use this larger hash. This is exposed by vboot_test.sh. Signed-off-by: Michael van der Westhuizen <michael@smart-africa.com> Acked-by: Simon Glass <sjg@chromium.org> [trini: Rework a bit so move the exportable parts of hash.h outside of !USE_HOSTCC and only need that as a new include to image.h] Signed-off-by: Tom Rini <trini@ti.com>
* gen: Add progressive hash APIHung-ying Tyan2014-03-21-0/+48
| | | | | | | | | | | Add hash_init(), hash_update() and hash_finish() to the hash_algo struct. Add hash_lookup_algo() to look up the struct given an algorithm name. Signed-off-by: Hung-ying Tyan <tyanh@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Heiko Schocher <hs@denx.de> Acked-by: Simon Glass <sjg@chromium.org>
* Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk2013-07-24-17/+1
| | | | | | Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
* hash: Add a way to calculate a hash for any algortihmSimon Glass2013-05-14-0/+22
| | | | | | | | | | | Rather than needing to call one of many hashing algorithms in U-Boot, provide a function hash_block() which handles this, and can support all available hash algorithms. Once we have md5 supported within hashing, we can use this function in the FIT image code. Signed-off-by: Simon Glass <sjg@chromium.org>
* hash: Use lower case for hash algorithm namesSimon Glass2013-02-28-1/+1
| | | | | | | | | | Rather than use strcasecmp() in the hash algorithm search, require the caller to do this first. Most of U-Boot can use lower case anyway, and the hash command can convert to lower case before calling hash_command(). This saves needing strcasecmp() for boards that use hashing but not the hash command. Signed-off-by: Simon Glass <sjg@chromium.org>
* Roll crc32 into hash infrastructureSimon Glass2013-02-28-1/+1
| | | | | | | | | | | | | | | | | Add the CRC32 algorithm to the list of available hashes, and make the crc32 command use hash_command(). Add a new crc32_wd_buf() to make this possible, which puts its result in a buffer rather than returning it as a 32-bit value. Note: For some boards the hash command is not enabled, neither are sha1, sha256 or the verify option. In this case the full hash implementation adds about 500 bytes of overhead. So as a special case, we use #ifdef to select very simple bahaviour in that case. The justification for this is that it is currently a very common case (virtually all boards enable crc32 but only some enable more advanced features). Signed-off-by: Simon Glass <sjg@chromium.org>
* hash: Add a flag to support saving hashes in the environmentSimon Glass2013-02-28-2/+7
| | | | | | | | | Some hashing commands permit saving the hash in an environment variable, and verifying a hash from there. But the crc32 command does not support this. In order to permit crc32 to use the generic hashing infrastructure, add a flag to select which behaviour to use. Signed-off-by: Simon Glass <sjg@chromium.org>
* Add generic hash APISimon Glass2012-12-11-0/+69
We have a SHA1 command and want to add a SHA256 command also. Instead of duplicating the code, create a generic hash API which can process commands for different algorithms. Signed-off-by: Simon Glass <sjg@chromium.org>