
Hi Ilias,
On Wed, 3 Jul 2024 at 04:56, Ilias Apalodimas ilias.apalodimas@linaro.org wrote:
Hi Raymond
On Tue, 2 Jul 2024 at 21:27, Raymond Mao raymond.mao@linaro.org wrote:
Integrate common/hash.c on the hash shim layer so that hash APIs from mbedtls can be leveraged by boot/image and efi_loader.
Signed-off-by: Raymond Mao raymond.mao@linaro.org
Changes in v2
- Use the original head files instead of creating new ones.
Changes in v3
- Add handle checkers for malloc.
Changes in v4
- None.
common/hash.c | 143 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+)
diff --git a/common/hash.c b/common/hash.c index ac63803fed9..96caf074374 100644 --- a/common/hash.c +++ b/common/hash.c
[snip]
@@ -267,10 +404,16 @@ static struct hash_algo hash_algo[] = { .hash_init = hw_sha_init, .hash_update = hw_sha_update, .hash_finish = hw_sha_finish, +#else +#if CONFIG_IS_ENABLED(MBEDTLS_LIB_CRYPTO)
.hash_init = hash_init_sha512,
.hash_update = hash_update_sha512,
.hash_finish = hash_finish_sha512,
I don't have strong opinion here, but you could alternatively define sha384 wrappers for mbedTLS and avoid this ifdef. In any case I personally don't mind.
I will prefer not to create a new wrapper function in order to save
space.
Regards, Raymond