+2013-11-29 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * util/mkimage.c (grub_install_generate_image): Use grub_crypto_hash for
+ checking fwstart.img rather than md fundtions directly.
+
2013-11-29 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-mkrescue.c (main): Check that fread succeeded.
size_t rom_size;
char *boot_path, *boot_img;
size_t boot_size;
- grub_uint8_t context[GRUB_MD_SHA512->contextsize];
/* fwstart.img is the only part which can't be tested by using *-elf
target. Check it against the checksum. */
const grub_uint8_t yeeloong_fwstart_good_hash[512 / 8] =
0x46, 0x50, 0xd6, 0x21, 0xce, 0x8e, 0x24, 0xa7
};
const grub_uint8_t *fwstart_good_hash;
+ grub_uint8_t fwstart_hash[512 / 8];
if (image_target->id == IMAGE_FULOONG2F_FLASH)
{
boot_size = grub_util_get_image_size (boot_path);
boot_img = grub_util_read_image (boot_path);
- grub_memset (context, 0, sizeof (context));
- GRUB_MD_SHA512->init (context);
- GRUB_MD_SHA512->write (context, boot_img, boot_size);
- GRUB_MD_SHA512->final (context);
- if (grub_memcmp (GRUB_MD_SHA512->read (context), fwstart_good_hash,
+ grub_crypto_hash (GRUB_MD_SHA512, fwstart_hash, boot_img, boot_size);
+
+ if (grub_memcmp (fwstart_hash, fwstart_good_hash,
GRUB_MD_SHA512->mdlen) != 0)
/* TRANSLATORS: fwstart.img may still be good, just it wasn't checked. */
grub_util_warn ("%s",