diff options
author | Philippe Reynes <philippe.reynes@softathome.com> | 2024-12-19 14:05:49 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2025-01-18 17:12:47 -0600 |
commit | ccc5e166836c2fa204a58fe9ac87c5fce72b5e7b (patch) | |
tree | e3e00e5c88bd32888e0d407207af89ddb6a84f33 /lib/mbedtls/sha256.c | |
parent | 70a42bf2170eadd2b8b99175785435f209faca0a (diff) |
lib: sha256: move common function to sha256_common.c
The function sha256_csum_wd is defined in lib/sha256.c
and in lib/mbedtls/sha256.c. To avoid duplicating this
function (and future function), we move this function
to the file lib/sha256_common.c
Reviewed-by: Raymond Mao <raymond.mao@linaro.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Diffstat (limited to 'lib/mbedtls/sha256.c')
-rw-r--r-- | lib/mbedtls/sha256.c | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/lib/mbedtls/sha256.c b/lib/mbedtls/sha256.c index 24aa58fa674..2128e598834 100644 --- a/lib/mbedtls/sha256.c +++ b/lib/mbedtls/sha256.c @@ -33,30 +33,3 @@ void sha256_finish(sha256_context *ctx, uint8_t digest[SHA256_SUM_LEN]) mbedtls_sha256_finish(ctx, digest); mbedtls_sha256_free(ctx); } - -void sha256_csum_wd(const unsigned char *input, unsigned int ilen, - unsigned char *output, unsigned int chunk_sz) -{ - sha256_context ctx; - - sha256_starts(&ctx); - - if (IS_ENABLED(CONFIG_HW_WATCHDOG) || IS_ENABLED(CONFIG_WATCHDOG)) { - const unsigned char *curr = input; - const unsigned char *end = input + ilen; - int chunk; - - while (curr < end) { - chunk = end - curr; - if (chunk > chunk_sz) - chunk = chunk_sz; - sha256_update(&ctx, curr, chunk); - curr += chunk; - schedule(); - } - } else { - sha256_update(&ctx, input, ilen); - } - - sha256_finish(&ctx, output); -} |