linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Simon Richter <Simon.Richter@hogyros.de>
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 4/7] crypto: sparc/md5 - Remove SPARC64 optimized MD5 code
Date: Sun, 3 Aug 2025 23:07:58 -0700	[thread overview]
Message-ID: <20250804060758.GA108924@sol> (raw)
In-Reply-To: <3de7cc4d-cb88-4107-9265-066cbedd4561@hogyros.de>

On Mon, Aug 04, 2025 at 01:44:21PM +0900, Simon Richter wrote:
> Hi,
> 
> On 8/4/25 05:44, Eric Biggers wrote:
> 
> > Taken together, it's clear that it's time to retire these additional MD5
> > implementations, and focus maintenance on the MD5 generic C code.
> 
> [...]
> 
> > -	ldd	[%o1 + 0x00], %f8
> > -	ldd	[%o1 + 0x08], %f10
> > -	ldd	[%o1 + 0x10], %f12
> > -	ldd	[%o1 + 0x18], %f14
> > -	ldd	[%o1 + 0x20], %f16
> > -	ldd	[%o1 + 0x28], %f18
> > -	ldd	[%o1 + 0x30], %f20
> > -	ldd	[%o1 + 0x38], %f22
> > -
> > -	MD5
> 
> This is a literal CPU instruction that ingests sixteen registers (f8 to f23)
> and updates the hash state in f0 to f3.

Note that QEMU doesn't support this instruction.  I don't actually know
whether the SPARC64 MD5 code even works, especially after (presumably
untested) refactoring like commit cc1f5bbe428c91.  I don't think anyone
does, TBH.  No one seems to be running the crypto tests on SPARC64.

> I can see the point of removing hand-optimized assembler code when a
> compiler can generate something that runs just as well from generic code,
> but this here is using CPU extensions that were made for this specific
> purpose.

You do realize this is MD5, right?  And also SPARC64?

I'm confused why people are so attached to still having MD5 assembly
code in 2025, and *only for rare platforms*.  It's illogical.

We should just treat MD5 like the other legacy algorithms MD4 and RC4,
for which the kernel just has generic C code.  That works perfectly fine
for the few users that still need those algorithms for compatibility
reasons.

> This is exactly the kind of thing you would point to as an argument why
> asynchronous hardware offload support is unnecessary.

For an algorithm that is actually worthwhile to accelerate, sure.  For
MD5, it's not worthwhile anyway.

- Eric

  reply	other threads:[~2025-08-04  6:08 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
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 [this message]
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=20250804060758.GA108924@sol \
    --to=ebiggers@kernel.org \
    --cc=Jason@zx2c4.com \
    --cc=Simon.Richter@hogyros.de \
    --cc=ardb@kernel.org \
    --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).