libgcrypt: Import replacement CRC operations
authorColin Watson <cjwatson@ubuntu.com>
Sun, 11 Feb 2018 00:18:12 +0000 (00:18 +0000)
committerDaniel Kiper <daniel.kiper@oracle.com>
Fri, 23 Feb 2018 21:37:36 +0000 (22:37 +0100)
commite5ba6b26181b8e3ffb09232a935a60e3b733bfac
tree6946c9ce23931c22dfaa52c0e347165c66d1d962
parent2391d579094cfab65a0fd89a3c617cb3a33fb715
libgcrypt: Import replacement CRC operations

The CRC implementation imported from libgcrypt 1.5.3 is arguably
non-free, due to being encumbered by the restrictive Internet Society
licence on RFCs (see e.g. https://wiki.debian.org/NonFreeIETFDocuments).
Fortunately, libgcrypt has since replaced it with a version that is both
reportedly better-optimised and doesn't suffer from this encumbrance.

The ideal solution would be to update to a new version of libgcrypt, and
I spent some time trying to do that.  However, util/import_gcry.py
requires complex modifications to cope with the new version, and I
stalled part-way through; furthermore, GRUB's libgcrypt tree already
contains some backports of upstream changes.  Rather than allowing the
perfect to be the enemy of the good, I think it's best to backport this
single change to at least sort out the licensing situation.  Doing so
won't make things any harder for a future wholesale upgrade.

This commit is mostly a straightforward backport of
https://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgcrypt.git;a=commitdiff;h=06e122baa3321483a47bbf82fd2a4540becfa0c9,
but I also imported bufhelp.h from libgcrypt 1.7.0 (newer versions
required further changes elsewhere).

I've tested that "hashsum -h crc32" still produces correct output for a
variety of files on both i386-pc and x86_64-emu targets.

Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/lib/libgcrypt/cipher/bufhelp.h [new file with mode: 0644]
grub-core/lib/libgcrypt/cipher/crc.c