]> git.ipfire.org Git - thirdparty/glibc.git/commit
Import Solar Designer's public domain MD5 for use by localedef.
authorZack Weinberg <zack@owlfolio.org>
Thu, 21 Sep 2023 18:45:59 +0000 (14:45 -0400)
committerZack Weinberg <zack@owlfolio.org>
Thu, 21 Sep 2023 20:05:43 +0000 (16:05 -0400)
commitf59011763cae16dc89afc87d9218c5937bf7686b
tree107003cb881d25ea615c25cb15664b889a1ed5da
parent5d00c201b9a2da768a79ea8d5311f257871c0b43
Import Solar Designer's public domain MD5 for use by localedef.

Locale archives contain embedded MD5 hashes for integrity protection.
glibc's locale-reading code does not check these, but localedef does
generate them.  It was reusing crypt/md5.c for the implementation.
Rather than moving that file over to locale/, import Alexander
Peslyak (aka Solar Designer)'s public domain MD5 implementation, which
is simpler, and in particular, completely agnostic to endianness.  The
API uses different names, because Peslyak wanted to be API-compatible
with openssl, but is otherwise equivalent.

glibc's *tests* of the MD5 core (crypt/md5test.c and crypt/md5test-giant.c)
are transferred to the locale directory, and the new implementation is
verified to pass both.  (The "giant" test takes 90 seconds to run on a
2018-era x86; it was in xtests in crypt and it remains in xtests after
this patch.)  I converted both of them to the new test driver while I
was in there.

crypt/md5c-test.c is a test of MD5 *password hashing*, not of the MD5
core, so it is not moved.

This patch was compile-tested with both --enable-crypt and the default
--disable-crypt.
crypt/Makefile
locale/Makefile
locale/locarchive.h
locale/md5.c [new file with mode: 0644]
locale/md5.h [new file with mode: 0644]
locale/programs/locarchive.c
locale/programs/locfile.c
locale/tst-md5-giant.c [moved from crypt/md5test-giant.c with 77% similarity]
locale/tst-md5.c [moved from crypt/md5test.c with 78% similarity]