mirror of
https://xff.cz/git/u-boot/
synced 2025-09-04 02:02:08 +02:00
Roll crc32 into hash infrastructure
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>
This commit is contained in:
@@ -30,4 +30,15 @@ uint32_t crc32 (uint32_t, const unsigned char *, uint);
|
||||
uint32_t crc32_wd (uint32_t, const unsigned char *, uint, uint);
|
||||
uint32_t crc32_no_comp (uint32_t, const unsigned char *, uint);
|
||||
|
||||
/**
|
||||
* crc32_wd_buf - Perform CRC32 on a buffer and return result in buffer
|
||||
*
|
||||
* @input: Input buffer
|
||||
* @ilen: Input buffer length
|
||||
* @output: Place to put checksum result (4 bytes)
|
||||
* @chunk_sz: Trigger watchdog after processing this many bytes
|
||||
*/
|
||||
void crc32_wd_buf(const unsigned char *input, uint ilen,
|
||||
unsigned char *output, uint chunk_sz);
|
||||
|
||||
#endif /* _UBOOT_CRC_H */
|
||||
|
Reference in New Issue
Block a user