From: Eric Biggers <ebiggers@kernel.org>
To: linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, "Ard Biesheuvel" <ardb@kernel.org>,
"Jason A . Donenfeld " <Jason@zx2c4.com>,
"René van Dorst" <opensource@vdorst.com>,
linux-mips@vger.kernel.org, llvm@lists.linux.dev,
stable@vger.kernel.org, "kernel test robot" <lkp@intel.com>
Subject: Re: [PATCH] lib/crypto: mips/chacha: Fix clang build and remove unneeded byteswap
Date: Mon, 23 Jun 2025 19:47:30 -0700 [thread overview]
Message-ID: <20250624024730.GC7127@sol> (raw)
In-Reply-To: <20250619225535.679301-1-ebiggers@kernel.org>
On Thu, Jun 19, 2025 at 03:55:35PM -0700, Eric Biggers wrote:
> The MIPS32r2 ChaCha code has never been buildable with the clang
> assembler. First, clang doesn't support the 'rotl' pseudo-instruction:
>
> error: unknown instruction, did you mean: rol, rotr?
>
> Second, clang requires that both operands of the 'wsbh' instruction be
> explicitly given:
>
> error: too few operands for instruction
>
> To fix this, align the code with the real instruction set by (1) using
> the real instruction 'rotr' instead of the nonstandard pseudo-
> instruction 'rotl', and (2) explicitly giving both operands to 'wsbh'.
>
> To make removing the use of 'rotl' a bit easier, also remove the
> unnecessary special-casing for big endian CPUs at
> .Lchacha_mips_xor_bytes. The tail handling is actually
> endian-independent since it processes one byte at a time. On big endian
> CPUs the old code byte-swapped SAVED_X, then iterated through it in
> reverse order. But the byteswap and reverse iteration canceled out.
>
> Tested with chacha20poly1305-selftest in QEMU using "-M malta" with both
> little endian and big endian mips32r2 kernels.
>
> Fixes: 49aa7c00eddf ("crypto: mips/chacha - import 32r2 ChaCha code from Zinc")
> Cc: stable@vger.kernel.org
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202505080409.EujEBwA0-lkp@intel.com/
> Signed-off-by: Eric Biggers <ebiggers@kernel.org>
> ---
>
> This applies on top of other pending lib/crypto patches and can be
> retrieved from git at:
>
> git fetch https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git mips-chacha-fix
>
> lib/crypto/mips/chacha-core.S | 20 +++++++-------------
> 1 file changed, 7 insertions(+), 13 deletions(-)
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git/log/?h=libcrypto-next
- Eric
prev parent reply other threads:[~2025-06-24 2:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-19 22:55 [PATCH] lib/crypto: mips/chacha: Fix clang build and remove unneeded byteswap Eric Biggers
2025-06-24 2:47 ` Eric Biggers [this message]
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=20250624024730.GC7127@sol \
--to=ebiggers@kernel.org \
--cc=Jason@zx2c4.com \
--cc=ardb@kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=lkp@intel.com \
--cc=llvm@lists.linux.dev \
--cc=opensource@vdorst.com \
--cc=stable@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.