* util/mkimage.c (grub_install_generate_image): Use grub_crypto_hash for
checking fwstart.img rather than md fundtions directly.
This commit is contained in:
parent
422e6e886c
commit
726409a513
2 changed files with 9 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
|||
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.
|
||||
|
|
|
@ -1565,7 +1565,6 @@ grub_install_generate_image (const char *dir, const char *prefix,
|
|||
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] =
|
||||
|
@ -1591,6 +1590,7 @@ grub_install_generate_image (const char *dir, const char *prefix,
|
|||
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)
|
||||
{
|
||||
|
@ -1606,11 +1606,9 @@ grub_install_generate_image (const char *dir, const char *prefix,
|
|||
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",
|
||||
|
|
Loading…
Reference in a new issue