* util/mkimage.c (grub_install_generate_image): Use grub_crypto_hash for

computing crc32 rather than handling with md fundtions directly.
This commit is contained in:
Vladimir Serbinenko 2013-11-29 04:14:26 +01:00
parent 726409a513
commit c8a0f1b229
2 changed files with 7 additions and 10 deletions

View file

@ -1,3 +1,8 @@
2013-11-29 Vladimir Serbinenko <phcoder@gmail.com>
* 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 <phcoder@gmail.com>
* util/mkimage.c (grub_install_generate_image): Use grub_crypto_hash for

View file

@ -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;