rimage: add SHA384 hashing

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
This commit is contained in:
Janusz Jankowski 2019-09-30 19:28:44 +02:00 committed by Liam Girdwood
parent 72b6521c87
commit e2743bc397
2 changed files with 19 additions and 1 deletions

View File

@ -87,3 +87,19 @@ void ri_sha256(struct image *image, unsigned int offset, unsigned int size,
module_sha_update(image, image->fw_image + offset, size);
module_sha_complete(image, hash);
}
static void module_sha384_create(struct image *image)
{
image->md = EVP_sha384();
image->mdctx = EVP_MD_CTX_new();
EVP_DigestInit_ex(image->mdctx, image->md, NULL);
}
void ri_sha384(struct image *image, unsigned int offset, unsigned int size,
uint8_t *hash)
{
module_sha384_create(image);
module_sha_update(image, image->fw_image + offset, size);
module_sha_complete(image, hash);
}

View File

@ -107,7 +107,7 @@ struct image {
int meu_offset;
int xcc_mod_offset;
/* SHA 256 */
/* SHA 256 & 384 */
const char *key_name;
EVP_MD_CTX *mdctx;
const EVP_MD *md;
@ -157,6 +157,8 @@ int ri_manifest_sign_v1_5(struct image *image);
int ri_manifest_sign_v1_8(struct image *image);
void ri_sha256(struct image *image, unsigned int offset, unsigned int size,
uint8_t *hash);
void ri_sha384(struct image *image, unsigned int offset, unsigned int size,
uint8_t *hash);
int pkcs_v1_5_sign_man_v1_5(struct image *image,
struct fw_image_manifest_v1_5 *man,