Re: [PATCH 3/7] crypto: powerpc/md5 - Remove PowerPC optimized MD5 code
From: Christophe Leroy <hidden>
Date: 2025-08-05 06:50:42
Also in:
linux-crypto, linux-mips, lkml, sparclinux
Le 05/08/2025 à 00:59, Eric Biggers a écrit :
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:What? That's crazy. Userspace MD5 code would be faster and more reliable. No need to make syscalls, transfer data to and from the kernel, have an external dependency, etc. Is this the coreutils md5sum? We need to get this reported and fixed.
Content of files is already buffered inside the kernel. likcapi doesn't tranfer data, it uses splice(). As far as I know, coreutil is not able to use the TALITOS Security engine we have on the mpc885 and mpc8321 microcontroleurs. We primarily use libkcapi for that. In order to keep things consistant, we use the same userspace on boards which don't have a security engine, ie the mpc866, we rely on the kernel providing an optimised software implementation fallback. Christophe