* grub-core/efiemu/prepare.c: Remove variable length arrays.

This commit is contained in:
Vladimir Serbinenko 2013-11-12 16:12:28 +01:00
parent 08772054e9
commit 3ea0ccb319
2 changed files with 15 additions and 10 deletions

View File

@ -1,3 +1,7 @@
2013-11-12 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/efiemu/prepare.c: Remove variable length arrays.
2013-11-12 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/osdep/windows/hostdisk.c (grub_util_fd_strerror): Silence

View File

@ -122,7 +122,10 @@ SUFFIX (grub_efiemu_crc) (void)
int handle;
grub_off_t off;
struct SUFFIX (grub_efiemu_runtime_services) *runtime_services;
grub_uint8_t crc32_context[GRUB_MD_CRC32->contextsize];
grub_uint32_t crc32_val;
if (GRUB_MD_CRC32->mdlen != 4)
return grub_error (GRUB_ERR_BUG, "incorrect mdlen");
/* compute CRC32 of runtime_services */
err = grub_efiemu_resolve_symbol ("efiemu_runtime_services",
@ -134,12 +137,11 @@ SUFFIX (grub_efiemu_crc) (void)
((grub_uint8_t *) grub_efiemu_mm_obtain_request (handle) + off);
runtime_services->hdr.crc32 = 0;
GRUB_MD_CRC32->init(crc32_context);
GRUB_MD_CRC32->write(crc32_context, runtime_services, runtime_services->hdr.header_size);
GRUB_MD_CRC32->final(crc32_context);
grub_crypto_hash (GRUB_MD_CRC32, &crc32_val,
runtime_services, runtime_services->hdr.header_size);
runtime_services->hdr.crc32 =
grub_be_to_cpu32(*(grub_uint32_t*)GRUB_MD_CRC32->read(crc32_context));
grub_be_to_cpu32(crc32_val);
err = grub_efiemu_resolve_symbol ("efiemu_system_table", &handle, &off);
if (err)
@ -147,12 +149,11 @@ SUFFIX (grub_efiemu_crc) (void)
/* compute CRC32 of system table */
SUFFIX (grub_efiemu_system_table)->hdr.crc32 = 0;
GRUB_MD_CRC32->init(crc32_context);
GRUB_MD_CRC32->write(crc32_context, SUFFIX (grub_efiemu_system_table),
SUFFIX (grub_efiemu_system_table)->hdr.header_size);
GRUB_MD_CRC32->final(crc32_context);
grub_crypto_hash (GRUB_MD_CRC32, &crc32_val,
SUFFIX (grub_efiemu_system_table),
SUFFIX (grub_efiemu_system_table)->hdr.header_size);
SUFFIX (grub_efiemu_system_table)->hdr.crc32 =
grub_be_to_cpu32(*(grub_uint32_t*)GRUB_MD_CRC32->read(crc32_context));
grub_be_to_cpu32(crc32_val);
grub_dprintf ("efiemu","system_table = %p, runtime_services = %p\n",
SUFFIX (grub_efiemu_system_table), runtime_services);