From c8a0f1b229ac6723b1a188c2de22ad860be6f636 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Fri, 29 Nov 2013 04:14:26 +0100 Subject: [PATCH] * util/mkimage.c (grub_install_generate_image): Use grub_crypto_hash for computing crc32 rather than handling with md fundtions directly. --- ChangeLog | 5 +++++ util/mkimage.c | 12 ++---------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index f130e8b1b..e9dab2855 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-11-29 Vladimir Serbinenko + + * util/mkimage.c (grub_install_generate_image): Use grub_crypto_hash for + computing crc32 rather than handling with md fundtions directly. + 2013-11-29 Vladimir Serbinenko * util/mkimage.c (grub_install_generate_image): Use grub_crypto_hash for diff --git a/util/mkimage.c b/util/mkimage.c index 1afba502e..55e2c906d 100644 --- a/util/mkimage.c +++ b/util/mkimage.c @@ -1660,7 +1660,6 @@ grub_install_generate_image (const char *dir, const char *prefix, case IMAGE_UBOOT: { struct grub_uboot_image_header *hdr; - GRUB_PROPERLY_ALIGNED_ARRAY (crc32_context, GRUB_MD_CRC32->contextsize); hdr = xmalloc (core_size + sizeof (struct grub_uboot_image_header)); memcpy (hdr + 1, core_img, core_size); @@ -1676,15 +1675,8 @@ grub_install_generate_image (const char *dir, const char *prefix, hdr->ih_arch = GRUB_UBOOT_IH_ARCH_ARM; hdr->ih_comp = GRUB_UBOOT_IH_COMP_NONE; - GRUB_MD_CRC32->init(crc32_context); - GRUB_MD_CRC32->write(crc32_context, hdr + 1, core_size); - GRUB_MD_CRC32->final(crc32_context); - hdr->ih_dcrc = grub_get_unaligned32 (GRUB_MD_CRC32->read (crc32_context)); - - GRUB_MD_CRC32->init(crc32_context); - GRUB_MD_CRC32->write(crc32_context, hdr, sizeof (*hdr)); - GRUB_MD_CRC32->final(crc32_context); - hdr->ih_hcrc = grub_get_unaligned32 (GRUB_MD_CRC32->read (crc32_context)); + grub_crypto_hash (GRUB_MD_CRC32, &hdr->ih_dcrc, hdr + 1, core_size); + grub_crypto_hash (GRUB_MD_CRC32, &hdr->ih_hcrc, hdr, sizeof (*hdr)); free (core_img); core_img = (char *) hdr;