hash: Remove old hash functions

Removed currently unused functions.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
This commit is contained in:
Adrian Warecki 2023-02-27 10:52:58 +01:00 committed by pjdobrowolski
parent d258ea23fc
commit 6c7a1512c6
2 changed files with 0 additions and 67 deletions

View File

@ -194,61 +194,3 @@ int hash_sha384(const void *data, size_t size, void *output, size_t output_len)
{
return hash_single(data, size, EVP_sha384(), output, output_len);
}
void module_sha256_create(struct image *image)
{
image->md = EVP_sha256();
image->mdctx = EVP_MD_CTX_new();
EVP_DigestInit_ex(image->mdctx, image->md, NULL);
}
void module_sha_update(struct image *image, uint8_t *data, size_t bytes)
{
EVP_DigestUpdate(image->mdctx, data, bytes);
}
void module_sha_complete(struct image *image, uint8_t *hash)
{
unsigned char md_value[EVP_MAX_MD_SIZE];
unsigned int md_len;
#if DEBUG_HASH
int i;
#endif
EVP_DigestFinal_ex(image->mdctx, md_value, &md_len);
EVP_MD_CTX_free(image->mdctx);
memcpy(hash, md_value, md_len);
#if DEBUG_HASH
fprintf(stdout, "Module digest is: ");
for (i = 0; i < md_len; i++)
fprintf(stdout, "%02x", md_value[i]);
fprintf(stdout, "\n");
#endif
}
void ri_sha256(struct image *image, unsigned int offset, unsigned int size,
uint8_t *hash)
{
assert((uint64_t)size + offset <= image->adsp->image_size);
module_sha256_create(image);
module_sha_update(image, image->fw_image + offset, size);
module_sha_complete(image, hash);
}
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)
{
assert((uint64_t)size + offset <= image->adsp->image_size);
module_sha384_create(image);
module_sha_update(image, image->fw_image + offset, size);
module_sha_complete(image, hash);
}

View File

@ -170,20 +170,11 @@ struct adsp {
int exec_boot_ldr;
};
void module_sha256_create(struct image *image);
void module_sha384_create(struct image *image);
void module_sha_update(struct image *image, uint8_t *data, size_t bytes);
void module_sha_complete(struct image *image, uint8_t *hash);
int ri_manifest_sign_v1_5(struct image *image);
int ri_manifest_sign_v1_8(struct image *image);
int ri_manifest_sign_v2_5(struct image *image);
int ri_manifest_sign_ace_v1_5(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,
void *ptr1, unsigned int size1);