| // SPDX-License-Identifier: GPL-2.0+ |
| * Hash shim layer on MbedTLS Crypto library |
| * Copyright (c) 2024 Linaro Limited |
| * Author: Raymond Mao <raymond.mao@linaro.org> |
| void MD5Init(MD5Context *ctx) |
| void MD5Update(MD5Context *ctx, unsigned char const *buf, unsigned int len) |
| mbedtls_md5_update(ctx, buf, len); |
| void MD5Final(unsigned char digest[16], MD5Context *ctx) |
| mbedtls_md5_finish(ctx, digest); |
| void md5_wd(const unsigned char *input, unsigned int len, |
| unsigned char output[16], unsigned int chunk_sz) |
| if (IS_ENABLED(CONFIG_HW_WATCHDOG) || IS_ENABLED(CONFIG_WATCHDOG)) { |
| const unsigned char *curr = input; |
| const unsigned char *end = input + len; |
| MD5Update(&context, curr, chunk); |
| MD5Update(&context, input, len); |
| MD5Final(output, &context); |