Skip to contentSkip to conversation

Import libgcrypt 1.11.0

PATCH Superseded Vladimir Serbinenko 2 participants 7 messages Sep 11, 2024 – Sep 27, 2024

v6 of 14 Superseded Latest is v14 →

lore
Share & tools
lore
#0 lore raw

PATCH v6 1/6 Import libgcrypt 1.11.0

We currently use an old version of libcrypt which results in us having fewer ciphers and missing on many other improvements.

---
 grub-core/lib/libgcrypt/AUTHORS               |   274 +
 grub-core/lib/libgcrypt/COPYING               |   339 +
 grub-core/lib/libgcrypt/COPYING.LIB           |   502 +
 grub-core/lib/libgcrypt/LICENSES              |   319 +
 grub-core/lib/libgcrypt/README                |   278 +
 grub-core/lib/libgcrypt/README.GIT            |    49 +
 grub-core/lib/libgcrypt/THANKS                |   168 +
 grub-core/lib/libgcrypt/VERSION               |     1 +
 grub-core/lib/libgcrypt/cipher/ChangeLog      |  3990 ---
 grub-core/lib/libgcrypt/cipher/ChangeLog-2011 |    40 +-
 grub-core/lib/libgcrypt/cipher/Makefile.am    |   330 +-
 grub-core/lib/libgcrypt/cipher/Manifest       |    73 -
 grub-core/lib/libgcrypt/cipher/ac.c           |  3301 --
 .../lib/libgcrypt/cipher/arcfour-amd64.S      |   108 +
 grub-core/lib/libgcrypt/cipher/arcfour.c      |    93 +-
 .../libgcrypt/cipher/aria-aesni-avx-amd64.S   |  1440 +
 .../libgcrypt/cipher/aria-aesni-avx2-amd64.S  |  1830 ++
 .../libgcrypt/cipher/aria-gfni-avx512-amd64.S |  1010 +
 grub-core/lib/libgcrypt/cipher/aria.c         |  1768 ++
 .../lib/libgcrypt/cipher/asm-common-aarch64.h |   132 +
 .../lib/libgcrypt/cipher/asm-common-amd64.h   |   213 +
 .../lib/libgcrypt/cipher/asm-common-i386.h    |   161 +
 .../lib/libgcrypt/cipher/asm-common-s390x.h   |    90 +
 .../lib/libgcrypt/cipher/asm-inline-s390x.h   |   205 +
 .../libgcrypt/cipher/asm-poly1305-aarch64.h   |   245 +
 .../lib/libgcrypt/cipher/asm-poly1305-amd64.h |   171 +
 .../lib/libgcrypt/cipher/asm-poly1305-s390x.h |   140 +
 grub-core/lib/libgcrypt/cipher/bithelp.h      |   111 +-
 grub-core/lib/libgcrypt/cipher/blake2.c       |  1086 +
 .../lib/libgcrypt/cipher/blake2b-amd64-avx2.S |   301 +
 .../libgcrypt/cipher/blake2b-amd64-avx512.S   |   429 +
 .../lib/libgcrypt/cipher/blake2s-amd64-avx.S  |   281 +
 .../libgcrypt/cipher/blake2s-amd64-avx512.S   |   397 +
 .../lib/libgcrypt/cipher/blowfish-amd64.S     |   601 +
 grub-core/lib/libgcrypt/cipher/blowfish-arm.S |   743 +
 grub-core/lib/libgcrypt/cipher/blowfish.c     |   802 +-
 grub-core/lib/libgcrypt/cipher/bufhelp.h      |   458 +-
 grub-core/lib/libgcrypt/cipher/bulkhelp.h     |   493 +
 .../libgcrypt/cipher/camellia-aarch64-ce.c    |    42 +
 .../lib/libgcrypt/cipher/camellia-aarch64.S   |   585 +
 .../cipher/camellia-aesni-avx-amd64.S         |  2802 ++
 .../cipher/camellia-aesni-avx2-amd64.S        |    34 +
 .../cipher/camellia-aesni-avx2-amd64.h        |  2327 ++
 grub-core/lib/libgcrypt/cipher/camellia-arm.S |   626 +
 .../cipher/camellia-gfni-avx2-amd64.S         |    34 +
 .../cipher/camellia-gfni-avx512-amd64.S       |  1634 +
 .../lib/libgcrypt/cipher/camellia-glue.c      |  1670 +-
 .../lib/libgcrypt/cipher/camellia-ppc8le.c    |    47 +
 .../lib/libgcrypt/cipher/camellia-ppc9le.c    |    47 +
 .../lib/libgcrypt/cipher/camellia-simd128.h   |  2235 ++
 .../cipher/camellia-vaes-avx2-amd64.S         |    35 +
 grub-core/lib/libgcrypt/cipher/camellia.c     |   172 +-
 grub-core/lib/libgcrypt/cipher/camellia.h     |    34 +-
 grub-core/lib/libgcrypt/cipher/cast5-amd64.S  |   663 +
 grub-core/lib/libgcrypt/cipher/cast5-arm.S    |   728 +
 grub-core/lib/libgcrypt/cipher/cast5.c        |   775 +-
 .../lib/libgcrypt/cipher/chacha20-aarch64.S   |   650 +
 .../libgcrypt/cipher/chacha20-amd64-avx2.S    |   604 +
 .../libgcrypt/cipher/chacha20-amd64-avx512.S  |   736 +
 .../libgcrypt/cipher/chacha20-amd64-ssse3.S   |  1015 +
 .../libgcrypt/cipher/chacha20-armv7-neon.S    |   393 +
 .../lib/libgcrypt/cipher/chacha20-p10le-8x.s  |   864 +
 grub-core/lib/libgcrypt/cipher/chacha20-ppc.c |   750 +
 .../lib/libgcrypt/cipher/chacha20-s390x.S     |  1566 +
 grub-core/lib/libgcrypt/cipher/chacha20.c     |  1450 +
 .../lib/libgcrypt/cipher/cipher-aeswrap.c     |   380 +
 grub-core/lib/libgcrypt/cipher/cipher-cbc.c   |   292 +
 grub-core/lib/libgcrypt/cipher/cipher-ccm.c   |   419 +
 grub-core/lib/libgcrypt/cipher/cipher-cfb.c   |   317 +
 grub-core/lib/libgcrypt/cipher/cipher-cmac.c  |   292 +
 grub-core/lib/libgcrypt/cipher/cipher-ctr.c   |   131 +
 grub-core/lib/libgcrypt/cipher/cipher-eax.c   |   293 +
 .../libgcrypt/cipher/cipher-gcm-armv7-neon.S  |   341 +
 .../cipher/cipher-gcm-armv8-aarch32-ce.S      |   588 +
 .../cipher/cipher-gcm-armv8-aarch64-ce.S      |   633 +
 .../cipher/cipher-gcm-intel-pclmul.c          |  2025 ++
 .../lib/libgcrypt/cipher/cipher-gcm-ppc.c     |   548 +
 .../lib/libgcrypt/cipher/cipher-gcm-siv.c     |   664 +
 grub-core/lib/libgcrypt/cipher/cipher-gcm.c   |  1260 +
 .../lib/libgcrypt/cipher/cipher-internal.h    |   975 +
 grub-core/lib/libgcrypt/cipher/cipher-ocb.c   |   763 +
 grub-core/lib/libgcrypt/cipher/cipher-ofb.c   |   108 +
 .../lib/libgcrypt/cipher/cipher-poly1305.c    |   383 +
 grub-core/lib/libgcrypt/cipher/cipher-siv.c   |   375 +
 grub-core/lib/libgcrypt/cipher/cipher-xts.c   |   189 +
 grub-core/lib/libgcrypt/cipher/cipher.c       |  2702 +-
 .../libgcrypt/cipher/crc-armv8-aarch64-ce.S   |   500 +
 grub-core/lib/libgcrypt/cipher/crc-armv8-ce.c |   229 +
 .../lib/libgcrypt/cipher/crc-intel-pclmul.c   |   939 +
 grub-core/lib/libgcrypt/cipher/crc-ppc.c      |   656 +
 grub-core/lib/libgcrypt/cipher/crc.c          |   192 +-
 grub-core/lib/libgcrypt/cipher/des-amd64.S    |  1116 +
 grub-core/lib/libgcrypt/cipher/des.c          |   301 +-
 grub-core/lib/libgcrypt/cipher/dsa-common.c   |   473 +
 grub-core/lib/libgcrypt/cipher/dsa.c          |  1207 +-
 grub-core/lib/libgcrypt/cipher/ecc-common.h   |   143 +
 grub-core/lib/libgcrypt/cipher/ecc-curves.c   |  1587 +
 grub-core/lib/libgcrypt/cipher/ecc-ecdh.c     |   357 +
 grub-core/lib/libgcrypt/cipher/ecc-ecdsa.c    |   305 +
 grub-core/lib/libgcrypt/cipher/ecc-eddsa.c    |  1079 +
 grub-core/lib/libgcrypt/cipher/ecc-gost.c     |   218 +
 grub-core/lib/libgcrypt/cipher/ecc-misc.c     |   469 +
 grub-core/lib/libgcrypt/cipher/ecc-sm2.c      |   569 +
 grub-core/lib/libgcrypt/cipher/ecc.c          |  3242 +-
 grub-core/lib/libgcrypt/cipher/elgamal.c      |   829 +-
 grub-core/lib/libgcrypt/cipher/gost-s-box.c   |   266 +
 grub-core/lib/libgcrypt/cipher/gost-sb.h      |  2128 ++
 grub-core/lib/libgcrypt/cipher/gost.h         |    34 +
 grub-core/lib/libgcrypt/cipher/gost28147.c    |   553 +
 grub-core/lib/libgcrypt/cipher/gostr3411-94.c |   383 +
 grub-core/lib/libgcrypt/cipher/hash-common.c  |   110 +-
 grub-core/lib/libgcrypt/cipher/hash-common.h  |    35 +-
 grub-core/lib/libgcrypt/cipher/hmac-tests.c   |   732 -
 grub-core/lib/libgcrypt/cipher/idea.c         |    24 +-
 grub-core/lib/libgcrypt/cipher/kdf-internal.h |    39 +
 grub-core/lib/libgcrypt/cipher/kdf.c          |  2239 +-
 .../libgcrypt/cipher/keccak-amd64-avx512.S    |   587 +
 .../lib/libgcrypt/cipher/keccak-armv7-neon.S  |   945 +
 grub-core/lib/libgcrypt/cipher/keccak.c       |  1904 ++
 .../lib/libgcrypt/cipher/keccak_permute_32.h  |   536 +
 .../lib/libgcrypt/cipher/keccak_permute_64.h  |   385 +
 grub-core/lib/libgcrypt/cipher/kem-ecc.c      |   332 +
 grub-core/lib/libgcrypt/cipher/kem-ecc.h      |    40 +
 grub-core/lib/libgcrypt/cipher/kem.c          |   435 +
 grub-core/lib/libgcrypt/cipher/kyber-common.c |   766 +
 grub-core/lib/libgcrypt/cipher/kyber-kdep.c   |   825 +
 grub-core/lib/libgcrypt/cipher/kyber.c        |   530 +
 grub-core/lib/libgcrypt/cipher/kyber.h        |   130 +
 grub-core/lib/libgcrypt/cipher/mac-cmac.c     |   532 +
 grub-core/lib/libgcrypt/cipher/mac-gmac.c     |   203 +
 grub-core/lib/libgcrypt/cipher/mac-hmac.c     |  1471 +
 grub-core/lib/libgcrypt/cipher/mac-internal.h |   290 +
 grub-core/lib/libgcrypt/cipher/mac-poly1305.c |   382 +
 grub-core/lib/libgcrypt/cipher/mac.c          |   834 +
 .../lib/libgcrypt/cipher/mceliece6688128f.c   |  3673 +++
 .../lib/libgcrypt/cipher/mceliece6688128f.h   |    63 +
 grub-core/lib/libgcrypt/cipher/md.c           |  1582 +-
 grub-core/lib/libgcrypt/cipher/md4.c          |   171 +-
 grub-core/lib/libgcrypt/cipher/md5.c          |   177 +-
 .../libgcrypt/cipher/poly1305-amd64-avx512.S  |  1626 +
 .../lib/libgcrypt/cipher/poly1305-internal.h  |    92 +
 .../lib/libgcrypt/cipher/poly1305-p10le.s     |   841 +
 .../lib/libgcrypt/cipher/poly1305-s390x.S     |    87 +
 grub-core/lib/libgcrypt/cipher/poly1305.c     |   846 +
 grub-core/lib/libgcrypt/cipher/primegen.c     |   563 +-
 .../lib/libgcrypt/cipher/pubkey-internal.h    |   107 +
 grub-core/lib/libgcrypt/cipher/pubkey-util.c  |  1363 +
 grub-core/lib/libgcrypt/cipher/pubkey.c       |  4329 +--
 grub-core/lib/libgcrypt/cipher/rfc2268.c      |    57 +-
 .../lib/libgcrypt/cipher/rijndael-aarch64.S   |   512 +
 .../lib/libgcrypt/cipher/rijndael-aesni.c     |  5033 +++
 .../lib/libgcrypt/cipher/rijndael-amd64.S     |   477 +
 grub-core/lib/libgcrypt/cipher/rijndael-arm.S |   581 +
 .../cipher/rijndael-armv8-aarch32-ce.S        |  2134 ++
 .../cipher/rijndael-armv8-aarch64-ce.S        |  2038 ++
 .../lib/libgcrypt/cipher/rijndael-armv8-ce.c  |   396 +
 .../lib/libgcrypt/cipher/rijndael-gcm-p10le.s |  1401 +
 .../lib/libgcrypt/cipher/rijndael-internal.h  |   216 +
 .../lib/libgcrypt/cipher/rijndael-p10le.c     |   119 +
 .../lib/libgcrypt/cipher/rijndael-padlock.c   |   109 +
 .../libgcrypt/cipher/rijndael-ppc-common.h    |   328 +
 .../libgcrypt/cipher/rijndael-ppc-functions.h |  2544 ++
 grub-core/lib/libgcrypt/cipher/rijndael-ppc.c |   230 +
 .../lib/libgcrypt/cipher/rijndael-ppc9le.c    |   119 +
 .../lib/libgcrypt/cipher/rijndael-s390x.c     |  1166 +
 .../cipher/rijndael-ssse3-amd64-asm.S         |   879 +
 .../libgcrypt/cipher/rijndael-ssse3-amd64.c   |   742 +
 .../lib/libgcrypt/cipher/rijndael-tables.h    |  1846 +-
 .../cipher/rijndael-vaes-avx2-amd64.S         |  3688 +++
 .../cipher/rijndael-vaes-avx2-i386.S          |  2804 ++
 .../lib/libgcrypt/cipher/rijndael-vaes-i386.c |   231 +
 .../lib/libgcrypt/cipher/rijndael-vaes.c      |   240 +
 grub-core/lib/libgcrypt/cipher/rijndael.c     |  2643 +-
 grub-core/lib/libgcrypt/cipher/rmd160.c       |   592 +-
 grub-core/lib/libgcrypt/cipher/rsa-common.c   |  1151 +
 grub-core/lib/libgcrypt/cipher/rsa.c          |  1736 +-
 .../lib/libgcrypt/cipher/salsa20-amd64.S      |   940 +
 .../lib/libgcrypt/cipher/salsa20-armv7-neon.S |   899 +
 grub-core/lib/libgcrypt/cipher/salsa20.c      |   600 +
 grub-core/lib/libgcrypt/cipher/scrypt.c       |   322 +
 grub-core/lib/libgcrypt/cipher/seed.c         |    32 +-
 .../lib/libgcrypt/cipher/serpent-armv7-neon.S |  1180 +
 .../lib/libgcrypt/cipher/serpent-avx2-amd64.S |  1214 +
 .../lib/libgcrypt/cipher/serpent-avx512-x86.c |   994 +
 .../lib/libgcrypt/cipher/serpent-sse2-amd64.S |  1276 +
 grub-core/lib/libgcrypt/cipher/serpent.c      |  2017 +-
 .../lib/libgcrypt/cipher/sha1-armv7-neon.S    |   526 +
 .../libgcrypt/cipher/sha1-armv8-aarch32-ce.S  |   220 +
 .../libgcrypt/cipher/sha1-armv8-aarch64-ce.S  |   204 +
 .../lib/libgcrypt/cipher/sha1-avx-amd64.S     |   433 +
 .../libgcrypt/cipher/sha1-avx-bmi2-amd64.S    |   446 +
 .../libgcrypt/cipher/sha1-avx2-bmi2-amd64.S   |   578 +
 .../lib/libgcrypt/cipher/sha1-intel-shaext.c  |   292 +
 .../lib/libgcrypt/cipher/sha1-ssse3-amd64.S   |   442 +
 grub-core/lib/libgcrypt/cipher/sha1.c         |   571 +-
 grub-core/lib/libgcrypt/cipher/sha1.h         |    47 +
 .../cipher/sha256-armv8-aarch32-ce.S          |   231 +
 .../cipher/sha256-armv8-aarch64-ce.S          |   218 +
 .../lib/libgcrypt/cipher/sha256-avx-amd64.S   |   511 +
 .../libgcrypt/cipher/sha256-avx2-bmi2-amd64.S |   533 +
 .../libgcrypt/cipher/sha256-intel-shaext.c    |   363 +
 grub-core/lib/libgcrypt/cipher/sha256-ppc.c   |   610 +
 .../lib/libgcrypt/cipher/sha256-ssse3-amd64.S |   533 +
 grub-core/lib/libgcrypt/cipher/sha256.c       |   775 +-
 grub-core/lib/libgcrypt/cipher/sha512-arm.S   |   464 +
 .../lib/libgcrypt/cipher/sha512-armv7-neon.S  |   452 +
 .../cipher/sha512-armv8-aarch64-ce.S          |   383 +
 .../lib/libgcrypt/cipher/sha512-avx-amd64.S   |   466 +
 .../libgcrypt/cipher/sha512-avx2-bmi2-amd64.S |   507 +
 .../libgcrypt/cipher/sha512-avx512-amd64.S    |   465 +
 grub-core/lib/libgcrypt/cipher/sha512-ppc.c   |   725 +
 .../lib/libgcrypt/cipher/sha512-ssse3-amd64.S |   472 +
 .../lib/libgcrypt/cipher/sha512-ssse3-i386.c  |   404 +
 grub-core/lib/libgcrypt/cipher/sha512.c       |  1310 +-
 grub-core/lib/libgcrypt/cipher/sm3-aarch64.S  |   660 +
 .../libgcrypt/cipher/sm3-armv8-aarch64-ce.S   |   221 +
 .../lib/libgcrypt/cipher/sm3-avx-bmi2-amd64.S |   555 +
 grub-core/lib/libgcrypt/cipher/sm3.c          |   565 +
 grub-core/lib/libgcrypt/cipher/sm4-aarch64.S  |   644 +
 .../libgcrypt/cipher/sm4-aesni-avx-amd64.S    |  1058 +
 .../libgcrypt/cipher/sm4-aesni-avx2-amd64.S   |   973 +
 .../libgcrypt/cipher/sm4-armv8-aarch64-ce.S   |   731 +
 .../cipher/sm4-armv9-aarch64-sve-ce.S         |   967 +
 .../libgcrypt/cipher/sm4-gfni-avx2-amd64.S    |  1260 +
 .../libgcrypt/cipher/sm4-gfni-avx512-amd64.S  |  1861 ++
 grub-core/lib/libgcrypt/cipher/sm4-ppc.c      |   342 +
 grub-core/lib/libgcrypt/cipher/sm4.c          |  2070 ++
 grub-core/lib/libgcrypt/cipher/sntrup761.c    |  1062 +
 grub-core/lib/libgcrypt/cipher/sntrup761.h    |    73 +
 grub-core/lib/libgcrypt/cipher/stribog.c      |  1362 +
 .../lib/libgcrypt/cipher/test-getrusage.c     |   105 -
 grub-core/lib/libgcrypt/cipher/tiger.c        |   311 +-
 .../lib/libgcrypt/cipher/twofish-aarch64.S    |   322 +
 .../lib/libgcrypt/cipher/twofish-amd64.S      |  1258 +
 grub-core/lib/libgcrypt/cipher/twofish-arm.S  |   363 +
 .../lib/libgcrypt/cipher/twofish-avx2-amd64.S |  1136 +
 grub-core/lib/libgcrypt/cipher/twofish.c      |   954 +-
 .../libgcrypt/cipher/whirlpool-sse2-amd64.S   |   348 +
 grub-core/lib/libgcrypt/cipher/whirlpool.c    |   334 +-
 grub-core/lib/libgcrypt/compat/Makefile.am    |    48 +
 grub-core/lib/libgcrypt/compat/clock.c        |    36 +
 grub-core/lib/libgcrypt/compat/compat.c       |    40 +
 grub-core/lib/libgcrypt/compat/getpid.c       |    29 +
 grub-core/lib/libgcrypt/compat/libcompat.h    |    37 +
 grub-core/lib/libgcrypt/config.h.in           |   873 +
 grub-core/lib/libgcrypt/configure             | 25763 ++++++++++++++++
 grub-core/lib/libgcrypt/configure.ac          |  3883 +++
 grub-core/lib/libgcrypt/mkinstalldirs         |   161 +
 grub-core/lib/libgcrypt/mpi/ChangeLog-2011    |    17 +-
 grub-core/lib/libgcrypt/mpi/Makefile.am       |    16 +-
 grub-core/lib/libgcrypt/mpi/Manifest          |    41 -
 .../mpi/{pentium4/sse2 => aarch64}/distfiles  |     1 +
 .../lib/libgcrypt/mpi/aarch64/mpi-asm-defs.h  |     4 +
 .../lib/libgcrypt/mpi/aarch64/mpih-add1.S     |    75 +
 .../lib/libgcrypt/mpi/aarch64/mpih-mul1.S     |   100 +
 .../lib/libgcrypt/mpi/aarch64/mpih-mul2.S     |   112 +
 .../lib/libgcrypt/mpi/aarch64/mpih-mul3.S     |   125 +
 .../lib/libgcrypt/mpi/aarch64/mpih-sub1.S     |    75 +
 grub-core/lib/libgcrypt/mpi/alpha/README      |     4 +-
 grub-core/lib/libgcrypt/mpi/alpha/mpih-add1.S |     4 +-
 .../lib/libgcrypt/mpi/alpha/mpih-lshift.S     |     4 +-
 grub-core/lib/libgcrypt/mpi/alpha/mpih-mul1.S |     4 +-
 grub-core/lib/libgcrypt/mpi/alpha/mpih-mul2.S |     4 +-
 grub-core/lib/libgcrypt/mpi/alpha/mpih-mul3.S |     4 +-
 .../lib/libgcrypt/mpi/alpha/mpih-rshift.S     |     4 +-
 grub-core/lib/libgcrypt/mpi/alpha/mpih-sub1.S |     4 +-
 .../lib/libgcrypt/mpi/alpha/udiv-qrnnd.S      |     4 +-
 grub-core/lib/libgcrypt/mpi/amd64/distfiles   |     1 +
 grub-core/lib/libgcrypt/mpi/amd64/func_abi.h  |    34 +
 .../lib/libgcrypt/mpi/amd64/mpi-asm-defs.h    |     2 +-
 grub-core/lib/libgcrypt/mpi/amd64/mpih-add1.S |    92 +-
 .../lib/libgcrypt/mpi/amd64/mpih-lshift.S     |    54 +-
 grub-core/lib/libgcrypt/mpi/amd64/mpih-mul1.S |    11 +-
 grub-core/lib/libgcrypt/mpi/amd64/mpih-mul2.S |    53 +-
 grub-core/lib/libgcrypt/mpi/amd64/mpih-mul3.S |    11 +-
 .../lib/libgcrypt/mpi/amd64/mpih-rshift.S     |    56 +-
 grub-core/lib/libgcrypt/mpi/amd64/mpih-sub1.S |    90 +-
 .../lib/libgcrypt/mpi/{i586 => arm}/distfiles |     6 +-
 .../lib/libgcrypt/mpi/arm/mpi-asm-defs.h      |     4 +
 grub-core/lib/libgcrypt/mpi/arm/mpih-add1.S   |    76 +
 grub-core/lib/libgcrypt/mpi/arm/mpih-mul1.S   |    80 +
 grub-core/lib/libgcrypt/mpi/arm/mpih-mul2.S   |    94 +
 grub-core/lib/libgcrypt/mpi/arm/mpih-mul3.S   |   100 +
 grub-core/lib/libgcrypt/mpi/arm/mpih-sub1.S   |    77 +
 .../lib/libgcrypt/mpi/asm-common-aarch64.h    |    26 +
 .../lib/libgcrypt/mpi/asm-common-amd64.h      |    26 +
 grub-core/lib/libgcrypt/mpi/asm-common-i386.h |    26 +
 grub-core/lib/libgcrypt/mpi/config.links      |   178 +-
 .../{cipher/rmd.h => mpi/ec-ed25519.c}        |    35 +-
 grub-core/lib/libgcrypt/mpi/ec-hw-s390x.c     |   412 +
 grub-core/lib/libgcrypt/mpi/ec-inline.h       |  1236 +
 grub-core/lib/libgcrypt/mpi/ec-internal.h     |    49 +
 grub-core/lib/libgcrypt/mpi/ec-nist.c         |   826 +
 grub-core/lib/libgcrypt/mpi/ec.c              |  2053 +-
 grub-core/lib/libgcrypt/mpi/generic/Manifest  |    29 -
 grub-core/lib/libgcrypt/mpi/generic/distfiles |     1 -
 .../lib/libgcrypt/mpi/generic/mpi-asm-defs.h  |    16 +-
 .../lib/libgcrypt/mpi/generic/mpih-add1.c     |    10 +-
 .../lib/libgcrypt/mpi/generic/mpih-lshift.c   |     6 +-
 .../lib/libgcrypt/mpi/generic/mpih-mul1.c     |     8 +-
 .../lib/libgcrypt/mpi/generic/mpih-mul2.c     |    10 +-
 .../lib/libgcrypt/mpi/generic/mpih-mul3.c     |     8 +-
 .../lib/libgcrypt/mpi/generic/mpih-rshift.c   |     4 +-
 .../lib/libgcrypt/mpi/generic/mpih-sub1.c     |     8 +-
 .../lib/libgcrypt/mpi/generic/udiv-w-sdiv.c   |     4 +-
 grub-core/lib/libgcrypt/mpi/hppa/mpih-add1.S  |     4 +-
 .../lib/libgcrypt/mpi/hppa/mpih-lshift.S      |     4 +-
 .../lib/libgcrypt/mpi/hppa/mpih-rshift.S      |     4 +-
 grub-core/lib/libgcrypt/mpi/hppa/mpih-sub1.S  |     4 +-
 grub-core/lib/libgcrypt/mpi/hppa/udiv-qrnnd.S |     4 +-
 grub-core/lib/libgcrypt/mpi/i386/Manifest     |    28 -
 grub-core/lib/libgcrypt/mpi/i386/distfiles    |     1 -
 grub-core/lib/libgcrypt/mpi/i386/mpih-add1.S  |    51 +-
 .../lib/libgcrypt/mpi/i386/mpih-lshift.S      |    16 +-
 grub-core/lib/libgcrypt/mpi/i386/mpih-mul1.S  |    16 +-
 grub-core/lib/libgcrypt/mpi/i386/mpih-mul2.S  |    16 +-
 grub-core/lib/libgcrypt/mpi/i386/mpih-mul3.S  |    16 +-
 .../lib/libgcrypt/mpi/i386/mpih-rshift.S      |    18 +-
 grub-core/lib/libgcrypt/mpi/i386/mpih-sub1.S  |    51 +-
 grub-core/lib/libgcrypt/mpi/i386/syntax.h     |    16 +-
 grub-core/lib/libgcrypt/mpi/i586/Manifest     |    27 -
 grub-core/lib/libgcrypt/mpi/i586/README       |    26 -
 grub-core/lib/libgcrypt/mpi/i586/mpih-add1.S  |   135 -
 .../lib/libgcrypt/mpi/i586/mpih-lshift.S      |   229 -
 grub-core/lib/libgcrypt/mpi/i586/mpih-mul1.S  |    89 -
 grub-core/lib/libgcrypt/mpi/i586/mpih-mul2.S  |    93 -
 grub-core/lib/libgcrypt/mpi/i586/mpih-mul3.S  |    93 -
 .../lib/libgcrypt/mpi/i586/mpih-rshift.S      |   228 -
 grub-core/lib/libgcrypt/mpi/i586/mpih-sub1.S  |   142 -
 grub-core/lib/libgcrypt/mpi/longlong.h        |   967 +-
 grub-core/lib/libgcrypt/mpi/m68k/Manifest     |    25 -
 grub-core/lib/libgcrypt/mpi/m68k/distfiles    |     1 -
 .../lib/libgcrypt/mpi/m68k/mc68020/Manifest   |    23 -
 .../lib/libgcrypt/mpi/m68k/mc68020/distfiles  |     1 -
 .../libgcrypt/mpi/m68k/mc68020/mpih-mul1.S    |     4 +-
 .../libgcrypt/mpi/m68k/mc68020/mpih-mul2.S    |     4 +-
 .../libgcrypt/mpi/m68k/mc68020/mpih-mul3.S    |     4 +-
 grub-core/lib/libgcrypt/mpi/m68k/mpih-add1.S  |     4 +-
 .../lib/libgcrypt/mpi/m68k/mpih-lshift.S      |     4 +-
 .../lib/libgcrypt/mpi/m68k/mpih-rshift.S      |     4 +-
 grub-core/lib/libgcrypt/mpi/m68k/mpih-sub1.S  |     4 +-
 grub-core/lib/libgcrypt/mpi/m68k/syntax.h     |     6 +-
 grub-core/lib/libgcrypt/mpi/mips3/Manifest    |    28 -
 grub-core/lib/libgcrypt/mpi/mips3/README      |     2 +-
 grub-core/lib/libgcrypt/mpi/mips3/distfiles   |     1 -
 grub-core/lib/libgcrypt/mpi/mips3/mpih-add1.S |     4 +-
 .../lib/libgcrypt/mpi/mips3/mpih-lshift.S     |     4 +-
 grub-core/lib/libgcrypt/mpi/mips3/mpih-mul1.S |     4 +-
 grub-core/lib/libgcrypt/mpi/mips3/mpih-mul2.S |     4 +-
 grub-core/lib/libgcrypt/mpi/mips3/mpih-mul3.S |     4 +-
 .../lib/libgcrypt/mpi/mips3/mpih-rshift.S     |     4 +-
 grub-core/lib/libgcrypt/mpi/mips3/mpih-sub1.S |     4 +-
 grub-core/lib/libgcrypt/mpi/mpi-add.c         |    64 +-
 grub-core/lib/libgcrypt/mpi/mpi-bit.c         |   257 +-
 grub-core/lib/libgcrypt/mpi/mpi-cmp.c         |    45 +-
 grub-core/lib/libgcrypt/mpi/mpi-div.c         |    23 +-
 grub-core/lib/libgcrypt/mpi/mpi-gcd.c         |    15 +-
 grub-core/lib/libgcrypt/mpi/mpi-inline.c      |     4 +-
 grub-core/lib/libgcrypt/mpi/mpi-inline.h      |     4 +-
 grub-core/lib/libgcrypt/mpi/mpi-internal.h    |    60 +-
 grub-core/lib/libgcrypt/mpi/mpi-inv.c         |   312 +-
 grub-core/lib/libgcrypt/mpi/mpi-mod.c         |    54 +-
 grub-core/lib/libgcrypt/mpi/mpi-mpow.c        |    12 +-
 grub-core/lib/libgcrypt/mpi/mpi-mul.c         |    27 +-
 grub-core/lib/libgcrypt/mpi/mpi-pow.c         |   458 +-
 grub-core/lib/libgcrypt/mpi/mpi-scan.c        |   136 +-
 grub-core/lib/libgcrypt/mpi/mpicoder.c        |   763 +-
 grub-core/lib/libgcrypt/mpi/mpih-const-time.c |   241 +
 grub-core/lib/libgcrypt/mpi/mpih-div.c        |    14 +-
 grub-core/lib/libgcrypt/mpi/mpih-mul.c        |    27 +-
 grub-core/lib/libgcrypt/mpi/mpiutil.c         |   488 +-
 grub-core/lib/libgcrypt/mpi/pa7100/Manifest   |    22 -
 grub-core/lib/libgcrypt/mpi/pa7100/distfiles  |     1 -
 .../lib/libgcrypt/mpi/pa7100/mpih-lshift.S    |     4 +-
 .../lib/libgcrypt/mpi/pa7100/mpih-rshift.S    |     4 +-
 grub-core/lib/libgcrypt/mpi/pentium4/README   |   115 -
 .../lib/libgcrypt/mpi/pentium4/distfiles      |     3 -
 .../lib/libgcrypt/mpi/pentium4/mmx/distfiles  |     2 -
 .../libgcrypt/mpi/pentium4/mmx/mpih-lshift.S  |   457 -
 .../libgcrypt/mpi/pentium4/mmx/mpih-rshift.S  |   453 -
 .../libgcrypt/mpi/pentium4/sse2/mpih-add1.S   |    91 -
 .../libgcrypt/mpi/pentium4/sse2/mpih-mul1.S   |    96 -
 .../libgcrypt/mpi/pentium4/sse2/mpih-mul2.S   |   136 -
 .../libgcrypt/mpi/pentium4/sse2/mpih-mul3.S   |   127 -
 .../libgcrypt/mpi/pentium4/sse2/mpih-sub1.S   |   112 -
 grub-core/lib/libgcrypt/mpi/power/Manifest    |    27 -
 grub-core/lib/libgcrypt/mpi/power/distfiles   |     1 -
 grub-core/lib/libgcrypt/mpi/power/mpih-add1.S |     4 +-
 .../lib/libgcrypt/mpi/power/mpih-lshift.S     |     4 +-
 grub-core/lib/libgcrypt/mpi/power/mpih-mul1.S |     4 +-
 grub-core/lib/libgcrypt/mpi/power/mpih-mul2.S |     4 +-
 grub-core/lib/libgcrypt/mpi/power/mpih-mul3.S |     4 +-
 .../lib/libgcrypt/mpi/power/mpih-rshift.S     |     4 +-
 grub-core/lib/libgcrypt/mpi/power/mpih-sub1.S |     4 +-
 .../lib/libgcrypt/mpi/powerpc32/Manifest      |    28 -
 .../lib/libgcrypt/mpi/powerpc32/distfiles     |     1 -
 .../lib/libgcrypt/mpi/powerpc32/mpih-add1.S   |     9 +-
 .../lib/libgcrypt/mpi/powerpc32/mpih-lshift.S |     8 +-
 .../lib/libgcrypt/mpi/powerpc32/mpih-mul1.S   |    10 +-
 .../lib/libgcrypt/mpi/powerpc32/mpih-mul2.S   |    10 +-
 .../lib/libgcrypt/mpi/powerpc32/mpih-mul3.S   |     9 +-
 .../lib/libgcrypt/mpi/powerpc32/mpih-rshift.S |    10 +-
 .../lib/libgcrypt/mpi/powerpc32/mpih-sub1.S   |     9 +-
 .../lib/libgcrypt/mpi/powerpc32/syntax.h      |     5 +-
 grub-core/lib/libgcrypt/mpi/sparc32/Manifest  |    24 -
 grub-core/lib/libgcrypt/mpi/sparc32/distfiles |     1 -
 .../lib/libgcrypt/mpi/sparc32/mpih-add1.S     |     4 +-
 .../lib/libgcrypt/mpi/sparc32/mpih-lshift.S   |     4 +-
 .../lib/libgcrypt/mpi/sparc32/mpih-rshift.S   |     4 +-
 grub-core/lib/libgcrypt/mpi/sparc32/udiv.S    |     4 +-
 .../lib/libgcrypt/mpi/sparc32v8/Manifest      |    23 -
 .../lib/libgcrypt/mpi/sparc32v8/distfiles     |     1 -
 .../lib/libgcrypt/mpi/sparc32v8/mpih-mul1.S   |     4 +-
 .../lib/libgcrypt/mpi/sparc32v8/mpih-mul2.S   |     4 +-
 .../lib/libgcrypt/mpi/sparc32v8/mpih-mul3.S   |     4 +-
 .../lib/libgcrypt/mpi/supersparc/Manifest     |    21 -
 .../lib/libgcrypt/mpi/supersparc/distfiles    |     1 -
 grub-core/lib/libgcrypt/mpi/supersparc/udiv.S |     4 +-
 grub-core/lib/libgcrypt/src/ChangeLog-2011    |    75 +-
 grub-core/lib/libgcrypt/src/Makefile.am       |    93 +-
 grub-core/lib/libgcrypt/src/Manifest          |    58 -
 grub-core/lib/libgcrypt/src/ath.c             |   344 -
 grub-core/lib/libgcrypt/src/ath.h             |   147 -
 grub-core/lib/libgcrypt/src/cipher-proto.h    |   248 +-
 grub-core/lib/libgcrypt/src/cipher.h          |   167 +-
 grub-core/lib/libgcrypt/src/const-time.c      |    88 +
 grub-core/lib/libgcrypt/src/const-time.h      |   167 +
 grub-core/lib/libgcrypt/src/context.c         |   154 +
 grub-core/lib/libgcrypt/src/context.h         |    33 +
 grub-core/lib/libgcrypt/src/dumpsexp.c        |    25 +-
 grub-core/lib/libgcrypt/src/ec-context.h      |   107 +
 grub-core/lib/libgcrypt/src/fips.c            |   810 +-
 grub-core/lib/libgcrypt/src/g10lib.h          |   284 +-
 grub-core/lib/libgcrypt/src/gcrypt-int.h      |   595 +
 grub-core/lib/libgcrypt/src/gcrypt-module.h   |   240 -
 grub-core/lib/libgcrypt/src/gcrypt-testapi.h  |    70 +
 grub-core/lib/libgcrypt/src/gcrypt.h.in       |  1354 +-
 grub-core/lib/libgcrypt/src/gcryptrnd.c       |   680 -
 .../lib/libgcrypt/src/gen-note-integrity.sh   |   123 +
 grub-core/lib/libgcrypt/src/getrandom.c       |   326 -
 grub-core/lib/libgcrypt/src/global.c          |   911 +-
 grub-core/lib/libgcrypt/src/hmac256.c         |    89 +-
 grub-core/lib/libgcrypt/src/hmac256.h         |     2 +-
 grub-core/lib/libgcrypt/src/hwf-arm.c         |   564 +
 grub-core/lib/libgcrypt/src/hwf-common.h      |    28 +
 grub-core/lib/libgcrypt/src/hwf-ppc.c         |   247 +
 grub-core/lib/libgcrypt/src/hwf-s390x.c       |   231 +
 grub-core/lib/libgcrypt/src/hwf-x86.c         |   512 +
 grub-core/lib/libgcrypt/src/hwfeatures.c      |   326 +-
 .../lib/libgcrypt/src/libgcrypt-config.in     |    20 +-
 grub-core/lib/libgcrypt/src/libgcrypt.def     |   167 +-
 grub-core/lib/libgcrypt/src/libgcrypt.m4      |   179 +-
 grub-core/lib/libgcrypt/src/libgcrypt.pc.in   |    18 +
 grub-core/lib/libgcrypt/src/libgcrypt.vers    |    93 +-
 grub-core/lib/libgcrypt/src/misc.c            |   448 +-
 grub-core/lib/libgcrypt/src/missing-string.c  |     4 +-
 grub-core/lib/libgcrypt/src/module.c          |   212 -
 grub-core/lib/libgcrypt/src/mpi.h             |   223 +-
 grub-core/lib/libgcrypt/src/mpicalc.c         |   627 +
 grub-core/lib/libgcrypt/src/secmem.c          |   621 +-
 grub-core/lib/libgcrypt/src/secmem.h          |    17 +-
 grub-core/lib/libgcrypt/src/sexp.c            |  1390 +-
 grub-core/lib/libgcrypt/src/stdmem.c          |   145 +-
 grub-core/lib/libgcrypt/src/stdmem.h          |    13 +-
 grub-core/lib/libgcrypt/src/types.h           |   160 +-
 grub-core/lib/libgcrypt/src/versioninfo.rc.in |     2 +-
 grub-core/lib/libgcrypt/src/visibility.c      |   996 +-
 grub-core/lib/libgcrypt/src/visibility.h      |  1234 +-
 468 files changed, 210279 insertions(+), 32949 deletions(-)
 create mode 100644 grub-core/lib/libgcrypt/AUTHORS
 create mode 100644 grub-core/lib/libgcrypt/COPYING
 create mode 100644 grub-core/lib/libgcrypt/COPYING.LIB
 create mode 100644 grub-core/lib/libgcrypt/LICENSES
 create mode 100644 grub-core/lib/libgcrypt/README
 create mode 100644 grub-core/lib/libgcrypt/README.GIT
 create mode 100644 grub-core/lib/libgcrypt/THANKS
 create mode 100644 grub-core/lib/libgcrypt/VERSION
 delete mode 100644 grub-core/lib/libgcrypt/cipher/ChangeLog
 delete mode 100644 grub-core/lib/libgcrypt/cipher/Manifest
 delete mode 100644 grub-core/lib/libgcrypt/cipher/ac.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/arcfour-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/aria-aesni-avx-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/aria-aesni-avx2-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/aria-gfni-avx512-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/aria.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/asm-common-aarch64.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/asm-common-amd64.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/asm-common-i386.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/asm-common-s390x.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/asm-inline-s390x.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/asm-poly1305-aarch64.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/asm-poly1305-amd64.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/asm-poly1305-s390x.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/blake2.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/blake2b-amd64-avx2.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/blake2b-amd64-avx512.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/blake2s-amd64-avx.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/blake2s-amd64-avx512.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/blowfish-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/blowfish-arm.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/bulkhelp.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/camellia-aarch64-ce.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/camellia-aarch64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/camellia-aesni-avx-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/camellia-aesni-avx2-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/camellia-aesni-avx2-amd64.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/camellia-arm.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/camellia-gfni-avx2-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/camellia-gfni-avx512-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/camellia-ppc8le.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/camellia-ppc9le.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/camellia-simd128.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/camellia-vaes-avx2-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/cast5-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/cast5-arm.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/chacha20-aarch64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/chacha20-amd64-avx2.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/chacha20-amd64-avx512.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/chacha20-amd64-ssse3.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/chacha20-armv7-neon.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/chacha20-p10le-8x.s
 create mode 100644 grub-core/lib/libgcrypt/cipher/chacha20-ppc.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/chacha20-s390x.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/chacha20.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/cipher-aeswrap.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/cipher-cbc.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/cipher-ccm.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/cipher-cfb.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/cipher-cmac.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/cipher-ctr.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/cipher-eax.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/cipher-gcm-armv7-neon.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/cipher-gcm-armv8-aarch32-ce.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/cipher-gcm-armv8-aarch64-ce.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/cipher-gcm-intel-pclmul.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/cipher-gcm-ppc.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/cipher-gcm-siv.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/cipher-gcm.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/cipher-internal.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/cipher-ocb.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/cipher-ofb.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/cipher-poly1305.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/cipher-siv.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/cipher-xts.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/crc-armv8-aarch64-ce.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/crc-armv8-ce.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/crc-intel-pclmul.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/crc-ppc.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/des-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/dsa-common.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/ecc-common.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/ecc-curves.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/ecc-ecdh.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/ecc-ecdsa.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/ecc-eddsa.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/ecc-gost.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/ecc-misc.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/ecc-sm2.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/gost-s-box.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/gost-sb.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/gost.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/gost28147.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/gostr3411-94.c
 delete mode 100644 grub-core/lib/libgcrypt/cipher/hmac-tests.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/kdf-internal.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/keccak-amd64-avx512.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/keccak-armv7-neon.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/keccak.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/keccak_permute_32.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/keccak_permute_64.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/kem-ecc.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/kem-ecc.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/kem.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/kyber-common.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/kyber-kdep.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/kyber.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/kyber.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/mac-cmac.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/mac-gmac.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/mac-hmac.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/mac-internal.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/mac-poly1305.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/mac.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/mceliece6688128f.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/mceliece6688128f.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/poly1305-amd64-avx512.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/poly1305-internal.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/poly1305-p10le.s
 create mode 100644 grub-core/lib/libgcrypt/cipher/poly1305-s390x.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/poly1305.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/pubkey-internal.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/pubkey-util.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/rijndael-aarch64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/rijndael-aesni.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/rijndael-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/rijndael-arm.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/rijndael-armv8-aarch32-ce.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/rijndael-armv8-aarch64-ce.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/rijndael-armv8-ce.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/rijndael-gcm-p10le.s
 create mode 100644 grub-core/lib/libgcrypt/cipher/rijndael-internal.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/rijndael-p10le.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/rijndael-padlock.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/rijndael-ppc-common.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/rijndael-ppc-functions.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/rijndael-ppc.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/rijndael-ppc9le.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/rijndael-s390x.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/rijndael-ssse3-amd64-asm.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/rijndael-ssse3-amd64.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/rijndael-vaes-avx2-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/rijndael-vaes-avx2-i386.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/rijndael-vaes-i386.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/rijndael-vaes.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/rsa-common.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/salsa20-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/salsa20-armv7-neon.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/salsa20.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/scrypt.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/serpent-armv7-neon.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/serpent-avx2-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/serpent-avx512-x86.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/serpent-sse2-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sha1-armv7-neon.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sha1-armv8-aarch32-ce.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sha1-armv8-aarch64-ce.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sha1-avx-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sha1-avx-bmi2-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sha1-avx2-bmi2-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sha1-intel-shaext.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/sha1-ssse3-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sha1.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/sha256-armv8-aarch32-ce.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sha256-armv8-aarch64-ce.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sha256-avx-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sha256-avx2-bmi2-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sha256-intel-shaext.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/sha256-ppc.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/sha256-ssse3-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sha512-arm.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sha512-armv7-neon.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sha512-armv8-aarch64-ce.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sha512-avx-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sha512-avx2-bmi2-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sha512-avx512-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sha512-ppc.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/sha512-ssse3-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sha512-ssse3-i386.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/sm3-aarch64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sm3-armv8-aarch64-ce.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sm3-avx-bmi2-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sm3.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/sm4-aarch64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sm4-aesni-avx-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sm4-aesni-avx2-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sm4-armv8-aarch64-ce.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sm4-armv9-aarch64-sve-ce.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sm4-gfni-avx2-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sm4-gfni-avx512-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/sm4-ppc.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/sm4.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/sntrup761.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/sntrup761.h
 create mode 100644 grub-core/lib/libgcrypt/cipher/stribog.c
 delete mode 100644 grub-core/lib/libgcrypt/cipher/test-getrusage.c
 create mode 100644 grub-core/lib/libgcrypt/cipher/twofish-aarch64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/twofish-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/twofish-arm.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/twofish-avx2-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/cipher/whirlpool-sse2-amd64.S
 create mode 100644 grub-core/lib/libgcrypt/compat/Makefile.am
 create mode 100644 grub-core/lib/libgcrypt/compat/clock.c
 create mode 100644 grub-core/lib/libgcrypt/compat/compat.c
 create mode 100644 grub-core/lib/libgcrypt/compat/getpid.c
 create mode 100644 grub-core/lib/libgcrypt/compat/libcompat.h
 create mode 100644 grub-core/lib/libgcrypt/config.h.in
 create mode 100755 grub-core/lib/libgcrypt/configure
 create mode 100644 grub-core/lib/libgcrypt/configure.ac
 create mode 100755 grub-core/lib/libgcrypt/mkinstalldirs
 delete mode 100644 grub-core/lib/libgcrypt/mpi/Manifest
 rename grub-core/lib/libgcrypt/mpi/{pentium4/sse2 => aarch64}/distfiles (80%)
 create mode 100644 grub-core/lib/libgcrypt/mpi/aarch64/mpi-asm-defs.h
 create mode 100644 grub-core/lib/libgcrypt/mpi/aarch64/mpih-add1.S
 create mode 100644 grub-core/lib/libgcrypt/mpi/aarch64/mpih-mul1.S
 create mode 100644 grub-core/lib/libgcrypt/mpi/aarch64/mpih-mul2.S
 create mode 100644 grub-core/lib/libgcrypt/mpi/aarch64/mpih-mul3.S
 create mode 100644 grub-core/lib/libgcrypt/mpi/aarch64/mpih-sub1.S
 create mode 100644 grub-core/lib/libgcrypt/mpi/amd64/func_abi.h
 rename grub-core/lib/libgcrypt/mpi/{i586 => arm}/distfiles (57%)
 create mode 100644 grub-core/lib/libgcrypt/mpi/arm/mpi-asm-defs.h
 create mode 100644 grub-core/lib/libgcrypt/mpi/arm/mpih-add1.S
 create mode 100644 grub-core/lib/libgcrypt/mpi/arm/mpih-mul1.S
 create mode 100644 grub-core/lib/libgcrypt/mpi/arm/mpih-mul2.S
 create mode 100644 grub-core/lib/libgcrypt/mpi/arm/mpih-mul3.S
 create mode 100644 grub-core/lib/libgcrypt/mpi/arm/mpih-sub1.S
 create mode 100644 grub-core/lib/libgcrypt/mpi/asm-common-aarch64.h
 create mode 100644 grub-core/lib/libgcrypt/mpi/asm-common-amd64.h
 create mode 100644 grub-core/lib/libgcrypt/mpi/asm-common-i386.h
 rename grub-core/lib/libgcrypt/{cipher/rmd.h => mpi/ec-ed25519.c} (51%)
 create mode 100644 grub-core/lib/libgcrypt/mpi/ec-hw-s390x.c
 create mode 100644 grub-core/lib/libgcrypt/mpi/ec-inline.h
 create mode 100644 grub-core/lib/libgcrypt/mpi/ec-internal.h
 create mode 100644 grub-core/lib/libgcrypt/mpi/ec-nist.c
 delete mode 100644 grub-core/lib/libgcrypt/mpi/generic/Manifest
 delete mode 100644 grub-core/lib/libgcrypt/mpi/i386/Manifest
 delete mode 100644 grub-core/lib/libgcrypt/mpi/i586/Manifest
 delete mode 100644 grub-core/lib/libgcrypt/mpi/i586/README
 delete mode 100644 grub-core/lib/libgcrypt/mpi/i586/mpih-add1.S
 delete mode 100644 grub-core/lib/libgcrypt/mpi/i586/mpih-lshift.S
 delete mode 100644 grub-core/lib/libgcrypt/mpi/i586/mpih-mul1.S
 delete mode 100644 grub-core/lib/libgcrypt/mpi/i586/mpih-mul2.S
 delete mode 100644 grub-core/lib/libgcrypt/mpi/i586/mpih-mul3.S
 delete mode 100644 grub-core/lib/libgcrypt/mpi/i586/mpih-rshift.S
 delete mode 100644 grub-core/lib/libgcrypt/mpi/i586/mpih-sub1.S
 delete mode 100644 grub-core/lib/libgcrypt/mpi/m68k/Manifest
 delete mode 100644 grub-core/lib/libgcrypt/mpi/m68k/mc68020/Manifest
 delete mode 100644 grub-core/lib/libgcrypt/mpi/mips3/Manifest
 create mode 100644 grub-core/lib/libgcrypt/mpi/mpih-const-time.c
 delete mode 100644 grub-core/lib/libgcrypt/mpi/pa7100/Manifest
 delete mode 100644 grub-core/lib/libgcrypt/mpi/pentium4/README
 delete mode 100644 grub-core/lib/libgcrypt/mpi/pentium4/distfiles
 delete mode 100644 grub-core/lib/libgcrypt/mpi/pentium4/mmx/distfiles
 delete mode 100644 grub-core/lib/libgcrypt/mpi/pentium4/mmx/mpih-lshift.S
 delete mode 100644 grub-core/lib/libgcrypt/mpi/pentium4/mmx/mpih-rshift.S
 delete mode 100644 grub-core/lib/libgcrypt/mpi/pentium4/sse2/mpih-add1.S
 delete mode 100644 grub-core/lib/libgcrypt/mpi/pentium4/sse2/mpih-mul1.S
 delete mode 100644 grub-core/lib/libgcrypt/mpi/pentium4/sse2/mpih-mul2.S
 delete mode 100644 grub-core/lib/libgcrypt/mpi/pentium4/sse2/mpih-mul3.S
 delete mode 100644 grub-core/lib/libgcrypt/mpi/pentium4/sse2/mpih-sub1.S
 delete mode 100644 grub-core/lib/libgcrypt/mpi/power/Manifest
 delete mode 100644 grub-core/lib/libgcrypt/mpi/powerpc32/Manifest
 delete mode 100644 grub-core/lib/libgcrypt/mpi/sparc32/Manifest
 delete mode 100644 grub-core/lib/libgcrypt/mpi/sparc32v8/Manifest
 delete mode 100644 grub-core/lib/libgcrypt/mpi/supersparc/Manifest
 delete mode 100644 grub-core/lib/libgcrypt/src/Manifest
 delete mode 100644 grub-core/lib/libgcrypt/src/ath.c
 delete mode 100644 grub-core/lib/libgcrypt/src/ath.h
 create mode 100644 grub-core/lib/libgcrypt/src/const-time.c
 create mode 100644 grub-core/lib/libgcrypt/src/const-time.h
 create mode 100644 grub-core/lib/libgcrypt/src/context.c
 create mode 100644 grub-core/lib/libgcrypt/src/context.h
 create mode 100644 grub-core/lib/libgcrypt/src/ec-context.h
 create mode 100644 grub-core/lib/libgcrypt/src/gcrypt-int.h
 delete mode 100644 grub-core/lib/libgcrypt/src/gcrypt-module.h
 create mode 100644 grub-core/lib/libgcrypt/src/gcrypt-testapi.h
 delete mode 100644 grub-core/lib/libgcrypt/src/gcryptrnd.c
 create mode 100755 grub-core/lib/libgcrypt/src/gen-note-integrity.sh
 delete mode 100644 grub-core/lib/libgcrypt/src/getrandom.c
 create mode 100644 grub-core/lib/libgcrypt/src/hwf-arm.c
 create mode 100644 grub-core/lib/libgcrypt/src/hwf-common.h
 create mode 100644 grub-core/lib/libgcrypt/src/hwf-ppc.c
 create mode 100644 grub-core/lib/libgcrypt/src/hwf-s390x.c
 create mode 100644 grub-core/lib/libgcrypt/src/hwf-x86.c
 create mode 100644 grub-core/lib/libgcrypt/src/libgcrypt.pc.in
 delete mode 100644 grub-core/lib/libgcrypt/src/module.c
 create mode 100644 grub-core/lib/libgcrypt/src/mpicalc.c
grub-core/lib/libgcrypt/AUTHORS new file +274 -0
new file mode 100644
index 000000000..f9161600b
@@ -0,0 +1,274 @@
+Library: Libgcrypt
+Homepage: https://gnupg.org/related_software/libgcrypt/
+Download: https://gnupg.org/ftp/gcrypt/libgcrypt/
+Repository: git://git.gnupg.org/libgcrypt.git
+Maintainer: Werner Koch <[email protected]>
+Bug reports: https://bugs.gnupg.org
+Security related bug reports: <[email protected]>
+End-of-life: TBD
+License (library): LGPLv2.1+
+License (manual and tools): GPLv2+
+
+
+Libgcrypt is free software.  See the files COPYING.LIB and COPYING for
+copying conditions, and LICENSES for notices about a few contributions
+that require these additional notices to be distributed.  License
+copyright years may be listed using range notation, e.g., 2000-2013,
+indicating that every year in the range, inclusive, is a copyrightable
+year that would otherwise be listed individually.
+
+
+List of Copyright holders
+=========================
+
+  Copyright (C) 1989,1991-2018 Free Software Foundation, Inc.
+  Copyright (C) 1994 X Consortium
+  Copyright (C) 1996 L. Peter Deutsch
+  Copyright (C) 1997 Werner Koch
+  Copyright (C) 1998 The Internet Society
+  Copyright (C) 1996-1999 Peter Gutmann, Paul Kendall, and Chris Wedgwood
+  Copyright (C) 1996-2006 Peter Gutmann, Matt Thomlinson and Blake Coverett
+  Copyright (C) 2003 Nikos Mavroyanopoulos
+  Copyright (c) 2006 CRYPTOGAMS
+  Copyright (C) 2006-2007 NTT (Nippon Telegraph and Telephone Corporation)
+  Copyright (C) 2012-2024 g10 Code GmbH
+  Copyright (C) 2012 Simon Josefsson, Niels Möller
+  Copyright (c) 2012 Intel Corporation
+  Copyright (C) 2013 Christian Grothoff
+  Copyright (C) 2013-2024 Jussi Kivilinna
+  Copyright (C) 2013-2014 Dmitry Eremin-Solenikov
+  Copyright (C) 2014 Stephan Mueller
+  Copyright (C) 2017 Jia Zhang
+  Copyright (C) 2018 Bundesamt für Sicherheit in der Informationstechnik
+  Copyright (C) 2020 Alibaba Group.
+  Copyright (C) 2020 Tianjia Zhang
+  Copyright (C) 2023 Simon Josefsson
+
+
+Authors with a FSF copyright assignment
+=======================================
+
+LIBGCRYPT       Werner Koch    2001-06-07
+Assigns past and future changes.
+Assignment for future changes terminated on 2012-12-04.
[email protected]
+Designed and implemented Libgcrypt.
+
+GNUPG	Matthew Skala		   1998-08-10
+Disclaims changes.
[email protected]
+Wrote cipher/twofish.c.
+
+GNUPG	Natural Resources Canada    1998-08-11
+Disclaims changes by Matthew Skala.
+
+GNUPG	Michael Roth	Germany     1998-09-17
+Assigns changes.
[email protected]
+Wrote cipher/des.c.
+Changes and bug fixes all over the place.
+
+GNUPG	Niklas Hernaeus 	1998-09-18
+Disclaims changes.
[email protected]
+Weak key patches.
+
+GNUPG	Rémi Guyomarch		1999-05-25
+Assigns past and future changes. (g10/compress.c, g10/encr-data.c,
+g10/free-packet.c, g10/mdfilter.c, g10/plaintext.c, util/iobuf.c)
[email protected]
+
+ANY     g10 Code GmbH           2001-06-07
+Assignment for future changes terminated on 2012-12-04.
+Code marked with ChangeLog entries of g10 Code employees.
+
+LIBGCRYPT Timo Schulz           2001-08-31
+Assigns past and future changes.
[email protected]
+
+LIBGCRYPT Simon Josefsson       2002-10-25
+Assigns past and future changes to FSF (cipher/{md4,crc}.c, CTR mode,
+CTS/MAC flags, self test improvements)
[email protected]
+
+LIBGCRYPT Moritz Schulte	2003-04-17
+Assigns past and future changes.
[email protected]
+
+GNUTLS  Nikolaos Mavrogiannopoulos  2003-11-22
[email protected]
+Original code for cipher/rfc2268.c.
+
+LIBGCRYPT	The Written Word	2005-04-15
+Assigns past and future changes. (new: src/libgcrypt.pc.in,
+src/Makefile.am, src/secmem.c, mpi/hppa1.1/mpih-mul3.S,
+mpi/hppa1.1/udiv-qrnnd.S, mpi/hppa1.1/mpih-mul2.S,
+mpi/hppa1.1/mpih-mul1.S, mpi/Makefile.am, tests/prime.c,
+tests/register.c, tests/ac.c, tests/basic.c, tests/tsexp.c,
+tests/keygen.c, tests/pubkey.c, configure.ac, acinclude.m4)
+
+LIBGCRYPT       Brad Hards       2006-02-09
+Assigns Past and Future Changes
[email protected]
+(Added OFB mode. Changed cipher/cipher.c, test/basic.c doc/gcrypt.tex.
+ added SHA-224, changed cipher/sha256.c, added HMAC tests.)
+
+LIBGCRYPT       Hye-Shik Chang   2006-09-07
+Assigns Past and Future Changes
[email protected]
+(SEED cipher)
+
+LIBGCRYPT       Werner Dittmann  2009-05-20
+Assigns Past and Future Changes
[email protected]
+(mpi/amd64, tests/mpitests.c)
+
+GNUPG           David Shaw
+Assigns past and future changes.
[email protected]
+(cipher/camellia-glue.c and related stuff)
+
+LIBGCRYPT       Andrey Jivsov    2010-12-09
+Assigns Past and Future Changes
[email protected]
+(cipher/ecc.c and related files)
+
+LIBGCRYPT       Ulrich Müller    2012-02-15
+Assigns Past and Future Changes
[email protected]
+(Changes to cipher/idea.c and related files)
+
+LIBGCRYPT       Vladimir Serbinenko  2012-04-26
+Assigns Past and Future Changes
[email protected]
+(cipher/serpent.c)
+
+
+Authors with a DCO
+==================
+
+Andrei Scherer <[email protected]>
+2014-08-22:[email protected]:
+
+Christian Aistleitner <[email protected]>
+2013-02-26:[email protected]:
+
+Christian Grothoff <[email protected]>
+2013-03-21:[email protected]:
+
+Clemens Lang <[email protected]>
+2022-02-10:[email protected]:
+
+Danny Tsen <[email protected]>
+2021-12-20:OF85D11C2F.7A339D7D-ON002587B1.0042A81E-002587B1.0042B94D@ibm.com
+
+Dmitry Baryshkov <[email protected]>
+Dmitry Eremin-Solenikov <[email protected]>
+2013-07-13:[email protected]:
+
+Dmitry Kasatkin <[email protected]>
+2012-12-14:[email protected]:
+
+Falko Strenzke <[email protected]>
+2023-09-27:[email protected]:
+
+H.J. Lu <[email protected]>
+2020-01-19:[email protected]:
+
+Jia Zhang <[email protected]>
+2017-10-17:[email protected]:
+
+Jérémie Courrèges-Anglas <[email protected]>
+2016-05-26:[email protected]:
+
+Jussi Kivilinna <[email protected]>
+2012-11-15:[email protected]:
+
+Jussi Kivilinna <[email protected]>
+2013-05-06:[email protected]:
+
+Markus Teich <markus dot teich at stusta dot mhn dot de>
+2014-10-08:20141008180509.GA2770@trolle:
+
+Martin Storsjö <[email protected]>
+2018-03-28:[email protected]:
+
+Mathias L. Baumann <mathias.baumann at sociomantic.com>
+2017-01-30:[email protected]:
+
+Milan Broz <[email protected]>
+2014-01-13:[email protected]:
+
+Paul Wolneykien <[email protected]>
+2019-11-19:[email protected]:
+
+Peter Wu <[email protected]>
+2015-07-22:20150722191325.GA8113@al:
+
+Rafaël Carré <[email protected]>
+2012-04-20:[email protected]:
+
+Sergey V. <[email protected]>
+2013-11-07:2066221.5IYa7Yq760@darkstar:
+
+Shawn Landden <[email protected]>
+2019-07-09:[email protected]:
+
+Simit Ghane <[email protected]>
+2024-05-06:OF22575887.761836D9-ON48258B15.0044A21E-48258B15.0044A222@lge.com:
+
+Stephan Mueller <[email protected]>
+2014-08-22:[email protected]:
+
+Tianjia Zhang <[email protected]>
+2020-01-08:[email protected]:
+
+Tomáš Mráz <[email protected]>
+2012-04-16:[email protected]:
+
+Vitezslav Cizek <[email protected]>
+2015-11-05:[email protected]:
+
+Werner Koch <[email protected]> (g10 Code GmbH)
+2012-12-05:[email protected]:
+
+
+More credits
+============
+
+Libgcrypt used to be part of GnuPG but has been taken out into its own
+package on 2000-12-21.
+
+Most of the stuff in mpi has been taken from an old GMP library
+version by Torbjorn Granlund <[email protected]>.
+
+The files cipher/rndunix.c and cipher/rndw32.c are based on those
+files from Cryptlib.  Copyright Peter Gutmann, Paul Kendall, and Chris
+Wedgwood 1996-1999.
+
+The ECC code cipher/ecc.c was based on code by Sergi Blanch i Torne,
+sergi at calcurco dot org.
+
+The implementation of the Camellia cipher has been been taken from the
+original NTT provided GPL source.
+
+The CAVS testing program tests/cavs_driver.pl is not to be considered
+a part of libgcrypt proper.  We distribute it merely for convenience.
+It has a permissive license and is copyrighted by atsec information
+security corporation.  See the file for details.
+
+The file salsa20.c is based on D.J. Bernstein's public domain code and
+taken from Nettle.  Copyright 2012 Simon Josefsson and Niels Möller.
+
+The sntrup761 code is based on public domain code written by Daniel
+J. Bernstein, Chitchanok Chuengsatiansup, Tanja Lange, and Christine
+van Vredendaal.  Copyright 2023 Simon Josefsson.
+
+
+ This file is free software; as a special exception the author gives
+ unlimited permission to copy and/or distribute it, with or without
+ modifications, as long as this notice is preserved.
+
+ This file is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
grub-core/lib/libgcrypt/COPYING new file +339 -0

339 lines not on this page · raw message

grub-core/lib/libgcrypt/COPYING.LIB new file +502 -0

502 lines not on this page · raw message

grub-core/lib/libgcrypt/LICENSES new file +319 -0

319 lines not on this page · raw message

grub-core/lib/libgcrypt/README new file +278 -0

278 lines not on this page · raw message

grub-core/lib/libgcrypt/README.GIT new file +49 -0

49 lines not on this page · raw message

grub-core/lib/libgcrypt/THANKS new file +168 -0

168 lines not on this page · raw message

grub-core/lib/libgcrypt/VERSION new file +1 -0
new file mode 100644
index 000000000..1cac385c6
@@ -0,0 +1 @@
+1.11.0
grub-core/lib/libgcrypt/cipher/ChangeLog deleted +0 -3990

1,070 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/ChangeLog-2011 +36 -4
index 05516c99e..1ce6bd1e6 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/cipher/Makefile.am +291 -39

330 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/Manifest deleted +0 -73

73 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/ac.c deleted +0 -3301

3,301 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/arcfour-amd64.S new file +108 -0

108 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/arcfour.c +77 -16

93 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/aria-aesni-avx-amd64.S new file +1440 -0

1,440 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/aria-aesni-avx2-amd64.S new file +1830 -0

1,830 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/aria-gfni-avx512-amd64.S new file +1010 -0

1,010 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/aria.c new file +1768 -0

1,768 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/asm-common-aarch64.h new file +132 -0

132 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/asm-common-amd64.h new file +213 -0

213 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/asm-common-i386.h new file +161 -0

161 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/asm-common-s390x.h new file +90 -0

90 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/asm-inline-s390x.h new file +205 -0

205 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/asm-poly1305-aarch64.h new file +245 -0

245 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/asm-poly1305-amd64.h new file +171 -0

171 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/asm-poly1305-s390x.h new file +140 -0

140 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/bithelp.h +90 -21

111 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/blake2.c new file +1086 -0

1,086 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/blake2b-amd64-avx2.S new file +301 -0

301 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/blake2b-amd64-avx512.S new file +429 -0

429 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/blake2s-amd64-avx.S new file +281 -0

281 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/blake2s-amd64-avx512.S new file +397 -0

397 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/blowfish-amd64.S new file +601 -0

601 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/blowfish-arm.S new file +743 -0

743 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/blowfish.c +643 -159

802 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/bufhelp.h +199 -259

458 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/bulkhelp.h new file +493 -0

493 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/camellia-aarch64-ce.c new file +42 -0

42 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/camellia-aarch64.S new file +585 -0

585 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/camellia-aesni-avx-amd64.S new file +2802 -0

2,802 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/camellia-aesni-avx2-amd64.S new file +34 -0
new file mode 100644
index 000000000..5102d1912

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/cipher/camellia-aesni-avx2-amd64.h new file +2327 -0

2,327 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/camellia-arm.S new file +626 -0

626 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/camellia-gfni-avx2-amd64.S new file +34 -0
new file mode 100644
index 000000000..20c9a432d

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/cipher/camellia-gfni-avx512-amd64.S new file +1634 -0

1,634 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/camellia-glue.c +1630 -40

1,670 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/camellia-ppc8le.c new file +47 -0

47 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/camellia-ppc9le.c new file +47 -0

47 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/camellia-simd128.h new file +2235 -0

2,235 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/camellia-vaes-avx2-amd64.S new file +35 -0
new file mode 100644
index 000000000..e6e0c78ec

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/cipher/camellia.c +62 -110

172 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/camellia.h +25 -9
index cccf786ca..0797e6f38 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/cipher/cast5-amd64.S new file +663 -0

663 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/cast5-arm.S new file +728 -0

728 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/cast5.c +670 -105

775 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/chacha20-aarch64.S new file +650 -0

650 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/chacha20-amd64-avx2.S new file +604 -0

604 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/chacha20-amd64-avx512.S new file +736 -0

736 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/chacha20-amd64-ssse3.S new file +1015 -0

1,015 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/chacha20-armv7-neon.S new file +393 -0

393 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/chacha20-p10le-8x.s new file +864 -0

864 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/chacha20-ppc.c new file +750 -0

750 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/chacha20-s390x.S new file +1566 -0

1,566 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/chacha20.c new file +1450 -0

1,450 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/cipher-aeswrap.c new file +380 -0

380 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/cipher-cbc.c new file +292 -0

292 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/cipher-ccm.c new file +419 -0

419 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/cipher-cfb.c new file +317 -0

317 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/cipher-cmac.c new file +292 -0

292 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/cipher-ctr.c new file +131 -0

131 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/cipher-eax.c new file +293 -0

293 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/cipher-gcm-armv7-neon.S new file +341 -0

341 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/cipher-gcm-armv8-aarch32-ce.S new file +588 -0

588 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/cipher-gcm-armv8-aarch64-ce.S new file +633 -0

633 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/cipher-gcm-intel-pclmul.c new file +2025 -0

2,025 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/cipher-gcm-ppc.c new file +548 -0

548 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/cipher-gcm-siv.c new file +664 -0

664 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/cipher-gcm.c new file +1260 -0

1,260 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/cipher-internal.h new file +975 -0

975 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/cipher-ocb.c new file +763 -0

763 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/cipher-ofb.c new file +108 -0

108 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/cipher-poly1305.c new file +383 -0

383 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/cipher-siv.c new file +375 -0

375 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/cipher-xts.c new file +189 -0

189 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/cipher.c +1260 -1442

2,702 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/crc-armv8-aarch64-ce.S new file +500 -0

500 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/crc-armv8-ce.c new file +229 -0

229 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/crc-intel-pclmul.c new file +939 -0

939 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/crc-ppc.c new file +656 -0

656 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/crc.c +177 -15

192 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/des-amd64.S new file +1116 -0

1,116 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/des.c +270 -31

301 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/dsa-common.c new file +473 -0

473 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/dsa.c +735 -472

1,207 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/ecc-common.h new file +143 -0

143 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/ecc-curves.c new file +1587 -0

1,587 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/ecc-ecdh.c new file +357 -0

357 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/ecc-ecdsa.c new file +305 -0

305 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/ecc-eddsa.c new file +1079 -0

1,079 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/ecc-gost.c new file +218 -0

218 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/ecc-misc.c new file +469 -0

469 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/ecc-sm2.c new file +569 -0

569 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/ecc.c +1915 -1327

3,242 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/elgamal.c +574 -255

829 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/gost-s-box.c new file +266 -0

266 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/gost-sb.h new file +2128 -0

2,128 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/gost.h new file +34 -0
new file mode 100644
index 000000000..53a405050

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/cipher/gost28147.c new file +553 -0

553 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/gostr3411-94.c new file +383 -0

383 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/hash-common.c +104 -6

110 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/hash-common.h +32 -3
index fdebef42a..561e77a7e 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/cipher/hmac-tests.c deleted +0 -732

732 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/idea.c +15 -9
index 3c5578f95..7f7066606 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/cipher/kdf-internal.h new file +39 -0
new file mode 100644
index 000000000..9f4f3c489

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/cipher/kdf.c +2178 -61

2,239 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/keccak-amd64-avx512.S new file +587 -0

587 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/keccak-armv7-neon.S new file +945 -0

945 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/keccak.c new file +1904 -0

1,904 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/keccak_permute_32.h new file +536 -0

536 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/keccak_permute_64.h new file +385 -0

385 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/kem-ecc.c new file +332 -0

332 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/kem-ecc.h new file +40 -0
new file mode 100644
index 000000000..b320a71cc

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/cipher/kem.c new file +435 -0

435 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/kyber-common.c new file +766 -0

766 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/kyber-kdep.c new file +825 -0

825 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/kyber.c new file +530 -0

530 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/kyber.h new file +130 -0

130 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/mac-cmac.c new file +532 -0

532 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/mac-gmac.c new file +203 -0

203 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/mac-hmac.c new file +1471 -0

1,471 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/mac-internal.h new file +290 -0

290 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/mac-poly1305.c new file +382 -0

382 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/mac.c new file +834 -0

834 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/mceliece6688128f.c new file +3673 -0

3,673 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/mceliece6688128f.h new file +63 -0

63 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/md.c +949 -633

1,582 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/md4.c +70 -101

171 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/md5.c +72 -105

177 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/poly1305-amd64-avx512.S new file +1626 -0

1,626 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/poly1305-internal.h new file +92 -0

92 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/poly1305-p10le.s new file +841 -0

841 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/poly1305-s390x.S new file +87 -0

87 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/poly1305.c new file +846 -0

846 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/primegen.c +291 -272

563 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/pubkey-internal.h new file +107 -0

107 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/pubkey-util.c new file +1363 -0

1,363 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/pubkey.c +688 -3641

4,329 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rfc2268.c +47 -10

57 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rijndael-aarch64.S new file +512 -0

512 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rijndael-aesni.c new file +5033 -0

5,033 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rijndael-amd64.S new file +477 -0

477 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rijndael-arm.S new file +581 -0

581 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rijndael-armv8-aarch32-ce.S new file +2134 -0

2,134 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rijndael-armv8-aarch64-ce.S new file +2038 -0

2,038 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rijndael-armv8-ce.c new file +396 -0

396 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rijndael-gcm-p10le.s new file +1401 -0

1,401 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rijndael-internal.h new file +216 -0

216 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rijndael-p10le.c new file +119 -0

119 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rijndael-padlock.c new file +109 -0

109 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rijndael-ppc-common.h new file +328 -0

328 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rijndael-ppc-functions.h new file +2544 -0

2,544 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rijndael-ppc.c new file +230 -0

230 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rijndael-ppc9le.c new file +119 -0

119 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rijndael-s390x.c new file +1166 -0

1,166 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rijndael-ssse3-amd64-asm.S new file +879 -0

879 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rijndael-ssse3-amd64.c new file +742 -0

742 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rijndael-tables.h +190 -1656

1,846 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rijndael-vaes-avx2-amd64.S new file +3688 -0

3,688 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rijndael-vaes-avx2-i386.S new file +2804 -0

2,804 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rijndael-vaes-i386.c new file +231 -0

231 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rijndael-vaes.c new file +240 -0

240 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rijndael.c +1292 -1351

2,643 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rmd160.c +270 -322

592 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rsa-common.c new file +1151 -0

1,151 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/rsa.c +1296 -440

1,736 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/salsa20-amd64.S new file +940 -0

940 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/salsa20-armv7-neon.S new file +899 -0

899 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/salsa20.c new file +600 -0

600 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/scrypt.c new file +322 -0

322 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/seed.c +16 -16
index ae26e6742..9cc34f9e6 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/cipher/serpent-armv7-neon.S new file +1180 -0

1,180 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/serpent-avx2-amd64.S new file +1214 -0

1,214 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/serpent-avx512-x86.c new file +994 -0

994 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/serpent-sse2-amd64.S new file +1276 -0

1,276 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/serpent.c +1542 -475

2,017 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha1-armv7-neon.S new file +526 -0

526 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha1-armv8-aarch32-ce.S new file +220 -0

220 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha1-armv8-aarch64-ce.S new file +204 -0

204 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha1-avx-amd64.S new file +433 -0

433 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha1-avx-bmi2-amd64.S new file +446 -0

446 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha1-avx2-bmi2-amd64.S new file +578 -0

578 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha1-intel-shaext.c new file +292 -0

292 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha1-ssse3-amd64.S new file +442 -0

442 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha1.c +431 -140

571 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha1.h new file +47 -0

47 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha256-armv8-aarch32-ce.S new file +231 -0

231 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha256-armv8-aarch64-ce.S new file +218 -0

218 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha256-avx-amd64.S new file +511 -0

511 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha256-avx2-bmi2-amd64.S new file +533 -0

533 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha256-intel-shaext.c new file +363 -0

363 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha256-ppc.c new file +610 -0

610 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha256-ssse3-amd64.S new file +533 -0

533 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha256.c +531 -244

775 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha512-arm.S new file +464 -0

464 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha512-armv7-neon.S new file +452 -0

452 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha512-armv8-aarch64-ce.S new file +383 -0

383 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha512-avx-amd64.S new file +466 -0

466 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha512-avx2-bmi2-amd64.S new file +507 -0

507 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha512-avx512-amd64.S new file +465 -0

465 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha512-ppc.c new file +725 -0

725 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha512-ssse3-amd64.S new file +472 -0

472 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha512-ssse3-i386.c new file +404 -0

404 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sha512.c +1023 -287

1,310 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sm3-aarch64.S new file +660 -0

660 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sm3-armv8-aarch64-ce.S new file +221 -0

221 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sm3-avx-bmi2-amd64.S new file +555 -0

555 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sm3.c new file +565 -0

565 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sm4-aarch64.S new file +644 -0

644 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sm4-aesni-avx-amd64.S new file +1058 -0

1,058 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sm4-aesni-avx2-amd64.S new file +973 -0

973 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sm4-armv8-aarch64-ce.S new file +731 -0

731 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sm4-armv9-aarch64-sve-ce.S new file +967 -0

967 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sm4-gfni-avx2-amd64.S new file +1260 -0

1,260 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sm4-gfni-avx512-amd64.S new file +1861 -0

1,861 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sm4-ppc.c new file +342 -0

342 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sm4.c new file +2070 -0

2,070 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sntrup761.c new file +1062 -0

1,062 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/sntrup761.h new file +73 -0

73 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/stribog.c new file +1362 -0

1,362 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/test-getrusage.c deleted +0 -105

105 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/tiger.c +130 -181

311 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/twofish-aarch64.S new file +322 -0

322 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/twofish-amd64.S new file +1258 -0

1,258 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/twofish-arm.S new file +363 -0

363 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/twofish-avx2-amd64.S new file +1136 -0

1,136 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/twofish.c +882 -72

954 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/whirlpool-sse2-amd64.S new file +348 -0

348 lines not on this page · raw message

grub-core/lib/libgcrypt/cipher/whirlpool.c +232 -102

334 lines not on this page · raw message

grub-core/lib/libgcrypt/compat/Makefile.am new file +48 -0

48 lines not on this page · raw message

grub-core/lib/libgcrypt/compat/clock.c new file +36 -0
new file mode 100644
index 000000000..2a2c205f3

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/compat/compat.c new file +40 -0
new file mode 100644
index 000000000..7684e4f31

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/compat/getpid.c new file +29 -0
new file mode 100644
index 000000000..032387c36

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/compat/libcompat.h new file +37 -0
new file mode 100644
index 000000000..d3eb81bfc

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/config.h.in new file +873 -0

873 lines not on this page · raw message

grub-core/lib/libgcrypt/configure new file +25763 -0

25,763 lines not on this page · raw message

grub-core/lib/libgcrypt/configure.ac new file +3883 -0

3,883 lines not on this page · raw message

grub-core/lib/libgcrypt/mkinstalldirs new file +161 -0

161 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/ChangeLog-2011 +13 -4
index 930717141..1e0787218 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/Makefile.am +11 -5
index e900539a2..6fe63fceb 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/Manifest deleted +0 -41

41 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/aarch64/distfiles renamed from grub-core/lib/libgcrypt/mpi/pentium4/sse2/distfiles +1 -0
similarity index 80%
rename from grub-core/lib/libgcrypt/mpi/pentium4/sse2/distfiles
rename to grub-core/lib/libgcrypt/mpi/aarch64/distfiles
index 7252cd7e3..1327bd4a7 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/aarch64/mpi-asm-defs.h new file +4 -0
new file mode 100644
index 000000000..65190653b

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/aarch64/mpih-add1.S new file +75 -0

75 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/aarch64/mpih-mul1.S new file +100 -0

100 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/aarch64/mpih-mul2.S new file +112 -0

112 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/aarch64/mpih-mul3.S new file +125 -0

125 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/aarch64/mpih-sub1.S new file +75 -0

75 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/alpha/README +2 -2
index 55c0a2917..00addfd39 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/alpha/mpih-add1.S +2 -2
index 50dbb2b9d..463c5c070 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/alpha/mpih-lshift.S +2 -2
index ded4b15c0..75ae698cc 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/alpha/mpih-mul1.S +2 -2
index cd91b1049..030a288d2 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/alpha/mpih-mul2.S +2 -2
index 5eb6b98be..566642eee 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/alpha/mpih-mul3.S +2 -2
index 7d5d2afe4..520d1c622 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/alpha/mpih-rshift.S +2 -2
index f0c981438..85e0af538 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/alpha/mpih-sub1.S +2 -2
index 9a644468c..6896b5746 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/alpha/udiv-qrnnd.S +2 -2
index dd0c52d7d..eb1602a95 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/amd64/distfiles +1 -0
index 634e36fb0..44aad5f82 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/amd64/func_abi.h new file +34 -0
new file mode 100644
index 000000000..c3f2d026c

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/amd64/mpi-asm-defs.h +1 -1
index 17de1c190..65190653b 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/amd64/mpih-add1.S +74 -18

92 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/amd64/mpih-lshift.S +28 -26

54 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/amd64/mpih-mul1.S +6 -5
index 54b0ab489..7bd9ff292 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/amd64/mpih-mul2.S +6 -47

53 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/amd64/mpih-mul3.S +6 -5
index 4d458a794..d0e85ba9e 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/amd64/mpih-rshift.S +29 -27

56 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/amd64/mpih-sub1.S +74 -16

90 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/arm/distfiles renamed from grub-core/lib/libgcrypt/mpi/i586/distfiles +1 -5
similarity index 57%
rename from grub-core/lib/libgcrypt/mpi/i586/distfiles
rename to grub-core/lib/libgcrypt/mpi/arm/distfiles
index 546f77768..27a2ca527 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/arm/mpi-asm-defs.h new file +4 -0
new file mode 100644
index 000000000..047d1f5a7

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/arm/mpih-add1.S new file +76 -0

76 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/arm/mpih-mul1.S new file +80 -0

80 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/arm/mpih-mul2.S new file +94 -0

94 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/arm/mpih-mul3.S new file +100 -0

100 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/arm/mpih-sub1.S new file +77 -0

77 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/asm-common-aarch64.h new file +26 -0
new file mode 100644
index 000000000..cf4bdb852

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/asm-common-amd64.h new file +26 -0
new file mode 100644
index 000000000..ad0e8e62f

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/asm-common-i386.h new file +26 -0
new file mode 100644
index 000000000..901664504

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/config.links +127 -51

178 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/ec-ed25519.c renamed from grub-core/lib/libgcrypt/cipher/rmd.h +18 -17
similarity index 51%
rename from grub-core/lib/libgcrypt/cipher/rmd.h
rename to grub-core/lib/libgcrypt/mpi/ec-ed25519.c
index 6a9fe3135..b52b339b1 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/ec-hw-s390x.c new file +412 -0

412 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/ec-inline.h new file +1236 -0

1,236 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/ec-internal.h new file +49 -0

49 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/ec-nist.c new file +826 -0

826 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/ec.c +1751 -302

2,053 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/generic/Manifest deleted +0 -29
deleted file mode 100644
index c429fde72..000000000

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/generic/distfiles +0 -1
index 9810eef4d..649e829b7 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/generic/mpi-asm-defs.h +7 -9
index 13424e280..e607806e1 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/generic/mpih-add1.c +5 -5
index 4ffe0eb23..0a51f06cc 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/generic/mpih-lshift.c +3 -3
index 8c1d943b0..8a9c1257f 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/generic/mpih-mul1.c +4 -4
index 614646c43..e88be9145 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/generic/mpih-mul2.c +5 -5
index 56979dfdb..bc925e019 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/generic/mpih-mul3.c +4 -4
index 9b8df1a69..4ecd2c6be 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/generic/mpih-rshift.c +2 -2
index e40794fcf..156337b38 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/generic/mpih-sub1.c +4 -4
index 25b08af1c..b8eff0dbb 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/generic/udiv-w-sdiv.c +2 -2
index e80d98bc5..719d18269 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/hppa/mpih-add1.S +2 -2
index 3bc0e5e19..8001bda39 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/hppa/mpih-lshift.S +2 -2
index 91b29bb6e..ba478ff2e 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/hppa/mpih-rshift.S +2 -2
index 37a9d4ef9..c486fc75c 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/hppa/mpih-sub1.S +2 -2
index 8d197e412..250563289 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/hppa/udiv-qrnnd.S +2 -2
index 59ebf7a00..06f06d15e 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/i386/Manifest deleted +0 -28
deleted file mode 100644
index 812bc8a5c..000000000

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/i386/distfiles +0 -1
index 22b9979bd..88d2a30c7 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/i386/mpih-add1.S +48 -3

51 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/i386/mpih-lshift.S +12 -4
index bf8ed9d4c..409c6c599 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/i386/mpih-mul1.S +13 -3
index c9760ef92..431730ce7 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/i386/mpih-mul2.S +13 -3
index 9794e1108..58a0d6e37 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/i386/mpih-mul3.S +13 -3
index 6df201763..327e6ac89 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/i386/mpih-rshift.S +13 -5
index 2920e55d8..18c36c0c4 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/i386/mpih-sub1.S +48 -3

51 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/i386/syntax.h +13 -3
index 88845f28d..2383ebd3e 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/i586/Manifest deleted +0 -27
deleted file mode 100644
index 6d1d7f824..000000000

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/i586/README deleted +0 -26
deleted file mode 100644
index d73b08268..000000000

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/i586/mpih-add1.S deleted +0 -135

135 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/i586/mpih-lshift.S deleted +0 -229

229 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/i586/mpih-mul1.S deleted +0 -89

89 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/i586/mpih-mul2.S deleted +0 -93

93 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/i586/mpih-mul3.S deleted +0 -93

93 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/i586/mpih-rshift.S deleted +0 -228

228 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/i586/mpih-sub1.S deleted +0 -142

142 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/longlong.h +582 -385

967 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/m68k/Manifest deleted +0 -25
deleted file mode 100644
index 8e0538adf..000000000

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/m68k/distfiles +0 -1
index 1e2e36f05..4c0967b84 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/m68k/mc68020/Manifest deleted +0 -23
deleted file mode 100644
index bcb27681e..000000000

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/m68k/mc68020/distfiles +0 -1
index 6b96433af..fc7df9fa3 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/m68k/mc68020/mpih-mul1.S +2 -2
index 007c94c6d..1b55097ad 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/m68k/mc68020/mpih-mul2.S +2 -2
index 44baa8d88..321d9ac70 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/m68k/mc68020/mpih-mul3.S +2 -2
index e958ef611..708fdc939 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/m68k/mpih-add1.S +2 -2
index 8182d21a3..951735a3d 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/m68k/mpih-lshift.S +2 -2
index 133d1aae3..540567c28 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/m68k/mpih-rshift.S +2 -2
index be9f43502..964c141fb 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/m68k/mpih-sub1.S +2 -2
index ee7555f89..f81569ceb 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/m68k/syntax.h +3 -3
index 6a3fea130..1c528db7e 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/mips3/Manifest deleted +0 -28
deleted file mode 100644
index e191184f3..000000000

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/mips3/README +1 -1
index e94b2c746..4ba4546d9 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/mips3/distfiles +0 -1
index ef9b6fef3..85260fc8e 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/mips3/mpih-add1.S +2 -2
index f3db029de..ba5ac1956 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/mips3/mpih-lshift.S +2 -2
index 084c109b2..013ee4a76 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/mips3/mpih-mul1.S +2 -2
index 6c0099de3..b2a6d1614 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/mips3/mpih-mul2.S +2 -2
index ca8276388..49ccce21a 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/mips3/mpih-mul3.S +2 -2
index be421a68e..a951ba694 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/mips3/mpih-rshift.S +2 -2
index e7e035a03..a8d39854d 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/mips3/mpih-sub1.S +2 -2
index 9fac67439..ae444b174 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/mpi-add.c +45 -19

64 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/mpi-bit.c +134 -123

257 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/mpi-cmp.c +34 -11

45 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/mpi-div.c +14 -9
index a6ee3006e..8d2a85738 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/mpi-gcd.c +8 -7
index 5cbefa121..9cf3062ee 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/mpi-inline.c +2 -2
index 39e222247..c6c66f3fa 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/mpi-inline.h +2 -2
index 94e2aec8a..090e8a94a 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/mpi-internal.h +55 -5

60 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/mpi-inv.c +305 -7

312 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/mpi-mod.c +29 -25

54 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/mpi-mpow.c +6 -6
index ca5b3f184..bbd102e31 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/mpi-mul.c +19 -8
index 9aefd217a..e8e574750 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/mpi-pow.c +446 -12

458 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/mpi-scan.c +68 -68

136 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/mpicoder.c +532 -231

763 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/mpih-const-time.c new file +241 -0

241 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/mpih-div.c +6 -8
index 0b458fffd..0f3849d64 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/mpih-mul.c +14 -13
index b8e056173..6c51533fc 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/mpiutil.c +410 -78

488 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/pa7100/Manifest deleted +0 -22
deleted file mode 100644
index f075ab056..000000000

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/pa7100/distfiles +0 -1
index e1cde4d57..fece94310 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/pa7100/mpih-lshift.S +2 -2
index 8ade19643..9bf6f728b 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/pa7100/mpih-rshift.S +2 -2
index 062420272..d0ceb8b1a 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/pentium4/README deleted +0 -115

115 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/pentium4/distfiles deleted +0 -3
deleted file mode 100644
index b419f85a9..000000000

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/pentium4/mmx/distfiles deleted +0 -2
deleted file mode 100644
index 8f0ea426d..000000000

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/pentium4/mmx/mpih-lshift.S deleted +0 -457

457 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/pentium4/mmx/mpih-rshift.S deleted +0 -453

453 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/pentium4/sse2/mpih-add1.S deleted +0 -91

91 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/pentium4/sse2/mpih-mul1.S deleted +0 -96

96 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/pentium4/sse2/mpih-mul2.S deleted +0 -136

136 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/pentium4/sse2/mpih-mul3.S deleted +0 -127

127 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/pentium4/sse2/mpih-sub1.S deleted +0 -112

112 lines not on this page · raw message

grub-core/lib/libgcrypt/mpi/power/Manifest deleted +0 -27
deleted file mode 100644
index c60fc23c2..000000000

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/power/distfiles +0 -1
index e1bc008bc..e664c8db6 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/power/mpih-add1.S +2 -2
index 876b56c66..b992f1582 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/power/mpih-lshift.S +2 -2
index d9e42daf8..1fcd1891c 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/power/mpih-mul1.S +2 -2
index 35034fa40..5876443c6 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/power/mpih-mul2.S +2 -2
index d056e8f3c..5b91101e5 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/power/mpih-mul3.S +2 -2
index 8bc317b76..8d54e84e4 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/power/mpih-rshift.S +2 -2
index f131a86d7..aca51abf1 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/power/mpih-sub1.S +2 -2
index 02748fc55..03a8d9da6 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/powerpc32/Manifest deleted +0 -28
deleted file mode 100644
index 26ab6ea3e..000000000

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/powerpc32/distfiles +0 -1
index a08661489..af10d795b 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/powerpc32/mpih-add1.S +5 -4
index 1661f5e67..cd5929433 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/powerpc32/mpih-lshift.S +4 -4
index 6231095dc..0f66a4030 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/powerpc32/mpih-mul1.S +5 -5
index bd418f7e3..75ff66af6 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/powerpc32/mpih-mul2.S +5 -5
index 1d97b81a4..bb3c81d5d 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/powerpc32/mpih-mul3.S +5 -4
index c410dbb02..196fca1cb 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/powerpc32/mpih-rshift.S +5 -5
index 98349edb5..f6702ad17 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/powerpc32/mpih-sub1.S +5 -4
index d612ea890..42672423b 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/powerpc32/syntax.h +3 -2
index 5d4af9f0a..5f4e6cf6c 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/sparc32/Manifest deleted +0 -24
deleted file mode 100644
index d279229b0..000000000

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/sparc32/distfiles +0 -1
index a20f18ead..51329dbdb 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/sparc32/mpih-add1.S +2 -2
index 61a80ca32..d3488f514 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/sparc32/mpih-lshift.S +2 -2
index 3422ab04e..4d544ede2 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/sparc32/mpih-rshift.S +2 -2
index cd3db41df..a8552d79c 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/sparc32/udiv.S +2 -2
index 006b5c125..04841fffc 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/sparc32v8/Manifest deleted +0 -23
deleted file mode 100644
index dc1ce6a8e..000000000

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/sparc32v8/distfiles +0 -1
index 6e9a53091..2fcb0d1aa 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/sparc32v8/mpih-mul1.S +2 -2
index 03fcddab0..162416b71 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/sparc32v8/mpih-mul2.S +2 -2
index 6f5cc436a..a94098363 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/sparc32v8/mpih-mul3.S +2 -2
index 93bb19433..467484962 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/supersparc/Manifest deleted +0 -21
deleted file mode 100644
index 869b97bdb..000000000

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/supersparc/distfiles +0 -1
index ef7c0a538..550601cb5 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/mpi/supersparc/udiv.S +2 -2
index 79e506a11..2582e358a 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/src/ChangeLog-2011 +69 -6

75 lines not on this page · raw message

grub-core/lib/libgcrypt/src/Makefile.am +58 -35

93 lines not on this page · raw message

grub-core/lib/libgcrypt/src/Manifest deleted +0 -58

58 lines not on this page · raw message

grub-core/lib/libgcrypt/src/ath.c deleted +0 -344

344 lines not on this page · raw message

grub-core/lib/libgcrypt/src/ath.h deleted +0 -147

147 lines not on this page · raw message

grub-core/lib/libgcrypt/src/cipher-proto.h +199 -49

248 lines not on this page · raw message

grub-core/lib/libgcrypt/src/cipher.h +108 -59

167 lines not on this page · raw message

grub-core/lib/libgcrypt/src/const-time.c new file +88 -0

88 lines not on this page · raw message

grub-core/lib/libgcrypt/src/const-time.h new file +167 -0

167 lines not on this page · raw message

grub-core/lib/libgcrypt/src/context.c new file +154 -0

154 lines not on this page · raw message

grub-core/lib/libgcrypt/src/context.h new file +33 -0
new file mode 100644
index 000000000..21a1f5dba

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/src/dumpsexp.c +14 -11
index f6384d7d5..ae6563591 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/src/ec-context.h new file +107 -0

107 lines not on this page · raw message

grub-core/lib/libgcrypt/src/fips.c +562 -248

810 lines not on this page · raw message

grub-core/lib/libgcrypt/src/g10lib.h +240 -44

284 lines not on this page · raw message

grub-core/lib/libgcrypt/src/gcrypt-int.h new file +595 -0

595 lines not on this page · raw message

grub-core/lib/libgcrypt/src/gcrypt-module.h deleted +0 -240

240 lines not on this page · raw message

grub-core/lib/libgcrypt/src/gcrypt-testapi.h new file +70 -0

70 lines not on this page · raw message

grub-core/lib/libgcrypt/src/gcrypt.h.in +843 -511

1,354 lines not on this page · raw message

grub-core/lib/libgcrypt/src/gcryptrnd.c deleted +0 -680

680 lines not on this page · raw message

grub-core/lib/libgcrypt/src/gen-note-integrity.sh new file +123 -0

123 lines not on this page · raw message

grub-core/lib/libgcrypt/src/getrandom.c deleted +0 -326

326 lines not on this page · raw message

grub-core/lib/libgcrypt/src/global.c +605 -306

911 lines not on this page · raw message

grub-core/lib/libgcrypt/src/hmac256.c +53 -36

89 lines not on this page · raw message

grub-core/lib/libgcrypt/src/hmac256.h +1 -1
index df28e7272..05700e0e0 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/src/hwf-arm.c new file +564 -0

564 lines not on this page · raw message

grub-core/lib/libgcrypt/src/hwf-common.h new file +28 -0
new file mode 100644
index 000000000..ebd045c53

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/src/hwf-ppc.c new file +247 -0

247 lines not on this page · raw message

grub-core/lib/libgcrypt/src/hwf-s390x.c new file +231 -0

231 lines not on this page · raw message

grub-core/lib/libgcrypt/src/hwf-x86.c new file +512 -0

512 lines not on this page · raw message

grub-core/lib/libgcrypt/src/hwfeatures.c +192 -134

326 lines not on this page · raw message

grub-core/lib/libgcrypt/src/libgcrypt-config.in +16 -4
index c052638cd..2456436ab 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/src/libgcrypt.def +119 -48

167 lines not on this page · raw message

grub-core/lib/libgcrypt/src/libgcrypt.m4 +155 -24

179 lines not on this page · raw message

grub-core/lib/libgcrypt/src/libgcrypt.pc.in new file +18 -0
new file mode 100644
index 000000000..325f5c2b6

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/src/libgcrypt.vers +60 -33

93 lines not on this page · raw message

grub-core/lib/libgcrypt/src/misc.c +381 -67

448 lines not on this page · raw message

grub-core/lib/libgcrypt/src/missing-string.c +2 -2
index 4756c00ea..434076168 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/src/module.c deleted +0 -212

212 lines not on this page · raw message

grub-core/lib/libgcrypt/src/mpi.h +141 -82

223 lines not on this page · raw message

grub-core/lib/libgcrypt/src/mpicalc.c new file +627 -0

627 lines not on this page · raw message

grub-core/lib/libgcrypt/src/secmem.c +413 -208

621 lines not on this page · raw message

grub-core/lib/libgcrypt/src/secmem.h +10 -7
index 29e151af4..3ed883546 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/src/sexp.c +1034 -356

1,390 lines not on this page · raw message

grub-core/lib/libgcrypt/src/stdmem.c +19 -126

145 lines not on this page · raw message

grub-core/lib/libgcrypt/src/stdmem.h +5 -8
index b476e7e50..12de9d4f8 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/src/types.h +84 -76

160 lines not on this page · raw message

grub-core/lib/libgcrypt/src/versioninfo.rc.in +1 -1
index 3199521c9..f87d0d059 100644

Lines of this file are not shown. View the raw message.

grub-core/lib/libgcrypt/src/visibility.c +638 -358

996 lines not on this page · raw message

grub-core/lib/libgcrypt/src/visibility.h +488 -746

1,234 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.39.2

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

Part of the diff is not shown here. View the raw message.

#1 lore raw

PATCH v6 2/6 Import b64dec from gpg-error

Base on libgpg-error 1.49 but with modifications to make it compile in GRUB environment

---
 grub-core/lib/b64dec.c | 293 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 293 insertions(+)
 create mode 100644 grub-core/lib/b64dec.c
grub-core/lib/b64dec.c new file +293 -0
new file mode 100644
index 000000000..8aafa9700
@@ -0,0 +1,293 @@
+/* b64dec.c - Simple Base64 decoder.
+ * Copyright (C) 2008, 2011 Free Software Foundation, Inc.
+ * Copyright (C) 2008, 2011, 2016 g10 Code GmbH
+ *
+ * This file is part of Libgpg-error.
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
+ * This file was originally a part of GnuPG.
+ */
+
+#include <config.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <grub/crypto.h>
+
+struct _gpgrt_b64state
+{
+  int idx;
+  int quad_count;
+  char *title;
+  unsigned char radbuf[4];
+  unsigned int crc;
+  gpg_err_code_t lasterr;
+  unsigned int flags;
+  unsigned int stop_seen:1;
+  unsigned int invalid_encoding:1;
+  unsigned int using_decoder:1;
+};
+
+
+/* The reverse base-64 list used for base-64 decoding. */
+static unsigned char const asctobin[128] =
+  {
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0xff, 0xff, 0x3e, 0xff, 0xff, 0xff, 0x3f,
+    0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b,
+    0x3c, 0x3d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
+    0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
+    0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
+    0x17, 0x18, 0x19, 0xff, 0xff, 0xff, 0xff, 0xff,
+    0xff, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
+    0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
+    0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
+    0x31, 0x32, 0x33, 0xff, 0xff, 0xff, 0xff, 0xff
+  };
+
+enum decoder_states
+  {
+    s_init, s_idle, s_lfseen, s_beginseen, s_waitheader, s_waitblank, s_begin,
+    s_b64_0, s_b64_1, s_b64_2, s_b64_3,
+    s_waitendtitle, s_waitend
+  };
+
+
+
+/* Allocate and initialize the context for the base64 decoder.  If
+   TITLE is NULL a plain base64 decoding is done.  If it is the empty
+   string the decoder will skip everything until a "-----BEGIN " line
+   has been seen, decoding ends at a "----END " line.  */
+gpgrt_b64state_t
+gpgrt_b64dec_start (const char *title)
+{
+  gpgrt_b64state_t state;
+  char *t = NULL;
+
+  if (title)
+    {
+      t = grub_strdup (title);
+      if (!t)
+        return NULL;
+    }
+
+  state = grub_calloc (1, sizeof (struct _gpgrt_b64state));
+  if (!state)
+    {
+      grub_free (t);
+      return NULL;
+    }
+
+  if (t)
+    {
+      state->title = t;
+      state->idx = s_init;
+    }
+  else
+    state->idx = s_b64_0;
+
+  state->using_decoder = 1;
+
+  return state;
+}
+
+
+/* Do in-place decoding of base-64 data of LENGTH in BUFFER.  Stores the
+   new length of the buffer at R_NBYTES. */
+gpg_err_code_t
+gpgrt_b64dec_proc (gpgrt_b64state_t state, void *buffer, size_t length,
+                    size_t *r_nbytes)
+{
+  enum decoder_states ds = state->idx;
+  unsigned char val = state->radbuf[0];
+  int pos = state->quad_count;
+  char *d, *s;
+
+  if (state->lasterr)
+    return state->lasterr;
+
+  if (state->stop_seen)
+    {
+      *r_nbytes = 0;
+      state->lasterr = GPG_ERR_EOF;
+      grub_free (state->title);
+      state->title = NULL;
+      return state->lasterr;
+    }
+
+  for (s=d=buffer; length && !state->stop_seen; length--, s++)
+    {
+    again:
+      switch (ds)
+        {
+        case s_idle:
+          if (*s == '\n')
+            {
+              ds = s_lfseen;
+              pos = 0;
+            }
+          break;
+        case s_init:
+          ds = s_lfseen;
+          /* Fall through */
+        case s_lfseen:
+          if (*s != "-----BEGIN "[pos])
+            {
+              ds = s_idle;
+              goto again;
+            }
+          else if (pos == 10)
+            {
+              pos = 0;
+              ds = s_beginseen;
+            }
+          else
+            pos++;
+          break;
+        case s_beginseen:
+          if (*s != "PGP "[pos])
+            ds = s_begin; /* Not a PGP armor.  */
+          else if (pos == 3)
+            ds = s_waitheader;
+          else
+            pos++;
+          break;
+        case s_waitheader:
+          if (*s == '\n')
+            ds = s_waitblank;
+          break;
+        case s_waitblank:
+          if (*s == '\n')
+            ds = s_b64_0; /* blank line found.  */
+          else if (*s == ' ' || *s == '\r' || *s == '\t')
+            ; /* Ignore spaces. */
+          else
+            {
+              /* Armor header line.  Note that we don't care that our
+               * FSM accepts a header prefixed with spaces.  */
+              ds = s_waitheader; /* Wait for next header.  */
+            }
+          break;
+        case s_begin:
+          if (*s == '\n')
+            ds = s_b64_0;
+          break;
+        case s_b64_0:
+        case s_b64_1:
+        case s_b64_2:
+        case s_b64_3:
+          {
+            int c;
+
+            if (*s == '-' && state->title)
+              {
+                /* Not a valid Base64 character: assume end
+                   header.  */
+                ds = s_waitend;
+              }
+            else if (*s == '=')
+              {
+                /* Pad character: stop */
+                if (ds == s_b64_1)
+                  *d++ = val;
+                ds = state->title? s_waitendtitle : s_waitend;
+              }
+            else if (*s == '\n' || *s == ' ' || *s == '\r' || *s == '\t')
+              ; /* Skip white spaces. */
+            else if ( (*s & 0x80)
+                      || (c = asctobin[*(unsigned char *)s]) == 255)
+              {
+                /* Skip invalid encodings.  */
+                state->invalid_encoding = 1;
+              }
+            else if (ds == s_b64_0)
+              {
+                val = c << 2;
+                ds = s_b64_1;
+              }
+            else if (ds == s_b64_1)
+              {
+                val |= (c>>4)&3;
+                *d++ = val;
+                val = (c<<4)&0xf0;
+                ds = s_b64_2;
+              }
+            else if (ds == s_b64_2)
+              {
+                val |= (c>>2)&15;
+                *d++ = val;
+                val = (c<<6)&0xc0;
+                ds = s_b64_3;
+              }
+            else
+              {
+                val |= c&0x3f;
+                *d++ = val;
+                ds = s_b64_0;
+              }
+          }
+          break;
+        case s_waitendtitle:
+          if (*s == '-')
+            ds = s_waitend;
+          break;
+        case s_waitend:
+          if ( *s == '\n')
+            state->stop_seen = 1;
+          break;
+        default:
+          grub_fatal ("invalid state");
+        }
+    }
+
+
+  state->idx = ds;
+  state->radbuf[0] = val;
+  state->quad_count = pos;
+  *r_nbytes = (d -(char*) buffer);
+  return 0;
+}
+
+
+/* Return an error code in case an encoding error has been found
+   during decoding. */
+gpg_err_code_t
+gpgrt_b64dec_finish (gpgrt_b64state_t state)
+{
+  gpg_error_t err;
+
+  if (!state)
+    return 0;  /* Already released.  */
+
+  if (!state->using_decoder)
+    err = GPG_ERR_CONFLICT;  /* State was allocated for the encoder.  */
+  else if (state->lasterr)
+    err = state->lasterr;
+  else
+    {
+      grub_free (state->title);
+      err = state->invalid_encoding? GPG_ERR_BAD_DATA : 0;
+    }
+  grub_free (state);
+
+  return err;
+}
Signature · 7 lines
2.39.2


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#2 lore raw

PATCH v6 3/6 Adjust import script, definitions and API users for libgcrypt 1.11

In reply to Vladimir Serbinenko
---
 autogen.sh                                    |   5 +
 conf/Makefile.common                          |   4 +-
 grub-core/Makefile.core.def                   |  36 ++-
 grub-core/commands/hashsum.c                  |   2 +-
 grub-core/commands/legacycfg.c                |   6 +-
 grub-core/commands/pgp.c                      | 114 +++-----
 grub-core/commands/xnu_uuid.c                 |   2 +-
 grub-core/disk/cryptodisk.c                   |   2 +-
 grub-core/io/gzio.c                           |   2 +-
 grub-core/io/lzopio.c                         |   2 +-
 grub-core/lib/adler32.c                       |  21 +-
 grub-core/lib/crc64.c                         |  24 +-
 grub-core/lib/crypto.c                        | 245 +++++++++++++++-
 grub-core/lib/libgcrypt-patches/01_md.patch   | 207 ++++++++++++++
 .../03_disable_rsa_shake.patch                |  34 +++
 .../libgcrypt-patches/04_aria_static.patch    |  22 ++
 grub-core/lib/libgcrypt/src/gcrypt-int.h      |  51 ----
 grub-core/lib/libgcrypt_wrap/cipher_wrap.h    |  13 +-
 grub-core/lib/libgcrypt_wrap/mem.c            |  83 +++++-
 grub-core/lib/posix_wrap/sys/types.h          |   4 +
 grub-core/lib/xzembed/xz_dec_stream.c         |  18 +-
 include/grub/crypto.h                         | 263 +++++++++++++++---
 include/grub/gcrypt/gpg-error.h               |  29 ++
 util/grub-fstest.c                            |   2 +-
 util/import_gcry.py                           | 193 +++++++++----
 util/import_gcrypt_inth.sed                   |  17 ++
 util/import_gcrypth.sed                       |   2 -
 27 files changed, 1121 insertions(+), 282 deletions(-)
 create mode 100644 grub-core/lib/libgcrypt-patches/01_md.patch
 create mode 100644 grub-core/lib/libgcrypt-patches/03_disable_rsa_shake.patch
 create mode 100644 grub-core/lib/libgcrypt-patches/04_aria_static.patch
 create mode 100644 util/import_gcrypt_inth.sed
autogen.sh +5 -0
index 195daa541..05bc9b2f0 100755
@@ -35,6 +35,7 @@ ${PYTHON} util/import_unicode.py unicode/UnicodeData.txt unicode/BidiMirroring.t
 echo "Importing libgcrypt..."
 ${PYTHON} util/import_gcry.py grub-core/lib/libgcrypt/ grub-core
 sed -n -f util/import_gcrypth.sed < grub-core/lib/libgcrypt/src/gcrypt.h.in > include/grub/gcrypt/gcrypt.h
+sed -n -f util/import_gcrypt_inth.sed < grub-core/lib/libgcrypt/src/gcrypt-int.h >> include/grub/gcrypt/gcrypt.h
 if [ -f include/grub/gcrypt/g10lib.h ]; then
     rm include/grub/gcrypt/g10lib.h
 fi
@@ -51,6 +52,10 @@ for x in mpi-asm-defs.h mpih-add1.c mpih-sub1.c mpih-mul1.c mpih-mul2.c mpih-mul
     cp grub-core/lib/libgcrypt-grub/mpi/generic/"$x" grub-core/lib/libgcrypt-grub/mpi/"$x"
 done
 
+for x in grub-core/lib/libgcrypt-patches/*.patch; do
+    patch -i $x -p1
+done
+
 echo "Generating Automake input..."
 
 # Automake doesn't like including files from a path outside the project.
conf/Makefile.common +2 -2
index c60f55386..5cada4568 100644
@@ -81,8 +81,8 @@ CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/lib/gnulib -I$(top_srcdir)/grub-co
 CFLAGS_POSIX = -fno-builtin
 CPPFLAGS_POSIX = -I$(top_srcdir)/grub-core/lib/posix_wrap
 
-CFLAGS_GCRY = -Wno-error -Wno-missing-field-initializers -Wno-redundant-decls -Wno-undef $(CFLAGS_POSIX)
-CPPFLAGS_GCRY = -I$(top_srcdir)/grub-core/lib/libgcrypt_wrap $(CPPFLAGS_POSIX) -D_GCRYPT_IN_LIBGCRYPT=1 -I$(top_srcdir)/include/grub/gcrypt
+CFLAGS_GCRY = -Wno-error=sign-compare -Wno-missing-field-initializers -Wno-redundant-decls -Wno-undef $(CFLAGS_POSIX)
+CPPFLAGS_GCRY = -I$(top_srcdir)/grub-core/lib/libgcrypt_wrap $(CPPFLAGS_POSIX) -D_GCRYPT_IN_LIBGCRYPT=1 -D_GCRYPT_CONFIG_H_INCLUDED=1 -DHAVE_STRTOUL=1 -I$(top_srcdir)/include/grub/gcrypt
 
 CPPFLAGS_EFIEMU = -I$(top_srcdir)/grub-core/efiemu/runtime
 
grub-core/Makefile.core.def +34 -2
index 705d73fab..799e4d471 100644
@@ -975,8 +975,8 @@ module = {
 module = {
   name = pgp;
   common = commands/pgp.c;
-  cflags = '$(CFLAGS_POSIX)';
-  cppflags = '-I$(srcdir)/lib/posix_wrap';
+  cflags = '$(CFLAGS_GCRY) -Wno-redundant-decls -Wno-sign-compare';
+  cppflags = '$(CPPFLAGS_GCRY)';
 };
 
 module = {
@@ -2175,6 +2175,22 @@ module = {
   common = tests/setjmp_test.c;
 };
 
+module = {
+  name = dsa_sexp_test;
+  common = tests/dsa_sexp_test.c;
+
+  cflags = '$(CFLAGS_GCRY) -Wno-redundant-decls -Wno-sign-compare';
+  cppflags = '$(CPPFLAGS_GCRY)';
+};
+
+module = {
+  name = rsa_sexp_test;
+  common = tests/rsa_sexp_test.c;
+
+  cflags = '$(CFLAGS_GCRY) -Wno-redundant-decls -Wno-sign-compare';
+  cppflags = '$(CPPFLAGS_GCRY)';
+};
+
 module = {
   name = signature_test;
   common = tests/signature_test.c;
@@ -2529,7 +2545,23 @@ module = {
   common = lib/libgcrypt-grub/mpi/mpicoder.c;
   common = lib/libgcrypt-grub/mpi/mpih-rshift.c;
   common = lib/libgcrypt-grub/mpi/mpi-inline.c;
+  common = lib/libgcrypt-grub/mpi/mpih-const-time.c;
+  common = lib/libgcrypt-grub/mpi/mpi-scan.c;
+  common = lib/libgcrypt-grub/src/const-time.c;
   common = lib/libgcrypt_wrap/mem.c;
+  common = lib/libgcrypt-grub/cipher/md.c;
+
+  cflags = '$(CFLAGS_GCRY) -Wno-redundant-decls -Wno-sign-compare -Wno-unused-but-set-variable';
+  cppflags = '$(CPPFLAGS_GCRY)';
+};
+
+module = {
+  name = pubkey;
+  common = lib/libgcrypt-grub/cipher/pubkey-util.c;
+  common = lib/libgcrypt-grub/cipher/rsa-common.c;
+  common = lib/libgcrypt-grub/cipher/dsa-common.c;
+  common = lib/libgcrypt-grub/src/sexp.c;
+  common = lib/b64dec.c;
 
   cflags = '$(CFLAGS_GCRY) -Wno-redundant-decls -Wno-sign-compare';
   cppflags = '$(CPPFLAGS_GCRY)';
grub-core/commands/hashsum.c +1 -1
index d56b5b0bb..b6f8e3d1a 100644
@@ -73,7 +73,7 @@ hash_file (grub_file_t file, const gcry_md_spec_t *hash, void *result)
   if (!readbuf || !context)
     goto fail;
 
-  hash->init (context);
+  hash->init (context, 0);
   while (1)
     {
       grub_ssize_t r;
grub-core/commands/legacycfg.c +3 -3
index e9e9d94ef..052bb110d 100644
@@ -625,7 +625,7 @@ check_password_md5_real (const char *entered,
   if (!ctx)
     return 0;
 
-  GRUB_MD_MD5->init (ctx);
+  GRUB_MD_MD5->init (ctx, 0);
   GRUB_MD_MD5->write (ctx, entered, enteredlen);
   GRUB_MD_MD5->write (ctx, pw->salt + 3, pw->saltlen - 3);
   GRUB_MD_MD5->write (ctx, entered, enteredlen);
@@ -633,7 +633,7 @@ check_password_md5_real (const char *entered,
   GRUB_MD_MD5->final (ctx);
   grub_memcpy (alt_result, digest, MD5_HASHLEN);
 
-  GRUB_MD_MD5->init (ctx);
+  GRUB_MD_MD5->init (ctx, 0);
   GRUB_MD_MD5->write (ctx, entered, enteredlen);
   GRUB_MD_MD5->write (ctx, pw->salt, pw->saltlen); /* include the $1$ header */
   for (i = enteredlen; i > 16; i -= 16)
@@ -649,7 +649,7 @@ check_password_md5_real (const char *entered,
     {
       grub_memcpy (alt_result, digest, 16);
 
-      GRUB_MD_MD5->init (ctx);
+      GRUB_MD_MD5->init (ctx, 0);
       if ((i & 1) != 0)
 	GRUB_MD_MD5->write (ctx, entered, enteredlen);
       else
grub-core/commands/pgp.c +33 -81

197 lines not on this page · raw message

grub-core/commands/xnu_uuid.c +1 -1
index ae4b3a415..1406c43f5 100644
@@ -68,7 +68,7 @@ grub_cmd_xnu_uuid (grub_command_t cmd __attribute__ ((unused)),
   ctx = grub_zalloc (GRUB_MD_MD5->contextsize);
   if (!ctx)
     return grub_errno;
-  GRUB_MD_MD5->init (ctx);
+  GRUB_MD_MD5->init (ctx, 0);
   GRUB_MD_MD5->write (ctx, hash_prefix, sizeof (hash_prefix));
   GRUB_MD_MD5->write (ctx, &serial, sizeof (serial));
   GRUB_MD_MD5->final (ctx);
grub-core/disk/cryptodisk.c +1 -1
index 5e1eb2743..e52a7ebb5 100644
@@ -297,7 +297,7 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev,
 	      return GPG_ERR_OUT_OF_MEMORY;
 
 	    tmp = grub_cpu_to_le64 (sector << log_sector_size);
-	    dev->iv_hash->init (ctx);
+	    dev->iv_hash->init (ctx, 0);
 	    dev->iv_hash->write (ctx, dev->iv_prefix, dev->iv_prefix_len);
 	    dev->iv_hash->write (ctx, &tmp, sizeof (tmp));
 	    dev->iv_hash->final (ctx);
grub-core/io/gzio.c +1 -1
index cb7eb1fe3..fa9d942b2 100644
@@ -1201,7 +1201,7 @@ initialize_tables (grub_gzio_t gzio)
   gzio->td = NULL;
 
   if (gzio->hcontext)
-    gzio->hdesc->init(gzio->hcontext);
+    gzio->hdesc->init(gzio->hcontext, 0);
 }
 
 
grub-core/io/lzopio.c +1 -1
index a7d442543..cea942308 100644
@@ -345,7 +345,7 @@ test_header (grub_file_t file)
     if (! context)
       return 0;
 
-    hcheck->init(context);
+    hcheck->init(context, 0);
 
     /* MAGIC is not included in check calculation.  */
     hcheck->write(context, &header.lzop_version, sizeof(header)- LZOP_MAGIC_SIZE);
grub-core/lib/adler32.c +16 -5
index 43b68af62..f849ccee6 100644
@@ -29,10 +29,12 @@ struct adler32_context
 };
 
 static void
-adler32_init (void *context)
+adler32_init (void *context, unsigned int flags)
 {
   struct adler32_context *ctx = context;
 
+  (void) flags;
+
   ctx->a = 1;
   ctx->b = 0;
 }
@@ -81,13 +83,22 @@ adler32_read (void *context)
 
 static gcry_md_spec_t spec_adler32 =
   {
-    "ADLER32", 0, 0, 0, 4,
-    adler32_init, adler32_write, adler32_final, adler32_read,
-    sizeof (struct adler32_context),
+    .algo = GCRY_MD_ADLER32,
+    .flags = {.disabled = 0, .fips = 0},
+    .name = "ADLER32",
+    .asnoid = NULL,
+    .asnlen = 0,
+    .oids = NULL,
+    .mdlen = 4,
+    .init = adler32_init,
+    .write = adler32_write,
+    .final = adler32_final,
+    .read = adler32_read,
+    .contextsize = sizeof (struct adler32_context),
+    .blocksize = 64,
 #ifdef GRUB_UTIL
     .modname = "adler32",
 #endif
-    .blocksize = 64
   };
 
 
grub-core/lib/crc64.c +19 -5
index 4960f3f89..c231fa97c 100644
@@ -61,8 +61,10 @@ init_crc64_table (void)
 }
 
 static void
-crc64_init (void *context)
+crc64_init (void *context, unsigned int flags)
 {
+  (void) flags;
+
   if (! crc64_table[1])
     init_crc64_table ();
   *(grub_uint64_t *) context = 0;
@@ -97,10 +99,22 @@ crc64_final (void *context __attribute__ ((unused)))
 
 gcry_md_spec_t _gcry_digest_spec_crc64 =
   {
-    "CRC64", 0, 0, 0, 8,
-    crc64_init, crc64_write, crc64_final, crc64_read,
-    sizeof (grub_uint64_t),
-    .blocksize = 64
+    .algo = GCRY_MD_CRC64,
+    .flags = {.disabled = 0, .fips = 0},
+    .name = "CRC64",
+    .asnoid = NULL,
+    .asnlen = 0,
+    .oids = NULL,
+    .mdlen = 8,
+    .init = crc64_init,
+    .write = crc64_write,
+    .final = crc64_final,
+    .read = crc64_read,
+    .contextsize = sizeof (grub_uint64_t),
+    .blocksize = 64,
+#ifdef GRUB_UTIL
+    .modname = "crc64",
+#endif
   };
 
 GRUB_MOD_INIT(crc64)
grub-core/lib/crypto.c +234 -11

311 lines not on this page · raw message

grub-core/lib/libgcrypt-patches/01_md.patch new file +207 -0

207 lines not on this page · raw message

grub-core/lib/libgcrypt-patches/03_disable_rsa_shake.patch new file +34 -0
new file mode 100644
index 000000000..cf43f0451
@@ -0,0 +1,34 @@
+--- a/grub-core/lib/libgcrypt-grub/cipher/rsa-common.c	2024-09-08 18:08:47.095956852 +0300
++++ b/grub-core/lib/libgcrypt-grub/cipher/rsa-common.c	2024-09-08 18:10:23.849959591 +0300
+@@ -912,6 +912,7 @@
+   memcpy (p, salt, saltlen);
+ 
+   /* Step 9: dbmask = MGF(H, emlen - hlen - 1).  */
++#if 0 // Not supported yet
+   if (algo == GCRY_MD_SHAKE128 || algo == GCRY_MD_SHAKE256)
+     {
+       gcry_buffer_t iov;
+@@ -925,6 +926,7 @@
+                                      &iov, 1);
+     }
+   else
++#endif
+     mgf1 (dbmask, emlen - hlen - 1, h, hlen, algo);
+ 
+   /* Step 10: maskedDB = DB ^ dbMask */
+@@ -1086,6 +1088,7 @@
+     }
+ 
+   /* Step 7: dbmask = MGF(H, emlen - hlen - 1).  */
++#if 0 // Not supported yet
+   if (algo == GCRY_MD_SHAKE128 || algo == GCRY_MD_SHAKE256)
+     {
+       gcry_buffer_t iov;
+@@ -1099,6 +1102,7 @@
+                                      &iov, 1);
+     }
+   else
++#endif
+     mgf1 (dbmask, emlen - hlen - 1, h, hlen, algo);
+ 
+   /* Step 8: maskedDB = DB ^ dbMask.  */
grub-core/lib/libgcrypt-patches/04_aria_static.patch new file +22 -0
new file mode 100644
index 000000000..bca7e8062
@@ -0,0 +1,22 @@
+Mark aria_encrypt and aria_decrypt as static
+
+--- a/grub-core/lib/libgcrypt-grub/cipher/aria.c	2024-09-08 18:20:57.926977479 +0300
++++ b/grub-core/lib/libgcrypt-grub/cipher/aria.c	2024-09-08 18:21:09.731977812 +0300
+@@ -1013,7 +1013,7 @@
+   return 4 * sizeof(void *) + 4 * sizeof(u32); /* stack burn depth */
+ }
+ 
+-unsigned int
++static unsigned int
+ aria_encrypt(void *c, byte *outbuf, const byte *inbuf)
+ {
+   ARIA_context *ctx = (ARIA_context *)c;
+@@ -1023,7 +1023,7 @@
+   return aria_crypt (ctx, outbuf, inbuf, ctx->enc_key);
+ }
+ 
+-unsigned int
++static unsigned int
+ aria_decrypt(void *c, byte *outbuf, const byte *inbuf)
+ {
+   ARIA_context *ctx = (ARIA_context *)c;
grub-core/lib/libgcrypt/src/gcrypt-int.h +0 -51

57 lines not on this page · raw message

grub-core/lib/libgcrypt_wrap/cipher_wrap.h +11 -2
index 42835493d..08efb30b3 100644
@@ -19,6 +19,8 @@
 #ifndef GRUB_GCRY_WRAP_HEADER
 #define GRUB_GCRY_WRAP_HEADER 1
 
+#define USE_SHA512 1
+
 #include <grub/types.h>
 #include <grub/mm.h>
 #include <grub/misc.h>
@@ -35,10 +37,9 @@
 #undef __GNU_LIBRARY__
 #define __GNU_LIBRARY__ 1
 
+#define UINT64_C(c) (c ## ULL)
 #define U64_C(c) (c ## ULL)
 
-#define PUBKEY_FLAG_NO_BLINDING    (1 << 0)
-
 #define CIPHER_INFO_NO_WEAK_KEY    1
 
 #define HAVE_U64_TYPEDEF 1
@@ -74,4 +75,12 @@ _gcry_fips_mode (void)
 
 #define gcry_mpi_mod _gcry_mpi_mod
 
+#define strtol grub_strtol
+#define strtoul grub_strtoul
+#define atoi(nptr) (strtol((nptr), NULL, 10))
+
+#define stpcpy grub_stpcpy
+
+#define spec_from_algo grub_crypto_lookup_md_by_algo
+
 #endif
grub-core/lib/libgcrypt_wrap/mem.c +78 -5

118 lines not on this page · raw message

grub-core/lib/posix_wrap/sys/types.h +4 -0
index eeda543c4..9f7e22531 100644
@@ -39,12 +39,16 @@ typedef grub_int32_t int32_t;
 typedef grub_int64_t int64_t;
 
 #define HAVE_U64_TYPEDEF 1
+#define HAVE_TYPE_U64 1
 typedef grub_uint64_t u64;
 #define HAVE_U32_TYPEDEF 1
+#define HAVE_TYPE_U32 1
 typedef grub_uint32_t u32;
 #define HAVE_U16_TYPEDEF 1
+#define HAVE_TYPE_U16 1
 typedef grub_uint16_t u16;
 #define HAVE_BYTE_TYPEDEF 1
+#define HAVE_TYPE_BYTE 1
 typedef grub_uint8_t byte;
 
 typedef grub_addr_t uintptr_t;
grub-core/lib/xzembed/xz_dec_stream.c +9 -9
index 832d8af9a..f2dd42dc2 100644
@@ -425,9 +425,9 @@ static enum xz_ret hash_validate(struct xz_dec *s, struct xz_buf *b,
 
 #ifndef GRUB_EMBED_DECOMPRESSOR
 	if (s->hash)
-		s->hash->init(s->hash_context);
+		s->hash->init(s->hash_context, 0);
 	if (s->crc32)
-		s->crc32->init(s->crc32_context);
+		s->crc32->init(s->crc32_context, 0);
 #endif
 	s->have_hash_value = 0;
 	s->pos = 0;
@@ -493,7 +493,7 @@ static enum xz_ret dec_stream_header(struct xz_dec *s)
 		s->crc32_context = kmalloc(s->crc32->contextsize, GFP_KERNEL);
 		if (s->crc32_context == NULL)
 			return XZ_MEMLIMIT_ERROR;
-		s->crc32->init(s->crc32_context);
+		s->crc32->init(s->crc32_context, 0);
 	}
 #endif
 
@@ -531,9 +531,9 @@ static enum xz_ret dec_stream_header(struct xz_dec *s)
 				return XZ_MEMLIMIT_ERROR;
 			}
 
-			s->hash->init(s->hash_context);
-			s->hash->init(s->index.hash.hash_context);
- 			s->hash->init(s->block.hash.hash_context);
+			s->hash->init(s->hash_context, 0);
+			s->hash->init(s->index.hash.hash_context, 0);
+ 			s->hash->init(s->block.hash.hash_context, 0);
 		}
 #endif
 	}
@@ -1014,9 +1014,9 @@ void xz_dec_reset(struct xz_dec *s)
 #ifndef GRUB_EMBED_DECOMPRESSOR
 	if (s->hash)
 	{
-		s->hash->init(s->hash_context);
-		s->hash->init(s->index.hash.hash_context);
-		s->hash->init(s->block.hash.hash_context);
+		s->hash->init(s->hash_context, 0);
+		s->hash->init(s->index.hash.hash_context, 0);
+		s->hash->init(s->block.hash.hash_context, 0);
 	}
 #endif
 	s->have_hash_value = 0;
include/grub/crypto.h +220 -43

386 lines not on this page · raw message

include/grub/gcrypt/gpg-error.h +29 -0
index 1e4250284..966ebf82d 100644
@@ -29,4 +29,33 @@ gpg_err_source (gpg_error_t err __attribute__ ((unused)))
 gcry_err_code_t
 gpg_error_from_syserror (void);
 
+gcry_err_code_t
+gpg_err_code_from_syserror (void);
+
+gcry_err_code_t
+gpg_error_from_errno (int err);
+
+gcry_err_code_t
+gpg_err_code_from_errno (int err);
+
+static inline const char *
+gpg_strsource (gcry_error_t err __attribute__ ((unused)))
+{
+  return NULL;
+}
+
+static inline int
+gpg_err_code_to_errno (gcry_err_code_t code)
+{
+  return code ? 1 : 0;
+}
+
+static inline gcry_error_t
+gpg_err_make_from_errno (gpg_err_source_t source __attribute__ ((unused)), int err)
+{
+  return gpg_err_code_from_errno (err);
+}
+
+#define gpg_error(x) (x)
+
 #endif
util/grub-fstest.c +1 -1
index 7ff9037b8..24b20ab91 100644
@@ -365,7 +365,7 @@ static void
 cmd_crc (char *pathname)
 {
   grub_uint8_t *crc32_context = xmalloc (GRUB_MD_CRC32->contextsize);
-  GRUB_MD_CRC32->init(crc32_context);
+  GRUB_MD_CRC32->init(crc32_context, 0);
 
   read_file (pathname, crc_hook, crc32_context);
   GRUB_MD_CRC32->final(crc32_context);
util/import_gcry.py +138 -55

435 lines not on this page · raw message

util/import_gcrypt_inth.sed new file +17 -0
new file mode 100644
index 000000000..ebe9371ee
@@ -0,0 +1,17 @@
+/^#@INSERT_SYS_SELECT_H@/ d
+/^@FALLBACK_SOCKLEN_T@/ d
+/^# *include <stdlib\.h>/ d
+/^# *include <string\.h>/ d
+/^# *include <winsock2\.h>/ d
+/^# *include <ws2tcpip\.h>/ d
+/^# *include <time\.h>/ d
+/^# *include <sys\/socket\.h>/ d
+/^# *include <sys\/time\.h>/ d
+/^  typedef long ssize_t;/ d
+/^  typedef int  pid_t;/ d
+/^# *include <gpg-error\.h>/ s,#include <gpg-error.h>,#include <grub/gcrypt/gpg-error.h>,
+/^typedef gpg_error_t gcry_error_t;/ d
+/^typedef gpg_err_code_t gcry_err_code_t;/ d
+/^typedef struct gcry_mpi \*gcry_mpi_t;/ d
+/^#error  gcrypt.h already included/ d
+p
util/import_gcrypth.sed +0 -2
index fe6d1a072..503b4b547 100644
@@ -13,6 +13,4 @@
 /^typedef gpg_error_t gcry_error_t;/ d
 /^typedef gpg_err_code_t gcry_err_code_t;/ d
 /^typedef struct gcry_mpi \*gcry_mpi_t;/ d
-/^struct gcry_thread_cbs/ d
-s,_gcry_mpi_invm,gcry_mpi_invm,g
 p
\ No newline at end of file
Signature · 7 lines
2.39.2


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#3 lore raw

Re: [PATCH v6 3/6] Adjust import script, definitions and API users for libgcrypt 1.11

Quoted 1,213 lines · On Wed, 11 Sep 2024 12:34:18 +0300 Vladimir Serbinenko <[email protected]>…
---
 autogen.sh                                    |   5 +
 conf/Makefile.common                          |   4 +-
 grub-core/Makefile.core.def                   |  36 ++-
 grub-core/commands/hashsum.c                  |   2 +-
 grub-core/commands/legacycfg.c                |   6 +-
 grub-core/commands/pgp.c                      | 114 +++-----
 grub-core/commands/xnu_uuid.c                 |   2 +-
 grub-core/disk/cryptodisk.c                   |   2 +-
 grub-core/io/gzio.c                           |   2 +-
 grub-core/io/lzopio.c                         |   2 +-
 grub-core/lib/adler32.c                       |  21 +-
 grub-core/lib/crc64.c                         |  24 +-
 grub-core/lib/crypto.c                        | 245 +++++++++++++++-
 grub-core/lib/libgcrypt-patches/01_md.patch   | 207 ++++++++++++++
 .../03_disable_rsa_shake.patch                |  34 +++
 .../libgcrypt-patches/04_aria_static.patch    |  22 ++
 grub-core/lib/libgcrypt/src/gcrypt-int.h      |  51 ----
 grub-core/lib/libgcrypt_wrap/cipher_wrap.h    |  13 +-
 grub-core/lib/libgcrypt_wrap/mem.c            |  83 +++++-
 grub-core/lib/posix_wrap/sys/types.h          |   4 +
 grub-core/lib/xzembed/xz_dec_stream.c         |  18 +-
 include/grub/crypto.h                         | 263 +++++++++++++++---
 include/grub/gcrypt/gpg-error.h               |  29 ++
 util/grub-fstest.c                            |   2 +-
 util/import_gcry.py                           | 193 +++++++++----
 util/import_gcrypt_inth.sed                   |  17 ++
 util/import_gcrypth.sed                       |   2 -
 27 files changed, 1121 insertions(+), 282 deletions(-)
 create mode 100644 grub-core/lib/libgcrypt-patches/01_md.patch
 create mode 100644 grub-core/lib/libgcrypt-patches/03_disable_rsa_shake.patch
 create mode 100644 grub-core/lib/libgcrypt-patches/04_aria_static.patch
 create mode 100644 util/import_gcrypt_inth.sed
autogen.sh +5 -0
index 195daa541..05bc9b2f0 100755
@@ -35,6 +35,7 @@ ${PYTHON} util/import_unicode.py unicode/UnicodeData.txt unicode/BidiMirroring.t
 echo "Importing libgcrypt..."
 ${PYTHON} util/import_gcry.py grub-core/lib/libgcrypt/ grub-core
 sed -n -f util/import_gcrypth.sed < grub-core/lib/libgcrypt/src/gcrypt.h.in > include/grub/gcrypt/gcrypt.h
+sed -n -f util/import_gcrypt_inth.sed < grub-core/lib/libgcrypt/src/gcrypt-int.h >> include/grub/gcrypt/gcrypt.h
 if [ -f include/grub/gcrypt/g10lib.h ]; then
     rm include/grub/gcrypt/g10lib.h
 fi
@@ -51,6 +52,10 @@ for x in mpi-asm-defs.h mpih-add1.c mpih-sub1.c mpih-mul1.c mpih-mul2.c mpih-mul
     cp grub-core/lib/libgcrypt-grub/mpi/generic/"$x" grub-core/lib/libgcrypt-grub/mpi/"$x"
 done
 
+for x in grub-core/lib/libgcrypt-patches/*.patch; do
+    patch -i $x -p1
+done
+
 echo "Generating Automake input..."
 
 # Automake doesn't like including files from a path outside the project.
conf/Makefile.common +2 -2
index c60f55386..5cada4568 100644
@@ -81,8 +81,8 @@ CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/lib/gnulib -I$(top_srcdir)/grub-co
 CFLAGS_POSIX = -fno-builtin
 CPPFLAGS_POSIX = -I$(top_srcdir)/grub-core/lib/posix_wrap
 
-CFLAGS_GCRY = -Wno-error -Wno-missing-field-initializers -Wno-redundant-decls -Wno-undef $(CFLAGS_POSIX)
-CPPFLAGS_GCRY = -I$(top_srcdir)/grub-core/lib/libgcrypt_wrap $(CPPFLAGS_POSIX) -D_GCRYPT_IN_LIBGCRYPT=1 -I$(top_srcdir)/include/grub/gcrypt
+CFLAGS_GCRY = -Wno-error=sign-compare -Wno-missing-field-initializers -Wno-redundant-decls -Wno-undef $(CFLAGS_POSIX)
+CPPFLAGS_GCRY = -I$(top_srcdir)/grub-core/lib/libgcrypt_wrap $(CPPFLAGS_POSIX) -D_GCRYPT_IN_LIBGCRYPT=1 -D_GCRYPT_CONFIG_H_INCLUDED=1 -DHAVE_STRTOUL=1 -I$(top_srcdir)/include/grub/gcrypt
 
 CPPFLAGS_EFIEMU = -I$(top_srcdir)/grub-core/efiemu/runtime
 
grub-core/Makefile.core.def +34 -2
index 705d73fab..799e4d471 100644
@@ -975,8 +975,8 @@ module = {
 module = {
   name = pgp;
   common = commands/pgp.c;
-  cflags = '$(CFLAGS_POSIX)';
-  cppflags = '-I$(srcdir)/lib/posix_wrap';
+  cflags = '$(CFLAGS_GCRY) -Wno-redundant-decls -Wno-sign-compare';
+  cppflags = '$(CPPFLAGS_GCRY)';
 };
 
 module = {
@@ -2175,6 +2175,22 @@ module = {
   common = tests/setjmp_test.c;
 };
 
+module = {
+  name = dsa_sexp_test;
+  common = tests/dsa_sexp_test.c;
+
+  cflags = '$(CFLAGS_GCRY) -Wno-redundant-decls -Wno-sign-compare';
+  cppflags = '$(CPPFLAGS_GCRY)';
+};
+
+module = {
+  name = rsa_sexp_test;
+  common = tests/rsa_sexp_test.c;
+
+  cflags = '$(CFLAGS_GCRY) -Wno-redundant-decls -Wno-sign-compare';
+  cppflags = '$(CPPFLAGS_GCRY)';
+};
+
 module = {
   name = signature_test;
   common = tests/signature_test.c;
@@ -2529,7 +2545,23 @@ module = {
   common = lib/libgcrypt-grub/mpi/mpicoder.c;
   common = lib/libgcrypt-grub/mpi/mpih-rshift.c;
   common = lib/libgcrypt-grub/mpi/mpi-inline.c;
+  common = lib/libgcrypt-grub/mpi/mpih-const-time.c;
+  common = lib/libgcrypt-grub/mpi/mpi-scan.c;
+  common = lib/libgcrypt-grub/src/const-time.c;
   common = lib/libgcrypt_wrap/mem.c;
+  common = lib/libgcrypt-grub/cipher/md.c;
+
+  cflags = '$(CFLAGS_GCRY) -Wno-redundant-decls -Wno-sign-compare -Wno-unused-but-set-variable';
+  cppflags = '$(CPPFLAGS_GCRY)';
+};
+
+module = {
+  name = pubkey;
+  common = lib/libgcrypt-grub/cipher/pubkey-util.c;
+  common = lib/libgcrypt-grub/cipher/rsa-common.c;
+  common = lib/libgcrypt-grub/cipher/dsa-common.c;
+  common = lib/libgcrypt-grub/src/sexp.c;
+  common = lib/b64dec.c;
 
   cflags = '$(CFLAGS_GCRY) -Wno-redundant-decls -Wno-sign-compare';
   cppflags = '$(CPPFLAGS_GCRY)';
grub-core/commands/hashsum.c +1 -1
index d56b5b0bb..b6f8e3d1a 100644
@@ -73,7 +73,7 @@ hash_file (grub_file_t file, const gcry_md_spec_t *hash, void *result)
   if (!readbuf || !context)
     goto fail;
 
-  hash->init (context);
+  hash->init (context, 0);
   while (1)
     {
       grub_ssize_t r;
grub-core/commands/legacycfg.c +3 -3
index e9e9d94ef..052bb110d 100644
@@ -625,7 +625,7 @@ check_password_md5_real (const char *entered,
   if (!ctx)
     return 0;
 
-  GRUB_MD_MD5->init (ctx);
+  GRUB_MD_MD5->init (ctx, 0);
   GRUB_MD_MD5->write (ctx, entered, enteredlen);
   GRUB_MD_MD5->write (ctx, pw->salt + 3, pw->saltlen - 3);
   GRUB_MD_MD5->write (ctx, entered, enteredlen);
@@ -633,7 +633,7 @@ check_password_md5_real (const char *entered,
   GRUB_MD_MD5->final (ctx);
   grub_memcpy (alt_result, digest, MD5_HASHLEN);
 
-  GRUB_MD_MD5->init (ctx);
+  GRUB_MD_MD5->init (ctx, 0);
   GRUB_MD_MD5->write (ctx, entered, enteredlen);
   GRUB_MD_MD5->write (ctx, pw->salt, pw->saltlen); /* include the $1$ header */
   for (i = enteredlen; i > 16; i -= 16)
@@ -649,7 +649,7 @@ check_password_md5_real (const char *entered,
     {
       grub_memcpy (alt_result, digest, 16);
 
-      GRUB_MD_MD5->init (ctx);
+      GRUB_MD_MD5->init (ctx, 0);
       if ((i & 1) != 0)
 	GRUB_MD_MD5->write (ctx, entered, enteredlen);
       else
grub-core/commands/pgp.c +33 -81
index c6766f044..22eca97ff 100644
@@ -136,41 +136,27 @@ struct signature_v4_header
   grub_uint16_t hashed_sub;
 } GRUB_PACKED;
 
-const char *hashes[] = {
-  [0x01] = "md5",
-  [0x02] = "sha1",
-  [0x03] = "ripemd160",
-  [0x08] = "sha256",
-  [0x09] = "sha384",
-  [0x0a] = "sha512",
-  [0x0b] = "sha224"
-};
-
 struct gcry_pk_spec *grub_crypto_pk_dsa;
 struct gcry_pk_spec *grub_crypto_pk_ecdsa;
 struct gcry_pk_spec *grub_crypto_pk_rsa;
 
-static int
-dsa_pad (gcry_mpi_t *hmpi, grub_uint8_t *hval,
-	 const gcry_md_spec_t *hash, struct grub_public_subkey *sk);
-static int
-rsa_pad (gcry_mpi_t *hmpi, grub_uint8_t *hval,
-	 const gcry_md_spec_t *hash, struct grub_public_subkey *sk);
-
 struct
 {
   const char *name;
+  const char *sigsexp;
   grub_size_t nmpisig;
+  const char *pubsexp;
   grub_size_t nmpipub;
   struct gcry_pk_spec **algo;
-  int (*pad) (gcry_mpi_t *hmpi, grub_uint8_t *hval,
-	      const gcry_md_spec_t *hash, struct grub_public_subkey *sk);
+  const char *padding;
   const char *module;
 } pkalgos[] =
   {
-    [1] = { "rsa", 1, 2, &grub_crypto_pk_rsa, rsa_pad, "gcry_rsa" },
-    [3] = { "rsa", 1, 2, &grub_crypto_pk_rsa, rsa_pad, "gcry_rsa" },
-    [17] = { "dsa", 2, 4, &grub_crypto_pk_dsa, dsa_pad, "gcry_dsa" },
+    [1] = { "rsa", "(sig-val (rsa (s %M)))", 1, "(public-key (dsa (n %M) (e %M)))", 2, &grub_crypto_pk_rsa, "pkcs1", "gcry_rsa" },
+    [3] = { "rsa", "(sig-val (rsa (s %M)))", 1, "(public-key (dsa (n %M) (e %M)))", 2, &grub_crypto_pk_rsa, "pkcs1", "gcry_rsa" },
+    [17] = { "dsa", "(sig-val (dsa (r %M) (s %M)))", 2,
+	     "(public-key (dsa (p %M) (q %M) (g %M) (y %M)))",
+	     4, &grub_crypto_pk_dsa, "raw", "gcry_dsa" },
   };
 
 struct grub_public_key
@@ -196,7 +182,7 @@ free_pk (struct grub_public_key *pk)
       grub_size_t i;
       for (i = 0; i < ARRAY_SIZE (sk->mpis); i++)
 	if (sk->mpis[i])
-	  gcry_mpi_release (sk->mpis[i]);
+	  _gcry_mpi_release (sk->mpis[i]);
       nsk = sk->next;
       grub_free (sk);
     }
@@ -303,7 +289,7 @@ grub_load_public_key (grub_file_t f)
 	goto fail;
 
       grub_memset (fingerprint_context, 0, GRUB_MD_SHA1->contextsize);
-      GRUB_MD_SHA1->init (fingerprint_context);
+      GRUB_MD_SHA1->init (fingerprint_context, 0);
       GRUB_MD_SHA1->write (fingerprint_context, "\x99", 1);
       len_be = grub_cpu_to_be16 (len);
       GRUB_MD_SHA1->write (fingerprint_context, &len_be, sizeof (len_be));
@@ -336,7 +322,7 @@ grub_load_public_key (grub_file_t f)
 
 	  GRUB_MD_SHA1->write (fingerprint_context, buffer, lb + sizeof (grub_uint16_t));
 
-	  if (gcry_mpi_scan (&sk->mpis[i], GCRYMPI_FMT_PGP,
+	  if (_gcry_mpi_scan (&sk->mpis[i], GCRYMPI_FMT_PGP,
 			     buffer, lb + sizeof (grub_uint16_t), 0))
 	    {
 	      grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
@@ -394,51 +380,6 @@ grub_crypto_pk_locate_subkey_in_trustdb (grub_uint64_t keyid)
   return 0;
 }
 
-
-static int
-dsa_pad (gcry_mpi_t *hmpi, grub_uint8_t *hval,
-	 const gcry_md_spec_t *hash, struct grub_public_subkey *sk)
-{
-  unsigned nbits = gcry_mpi_get_nbits (sk->mpis[1]);
-  grub_dprintf ("crypt", "must be %u bits got %d bits\n", nbits,
-		(int)(8 * hash->mdlen));
-  return gcry_mpi_scan (hmpi, GCRYMPI_FMT_USG, hval,
-			nbits / 8 < (unsigned) hash->mdlen ? nbits / 8
-			: (unsigned) hash->mdlen, 0);
-}
-
-static int
-rsa_pad (gcry_mpi_t *hmpi, grub_uint8_t *hval,
-	 const gcry_md_spec_t *hash, struct grub_public_subkey *sk)
-{
-  grub_size_t tlen, emlen, fflen;
-  grub_uint8_t *em, *emptr;
-  unsigned nbits = gcry_mpi_get_nbits (sk->mpis[0]);
-  int ret;
-  tlen = hash->mdlen + hash->asnlen;
-  emlen = (nbits + 7) / 8;
-  if (emlen < tlen + 11)
-    return 1;
-
-  em = grub_malloc (emlen);
-  if (!em)
-    return 1;
-
-  em[0] = 0x00;
-  em[1] = 0x01;
-  fflen = emlen - tlen - 3;
-  for (emptr = em + 2; emptr < em + 2 + fflen; emptr++)
-    *emptr = 0xff;
-  *emptr++ = 0x00;
-  grub_memcpy (emptr, hash->asnoid, hash->asnlen);
-  emptr += hash->asnlen;
-  grub_memcpy (emptr, hval, hash->mdlen);
-
-  ret = gcry_mpi_scan (hmpi, GCRYMPI_FMT_USG, em, emlen, 0);
-  grub_free (em);
-  return ret;
-}
-
 struct grub_pubkey_context
 {
   grub_file_t sig;
@@ -483,15 +424,12 @@ grub_verify_signature_init (struct grub_pubkey_context *ctxt, grub_file_t sig)
   if (t != 0)
     return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
 
-  if (h >= ARRAY_SIZE (hashes) || hashes[h] == NULL)
-    return grub_error (GRUB_ERR_BAD_SIGNATURE, "unknown hash");
-
   if (pk >= ARRAY_SIZE (pkalgos) || pkalgos[pk].name == NULL)
     return grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
 
-  ctxt->hash = grub_crypto_lookup_md_by_name (hashes[h]);
+  ctxt->hash = grub_crypto_lookup_md_by_algo (h);
   if (!ctxt->hash)
-    return grub_error (GRUB_ERR_BAD_SIGNATURE, "hash `%s' not loaded", hashes[h]);
+    return grub_error (GRUB_ERR_BAD_SIGNATURE, "hash `%d' not loaded", h);
 
   grub_dprintf ("crypt", "alive\n");
 
@@ -499,7 +437,7 @@ grub_verify_signature_init (struct grub_pubkey_context *ctxt, grub_file_t sig)
   if (!ctxt->hash_context)
     return grub_errno;
 
-  ctxt->hash->init (ctxt->hash_context);
+  ctxt->hash->init (ctxt->hash_context, 0);
   ctxt->sig = sig;
 
   return GRUB_ERR_NONE;
@@ -528,7 +466,6 @@ grub_verify_signature_real (struct grub_pubkey_context *ctxt,
   grub_uint16_t unhashed_sub;
   grub_ssize_t r;
   grub_uint8_t hash_start[2];
-  gcry_mpi_t hmpi;
   grub_uint64_t keyid = 0;
   struct grub_public_subkey *sk;
 
@@ -620,7 +557,7 @@ grub_verify_signature_real (struct grub_pubkey_context *ctxt,
       grub_memcpy (readbuf, &l, sizeof (l));
       grub_dprintf ("crypt", "alive\n");
 
-      if (gcry_mpi_scan (&mpis[i], GCRYMPI_FMT_PGP,
+      if (_gcry_mpi_scan (&mpis[i], GCRYMPI_FMT_PGP,
 			 readbuf, lb + sizeof (grub_uint16_t), 0))
 	goto fail;
       grub_dprintf ("crypt", "alive\n");
@@ -638,8 +575,6 @@ grub_verify_signature_real (struct grub_pubkey_context *ctxt,
       goto fail;
     }
 
-  if (pkalgos[pk].pad (&hmpi, hval, ctxt->hash, sk))
-    goto fail;
   if (!*pkalgos[pk].algo)
     {
       grub_dl_load (pkalgos[pk].module);
@@ -652,7 +587,24 @@ grub_verify_signature_real (struct grub_pubkey_context *ctxt,
 		  pkalgos[pk].module);
       goto fail;
     }
-  if ((*pkalgos[pk].algo)->verify (0, hmpi, mpis, sk->mpis, 0, 0))
+
+  gcry_sexp_t hsexp, pubkey, sig;
+  grub_size_t errof;
+
+  if(_gcry_sexp_build(&hsexp, &errof, "(data (flags %s) (hash %s %b))", pkalgos[pk].padding, ctxt->hash->name, ctxt->hash->mdlen, hval))
+    goto fail;
+
+  if(_gcry_sexp_build(&pubkey, &errof, pkalgos[pk].pubsexp, sk->mpis[0], sk->mpis[1], sk->mpis[2], sk->mpis[3]))
+    goto fail;
+
+  if(_gcry_sexp_build(&sig, &errof, pkalgos[pk].sigsexp, mpis[0], mpis[1]))
+    goto fail;
+
+  _gcry_sexp_dump(sig);
+  _gcry_sexp_dump(hsexp);
+  _gcry_sexp_dump(pubkey);
+
+  if ((*pkalgos[pk].algo)->verify (sig, hsexp, pubkey))
     goto fail;
 
   grub_free (readbuf);
grub-core/commands/xnu_uuid.c +1 -1
index ae4b3a415..1406c43f5 100644
@@ -68,7 +68,7 @@ grub_cmd_xnu_uuid (grub_command_t cmd __attribute__ ((unused)),
   ctx = grub_zalloc (GRUB_MD_MD5->contextsize);
   if (!ctx)
     return grub_errno;
-  GRUB_MD_MD5->init (ctx);
+  GRUB_MD_MD5->init (ctx, 0);
   GRUB_MD_MD5->write (ctx, hash_prefix, sizeof (hash_prefix));
   GRUB_MD_MD5->write (ctx, &serial, sizeof (serial));
   GRUB_MD_MD5->final (ctx);
grub-core/disk/cryptodisk.c +1 -1
index 5e1eb2743..e52a7ebb5 100644
@@ -297,7 +297,7 @@ grub_cryptodisk_endecrypt (struct grub_cryptodisk *dev,
 	      return GPG_ERR_OUT_OF_MEMORY;
 
 	    tmp = grub_cpu_to_le64 (sector << log_sector_size);
-	    dev->iv_hash->init (ctx);
+	    dev->iv_hash->init (ctx, 0);
 	    dev->iv_hash->write (ctx, dev->iv_prefix, dev->iv_prefix_len);
 	    dev->iv_hash->write (ctx, &tmp, sizeof (tmp));
 	    dev->iv_hash->final (ctx);
grub-core/io/gzio.c +1 -1
index cb7eb1fe3..fa9d942b2 100644
@@ -1201,7 +1201,7 @@ initialize_tables (grub_gzio_t gzio)
   gzio->td = NULL;
 
   if (gzio->hcontext)
-    gzio->hdesc->init(gzio->hcontext);
+    gzio->hdesc->init(gzio->hcontext, 0);
 }
 
 
grub-core/io/lzopio.c +1 -1
index a7d442543..cea942308 100644
@@ -345,7 +345,7 @@ test_header (grub_file_t file)
     if (! context)
       return 0;
 
-    hcheck->init(context);
+    hcheck->init(context, 0);
 
     /* MAGIC is not included in check calculation.  */
     hcheck->write(context, &header.lzop_version, sizeof(header)- LZOP_MAGIC_SIZE);
grub-core/lib/adler32.c +16 -5
index 43b68af62..f849ccee6 100644
@@ -29,10 +29,12 @@ struct adler32_context
 };
 
 static void
-adler32_init (void *context)
+adler32_init (void *context, unsigned int flags)
 {
   struct adler32_context *ctx = context;
 
+  (void) flags;
+
   ctx->a = 1;
   ctx->b = 0;
 }
@@ -81,13 +83,22 @@ adler32_read (void *context)
 
 static gcry_md_spec_t spec_adler32 =
   {
-    "ADLER32", 0, 0, 0, 4,
-    adler32_init, adler32_write, adler32_final, adler32_read,
-    sizeof (struct adler32_context),
+    .algo = GCRY_MD_ADLER32,
+    .flags = {.disabled = 0, .fips = 0},
+    .name = "ADLER32",
+    .asnoid = NULL,
+    .asnlen = 0,
+    .oids = NULL,
+    .mdlen = 4,
+    .init = adler32_init,
+    .write = adler32_write,
+    .final = adler32_final,
+    .read = adler32_read,
+    .contextsize = sizeof (struct adler32_context),
+    .blocksize = 64,
 #ifdef GRUB_UTIL
     .modname = "adler32",
 #endif
-    .blocksize = 64
   };
 
 
grub-core/lib/crc64.c +19 -5
index 4960f3f89..c231fa97c 100644
@@ -61,8 +61,10 @@ init_crc64_table (void)
 }
 
 static void
-crc64_init (void *context)
+crc64_init (void *context, unsigned int flags)
 {
+  (void) flags;
+
   if (! crc64_table[1])
     init_crc64_table ();
   *(grub_uint64_t *) context = 0;
@@ -97,10 +99,22 @@ crc64_final (void *context __attribute__ ((unused)))
 
 gcry_md_spec_t _gcry_digest_spec_crc64 =
   {
-    "CRC64", 0, 0, 0, 8,
-    crc64_init, crc64_write, crc64_final, crc64_read,
-    sizeof (grub_uint64_t),
-    .blocksize = 64
+    .algo = GCRY_MD_CRC64,
+    .flags = {.disabled = 0, .fips = 0},
+    .name = "CRC64",
+    .asnoid = NULL,
+    .asnlen = 0,
+    .oids = NULL,
+    .mdlen = 8,
+    .init = crc64_init,
+    .write = crc64_write,
+    .final = crc64_final,
+    .read = crc64_read,
+    .contextsize = sizeof (grub_uint64_t),
+    .blocksize = 64,
+#ifdef GRUB_UTIL
+    .modname = "crc64",
+#endif
   };
 
 GRUB_MOD_INIT(crc64)
grub-core/lib/crypto.c +234 -11
index 396f76410..dd60dd4ac 100644
@@ -37,6 +37,8 @@ struct grub_crypto_hmac_handle
 static gcry_cipher_spec_t *grub_ciphers = NULL;
 static gcry_md_spec_t *grub_digests = NULL;
 
+int _gcry_no_fips_mode_required = 1;
+
 void (*grub_crypto_autoload_hook) (const char *name) = NULL;
 
 /* Based on libgcrypt-1.4.4/src/misc.c.  */
@@ -56,6 +58,17 @@ _gcry_burn_stack (int size)
   grub_burn_stack (size);
 }
 
+void
+__gcry_burn_stack (unsigned int size)
+{
+  grub_burn_stack (size);
+}
+
+void
+__gcry_burn_stack_dummy (void)
+{
+}
+
 void __attribute__ ((noreturn))
 _gcry_assert_failed (const char *expr, const char *file, int line,
 		     const char *func)
@@ -64,6 +77,12 @@ _gcry_assert_failed (const char *expr, const char *file, int line,
   grub_fatal ("assertion %s at %s:%d (%s) failed\n", expr, file, line, func);
 }
 
+void
+_gcry_bug( const char *file, int line, const char *func )
+{
+    grub_fatal ("... this is a bug (%s:%d:%s)\n", file, line, func);
+}
+
 
 void _gcry_log_error (const char *fmt, ...)
 {
@@ -83,6 +102,36 @@ void _gcry_log_error (const char *fmt, ...)
     }
 }
 
+void _gcry_log_info (const char *fmt, ...)
+{
+  va_list args;
+  const char *debug = grub_env_get ("debug");
+
+  if (! debug)
+    return;
+
+  if (grub_strword (debug, "all") || grub_strword (debug, "gcrypt"))
+    {
+      grub_printf ("gcrypt info: ");
+      va_start (args, fmt);
+      grub_vprintf (fmt, args);
+      va_end (args);
+      grub_refresh ();
+    }
+}
+
+void
+_gcry_fast_wipememory2 (void *ptr, int set, grub_size_t len)
+{
+  grub_memset(ptr, set, len);
+}
+
+void
+_gcry_fast_wipememory (void *ptr, grub_size_t len)
+{
+  grub_memset(ptr, 0, len);
+}
+
 void
 grub_cipher_register (gcry_cipher_spec_t *cipher)
 {
@@ -129,7 +178,7 @@ grub_crypto_hash (const gcry_md_spec_t *hash, void *out, const void *in,
 
   if (hash->contextsize > sizeof (ctx))
     grub_fatal ("Too large md context");
-  hash->init (&ctx);
+  hash->init (&ctx, 0);
   hash->write (&ctx, in, inlen);
   hash->final (&ctx);
   grub_memcpy (out, hash->read (&ctx), hash->mdlen);
@@ -153,6 +202,91 @@ grub_crypto_lookup_md_by_name (const char *name)
     }
 }
 
+const gcry_md_spec_t *
+grub_crypto_lookup_md_by_oid (const char *oid)
+{
+  const gcry_md_spec_t *md;
+
+  if (!oid)
+    return NULL;
+
+  if (grub_strncmp (oid, "oid.", 4) == 0 || grub_strncmp (oid, "OID.", 4) == 0)
+    oid += 4;
+
+
+  for (md = grub_digests; md; md = md->next)
+    {
+      const gcry_md_oid_spec_t *oid_specs = md->oids;
+      if (oid_specs)
+        {
+          for (int j = 0; oid_specs[j].oidstring; j++)
+            if (grub_strcasecmp (oid, oid_specs[j].oidstring) == 0)
+              return md;
+        }
+    }
+
+  return NULL;
+}
+
+static const char *md_algos[] = {
+    [1] = "MD5",
+    [2] = "SHA1",
+    [3] = "RIPEMD160",
+    [6] = "TIGER",
+    [8] = "SHA256",
+    [9] = "SHA384",
+    [10] = "SHA512",
+    [11] = "SHA224",
+
+    [301] = "MD4",
+    [302] = "CRC32",
+    [303] = "CRC32RFC1510",
+    [304] = "CRC24RFC2440",
+    [305] = "WHIRLPOOL",
+    [306] = "TIGER1",
+    [307] = "TIGER2",
+    [308] = "GOSTR3411_94",
+    [309] = "STRIBOG256",
+    [310] = "STRIBOG512",
+    [311] = "GOSTR3411_CP",
+    [312] = "SHA3-224",
+    [313] = "SHA3-256",
+    [314] = "SHA3-384",
+    [315] = "SHA3-512",
+    [316] = "SHAKE128",
+    [317] = "SHAKE256",
+    [318] = "BLAKE2B_512",
+    [319] = "BLAKE2B_384",
+    [320] = "BLAKE2B_256",
+    [321] = "BLAKE2B_160",
+    [322] = "BLAKE2S_256",
+    [323] = "BLAKE2S_224",
+    [324] = "BLAKE2S_160",
+    [325] = "BLAKE2S_128",
+    [326] = "SM3",
+    [327] = "SHA512_256",
+    [328] = "SHA512_224",
+};
+
+
+const gcry_md_spec_t *
+grub_crypto_lookup_md_by_algo (int algo)
+{
+  const gcry_md_spec_t *md;
+  int first = 1;
+  while (1)
+    {
+      for (md = grub_digests; md; md = md->next)
+	if (algo == md->algo)
+	  return md;
+      if (grub_crypto_autoload_hook && first && algo > 0 && algo < (int)ARRAY_SIZE(md_algos) && md_algos[algo]) {
+	grub_crypto_autoload_hook (md_algos[algo]);
+      } else
+	return NULL;
+      first = 0;
+    }
+}
+
 const gcry_cipher_spec_t *
 grub_crypto_lookup_cipher_by_name (const char *name)
 {
@@ -196,7 +330,9 @@ grub_crypto_cipher_set_key (grub_crypto_cipher_handle_t cipher,
 			    const unsigned char *key,
 			    unsigned keylen)
 {
-  return cipher->cipher->setkey (cipher->ctx, key, keylen);
+  /* TODO: Fix this. It's ugly as hell.  */
+  void *bulk_ops[100];
+  return cipher->cipher->setkey (cipher->ctx, key, keylen, (void *) bulk_ops);
 }
 
 gcry_err_code_t
@@ -343,7 +479,7 @@ grub_crypto_hmac_init (const struct gcry_md_spec *md,
   grub_free (helpkey);
   helpkey = NULL;
 
-  md->init (ctx);
+  md->init (ctx, 0);
 
   md->write (ctx, ipad, md->blocksize); /* inner pad */
   grub_memset (ipad, 0, md->blocksize);
@@ -390,7 +526,7 @@ grub_crypto_hmac_fini (struct grub_crypto_hmac_handle *hnd, void *out)
   hnd->md->read (hnd->ctx);
   p = hnd->md->read (hnd->ctx);
 
-  hnd->md->init (ctx2);
+  hnd->md->init (ctx2, 0);
   hnd->md->write (ctx2, hnd->opad, hnd->md->blocksize);
   hnd->md->write (ctx2, p, hnd->md->mdlen);
   hnd->md->final (ctx2);
@@ -433,19 +569,106 @@ grub_crypto_gcry_error (gcry_err_code_t in)
   return GRUB_ACCESS_DENIED;
 }
 
+
+/*
+ * Compare byte arrays of length LEN, return 1 if it's not same,
+ * 0, otherwise.
+ */
 int
-grub_crypto_memcmp (const void *a, const void *b, grub_size_t n)
+grub_crypto_memcmp (const void *b1, const void *b2, grub_size_t len)
 {
-  register grub_size_t counter = 0;
-  const grub_uint8_t *pa, *pb;
+  const grub_uint8_t *a = b1;
+  const grub_uint8_t *b = b2;
+  int ab, ba;
+  grub_size_t i;
 
-  for (pa = a, pb = b; n; pa++, pb++, n--)
+  /* Constant-time compare. */
+  for (i = 0, ab = 0, ba = 0; i < len; i++)
     {
-      if (*pa != *pb)
-	counter++;
+      /* If a[i] != b[i], either ab or ba will be negative. */
+      ab |= a[i] - b[i];
+      ba |= b[i] - a[i];
     }
 
-  return !!counter;
+  /* 'ab | ba' is negative when buffers are not equal, extract sign bit.  */
+  return ((unsigned int)(ab | ba) >> (sizeof(unsigned int) * 8 - 1)) & 1;
+}
+
+
+void *
+_gcry_malloc_secure (grub_size_t n)
+{
+  return grub_malloc(n);
+}
+
+void *
+_gcry_malloc (grub_size_t n)
+{
+  return grub_malloc(n);
+}
+
+void *
+_gcry_xmalloc(grub_size_t n)
+{
+  void *ret = grub_malloc(n);
+  if (ret == NULL)
+    grub_fatal("_gcry_xmalloc failed");
+  return ret;
+}
+
+void *
+_gcry_xmalloc_secure(grub_size_t n)
+{
+  void *ret = grub_malloc(n);
+  if (ret == NULL)
+    grub_fatal("_gcry_xmalloc_secure failed");
+  return ret;
+}
+
+void _gcry_free (void *p)
+{
+  grub_free (p);
+}
+
+void *
+_gcry_xrealloc (void *a, grub_size_t n)
+{
+  void *ret = grub_realloc(a, n);
+  if (ret == NULL)
+    grub_fatal("_gcry_xrealloc failed");
+  return ret;
+}
+
+void *
+_gcry_xcalloc (grub_size_t n, grub_size_t m)
+{
+  void *ret = grub_calloc(n, m);
+  if (ret == NULL)
+    grub_fatal("_gcry_xcalloc failed");
+  return ret;
+}
+
+void *
+_gcry_xcalloc_secure (grub_size_t n, grub_size_t m)
+{
+  void *ret = grub_calloc(n, m);
+  if (ret == NULL)
+    grub_fatal("_gcry_xcalloc_secure failed");
+  return ret;
+}
+
+
+int
+_gcry_is_secure (const void *a)
+{
+  (void) a;
+
+  return 0;
+}
+
+void _gcry_divide_by_zero (void)
+{
+  grub_fatal("gcrypt division by zero");
 }
 
 #ifndef GRUB_UTIL
grub-core/lib/libgcrypt-patches/01_md.patch new file +207 -0
new file mode 100644
index 000000000..dbb493dfc
@@ -0,0 +1,207 @@
+--- a/grub-core/lib/libgcrypt-grub/cipher/md.c 2024-05-21 01:22:04.222084773 +0300
++++ b/grub-core/lib/libgcrypt-grub/cipher/md.c 2024-05-21 01:22:07.368099961 +0300
+@@ -20,11 +20,25 @@
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+  */
++#include <config.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <errno.h>
+ 
+ 
+ #include "g10lib.h"
+ #include "cipher.h"
+ 
++#define _gcry_md_selftest(a,b,c) 0
++typedef struct gcry_md_list
++{
++  const gcry_md_spec_t *spec;
++  struct gcry_md_list *next;
++  size_t actual_struct_size;     /* Allocated size of this structure. */
++  PROPERLY_ALIGNED_TYPE context[1];
++} GcryDigestEntry;
++
+ 
+ /* This is the list of the digest implementations included in
+    libgcrypt.  */
+@@ -53,7 +67,6 @@
+ static void md_close (gcry_md_hd_t a);
+ static void md_write (gcry_md_hd_t a, const void *inbuf, size_t inlen);
+ static byte *md_read( gcry_md_hd_t a, int algo );
+-static int md_get_algo( gcry_md_hd_t a );
+ static int md_digest_length( int algo );
+ static void md_start_debug ( gcry_md_hd_t a, const char *suffix );
+ static void md_stop_debug ( gcry_md_hd_t a );
+@@ -186,9 +199,6 @@
+ 
+   if (! err)
+     {
+-      /* Hmmm, should we really do that? - yes [-wk] */
+-      _gcry_fast_random_poll ();
+-
+       if (algo)
+ 	{
+ 	  err = md_enable (hd, algo);
+@@ -437,14 +447,6 @@
+ {
+   GcryDigestEntry *r;
+ 
+-  if (a->ctx->debug)
+-    {
+-      if (a->bufpos && fwrite (a->buf, a->bufpos, 1, a->ctx->debug) != 1)
+-	BUG();
+-      if (inlen && fwrite (inbuf, inlen, 1, a->ctx->debug) != 1)
+-	BUG();
+-    }
+-
+   for (r = a->ctx->list; r; r = r->next)
+     {
+       if (a->bufpos)
+@@ -520,55 +522,6 @@
+ 
+ 
+ 
+-static gcry_err_code_t
+-md_customize (gcry_md_hd_t h, void *buffer, size_t buflen)
+-{
+-  gcry_err_code_t rc = 0;
+-  GcryDigestEntry *r;
+-  int algo_had_customize = 0;
+-
+-  if (!h->ctx->list)
+-    return GPG_ERR_DIGEST_ALGO; /* Might happen if no algo is enabled.  */
+-
+-  for (r = h->ctx->list; r; r = r->next)
+-    {
+-      switch (r->spec->algo)
+-        {
+-        case GCRY_MD_CSHAKE128:
+-        case GCRY_MD_CSHAKE256:
+-          algo_had_customize = 1;
+-          if (buflen != sizeof (struct gcry_cshake_customization))
+-            rc = GPG_ERR_INV_ARG;
+-          else
+-            rc = _gcry_cshake_customize (r->context, buffer);
+-          break;
+-        default:
+-          rc = GPG_ERR_DIGEST_ALGO;
+-          break;
+-        }
+-
+-      if (rc)
+-        break;
+-    }
+-
+-  if (rc && !algo_had_customize)
+-    {
+-      /* None of algorithms had customize implementation, so contexts were not
+-       * modified. Just return error. */
+-      return rc;
+-    }
+-  else if (rc && algo_had_customize)
+-    {
+-      /* Some of the contexts have been modified, but got error. Reset
+-       * all contexts. */
+-      _gcry_md_reset (h);
+-      return rc;
+-    }
+-
+-  return 0;
+-}
+-
+-
+ gcry_err_code_t
+ _gcry_md_ctl (gcry_md_hd_t hd, int cmd, void *buffer, size_t buflen)
+ {
+@@ -587,9 +540,6 @@
+     case GCRYCTL_STOP_DUMP:
+       md_stop_debug ( hd );
+       break;
+-    case GCRYCTL_MD_CUSTOMIZE:
+-      rc = md_customize (hd, buffer, buflen);
+-      break;
+     default:
+       rc = GPG_ERR_INV_OP;
+     }
+@@ -695,6 +645,7 @@
+       return;
+     }
+ 
++#if 0
+   if (spec->hash_buffers != NULL)
+     {
+       gcry_buffer_t iov;
+@@ -711,6 +662,7 @@
+       spec->hash_buffers (digest, spec->mdlen, &iov, 1);
+     }
+   else
++#endif
+     {
+       /* For the others we do not have a fast function, so we use the
+          normal functions. */
+@@ -746,7 +698,7 @@
+    DIGESTLEN may also be the appropriate length or, in case of XOF
+    algorithms, DIGESTLEN indicates number bytes to extract from XOF
+    to DIGEST.  */
+-#define _gcry_md_hash_buffers 0
++
+ 
+ /* Shortcut function to hash multiple buffers with a given algo.  In
+    contrast to gcry_md_hash_buffer, this function returns an error on
+@@ -762,7 +714,6 @@
+    On success 0 is returned and resulting hash or HMAC is stored at
+    DIGEST which must have been provided by the caller with an
+    appropriate length.  */
+-#define _gcry_md_hash_buffers 0
+ 
+ 
+ 
+@@ -893,43 +844,15 @@
+ static void
+ md_start_debug ( gcry_md_hd_t md, const char *suffix )
+ {
+-  static int idx=0;
+-  char buf[50];
+-
+-  if (fips_mode ())
+-    return;
+-
+-  if ( md->ctx->debug )
+-    {
+-      log_debug("Oops: md debug already started\n");
+-      return;
+-    }
+-  idx++;
+-  snprintf (buf, DIM(buf)-1, "dbgmd-%05d.%.10s", idx, suffix );
+-  md->ctx->debug = fopen(buf, "w");
+-  if ( !md->ctx->debug )
+-    log_debug("md debug: can't open %s\n", buf );
++  (void) md;
++  (void) suffix;
+ }
+ 
+ 
+ static void
+ md_stop_debug( gcry_md_hd_t md )
+ {
+-  if ( md->ctx->debug )
+-    {
+-      if ( md->bufpos )
+-        md_write ( md, NULL, 0 );
+-      fclose (md->ctx->debug);
+-      md->ctx->debug = NULL;
+-    }
+-
+-  {  /* a kludge to pull in the __muldi3 for Solaris */
+-    volatile u32 a = (u32)(uintptr_t)md;
+-    volatile u64 b = 42;
+-    volatile u64 c;
+-    c = a * b;
+-    (void)c;
+-  }
++  (void) md;
+ }
+ 
+ 
grub-core/lib/libgcrypt-patches/03_disable_rsa_shake.patch new file +34 -0
new file mode 100644
index 000000000..cf43f0451
@@ -0,0 +1,34 @@
+--- a/grub-core/lib/libgcrypt-grub/cipher/rsa-common.c	2024-09-08 18:08:47.095956852 +0300
++++ b/grub-core/lib/libgcrypt-grub/cipher/rsa-common.c	2024-09-08 18:10:23.849959591 +0300
+@@ -912,6 +912,7 @@
+   memcpy (p, salt, saltlen);
+ 
+   /* Step 9: dbmask = MGF(H, emlen - hlen - 1).  */
++#if 0 // Not supported yet
+   if (algo == GCRY_MD_SHAKE128 || algo == GCRY_MD_SHAKE256)
+     {
+       gcry_buffer_t iov;
+@@ -925,6 +926,7 @@
+                                      &iov, 1);
+     }
+   else
++#endif
+     mgf1 (dbmask, emlen - hlen - 1, h, hlen, algo);
+ 
+   /* Step 10: maskedDB = DB ^ dbMask */
+@@ -1086,6 +1088,7 @@
+     }
+ 
+   /* Step 7: dbmask = MGF(H, emlen - hlen - 1).  */
++#if 0 // Not supported yet
+   if (algo == GCRY_MD_SHAKE128 || algo == GCRY_MD_SHAKE256)
+     {
+       gcry_buffer_t iov;
+@@ -1099,6 +1102,7 @@
+                                      &iov, 1);
+     }
+   else
++#endif
+     mgf1 (dbmask, emlen - hlen - 1, h, hlen, algo);
+ 
+   /* Step 8: maskedDB = DB ^ dbMask.  */
grub-core/lib/libgcrypt-patches/04_aria_static.patch new file +22 -0
new file mode 100644
index 000000000..bca7e8062
@@ -0,0 +1,22 @@
+Mark aria_encrypt and aria_decrypt as static
+
+--- a/grub-core/lib/libgcrypt-grub/cipher/aria.c	2024-09-08 18:20:57.926977479 +0300
++++ b/grub-core/lib/libgcrypt-grub/cipher/aria.c	2024-09-08 18:21:09.731977812 +0300
+@@ -1013,7 +1013,7 @@
+   return 4 * sizeof(void *) + 4 * sizeof(u32); /* stack burn depth */
+ }
+ 
+-unsigned int
++static unsigned int
+ aria_encrypt(void *c, byte *outbuf, const byte *inbuf)
+ {
+   ARIA_context *ctx = (ARIA_context *)c;
+@@ -1023,7 +1023,7 @@
+   return aria_crypt (ctx, outbuf, inbuf, ctx->enc_key);
+ }
+ 
+-unsigned int
++static unsigned int
+ aria_decrypt(void *c, byte *outbuf, const byte *inbuf)
+ {
+   ARIA_context *ctx = (ARIA_context *)c;
grub-core/lib/libgcrypt/src/gcrypt-int.h +0 -51
index 1b4492818..701081680 100644
@@ -297,57 +297,6 @@ void _gcry_set_log_handler (gcry_handler_log_t f, void *opaque);
 void _gcry_set_gettext_handler (const char *(*f)(const char*));
 void _gcry_set_progress_handler (gcry_handler_progress_t cb, void *cb_data);
 
-
-/* Return a pointer to a string containing a description of the error
-   code in the error value ERR.  */
-static inline const char *
-_gcry_strerror (gcry_error_t err)
-{
-  return gpg_strerror (err);
-}
-
-/* Return a pointer to a string containing a description of the error
-   source in the error value ERR.  */
-static inline const char *
-_gcry_strsource (gcry_error_t err)
-{
-  return gpg_strsource (err);
-}
-
-/* Retrieve the error code for the system error ERR.  This returns
-   GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report
-   this).  */
-static inline gcry_err_code_t
-_gcry_err_code_from_errno (int err)
-{
-  return gpg_err_code_from_errno (err);
-}
-
-/* Retrieve the system error for the error code CODE.  This returns 0
-   if CODE is not a system error code.  */
-static inline int
-_gcry_err_code_to_errno (gcry_err_code_t code)
-{
-  return gpg_err_code_to_errno (code);
-}
-
-/* Return an error value with the error source SOURCE and the system
-   error ERR.  */
-static inline gcry_error_t
-_gcry_err_make_from_errno (gpg_err_source_t source, int err)
-{
-  return gpg_err_make_from_errno (source, err);
-}
-
-
-/* Return an error value with the system error ERR.  */
-static inline gcry_error_t
-_gcry_error_from_errno (int err)
-{
-  return gpg_error (gpg_err_code_from_errno (err));
-}
-
-
 
 gpg_err_code_t _gcry_sexp_new (gcry_sexp_t *retsexp,
                                const void *buffer, size_t length,
grub-core/lib/libgcrypt_wrap/cipher_wrap.h +2 -0
index 42835493d..08efb30b3 100644
@@ -19,6 +19,8 @@
 #ifndef GRUB_GCRY_WRAP_HEADER
 #define GRUB_GCRY_WRAP_HEADER 1
 
+#define USE_SHA512 1
+
 #include <grub/types.h>
 #include <grub/mm.h>
 #include <grub/misc.h>

grub-core/lib/libgcrypt_wrap/cipher_wrap.h line 41

Quoted 5 lines
grub-core/lib/libgcrypt_wrap/cipher_wrap.h +1 -0
@@ -35,10 +37,9 @@
 #undef __GNU_LIBRARY__
 #define __GNU_LIBRARY__ 1
 
+#define UINT64_C(c) (c ## ULL)
 #define U64_C(c) (c ## ULL)

I think the define of U64_C above needs to be removed. As is, I get this error when building the x86_64-efi target:

/home/g10/grub-tests-uml.libgcrypt/grub/grub-core/lib/libgcrypt-grub/src/types.h:106: error: "U64_C" redefined [-Werror]
106 | # define U64_C(c) (UINT64_C(c))

      |
/home/g10/grub-tests-uml.libgcrypt/grub/grub-core/lib/libgcrypt_wrap/cipher_wrap.h:41: note: this is the location of the previous definition
   41 | #define U64_C(c) (c ## ULL)
      |

After removing the line the build succeeded. I've run the test suite on an x86_64-efi build with this change and these changes don't appear to cause any failures (LUKS1/2, cryptomount, and sha1sum tests pass). I've yet to test this live though.

Glenn

Quoted 1,166 lines
grub-core/lib/libgcrypt_wrap/cipher_wrap.h +8 -2
-#define PUBKEY_FLAG_NO_BLINDING    (1 << 0)
-
 #define CIPHER_INFO_NO_WEAK_KEY    1
 
 #define HAVE_U64_TYPEDEF 1
@@ -74,4 +75,12 @@ _gcry_fips_mode (void)
 
 #define gcry_mpi_mod _gcry_mpi_mod
 
+#define strtol grub_strtol
+#define strtoul grub_strtoul
+#define atoi(nptr) (strtol((nptr), NULL, 10))
+
+#define stpcpy grub_stpcpy
+
+#define spec_from_algo grub_crypto_lookup_md_by_algo
+
 #endif
grub-core/lib/libgcrypt_wrap/mem.c +78 -5
index 74c6eafe5..e947dc998 100644
@@ -46,6 +46,15 @@ gcry_xcalloc (size_t n, size_t m)
   return ret;
 }
 
+void *
+_gcry_calloc (size_t n, size_t m)
+{
+  size_t sz;
+  if (grub_mul (n, m, &sz))
+    return NULL;
+  return grub_zalloc (sz);
+}
+
 void *
 gcry_xmalloc_secure (size_t n)
 {
@@ -69,6 +78,15 @@ gcry_xcalloc_secure (size_t n, size_t m)
   return ret;
 }
 
+void *
+_gcry_calloc_secure (size_t n, size_t m)
+{
+  size_t sz;
+  if (grub_mul (n, m, &sz))
+    return NULL;
+  return grub_zalloc (sz);
+}
+
 void *
 gcry_xmalloc (size_t n)
 {
@@ -89,10 +107,10 @@ gcry_xrealloc (void *a, size_t n)
   return ret;
 }
 
-void
-_gcry_check_heap (const void *a __attribute__ ((unused)))
+void *
+_gcry_realloc (void *a, size_t n)
 {
-
+  return grub_realloc (a, n);
 }
 
 void _gcry_log_printf (const char *fmt, ...)
@@ -113,6 +131,24 @@ void _gcry_log_printf (const char *fmt, ...)
     }
 }
 
+void _gcry_log_debug (const char *fmt, ...)
+{
+  va_list args;
+  const char *debug = grub_env_get ("debug");
+
+  if (! debug)
+    return;
+
+  if (grub_strword (debug, "all") || grub_strword (debug, "gcrypt"))
+    {
+      grub_printf ("gcrypt: ");
+      va_start (args, fmt);
+      grub_vprintf (fmt, args);
+      va_end (args);
+      grub_refresh ();
+    }
+}
+
 void _gcry_log_bug (const char *fmt, ...)
 {
   va_list args;
@@ -126,9 +162,9 @@ void _gcry_log_bug (const char *fmt, ...)
 }
 
 gcry_err_code_t
-gpg_error_from_syserror (void)
+gpg_err_code_from_errno (int err)
 {
-  switch (grub_errno)
+  switch (err)
     {
     case GRUB_ERR_NONE:
       return GPG_ERR_NO_ERROR;
@@ -138,3 +174,40 @@ gpg_error_from_syserror (void)
       return GPG_ERR_GENERAL;
     }
 }
+
+gcry_err_code_t
+gpg_error_from_syserror (void)
+{
+  return gpg_err_code_from_errno(grub_errno);
+}
+
+gcry_err_code_t
+gpg_err_code_from_syserror (void)
+{
+  return gpg_error_from_syserror ();
+}
+
+void _gcry_fatal_error(int rc, const char *text )
+{
+  grub_fatal("gcry fatal %d: %s", rc, text);
+}
+
+
+void _gcry_randomize (void *buffer __attribute__((unused)), size_t length __attribute__((unused)),
+                      enum gcry_random_level level __attribute__((unused)))
+{
+  grub_fatal("Attempt to get secure random numbers");
+}
+
+
+void *_gcry_random_bytes_secure (size_t nbytes __attribute__((unused)), enum gcry_random_level level __attribute__((unused)))
+{
+  grub_fatal("Attempt to get secure random numbers");
+}
+
+const char *gpg_strerror (gpg_error_t err)
+{
+  static char buf[256];
+  grub_snprintf(buf, sizeof(buf) - 5, "gpg error %d\n", err);
+  return buf;
+}
grub-core/lib/posix_wrap/sys/types.h +4 -0
index eeda543c4..9f7e22531 100644
@@ -39,12 +39,16 @@ typedef grub_int32_t int32_t;
 typedef grub_int64_t int64_t;
 
 #define HAVE_U64_TYPEDEF 1
+#define HAVE_TYPE_U64 1
 typedef grub_uint64_t u64;
 #define HAVE_U32_TYPEDEF 1
+#define HAVE_TYPE_U32 1
 typedef grub_uint32_t u32;
 #define HAVE_U16_TYPEDEF 1
+#define HAVE_TYPE_U16 1
 typedef grub_uint16_t u16;
 #define HAVE_BYTE_TYPEDEF 1
+#define HAVE_TYPE_BYTE 1
 typedef grub_uint8_t byte;
 
 typedef grub_addr_t uintptr_t;
grub-core/lib/xzembed/xz_dec_stream.c +9 -9
index 832d8af9a..f2dd42dc2 100644
@@ -425,9 +425,9 @@ static enum xz_ret hash_validate(struct xz_dec *s, struct xz_buf *b,
 
 #ifndef GRUB_EMBED_DECOMPRESSOR
 	if (s->hash)
-		s->hash->init(s->hash_context);
+		s->hash->init(s->hash_context, 0);
 	if (s->crc32)
-		s->crc32->init(s->crc32_context);
+		s->crc32->init(s->crc32_context, 0);
 #endif
 	s->have_hash_value = 0;
 	s->pos = 0;
@@ -493,7 +493,7 @@ static enum xz_ret dec_stream_header(struct xz_dec *s)
 		s->crc32_context = kmalloc(s->crc32->contextsize, GFP_KERNEL);
 		if (s->crc32_context == NULL)
 			return XZ_MEMLIMIT_ERROR;
-		s->crc32->init(s->crc32_context);
+		s->crc32->init(s->crc32_context, 0);
 	}
 #endif
 
@@ -531,9 +531,9 @@ static enum xz_ret dec_stream_header(struct xz_dec *s)
 				return XZ_MEMLIMIT_ERROR;
 			}
 
-			s->hash->init(s->hash_context);
-			s->hash->init(s->index.hash.hash_context);
- 			s->hash->init(s->block.hash.hash_context);
+			s->hash->init(s->hash_context, 0);
+			s->hash->init(s->index.hash.hash_context, 0);
+ 			s->hash->init(s->block.hash.hash_context, 0);
 		}
 #endif
 	}
@@ -1014,9 +1014,9 @@ void xz_dec_reset(struct xz_dec *s)
 #ifndef GRUB_EMBED_DECOMPRESSOR
 	if (s->hash)
 	{
-		s->hash->init(s->hash_context);
-		s->hash->init(s->index.hash.hash_context);
-		s->hash->init(s->block.hash.hash_context);
+		s->hash->init(s->hash_context, 0);
+		s->hash->init(s->index.hash.hash_context, 0);
+		s->hash->init(s->block.hash.hash_context, 0);
 	}
 #endif
 	s->have_hash_value = 0;
include/grub/crypto.h +220 -43
index 31c87c302..c0b42a735 100644
@@ -65,7 +65,33 @@ typedef enum
     GPG_ERR_WRONG_PUBKEY_ALGO,
     GPG_ERR_OUT_OF_MEMORY,
     GPG_ERR_TOO_LARGE,
-    GPG_ERR_ENOMEM
+    GPG_ERR_ENOMEM,
+    GPG_ERR_CHECKSUM,
+    GPG_ERR_INV_LENGTH,
+    GPG_ERR_VALUE_NOT_FOUND,
+    GPG_ERR_ERANGE,
+    GPG_ERR_INV_DATA,
+    GPG_ERR_ENCODING_PROBLEM,
+    GPG_ERR_BUFFER_TOO_SHORT,
+    GPG_ERR_SYNTAX,
+    GPG_ERR_SEXP_INV_LEN_SPEC,
+    GPG_ERR_SEXP_UNMATCHED_DH,
+    GPG_ERR_SEXP_UNMATCHED_PAREN,
+    GPG_ERR_SEXP_ZERO_PREFIX,
+    GPG_ERR_SEXP_NESTED_DH,
+    GPG_ERR_SEXP_UNEXPECTED_PUNC,
+    GPG_ERR_SEXP_BAD_CHARACTER,
+    GPG_ERR_SEXP_NOT_CANONICAL,
+    GPG_ERR_SEXP_STRING_TOO_LONG,
+    GPG_ERR_SEXP_BAD_QUOTATION,
+    GPG_ERR_SEXP_ODD_HEX_NUMBERS,
+    GPG_ERR_SEXP_BAD_HEX_CHAR,
+    GPG_ERR_LIMIT_REACHED,
+    GPG_ERR_EOF,
+    GPG_ERR_BAD_DATA,
+    GPG_ERR_EINVAL,
+    GPG_ERR_INV_STATE,
+    GPG_ERR_UNKNOWN_ALGORITHM,
   } gpg_err_code_t;
 typedef gpg_err_code_t gpg_error_t;
 typedef gpg_error_t gcry_error_t;
@@ -84,37 +110,60 @@ enum gcry_cipher_modes
   };
 #endif
 
+/* Extra algo IDs not coming from gcrypt.  */
+#define GCRY_MD_ADLER32 10301
+#define GCRY_MD_CRC64 10302
+
 /* Don't rely on this. Check!  */
 #define GRUB_CRYPTO_MAX_MDLEN 64
 #define GRUB_CRYPTO_MAX_CIPHER_BLOCKSIZE 16
 #define GRUB_CRYPTO_MAX_MD_CONTEXT_SIZE 256
 
 /* Type for the cipher_setkey function.  */
+struct cipher_bulk_ops;
+
 typedef gcry_err_code_t (*gcry_cipher_setkey_t) (void *c,
 						 const unsigned char *key,
-						 unsigned keylen);
+						 unsigned keylen,
+						 struct cipher_bulk_ops *bulk_ops);
 
 /* Type for the cipher_encrypt function.  */
-typedef void (*gcry_cipher_encrypt_t) (void *c,
-				       unsigned char *outbuf,
-				       const unsigned char *inbuf);
+typedef unsigned int (*gcry_cipher_encrypt_t) (void *c,
+					       unsigned char *outbuf,
+					       const unsigned char *inbuf);
 
 /* Type for the cipher_decrypt function.  */
-typedef void (*gcry_cipher_decrypt_t) (void *c,
-				       unsigned char *outbuf,
-				       const unsigned char *inbuf);
+typedef unsigned int (*gcry_cipher_decrypt_t) (void *c,
+					       unsigned char *outbuf,
+					       const unsigned char *inbuf);
 
 /* Type for the cipher_stencrypt function.  */
 typedef void (*gcry_cipher_stencrypt_t) (void *c,
 					 unsigned char *outbuf,
 					 const unsigned char *inbuf,
-					 unsigned int n);
+					 grub_size_t n);
 
 /* Type for the cipher_stdecrypt function.  */
 typedef void (*gcry_cipher_stdecrypt_t) (void *c,
 					 unsigned char *outbuf,
 					 const unsigned char *inbuf,
-					 unsigned int n);
+					 grub_size_t n);
+
+typedef void (*selftest_report_func_t)(const char *domain,
+                                       int algo,
+                                       const char *what,
+                                       const char *errdesc);
+
+/* The type used to convey additional information to a cipher.  */
+typedef gpg_err_code_t (*gcry_cipher_set_extra_info_t)
+     (void *c, int what, const void *buffer, grub_size_t buflen);
+
+/* The type used to set an IV directly in the algorithm module.  */
+typedef void (*gcry_cipher_setiv_func_t)(void *c, const grub_uint8_t *iv, grub_size_t ivlen);
+
+/* Definition of the selftest functions.  */
+typedef gpg_err_code_t (*gcry_selftest_func_t)
+     (int algo, int extended, selftest_report_func_t report);
 
 typedef struct gcry_cipher_oid_spec
 {
@@ -125,9 +174,14 @@ typedef struct gcry_cipher_oid_spec
 /* Module specification structure for ciphers.  */
 typedef struct gcry_cipher_spec
 {
+  int algo;
+  struct {
+    unsigned int disabled:1;
+    unsigned int fips:1;
+  } flags;
   const char *name;
   const char **aliases;
-  gcry_cipher_oid_spec_t *oids;
+  const gcry_cipher_oid_spec_t *oids;
   grub_size_t blocksize;
   grub_size_t keylen;
   grub_size_t contextsize;
@@ -136,6 +190,10 @@ typedef struct gcry_cipher_spec
   gcry_cipher_decrypt_t decrypt;
   gcry_cipher_stencrypt_t stencrypt;
   gcry_cipher_stdecrypt_t stdecrypt;
+  gcry_selftest_func_t selftest;
+  gcry_cipher_set_extra_info_t set_extra_info;
+  gcry_cipher_setiv_func_t setiv;
+
 #ifdef GRUB_UTIL
   const char *modname;
 #endif
@@ -143,7 +201,7 @@ typedef struct gcry_cipher_spec
 } gcry_cipher_spec_t;
 
 /* Type for the md_init function.  */
-typedef void (*gcry_md_init_t) (void *c);
+typedef void (*gcry_md_init_t) (void *c, unsigned int flags);
 
 /* Type for the md_write function.  */
 typedef void (*gcry_md_write_t) (void *c, const void *buf, grub_size_t nbytes);
@@ -162,16 +220,24 @@ typedef struct gcry_md_oid_spec
 /* Module specification structure for message digests.  */
 typedef struct gcry_md_spec
 {
+  int algo;
+  struct {
+    unsigned int disabled:1;
+    unsigned int fips:1;
+  } flags;
   const char *name;
-  unsigned char *asnoid;
+  const unsigned char *asnoid;
   int asnlen;
-  gcry_md_oid_spec_t *oids;
+  const gcry_md_oid_spec_t *oids;
   grub_size_t mdlen;
   gcry_md_init_t init;
   gcry_md_write_t write;
   gcry_md_final_t final;
   gcry_md_read_t read;
+  void *extract;
+  void *hash_buffers;
   grub_size_t contextsize; /* allocate this amount of context */
+
   /* Block size, needed for HMAC.  */
   grub_size_t blocksize;
 #ifdef GRUB_UTIL
@@ -180,54 +246,123 @@ typedef struct gcry_md_spec
   struct gcry_md_spec *next;
 } gcry_md_spec_t;
 
+typedef struct gcry_md_handle*gcry_md_hd_t;
+
 struct gcry_mpi;
 typedef struct gcry_mpi *gcry_mpi_t;
 
+struct gcry_sexp;
+typedef struct gcry_sexp *gcry_sexp_t;
+
+
+#define PUBKEY_FLAG_NO_BLINDING    (1 << 0)
+#define PUBKEY_FLAG_RFC6979        (1 << 1)
+#define PUBKEY_FLAG_FIXEDLEN       (1 << 2)
+#define PUBKEY_FLAG_LEGACYRESULT   (1 << 3)
+#define PUBKEY_FLAG_RAW_FLAG       (1 << 4)
+#define PUBKEY_FLAG_TRANSIENT_KEY  (1 << 5)
+#define PUBKEY_FLAG_USE_X931       (1 << 6)
+#define PUBKEY_FLAG_USE_FIPS186    (1 << 7)
+#define PUBKEY_FLAG_USE_FIPS186_2  (1 << 8)
+#define PUBKEY_FLAG_PARAM          (1 << 9)
+#define PUBKEY_FLAG_COMP           (1 << 10)
+#define PUBKEY_FLAG_NOCOMP         (1 << 11)
+#define PUBKEY_FLAG_EDDSA          (1 << 12)
+#define PUBKEY_FLAG_GOST           (1 << 13)
+#define PUBKEY_FLAG_NO_KEYTEST     (1 << 14)
+#define PUBKEY_FLAG_DJB_TWEAK      (1 << 15)
+#define PUBKEY_FLAG_SM2            (1 << 16)
+#define PUBKEY_FLAG_PREHASH        (1 << 17)
+
+enum pk_operation
+  {
+    PUBKEY_OP_ENCRYPT,
+    PUBKEY_OP_DECRYPT,
+    PUBKEY_OP_SIGN,
+    PUBKEY_OP_VERIFY
+  };
+
+enum pk_encoding
+  {
+    PUBKEY_ENC_RAW,
+    PUBKEY_ENC_PKCS1,
+    PUBKEY_ENC_PKCS1_RAW,
+    PUBKEY_ENC_OAEP,
+    PUBKEY_ENC_PSS,
+    PUBKEY_ENC_UNKNOWN
+  };
+
+struct pk_encoding_ctx
+{
+  enum pk_operation op;
+  unsigned int nbits;
+
+  enum pk_encoding encoding;
+  int flags;
+
+  int hash_algo;
+
+  /* for OAEP */
+  unsigned char *label;
+  grub_size_t labellen;
+
+  /* for PSS */
+  grub_size_t saltlen;
+
+  int (* verify_cmp) (void *opaque, gcry_mpi_t tmp);
+  void *verify_arg;
+};
+
 /* Type for the pk_generate function.  */
-typedef gcry_err_code_t (*gcry_pk_generate_t) (int algo,
-					       unsigned int nbits,
-					       unsigned long use_e,
-					       gcry_mpi_t *skey,
-					       gcry_mpi_t **retfactors);
+typedef gcry_err_code_t (*gcry_pk_generate_t) (gcry_sexp_t genparms,
+                                               gcry_sexp_t *r_skey);
 
 /* Type for the pk_check_secret_key function.  */
-typedef gcry_err_code_t (*gcry_pk_check_secret_key_t) (int algo,
-						       gcry_mpi_t *skey);
+typedef gcry_err_code_t (*gcry_pk_check_secret_key_t) (gcry_sexp_t keyparms);
 
 /* Type for the pk_encrypt function.  */
-typedef gcry_err_code_t (*gcry_pk_encrypt_t) (int algo,
-					      gcry_mpi_t *resarr,
-					      gcry_mpi_t data,
-					      gcry_mpi_t *pkey,
-					      int flags);
+typedef gcry_err_code_t (*gcry_pk_encrypt_t) (gcry_sexp_t *r_ciph,
+                                              gcry_sexp_t s_data,
+                                              gcry_sexp_t keyparms);
 
 /* Type for the pk_decrypt function.  */
-typedef gcry_err_code_t (*gcry_pk_decrypt_t) (int algo,
-					      gcry_mpi_t *result,
-					      gcry_mpi_t *data,
-					      gcry_mpi_t *skey,
-					      int flags);
+typedef gcry_err_code_t (*gcry_pk_decrypt_t) (gcry_sexp_t *r_plain,
+                                              gcry_sexp_t s_data,
+                                              gcry_sexp_t keyparms);
 
 /* Type for the pk_sign function.  */
-typedef gcry_err_code_t (*gcry_pk_sign_t) (int algo,
-					   gcry_mpi_t *resarr,
-					   gcry_mpi_t data,
-					   gcry_mpi_t *skey);
+typedef gcry_err_code_t (*gcry_pk_sign_t) (gcry_sexp_t *r_sig,
+                                           gcry_sexp_t s_data,
+                                           gcry_sexp_t keyparms);
 
 /* Type for the pk_verify function.  */
-typedef gcry_err_code_t (*gcry_pk_verify_t) (int algo,
-					     gcry_mpi_t hash,
-					     gcry_mpi_t *data,
-					     gcry_mpi_t *pkey,
-					     int (*cmp) (void *, gcry_mpi_t),
-					     void *opaquev);
+typedef gcry_err_code_t (*gcry_pk_verify_t) (gcry_sexp_t s_sig,
+                                             gcry_sexp_t s_data,
+                                             gcry_sexp_t keyparms);
 
 /* Type for the pk_get_nbits function.  */
-typedef unsigned (*gcry_pk_get_nbits_t) (int algo, gcry_mpi_t *pkey);
+typedef unsigned (*gcry_pk_get_nbits_t) (gcry_sexp_t keyparms);
+
+/* The type used to compute the keygrip.  */
+typedef gpg_err_code_t (*pk_comp_keygrip_t) (gcry_md_hd_t md,
+                                             gcry_sexp_t keyparm);
+
+/* The type used to query an ECC curve name.  */
+typedef const char *(*pk_get_curve_t)(gcry_sexp_t keyparms, int iterator,
+                                      unsigned int *r_nbits);
+
+/* The type used to query ECC curve parameters by name.  */
+typedef gcry_sexp_t (*pk_get_curve_param_t)(const char *name);
 
 /* Module specification structure for message digests.  */
 typedef struct gcry_pk_spec
 {
+  int algo;
+  struct {
+    unsigned int disabled:1;
+    unsigned int fips:1;
+  } flags;
+  int use;
   const char *name;
   const char **aliases;
   const char *elements_pkey;
@@ -235,7 +370,6 @@ typedef struct gcry_pk_spec
   const char *elements_enc;
   const char *elements_sig;
   const char *elements_grip;
-  int use;
   gcry_pk_generate_t generate;
   gcry_pk_check_secret_key_t check_secret_key;
   gcry_pk_encrypt_t encrypt;
@@ -243,6 +377,10 @@ typedef struct gcry_pk_spec
   gcry_pk_sign_t sign;
   gcry_pk_verify_t verify;
   gcry_pk_get_nbits_t get_nbits;
+  pk_comp_keygrip_t comp_keygrip;
+  pk_get_curve_t get_curve;
+  pk_get_curve_param_t get_curve_param;
+
 #ifdef GRUB_UTIL
   const char *modname;
 #endif
@@ -345,6 +483,10 @@ grub_crypto_hash (const gcry_md_spec_t *hash, void *out, const void *in,
 		  grub_size_t inlen);
 const gcry_md_spec_t *
 grub_crypto_lookup_md_by_name (const char *name);
+const gcry_md_spec_t *
+grub_crypto_lookup_md_by_algo (int algo);
+const gcry_md_spec_t *
+grub_crypto_lookup_md_by_oid (const char *oid);
 
 grub_err_t
 grub_crypto_gcry_error (gcry_err_code_t in);
@@ -408,7 +550,35 @@ void _gcry_assert_failed (const char *expr, const char *file, int line,
 
 void _gcry_burn_stack (int bytes);
 void _gcry_log_error( const char *fmt, ... )  __attribute__ ((format (__printf__, 1, 2)));
+void _gcry_log_info (const char *fmt, ...);
+void __gcry_burn_stack (unsigned int size);
+void __gcry_burn_stack_dummy (void);
+void _gcry_bug( const char *file, int line, const char *func );
+void
+_gcry_fast_wipememory (void *ptr, grub_size_t len);
+void
+_gcry_fast_wipememory2 (void *ptr, int set, grub_size_t len);
+unsigned int
+_gcry_ct_memequal (const void *b1, const void *b2, grub_size_t len);
+unsigned int
+_gcry_ct_not_memequal (const void *b1, const void *b2, grub_size_t len);
+
+
+static inline unsigned int _gcry_get_hw_features(void)
+{
+  return 0;
+}
 
+void *_gcry_malloc(grub_size_t n);
+void *_gcry_malloc_secure(grub_size_t n);
+void *_gcry_xmalloc(grub_size_t n);
+void *_gcry_xmalloc_secure(grub_size_t n);
+void _gcry_free (void *p);
+void *_gcry_xrealloc (void *a, grub_size_t n);
+int _gcry_is_secure (const void *a);
+void *_gcry_xcalloc (grub_size_t n, grub_size_t m);
+void *_gcry_xcalloc_secure (grub_size_t n, grub_size_t m);
+void _gcry_divide_by_zero (void);
 
 #ifdef GRUB_UTIL
 void grub_gcry_init_all (void);
@@ -419,4 +589,11 @@ grub_get_random (void *out, grub_size_t len);
 
 #endif
 
+typedef struct _gpgrt_b64state *gpgrt_b64state_t;
+gpgrt_b64state_t gpgrt_b64dec_start (const char *title);
+gpg_error_t      gpgrt_b64dec_proc (gpgrt_b64state_t state,
+				    void *buffer, grub_size_t length,
+                                    grub_size_t *r_nbytes);
+gpg_error_t      gpgrt_b64dec_finish (gpgrt_b64state_t state);
+const char *gpg_strerror (gpg_error_t err);
 #endif
include/grub/gcrypt/gpg-error.h +29 -0
index 1e4250284..966ebf82d 100644
@@ -29,4 +29,33 @@ gpg_err_source (gpg_error_t err __attribute__ ((unused)))
 gcry_err_code_t
 gpg_error_from_syserror (void);
 
+gcry_err_code_t
+gpg_err_code_from_syserror (void);
+
+gcry_err_code_t
+gpg_error_from_errno (int err);
+
+gcry_err_code_t
+gpg_err_code_from_errno (int err);
+
+static inline const char *
+gpg_strsource (gcry_error_t err __attribute__ ((unused)))
+{
+  return NULL;
+}
+
+static inline int
+gpg_err_code_to_errno (gcry_err_code_t code)
+{
+  return code ? 1 : 0;
+}
+
+static inline gcry_error_t
+gpg_err_make_from_errno (gpg_err_source_t source __attribute__ ((unused)), int err)
+{
+  return gpg_err_code_from_errno (err);
+}
+
+#define gpg_error(x) (x)
+
 #endif
util/grub-fstest.c +1 -1
index 7ff9037b8..24b20ab91 100644
@@ -365,7 +365,7 @@ static void
 cmd_crc (char *pathname)
 {
   grub_uint8_t *crc32_context = xmalloc (GRUB_MD_CRC32->contextsize);
-  GRUB_MD_CRC32->init(crc32_context);
+  GRUB_MD_CRC32->init(crc32_context, 0);
 
   read_file (pathname, crc_hook, crc32_context);
   GRUB_MD_CRC32->final(crc32_context);
util/import_gcry.py +138 -55
index 2b3322d3a..e3f6d65a1 100644
@@ -22,6 +22,23 @@ import os
 import datetime
 import codecs
 
+def removesuffix(base: str, suffix: str) -> str:
+    """ Backport of `removesuffix` from PEP-616 (Python 3.9+) """
+
+    if base.endswith(suffix):
+        return base[:-len(suffix)]
+    else:
+        return base
+
+
+def removeprefix(base: str, prefix: str) -> str:
+    """ Backport of `removeprefix` from PEP-616 (Python 3.9+) """
+
+    if base.startswith(prefix):
+        return base[len(prefix):]
+    else:
+        return base
+
 if len (sys.argv) < 3:
     print ("Usage: %s SOURCE DESTINATION" % sys.argv[0])
     exit (0)
@@ -62,6 +79,12 @@ confutil.write ("  cflags = '$(CFLAGS_GCRY)';\n");
 confutil.write ("  cppflags = '$(CPPFLAGS_GCRY)';\n");
 confutil.write ("  extra_dist = grub-core/lib/libgcrypt-grub/cipher/ChangeLog;\n");
 confutil.write ("\n");
+
+for src in ['src/const-time.c']:
+    confutil.write ("  common = grub-core/lib/libgcrypt-grub/%s;\n" % src)
+
+confutil.write ("\n");
+
 chlog = ""
 modules_sym_md = []
 
@@ -71,6 +94,8 @@ modules_sym_md = []
 mdblocksizes = {"_gcry_digest_spec_crc32" : 64,
                 "_gcry_digest_spec_crc32_rfc1510" : 64,
                 "_gcry_digest_spec_crc24_rfc2440" : 64,
+                "_gcry_digest_spec_cshake128": 64,
+                "_gcry_digest_spec_cshake256": 64,
                 "_gcry_digest_spec_md4" : 64,
                 "_gcry_digest_spec_md5" : 64,
                 "_gcry_digest_spec_rmd160" : 64,
@@ -79,10 +104,23 @@ mdblocksizes = {"_gcry_digest_spec_crc32" : 64,
                 "_gcry_digest_spec_sha256" : 64,
                 "_gcry_digest_spec_sha384" : 128,
                 "_gcry_digest_spec_sha512" : 128,
+                "_gcry_digest_spec_sha512_256": 128,
+                "_gcry_digest_spec_sha512_224": 128,
                 "_gcry_digest_spec_tiger" : 64,
                 "_gcry_digest_spec_tiger1" : 64,
                 "_gcry_digest_spec_tiger2" : 64,
-                "_gcry_digest_spec_whirlpool" : 64}
+                "_gcry_digest_spec_whirlpool" : 64,
+                "_gcry_digest_spec_shake128": 64,
+                "_gcry_digest_spec_shake256": 64,
+                "_gcry_digest_spec_sm3": 64,
+                "_gcry_digest_spec_stribog_256": 64,
+                "_gcry_digest_spec_stribog_512": 64,
+                "_gcry_digest_spec_sha3_224": 1152 / 8,
+                "_gcry_digest_spec_sha3_256": 1088 / 8,
+                "_gcry_digest_spec_sha3_384": 832 / 8,
+                "_gcry_digest_spec_sha3_512": 576 / 8,
+                "_gcry_digest_spec_gost3411_94": 32,
+                "_gcry_digest_spec_gost3411_cp": 32}
 
 cryptolist = codecs.open (os.path.join (cipher_dir_out, "crypto.lst"), "w", "utf-8")
 
@@ -99,26 +137,60 @@ cryptolist.write ("AES-256: gcry_rijndael\n");
 cryptolist.write ("ADLER32: adler32\n");
 cryptolist.write ("CRC64: crc64\n");
 
+extra_files = {
+    "gcry_camellia": ["camellia.c"], # Main file is camellia-glue.c
+    "gcry_sha512"  : ["hash-common.c"],
+}
+extra_files_list = [x for xs in extra_files.values() for x in xs] + ["pubkey-util.c", "rsa-common.c", "dsa-common.c", "md.c"]
+
 for cipher_file in cipher_files:
     infile = os.path.join (cipher_dir_in, cipher_file)
     outfile = os.path.join (cipher_dir_out, cipher_file)
     if cipher_file == "ChangeLog" or cipher_file == "ChangeLog-2011":
         continue
     chlognew = "	* %s" % cipher_file
-    if re.match ("(Manifest|Makefile\.am|ac\.c|cipher\.c|hash-common\.c|hmac-tests\.c|md\.c|pubkey\.c)$", cipher_file) or cipher_file == "kdf.c" or cipher_file == "elgamal.c" or cipher_file == "primegen.c" or cipher_file == "ecc.c" or cipher_file == "test-getrusage.c":
+    # Unused generic support files
+    if re.match (r"(Makefile\.am|cipher\.c|cipher-.*\.c|mac-.*\.c|mac\.c|pubkey\.c|primegen\.c)$", cipher_file):
+        chlog = "%s%s: Removed\n" % (chlog, chlognew)
+        continue
+    # TODO: Support KDF
+    if re.match (r"(kdf\.c|scrypt\.c)$", cipher_file):
+        chlog = "%s%s: Removed\n" % (chlog, chlognew)
+        continue
+    # TODO: Support chacha20 and poly1305
+    if cipher_file in ["chacha20.c", "poly1305.c"]:
+        chlog = "%s%s: Removed\n" % (chlog, chlognew)
+        continue
+    # TODO: Support blake2
+    if cipher_file == "blake2.c":
+        chlog = "%s%s: Removed\n" % (chlog, chlognew)
+        continue        
+
+    # TODO: Use optimized versions
+    if re.match (r"(.*\.[sS]|.*-aarch64-ce.c|.*-intel-shaext\.c|.*-ssse3-i386\.c|.*-ppc\.c|.*-ssse3-amd64\.c|.*-s390x\.c|rijndael-aesni\.c|crc-intel-pclmul\.c|.*-armv8-ce\.c|.*-p10le\.c|rijndael-padlock.c|.*-ppc8le.c|.*-ppc9le.c|rijndael-vaes\.c|.*-vaes-i386\.c|.*-avx512-x86\.c)$", cipher_file):
+        chlog = "%s%s: Removed\n" % (chlog, chlognew)
+        continue
+    # TODO: Support ECC, Elgamal and post-quantum
+    if re.match (r"^(ecc-.*\.c|ecc\.c|elgamal\.c|kem\.c|kem-ecc\.c|sntrup761\.c|mceliece6688128f\.c|kyber\.c|kyber-.*\.c)$", cipher_file):
+        chlog = "%s%s: Removed\n" % (chlog, chlognew)
+        continue
+    # Not part of the code
+    if cipher_file in ["gost-s-box.c"]:
         chlog = "%s%s: Removed\n" % (chlog, chlognew)
         continue
     # Autogenerated files. Not even worth mentionning in ChangeLog
-    if re.match ("Makefile\.in$", cipher_file):
+    if re.match (r"Makefile\.in$", cipher_file):
         continue
     nch = False
-    if re.match (".*\.[ch]$", cipher_file):
-        isc = re.match (".*\.c$", cipher_file)
+    if re.match (r".*\.[ch]$", cipher_file):
+        isc = re.match (r".*\.c$", cipher_file)
         f = codecs.open (infile, "r", "utf-8")
         fw = codecs.open (outfile, "w", "utf-8")
         fw.write ("/* This file was automatically imported with \n")
         fw.write ("   import_gcry.py. Please don't modify it */\n")
-        fw.write ("#include <grub/dl.h>\n")
+        add_license = cipher_file == "pubkey-util.c" or (isc and not cipher_file in extra_files_list)
+        if add_license:
+            fw.write ("#include <grub/dl.h>\n")
         if cipher_file == "camellia.h":
             fw.write ("#include <grub/misc.h>\n")
             fw.write ("void camellia_setup128(const unsigned char *key, grub_uint32_t *subkey);\n")
@@ -132,7 +204,7 @@ for cipher_file in cipher_files:
             fw.write ("void camellia_decrypt256(const grub_uint32_t *subkey, grub_uint32_t *io);\n")                      
             fw.write ("#define memcpy grub_memcpy\n")
         # Whole libgcrypt is distributed under GPLv3+ or compatible
-        if isc:
+        if add_license:
             fw.write ("GRUB_MOD_LICENSE (\"GPLv3+\");\n")
 
         ciphernames = []
@@ -148,14 +220,10 @@ for cipher_file in cipher_files:
         iscipher = False
         iscryptostart = False
         iscomma = False
-        isglue = False
         skip_statement = False
+        skip_comma = False
         if isc:
-            modname = cipher_file [0:len(cipher_file) - 2]
-            if re.match (".*-glue$", modname):
-                modname = modname.replace ("-glue", "")
-                isglue = True
-            modname = "gcry_%s" % modname
+            modname = "gcry_%s" % removesuffix(removesuffix(cipher_file, ".c"), "-glue").replace("-", "_")
         for line in f:
             line = line
             if skip_statement:
@@ -171,7 +239,7 @@ for cipher_file in cipher_files:
                     skip2 = False
                 continue
             if iscryptostart:
-                s = re.search (" *\"([A-Z0-9_a-z]*)\"", line)
+                s = re.search (" *\"([A-Z0-9_a-z-]*)\"", line)
                 if not s is None:
                     sg = s.groups()[0]
                     cryptolist.write (("%s: %s\n") % (sg, modname))
@@ -201,7 +269,7 @@ for cipher_file in cipher_files:
                     ispk = False
                 iscomma = not re.search (",$", line) is None
             # Used only for selftests.
-            m = re.match ("(static byte|static unsigned char) (weak_keys_chksum)\[[0-9]*\] =", line)
+            m = re.match (r"(static byte|static unsigned char|static const gcry_md_spec_t \* const) (weak_keys_chksum|digest_list)\[[0-9]*\] =", line)
             if not m is None:
                 skip = 1
                 fname = m.groups ()[1]
@@ -212,11 +280,15 @@ for cipher_file in cipher_files:
                     chlognew = "%s %s" % (chlognew, chmsg)
                     nch = True
                 continue
+            if (not hold) and (re.match (r"[ \t]*(run_selftests|do_tripledes_set_extra_info),?", line) is not None):
+                iscomma = True
+                line = ""
             if hold:
                 hold = False
                 # We're optimising for size and exclude anything needing good
                 # randomness.
-                if not re.match ("(run_selftests|selftest|_gcry_aes_c.._..c|_gcry_[a-z0-9]*_hash_buffer|tripledes_set2keys|do_tripledes_set_extra_info|_gcry_rmd160_mixblock|serpent_test|dsa_generate_ext|test_keys|gen_k|sign|gen_x931_parm_xp|generate_x931|generate_key|dsa_generate|dsa_sign|ecc_sign|generate|generate_fips186|_gcry_register_pk_dsa_progress|_gcry_register_pk_ecc_progress|progress|scanval|ec2os|ecc_generate_ext|ecc_generate|compute_keygrip|ecc_get_param|_gcry_register_pk_dsa_progress|gen_x931_parm_xp|gen_x931_parm_xi|rsa_decrypt|rsa_sign|rsa_generate_ext|rsa_generate|secret|check_exponent|rsa_blind|rsa_unblind|extract_a_from_sexp|curve_free|curve_copy|point_set)", line) is None:
+                # TODO: Support shake2+rsa (Needs md_extract)
+                if re.match ("(_gcry_hash_selftest_check_one|bulk_selftest_setkey|run_selftests|do_tripledes_set_extra_info|selftest|sm4_selftest|cshake_hash_buffers|_gcry_[a-z0-9_]*_hash_buffers|_gcry_sha1_hash_buffer|tripledes_set2keys|_gcry_rmd160_mixblock|serpent_test|dsa_generate_ext|test_keys|gen_k|sign|gen_x931_parm_xp|generate_x931|generate_key|dsa_generate|dsa_sign|ecc_sign|generate|generate_fips186|_gcry_register_pk_dsa_progress|_gcry_register_pk_ecc_progress|progress|scanval|ec2os|ecc_generate_ext|ecc_generate|ecc_get_param|_gcry_register_pk_dsa_progress|gen_x931_parm_xp|gen_x931_parm_xi|rsa_decrypt|rsa_sign|rsa_generate_ext|rsa_generate|secret|check_exponent|rsa_blind|rsa_unblind|extract_a_from_sexp|curve_free|curve_copy|point_set|_gcry_dsa_gen_rfc6979_k|bits2octets|int2octets|md_extract|_gcry_md_debug|_gcry_md_selftest|_gcry_md_is_enabled|_gcry_md_is_secure|_gcry_md_init|_gcry_md_info|_gcry_md_get_algo |md_get_algo |_gcry_md_get |_gcry_md_extract|_gcry_md_setkey|md_setkey|prepare_macpads|_gcry_md_algo_name|search_oid|spec_from_oid|spec_from_name|spec_from_algo|map_algo|_gcry_cshake_customize|cshake_input_[sn])", line) is not None:
 
                     skip = 1
                     if not re.match ("selftest", line) is None and cipher_file == "idea.c":
@@ -224,6 +296,11 @@ for cipher_file in cipher_files:
 
                     if not re.match ("serpent_test", line) is None:
                         fw.write ("static const char *serpent_test (void) { return 0; }\n");
+                    if not re.match ("sm4_selftest", line) is None:
+                        fw.write ("static const char *sm4_selftest (void) { return 0; }\n");
+                    hash_buf = re.match ("(_gcry_[a-z0-9_]*_hash_buffers)", line)
+                    if hash_buf is not None:
+                        fw.write ("#define %s 0" % (hash_buf.group(0)))
                     if not re.match ("dsa_generate", line) is None:
                         fw.write ("#define dsa_generate 0");
                     if not re.match ("ecc_generate", line) is None:
@@ -238,6 +315,10 @@ for cipher_file in cipher_files:
                         fw.write ("#define dsa_sign 0");
                     if not re.match ("ecc_sign", line) is None:
                         fw.write ("#define ecc_sign 0");
+                    if not re.match ("search_oid", line) is None:
+                        fw.write ("#define search_oid(a,b) grub_crypto_lookup_md_by_oid(a)")
+                    if not re.match ("spec_from_name", line) is None:
+                        fw.write ("#define spec_from_name grub_crypto_lookup_md_by_name")
                     fname = re.match ("[a-zA-Z0-9_]*", line).group ()
                     chmsg = "(%s): Removed." % fname
                     if nch:
@@ -257,45 +338,46 @@ for cipher_file in cipher_files:
                     chlognew = "%s: %s" % (chlognew, chmsg)
                     nch = True
                 continue
-            m = re.match ("gcry_cipher_spec_t", line)
+            m = re.match ("(const )?gcry_cipher_spec_t", line)
             if isc and not m is None:
                 assert (not ismd)
                 assert (not ispk)
                 assert (not iscipher)
                 assert (not iscryptostart)
-                ciphername = line [len ("gcry_cipher_spec_t"):].strip ()
+                ciphername = removeprefix(removeprefix(line, "const "), "gcry_cipher_spec_t").strip ()
                 ciphername = re.match("[a-zA-Z0-9_]*",ciphername).group ()
                 ciphernames.append (ciphername)
                 iscipher = True
                 iscryptostart = True
 
-            m = re.match ("gcry_pk_spec_t", line)
+            m = re.match ("(const )?gcry_pk_spec_t", line)
             if isc and not m is None:
                 assert (not ismd)
                 assert (not ispk)
                 assert (not iscipher)
                 assert (not iscryptostart)
-                pkname = line [len ("gcry_pk_spec_t"):].strip ()
+                pkname = removeprefix(removeprefix(line, "const "), "gcry_pk_spec_t").strip ()
                 pkname = re.match("[a-zA-Z0-9_]*",pkname).group ()
                 pknames.append (pkname)
                 ispk = True
                 iscryptostart = True
 
-            m = re.match ("gcry_md_spec_t", line)
+            m = re.match ("(const )?gcry_md_spec_t", line)
             if isc and not m is None:
                 assert (not ismd)
                 assert (not ispk)
                 assert (not iscipher)
                 assert (not iscryptostart)
-                mdname = line [len ("gcry_md_spec_t"):].strip ()
+                line = removeprefix(line, "const ")
+                mdname = removeprefix(removeprefix(line, "const "), "gcry_md_spec_t").strip ()
                 mdname = re.match("[a-zA-Z0-9_]*",mdname).group ()
                 mdnames.append (mdname)
                 ismd = True
                 mdarg = 0
                 iscryptostart = True
-            m = re.match ("static const char \*selftest.*;$", line)
+            m = re.match (r"static const char \*selftest.*;$", line)
             if not m is None:
-                fname = line[len ("static const char \*"):]
+                fname = line[len (r"static const char \*"):]
                 fname = re.match ("[a-zA-Z0-9_]*", fname).group ()
                 chmsg = "(%s): Removed declaration." % fname
                 if nch:
@@ -331,7 +413,7 @@ for cipher_file in cipher_files:
                     chlognew = "%s %s" % (chlognew, chmsg)
                     nch = True
                 continue
-            m = re.match ("static void \(\*progress_cb\).*;$", line)
+            m = re.match (r"static void \(\*progress_cb\).*;$", line)
             if not m is None:
                 chmsg = "(progress_cb): Removed declaration."
                 if nch:
@@ -340,7 +422,7 @@ for cipher_file in cipher_files:
                     chlognew = "%s %s" % (chlognew, chmsg)
                     nch = True
                 continue
-            m = re.match ("static void \*progress_cb_data.*;$", line)
+            m = re.match (r"static void \*progress_cb_data.*;$", line)
             if not m is None:
                 chmsg = "(progress_cb): Removed declaration."
                 if nch:
@@ -350,22 +432,22 @@ for cipher_file in cipher_files:
                     nch = True
                 continue
 
-            m = re.match ("(static const char( |)\*|static gpg_err_code_t|void|static int|static gcry_err_code_t|static gcry_mpi_t|static void|void|static elliptic_curve_t) *$", line)
+            m = re.match (r"((static )?const char( |)\*|static const gcry_md_spec_t \*|(static )?gpg_err_code_t|gpg_error_t|void|(static )?(unsigned )?int|(static )?gcry_err_code_t|static gcry_mpi_t|static void|void|static elliptic_curve_t) *$", line)
             if not m is None:
                 hold = True
                 holdline = line
                 continue
-            m = re.match ("static int tripledes_set2keys \(.*\);", line)
+            m = re.match (r"static int tripledes_set2keys \(.*\);", line)
             if not m is None:
                 continue
-            m = re.match ("static int tripledes_set3keys \(.*\);", line)
+            m = re.match (r"static int tripledes_set3keys \(.*\);", line)
             if not m is None:
                 continue
-            m = re.match ("static int tripledes_set2keys \(", line)
+            m = re.match (r"static int tripledes_set2keys \(", line)
             if not m is None:
                 skip_statement = True
                 continue
-            m = re.match ("static int tripledes_set3keys \(", line)
+            m = re.match (r"static int tripledes_set3keys \(", line)
             if not m is None:
                 skip_statement = True
                 continue
@@ -421,11 +503,9 @@ for cipher_file in cipher_files:
                 continue
             fw.write (line)
         if len (ciphernames) > 0 or len (mdnames) > 0 or len (pknames) > 0:
-            if isglue:
-                modfiles = "lib/libgcrypt-grub/cipher/%s lib/libgcrypt-grub/cipher/%s" \
-                    % (cipher_file, cipher_file.replace ("-glue.c", ".c"))
-            else:
-                modfiles = "lib/libgcrypt-grub/cipher/%s" % cipher_file
+            modfiles = [cipher_file]
+            if modname in extra_files.keys():
+                modfiles += extra_files[modname]
             if len (ciphernames) > 0 or len (mdnames) > 0:
                 modules_sym_md.append (modname)
             chmsg = "(GRUB_MOD_INIT(%s)): New function\n" % modname
@@ -447,7 +527,7 @@ for cipher_file in cipher_files:
                 chlognew = "%s\n	%s" % (chlognew, chmsg)
                 fw.write ("  grub_md_register (&%s);\n" % mdname)
             for pkname in pknames:
-                chmsg = "Register pk %s" % mdname
+                chmsg = "Register pk %s" % pkname
                 chlognew = "%s\n	%s" % (chlognew, chmsg)
                 fw.write ("  grub_crypto_pk_%s = &%s;\n"
                           % (pkname.replace ("_gcry_pubkey_spec_", ""), pkname))
@@ -465,17 +545,17 @@ for cipher_file in cipher_files:
                 chlognew = "%s\n	%s" % (chlognew, chmsg)
                 fw.write ("  grub_md_unregister (&%s);\n" % mdname)
             for pkname in pknames:
-                chmsg = "Unregister pk %s" % mdname
+                chmsg = "Unregister pk %s" % pkname
                 chlognew = "%s\n	%s" % (chlognew, chmsg)
                 fw.write ("  grub_crypto_pk_%s = 0;\n"
                           % (pkname.replace ("_gcry_pubkey_spec_", "")))
             fw.write ("}\n")
             conf.write ("module = {\n")
             conf.write ("  name = %s;\n" % modname)
-            for src in modfiles.split():
-                conf.write ("  common = %s;\n" % src)
+            for src in modfiles:
+                conf.write ("  common = lib/libgcrypt-grub/cipher/%s;\n" % src)
                 if len (ciphernames) > 0 or len (mdnames) > 0:
-                    confutil.write ("  common = grub-core/%s;\n" % src)
+                    confutil.write ("  common = grub-core/lib/libgcrypt-grub/cipher/%s;\n" % src)
             if modname == "gcry_ecc":
                 conf.write ("  common = lib/libgcrypt-grub/mpi/ec.c;\n")
                 conf.write ("  cflags = '$(CFLAGS_GCRY) -Wno-redundant-decls -Wno-sign-compare';\n")
@@ -490,7 +570,7 @@ for cipher_file in cipher_files:
             fw.close ()
             if nch:
                 chlog = "%s%s\n" % (chlog, chlognew)
-        elif isc and cipher_file != "camellia.c":
+        elif isc and cipher_file not in extra_files_list:
             print ("WARNING: C file isn't a module: %s" % cipher_file)
             f.close ()
             fw.close ()
@@ -512,7 +592,7 @@ for src in sorted (os.listdir (os.path.join (indir, "src"))):
             or src == "libgcrypt.vers" or src == "Makefile.am" \
             or src == "Manifest" or src == "misc.c" \
             or src == "missing-string.c" or src == "module.c" \
-            or src == "secmem.c" or src == "sexp.c" \
+            or src == "secmem.c" \
             or src == "stdmem.c" or src == "visibility.c":
         continue
     outfile = os.path.join (basedir, "src", src)
@@ -534,8 +614,17 @@ for src in sorted (os.listdir (os.path.join (indir, "src"))):
         fw.close ()
         continue
 
+    if src == "cipher-proto.h":
+        fw.write("#include <grub/crypto.h>\n")
+        fw.write("typedef gcry_selftest_func_t selftest_func_t;")
+        f.close ()
+        fw.close ()
+        continue
+
     if src == "g10lib.h":
-        fw.write (f.read ().replace ("(printf,f,a)", "(__printf__,f,a)"))
+        fw.write("#include <cipher_wrap.h>\n")
+        fw.write("#include <grub/crypto.h>\n")
+        fw.write (f.read ().replace ("(printf,f,a)", "(__printf__,f,a)").replace ("#include \"../compat/libcompat.h\"", "").replace("#define N_(a) (a)", ""))
         f.close ()
         fw.close ()
         continue
@@ -546,7 +635,7 @@ for src in sorted (os.listdir (os.path.join (indir, "src"))):
 
 for src in sorted (os.listdir (os.path.join (indir, "mpi"))):
     if src == "config.links" or src == "ChangeLog-2011" \
-            or src == "mpi-scan.c" or src == "Manifest" \
+            or src == "Manifest" \
             or src == "Makefile.am":
         continue
     infile = os.path.join (indir, "mpi", src)
@@ -568,17 +657,17 @@ for src in sorted (os.listdir (os.path.join (indir, "mpi"))):
             hold = False
             # We're optimising for size and exclude anything needing good
             # randomness.
-            if not re.match ("(_gcry_mpi_get_hw_config|gcry_mpi_randomize)", line) is None:
+            if not re.match ("(_gcry_mpi_get_hw_config|gcry_mpi_randomize|_gcry_mpi_randomize)", line) is None:
                 skip = 1
                 continue
             else:
                 fw.write (holdline)
-        m = re.match ("(const char( |)\*|void) *$", line)
+        m = re.match (r"(const char( |)\*|void) *$", line)
         if not m is None:
             hold = True
             holdline = line
             continue
-        m = re.match ("#include \"mod-source-info\.h\"", line)
+        m = re.match (r"#include \"mod-source-info\.h\"", line)
         if not m is None:
             continue
         fw.write (line)
@@ -612,9 +701,6 @@ fw.write ("#include <cipher_wrap.h>\n")
 chlog = "%s	* g10lib.h: Likewise.\n" % chlog
 fw.close ()
 
-infile = os.path.join (cipher_dir_in, "ChangeLog")
-outfile = os.path.join (cipher_dir_out, "ChangeLog")
-
 conf.close ();
 
 initfile = codecs.open (os.path.join (cipher_dir_out, "init.c"), "w", "utf-8")
@@ -643,7 +729,7 @@ confutil.write ("};\n");
 confutil.close ();
 
 
-f=codecs.open (infile, "r", "utf-8")
+outfile = os.path.join (cipher_dir_out, "ChangeLog")
 fw=codecs.open (outfile, "w", "utf-8")
 dt = datetime.date.today ()
 fw.write ("%04d-%02d-%02d  Automatic import tool\n" % \
@@ -653,7 +739,4 @@ fw.write ("	Imported ciphers to GRUB\n")
 fw.write ("\n")
 fw.write (chlog)
 fw.write ("\n")
-for line in f:
-    fw.write (line)
-f.close ()
 fw.close ()
util/import_gcrypt_inth.sed new file +17 -0
new file mode 100644
index 000000000..ebe9371ee
@@ -0,0 +1,17 @@
+/^#@INSERT_SYS_SELECT_H@/ d
+/^@FALLBACK_SOCKLEN_T@/ d
+/^# *include <stdlib\.h>/ d
+/^# *include <string\.h>/ d
+/^# *include <winsock2\.h>/ d
+/^# *include <ws2tcpip\.h>/ d
+/^# *include <time\.h>/ d
+/^# *include <sys\/socket\.h>/ d
+/^# *include <sys\/time\.h>/ d
+/^  typedef long ssize_t;/ d
+/^  typedef int  pid_t;/ d
+/^# *include <gpg-error\.h>/ s,#include <gpg-error.h>,#include <grub/gcrypt/gpg-error.h>,
+/^typedef gpg_error_t gcry_error_t;/ d
+/^typedef gpg_err_code_t gcry_err_code_t;/ d
+/^typedef struct gcry_mpi \*gcry_mpi_t;/ d
+/^#error  gcrypt.h already included/ d
+p
util/import_gcrypth.sed +0 -0
index fe6d1a072..503b4b547 100644

util/import_gcrypth.sed line 16

Quoted 7 lines
util/import_gcrypth.sed +0 -2
@@ -13,6 +13,4 @@
 /^typedef gpg_error_t gcry_error_t;/ d
 /^typedef gpg_err_code_t gcry_err_code_t;/ d
 /^typedef struct gcry_mpi \*gcry_mpi_t;/ d
-/^struct gcry_thread_cbs/ d
-s,_gcry_mpi_invm,gcry_mpi_invm,g
 p
\ No newline at end of file

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#4 lore raw

PATCH v6 4/6 Add DSA and RSA SEXP tests

In reply to Vladimir Serbinenko

This allows us to test purely the integration of the implementation of DSA and RSA from libgcrypt without concerning with additional code.

---
 grub-core/tests/dsa_sexp_test.c | 125 ++++++++++++++++++++++++++++++++
 grub-core/tests/rsa_sexp_test.c |  99 +++++++++++++++++++++++++
 2 files changed, 224 insertions(+)
 create mode 100644 grub-core/tests/dsa_sexp_test.c
 create mode 100644 grub-core/tests/rsa_sexp_test.c
grub-core/tests/dsa_sexp_test.c new file +125 -0
new file mode 100644
index 000000000..5b7b7b143
@@ -0,0 +1,125 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2024 Free Software Foundation, Inc.
+ *
+ *  GRUB is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/test.h>
+#include <grub/crypto.h>
+#include <grub/gcrypt/gcrypt.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+static char pubkey_dump[] = {
+  0x28, 0x31, 0x30, 0x3a, 0x70, 0x75, 0x62, 0x6c,
+  0x69, 0x63, 0x2d, 0x6b, 0x65, 0x79, 0x28, 0x33,
+  0x3a, 0x64, 0x73, 0x61, 0x28, 0x31, 0x3a, 0x70,
+  0x31, 0x32, 0x39, 0x3a, 0x00, 0xc0, 0x50, 0x14,
+  0x4c, 0x97, 0x10, 0x69, 0x07, 0xa7, 0xe9, 0x2b,
+  0xe5, 0xc6, 0x88, 0xe1, 0x6d, 0xd8, 0x38, 0x28,
+  0x09, 0x49, 0x5b, 0xe8, 0xa3, 0x04, 0xb8, 0xc4,
+  0x6e, 0x98, 0xc1, 0xc2, 0xb0, 0x2a, 0xe0, 0xe2,
+  0x1a, 0x30, 0xd2, 0xdb, 0x45, 0x1a, 0x88, 0x80,
+  0x28, 0x24, 0xb0, 0xbf, 0xc2, 0xbd, 0xe9, 0xf6,
+  0x9d, 0xa2, 0x01, 0x94, 0xe6, 0x7f, 0xa0, 0xb6,
+  0xe4, 0x39, 0xfc, 0x54, 0xba, 0x99, 0xb6, 0xbe,
+  0x39, 0xee, 0xa5, 0xd9, 0xa0, 0x35, 0x3c, 0x2d,
+  0x3e, 0x96, 0xc3, 0x96, 0xa5, 0x0d, 0x2b, 0xbf,
+  0x3b, 0xa3, 0xe2, 0xe8, 0x89, 0xed, 0x60, 0xe0,
+  0x43, 0x61, 0xb6, 0x73, 0xf6, 0xa7, 0xb4, 0x56,
+  0x76, 0x04, 0xf7, 0x8b, 0xf1, 0x84, 0xaa, 0x3e,
+  0xe0, 0x08, 0xad, 0xdd, 0xc2, 0x36, 0xfd, 0x3d,
+  0xd0, 0xad, 0xf4, 0x3a, 0x7e, 0x80, 0x8c, 0x52,
+  0x2b, 0x04, 0xa8, 0x03, 0x27, 0x29, 0x28, 0x31,
+  0x3a, 0x71, 0x32, 0x31, 0x3a, 0x00, 0xd5, 0x34,
+  0xd2, 0xc5, 0x1c, 0x26, 0xdf, 0xb0, 0xba, 0x78,
+  0x75, 0xe5, 0xe9, 0x36, 0x6b, 0x04, 0x03, 0xe2,
+  0x57, 0x3f, 0x29, 0x28, 0x31, 0x3a, 0x67, 0x31,
+  0x32, 0x38, 0x3a, 0x3b, 0xa0, 0xac, 0xa3, 0xa1,
+  0xd1, 0x04, 0x23, 0x5f, 0x9f, 0xbc, 0x6d, 0x9e,
+  0x88, 0x2a, 0x28, 0xc1, 0x48, 0xaf, 0xa5, 0x17,
+  0x59, 0x3a, 0x17, 0x33, 0x56, 0xaa, 0x8d, 0x27,
+  0x64, 0xfe, 0x8e, 0x8a, 0x2e, 0xba, 0xf2, 0x66,
+  0xcc, 0x66, 0xbd, 0xa4, 0xfe, 0xa9, 0x07, 0x0d,
+  0xae, 0x8c, 0x9f, 0x70, 0xf7, 0x87, 0xaa, 0x01,
+  0x47, 0x6b, 0xf9, 0x0f, 0x09, 0x18, 0x42, 0x76,
+  0xc4, 0xa3, 0xb9, 0x55, 0x11, 0x8d, 0xa3, 0xa5,
+  0x69, 0x30, 0x91, 0xb7, 0x03, 0xef, 0x7f, 0x12,
+  0xe6, 0xb9, 0x78, 0x73, 0xe0, 0xc0, 0x4f, 0xc6,
+  0xd9, 0x43, 0x99, 0x95, 0x0b, 0x4d, 0x58, 0xd3,
+  0x6b, 0x76, 0xb0, 0x6a, 0xcf, 0x68, 0x6d, 0xf0,
+  0xd9, 0xc1, 0x88, 0x43, 0x9d, 0xf9, 0x04, 0xcb,
+  0xc9, 0x82, 0x6c, 0xee, 0xd4, 0x9c, 0xbd, 0x1c,
+  0x4d, 0x54, 0x29, 0x83, 0xa9, 0x5e, 0xaa, 0x10,
+  0xa7, 0xc1, 0x04, 0x29, 0x28, 0x31, 0x3a, 0x79,
+  0x31, 0x32, 0x39, 0x3a, 0x00, 0x82, 0x33, 0xf1,
+  0x91, 0xe3, 0xf2, 0x12, 0x93, 0x5a, 0xed, 0x0c,
+  0x9d, 0xec, 0x67, 0xaa, 0xa7, 0x97, 0x7f, 0x9f,
+  0x5e, 0xef, 0x6a, 0x3e, 0xa4, 0x7f, 0x9b, 0xed,
+  0x65, 0xd7, 0xba, 0x40, 0x6d, 0xe1, 0xde, 0xc1,
+  0x14, 0x4c, 0x9b, 0x28, 0x5c, 0x03, 0x8e, 0x1a,
+  0xd4, 0x1b, 0x80, 0x1b, 0x07, 0xd6, 0x84, 0x04,
+  0x49, 0x6c, 0x1b, 0x08, 0x84, 0x15, 0x54, 0x62,
+  0xca, 0xd5, 0x75, 0xff, 0xc8, 0xb3, 0x81, 0x76,
+  0x82, 0x91, 0x35, 0x80, 0x20, 0x73, 0x2a, 0x21,
+  0xca, 0x22, 0x06, 0xa7, 0x73, 0x99, 0x75, 0x7e,
+  0x5e, 0xa6, 0x09, 0x59, 0x66, 0x2c, 0xcd, 0xb1,
+  0x8d, 0x3b, 0xc0, 0x68, 0xc5, 0x41, 0xa0, 0x9d,
+  0x82, 0x15, 0xc4, 0xdd, 0x47, 0x1c, 0x5b, 0xa9,
+  0x74, 0x18, 0xaf, 0x72, 0x63, 0x6b, 0x0a, 0x4e,
+  0x95, 0x09, 0x7a, 0xb5, 0x4b, 0x98, 0x85, 0xb9,
+  0x6d, 0x9d, 0x3b, 0x73, 0x8c, 0x29, 0x29, 0x29,
+};
+
+static char sig_dump[] = {
+  0x28, 0x37, 0x3a, 0x73, 0x69, 0x67, 0x2d, 0x76,
+  0x61, 0x6c, 0x28, 0x33, 0x3a, 0x64, 0x73, 0x61,
+  0x28, 0x31, 0x3a, 0x72, 0x32, 0x30, 0x3a, 0xb6,
+  0x60, 0x37, 0xef, 0x02, 0x7c, 0x7c, 0x6e, 0x4f,
+  0x66, 0x8c, 0x7c, 0x26, 0x77, 0xd9, 0x33, 0x90,
+  0xba, 0x7c, 0xfb, 0x29, 0x28, 0x31, 0x3a, 0x73,
+  0x32, 0x30, 0x3a, 0x83, 0xc0, 0x84, 0x72, 0xc6,
+  0x1c, 0x85, 0x6f, 0x8b, 0x9b, 0xb0, 0x38, 0x38,
+  0xb2, 0xb6, 0xdf, 0x1c, 0x52, 0x96, 0x1b, 0x29,
+  0x29, 0x29,
+};
+
+extern gcry_pk_spec_t _gcry_pubkey_spec_dsa;
+
+static void
+dsa_sexp_test (void)
+{
+  gcry_sexp_t sign_parms, sign_parms_invalid, pubkey, sig;
+  int rc;
+  grub_size_t errof;
+
+  rc = _gcry_sexp_build (&sign_parms_invalid, &errof,
+			"(data (value \"hi\"))\n");
+  grub_test_assert (rc == 0, "sexp build failed");
+
+  rc = _gcry_sexp_build (&sign_parms, &errof,
+			"(data (value \"hello\"))\n");
+  grub_test_assert (rc == 0, "sexp build failed");
+  rc = _gcry_sexp_new (&pubkey, pubkey_dump, sizeof(pubkey_dump), 0);
+  grub_test_assert (rc == 0, "sexp new failed");
+  rc = _gcry_sexp_new (&sig, sig_dump, sizeof(sig_dump), 0);
+  grub_test_assert (rc == 0, "sexp new failed");
+  rc = _gcry_pubkey_spec_dsa.verify (sig, sign_parms, pubkey);
+  grub_test_assert (rc == 0, "signature verification failed: %d", rc);
+  rc = _gcry_pubkey_spec_dsa.verify (sig, sign_parms_invalid, pubkey);
+  grub_test_assert (rc != 0, "signature verification succeded wrongly");
+}
+
+GRUB_FUNCTIONAL_TEST (dsa_sexp_test, dsa_sexp_test);
grub-core/tests/rsa_sexp_test.c new file +99 -0

99 lines not on this page · raw message

Signature · 7 lines
2.39.2


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#5 lore raw

PATCH v6 5/6 keccak: Disable acceleration with SSE asm

In reply to Vladimir Serbinenko

Libgcrypt code assumes that on x64 all SSE registers are fair game. While it's true that CPUs in question support it, we disable it in our compilation options. Disable the offending optimization.

---
 .../lib/libgcrypt-patches/02_keccak_sse.patch | 23 +++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 grub-core/lib/libgcrypt-patches/02_keccak_sse.patch
grub-core/lib/libgcrypt-patches/02_keccak_sse.patch new file +23 -0
new file mode 100644
index 000000000..9605bda48
@@ -0,0 +1,23 @@
+commit b0cf06271da5fe20360953a53a47c69da89669cd
+Author: Vladimir Serbinenko <[email protected]>
+Date:   Sun Apr 7 06:33:11 2024 +0300
+
+    keccak: Disable acceleration with SSE asm
+
+    Libgcrypt code assumes that on x64 all SSE registers are fair game.
+    While it's true that CPUs in question support it, we disable it in
+    our compilation options. Disable the offending optimization.
+
+diff --git a/grub-core/lib/libgcrypt/cipher/keccak.c b/grub-core/lib/libgcrypt/cipher/keccak.c
+index 11e64b3e7..8b570263b 100644
+--- a/grub-core/lib/libgcrypt-grub/cipher/keccak.c
++++ b/grub-core/lib/libgcrypt-grub/cipher/keccak.c
+@@ -275,7 +275,7 @@ keccak_absorb_lane32bi(u32 *lane, u32 x0, u32 x1)
+ /* Construct generic 64-bit implementation. */
+ #ifdef USE_64BIT
+ 
+-#if __GNUC__ >= 4 && defined(__x86_64__)
++#if __GNUC__ >= 4 && defined(__x86_64__) && 0
+ 
+ static inline void absorb_lanes64_8(u64 *dst, const byte *in)
+ {
Signature · 7 lines
2.39.2


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#6 lore raw

PATCH v6 6/6 Implement __aeabi_uldivmod

In reply to Vladimir Serbinenko

Some arm compilers insert 64-bit division into the code compiled from libgcrypt source and possibly others. Rether than fighting it, simply provide the function in question.

---
 grub-core/kern/arm/compiler-rt.S | 11 +++++++++++
 include/grub/compiler-rt.h       |  3 +++
 2 files changed, 14 insertions(+)
grub-core/kern/arm/compiler-rt.S +11 -0
index 645b42f50..26fe1c98d 100644
@@ -75,6 +75,17 @@ FUNCTION(__aeabi_uidivmod)
 FUNCTION(__aeabi_idivmod)
 	division32 grub_divmod32s
 
+        /* Copied from LLVM under MIT license.  */
+FUNCTION(__aeabi_uldivmod)
+        push	{r11, lr}
+        sub	sp, sp, #16
+        add	r12, sp, #8
+        str	r12, [sp]
+        bl	grub_divmod64
+        ldr	r2, [sp, #8]
+        ldr	r3, [sp, #12]
+        add	sp, sp, #16
+        pop	{r11, pc}
 /*
  * Null divide-by-zero handler
  */
include/grub/compiler-rt.h +3 -0
index 17828b322..43fd8f4d7 100644
@@ -73,6 +73,9 @@ EXPORT_FUNC (__aeabi_uidiv) (grub_uint32_t a, grub_uint32_t b);
 grub_uint32_t
 EXPORT_FUNC (__aeabi_uidivmod) (grub_uint32_t a, grub_uint32_t b);
 
+grub_uint64_t
+EXPORT_FUNC (__aeabi_uldivmod) (grub_uint64_t a, grub_uint64_t b);
+
 grub_int32_t
 EXPORT_FUNC (__aeabi_idiv) (grub_int32_t a, grub_int32_t b);
 grub_int32_t
Signature · 7 lines
2.39.2


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel