Remove crc.mod and move crc command to hashsum.mod.
Remove lib/crc.c - users updated to use gcrypt implementation. * grub-core/commands/crc.c: Removed. * grub-core/Makefile.core.def (crc): Module removed. * grub-core/commands/hashsum.c (aliases[]): Add crc alias. * grub-core/commands/hashsum.c (GRUB_MOD_INIT): Register crc command. * grub-core/commands/hashsum.c (GRUB_MOD_FINI): Unregister crc command. * grub-core/lib/crc.c: Removed. * include/grub/lib/crc.h: Removed. * Makefile.util.def (crc): Remove lib/crc.c * grub-core/Makefile.core.def (libgrub.a): Remove grub-core/lib/crc.c. * util/grub-fstest.c (cmd_crd): Use libgcrypt crc implementation. * Makefile.util.def (libgrub.a): Add grub-core/lib/libgcrypt-grub/cipher/crc.c. * Makefile.util.def (grub-fstest): Add CFLAGS_GCRY to cflags. * Makefile.util.def (grub-fstest): Add CPPFLAGS_GCRY to cppflags. * grub-core/efiemu/prepare.c (grub_efiemu_crc): Use libgcrypt crc implementation.
This commit is contained in:
parent
e0337366d1
commit
c55f50180d
9 changed files with 55 additions and 193 deletions
|
@ -30,7 +30,7 @@
|
|||
#include <grub/term.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/lib/hexdump.h>
|
||||
#include <grub/lib/crc.h>
|
||||
#include <grub/crypto.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
|
@ -239,19 +239,22 @@ cmd_hex (char *pathname)
|
|||
static void
|
||||
cmd_crc (char *pathname)
|
||||
{
|
||||
grub_uint32_t crc = 0;
|
||||
grub_uint8_t crc32_context[GRUB_MD_CRC32->contextsize];
|
||||
GRUB_MD_CRC32->init(crc32_context);
|
||||
|
||||
auto int crc_hook (grub_off_t ofs, char *buf, int len);
|
||||
int crc_hook (grub_off_t ofs, char *buf, int len)
|
||||
{
|
||||
(void) ofs;
|
||||
|
||||
crc = grub_getcrc32 (crc, buf, len);
|
||||
GRUB_MD_CRC32->write(crc32_context, buf, len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
read_file (pathname, crc_hook);
|
||||
printf ("%08x\n", crc);
|
||||
GRUB_MD_CRC32->final(crc32_context);
|
||||
printf ("%08x\n",
|
||||
grub_be_to_cpu32(*(grub_uint32_t*)GRUB_MD_CRC32->read(crc32_context)));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue