Re: [PATCH 3/7] crypto: powerpc/md5 - Remove PowerPC optimized MD5 code
From: Christophe Leroy <hidden>
Date: 2025-08-05 06:50:35
Also in:
linux-crypto, linux-mips, lkml, sparclinux
Le 05/08/2025 à 01:09, Eric Biggers a écrit :
On Mon, Aug 04, 2025 at 10:59:01PM +0000, Eric Biggers wrote:quoted
On Mon, Aug 04, 2025 at 09:02:27PM +0200, Christophe Leroy wrote:quoted
Le 04/08/2025 à 20:09, Eric Biggers a écrit :quoted
On Mon, Aug 04, 2025 at 07:42:15PM +0200, Christophe Leroy wrote:quoted
Le 03/08/2025 à 22:44, Eric Biggers a écrit :quoted
MD5 is insecure, is no longer commonly used, and has never been optimized for the most common architectures in the kernel. Only mips, powerpc, and sparc have optimized MD5 code in the kernel. Of these, only the powerpc one is actually testable in QEMU. The mips one works only on Cavium Octeon SoCs. Taken together, it's clear that it's time to retire these additional MD5 implementations, and focus maintenance on the MD5 generic C code.Sorry, for me it is not that clear. Even if MD5 is depracated we still have several applications that use MD5 for various reasons on our boards. I ran the test on kernel v6.16 with following file: # ls -l avion.au -rw------- 1 root root 12130159 Jan 1 1970 avion.au With CONFIG_CRYPTO_MD5_PPC: # time md5sum avion.au 6513851d6109d42477b20cd56bf57f28 avion.au real 0m 1.02s user 0m 0.01s sys 0m 1.01s Without CONFIG_CRYPTO_MD5_PPC: # time md5sum avion.au 6513851d6109d42477b20cd56bf57f28 avion.au real 0m 1.35s user 0m 0.01s sys 0m 1.34s I think the difference is big enough to consider keeping optimised MD5 code.But md5sum doesn't use the kernel's MD5 code. So it's implausible that it has any effect on md5sum. The difference you saw must be due to an unrelated reason like I/O caching, CPU frequency, etc. Try running your test multiple times to eliminate other sources of variation.md5sum uses the kernel's MD5 code: libkcapi.so.1 => /usr/lib/libkcapi.so.1 (0x6ffa0000) <==Oh, I think you used the obscure implementation of md5sum from libkcapi-tools, instead of the normal md5sum. Why? Did you check how the normal md5sum performs too? Just doing the calculation in userspace is much more efficient.
Calculation in userspace is less efficient on my board: # time md5sum avion.au 6513851d6109d42477b20cd56bf57f28 avion.au real 0m 1.87s user 0m 1.51s sys 0m 0.35s Christophe