1 // SPDX-License-Identifier: GPL-2.0+
3 * FIPS-180-2 compliant SHA-256 implementation
5 * Copyright (C) 2001-2003 Christophe Devine
9 #include <u-boot/schedule.h>
10 #endif /* USE_HOSTCC */
12 #include <u-boot/sha256.h>
14 #include <linux/compiler_attributes.h>
17 * Output = SHA-256( input buffer ). Trigger the watchdog every 'chunk_sz'
18 * bytes of input processed.
20 void sha256_csum_wd(const unsigned char *input, unsigned int ilen,
21 unsigned char *output, unsigned int chunk_sz)
24 #if !defined(USE_HOSTCC) && \
25 (defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG))
26 const unsigned char *end;
33 #if !defined(USE_HOSTCC) && \
34 (defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG))
35 curr = (unsigned char *)input;
41 sha256_update(&ctx, curr, chunk);
46 sha256_update(&ctx, input, ilen);
49 sha256_finish(&ctx, output);