sparclinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	Ard Biesheuvel <ardb@kernel.org>,
	"Jason A . Donenfeld" <Jason@zx2c4.com>,
	linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	sparclinux@vger.kernel.org
Subject: Re: [PATCH 3/7] crypto: powerpc/md5 - Remove PowerPC optimized MD5 code
Date: Mon, 4 Aug 2025 22:59:01 +0000	[thread overview]
Message-ID: <20250804225901.GC54248@google.com> (raw)
In-Reply-To: <187412bd-3ae0-4fe8-b526-f96af6bea6dc@csgroup.eu>

On Mon, Aug 04, 2025 at 09:02:27PM +0200, Christophe Leroy wrote:
> 
> 
> Le 04/08/2025 à 20:09, Eric Biggers a écrit :
> > On Mon, Aug 04, 2025 at 07:42:15PM +0200, Christophe Leroy wrote:
> > > 
> > > 
> > > Le 03/08/2025 à 22:44, Eric Biggers a écrit :
> > > > 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.

- Eric

  reply	other threads:[~2025-08-04 22:59 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-03 20:44 [PATCH 0/7] MD5 library functions Eric Biggers
2025-08-03 20:44 ` [PATCH 1/7] mips: cavium-octeon: Remove Octeon optimized MD5 code Eric Biggers
2025-08-03 20:44 ` [PATCH 2/7] mips: cavium-octeon: Move octeon-crypto.c into parent dir Eric Biggers
2025-08-03 20:44 ` [PATCH 3/7] crypto: powerpc/md5 - Remove PowerPC optimized MD5 code Eric Biggers
2025-08-03 22:07   ` Segher Boessenkool
2025-08-03 22:14     ` Eric Biggers
2025-08-03 22:27       ` Segher Boessenkool
2025-08-03 22:56         ` Eric Biggers
2025-08-04 17:42   ` Christophe Leroy
2025-08-04 18:09     ` Eric Biggers
2025-08-04 19:02       ` Christophe Leroy
2025-08-04 22:59         ` Eric Biggers [this message]
2025-08-04 23:09           ` Eric Biggers
2025-08-05  6:21             ` Christophe Leroy
2025-08-05  4:49           ` Crypto use cases (was: Remove PowerPC optimized MD5 code) Simon Richter
2025-08-05  4:58             ` Eric Biggers
2025-08-05  7:17               ` Crypto use cases Simon Richter
2025-08-05 17:15                 ` Eric Biggers
2025-08-05  6:27           ` [PATCH 3/7] crypto: powerpc/md5 - Remove PowerPC optimized MD5 code Christophe Leroy
2025-08-05 16:16             ` Eric Biggers
2025-08-03 20:44 ` [PATCH 4/7] crypto: sparc/md5 - Remove SPARC64 " Eric Biggers
2025-08-04  4:44   ` Simon Richter
2025-08-04  6:07     ` Eric Biggers
2025-08-03 20:44 ` [PATCH 5/7] lib/crypto: md5: Add MD5 and HMAC-MD5 library functions Eric Biggers
2025-08-03 20:44 ` [PATCH 6/7] crypto: md5 - Wrap library and add HMAC support Eric Biggers
2025-08-03 20:44 ` [PATCH 7/7] lib/crypto: tests: Add KUnit tests for MD5 and HMAC-MD5 Eric Biggers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250804225901.GC54248@google.com \
    --to=ebiggers@kernel.org \
    --cc=Jason@zx2c4.com \
    --cc=ardb@kernel.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=sparclinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).