bootutil: Replace hash with SHA384 when P384 is used
Currently all the hashing functionality is done with SHA256
but if we would like to use ECDSA-P384 that requires SHA384
as the hashing algorithm, but MCUboot is using SHA256
for image hashing and public key hashing. This commit modifies
the hashing operations to use SHA384 thus SHA256 can be omitted
which is beneficial from a code size standpoint.
Signed-off-by: Roland Mikhel <roland.mikhel@arm.com>
Change-Id: I59230f76f88e0b42ad6383b2c9b71b73f33d7dd7
diff --git a/ext/nrf/cc310_glue.h b/ext/nrf/cc310_glue.h
index c42fad5..ed3ed5c 100644
--- a/ext/nrf/cc310_glue.h
+++ b/ext/nrf/cc310_glue.h
@@ -32,7 +32,7 @@
#define NRF_CRYPTOCELL NRF_CRYPTOCELL_S
#endif
-typedef nrf_cc310_bl_hash_context_sha256_t bootutil_sha256_context;
+typedef nrf_cc310_bl_hash_context_sha256_t bootutil_sha_context;
int cc310_ecdsa_verify_secp256r1(uint8_t *hash,
uint8_t *public_key,
@@ -66,7 +66,7 @@
nrf_cc310_bl_hash_sha256_init(ctx);
}
-static inline void cc310_sha256_finalize(bootutil_sha256_context *ctx,
+static inline void cc310_sha256_finalize(nrf_cc310_bl_hash_context_sha256_t *ctx,
uint8_t *output)
{
nrf_cc310_bl_hash_sha256_finalize(ctx,