Linux cryptographic layer development
 help / color / mirror / Atom feed
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>,
	Zhihang Shao <zhihang.shao.iscas@gmail.com>
Subject: Re: [PATCH 2/3] lib/crypto: poly1305: Consolidate into single module
Date: Thu, 21 Aug 2025 00:14:45 -0400	[thread overview]
Message-ID: <20250821041445.GH185832@quark> (raw)
In-Reply-To: <20250816194353.562491-3-ebiggers@kernel.org>

On Sat, Aug 16, 2025 at 12:43:52PM -0700, Eric Biggers wrote:
> -perlasm-flavour-$(CONFIG_32BIT) := o32
> -perlasm-flavour-$(CONFIG_64BIT) := 64
> -
> -quiet_cmd_perlasm = PERLASM $@
> -      cmd_perlasm = $(PERL) $(<) $(perlasm-flavour-y) $(@)
> -
> -$(obj)/poly1305-core.S: $(src)/poly1305-mips.pl FORCE
> -	$(call if_changed,perlasm)
[...]
> +ifeq ($(CONFIG_MIPS),y)
> +libpoly1305-y += mips/poly1305-core.o
> +poly1305-perlasm-flavour-$(CONFIG_32BIT) := o32
> +poly1305-perlasm-flavour-$(CONFIG_64BIT) := 64
> +quiet_cmd_perlasm_poly1305 = PERLASM $@
> +      cmd_perlasm_poly1305 = $(PERL) $< $(poly1305-perlasm-flavour-y) $@
> +$(obj)/mips/poly1305-core.S: $(src)/mips/poly1305-mips.pl
> +	$(call if_changed,perlasm_poly1305)
> +endif

Small issue that I noticed: I removed the "FORCE" from the rule for
poly1305-core.S since none of the other perlasm rules had it.  But it's
actually needed because, unlike the other perlasm rules, this one uses
'if_changed' instead of 'cmd'.  'if_changed' requires FORCE.  And I
believe it does need to use 'if_changed', since the contents of the
generated .S file depends on the perlasm-flavour passed as an argument
to the perl script.  That can change when the kernel config changes.

So, TLDR: I'll restore the FORCE to the rule, and add a comment.

The RISC-V optimized Poly1305 code added by the third patch will need
if_changed and FORCE for the same reason.

Of course, it's unfortunate that these are written in Perl at all.  But
that is the convention used by Andy / CRYPTOGAMS, so that is what we'll
use unless someone wants to rewrite it...

- Eric

  reply	other threads:[~2025-08-21  4:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-16 19:43 [PATCH 0/3] Consolidate Poly1305 code and add RISC-V optimization Eric Biggers
2025-08-16 19:43 ` [PATCH 1/3] lib/crypto: poly1305: Remove unused function poly1305_is_arch_optimized() Eric Biggers
2025-08-16 19:43 ` [PATCH 2/3] lib/crypto: poly1305: Consolidate into single module Eric Biggers
2025-08-21  4:14   ` Eric Biggers [this message]
2025-08-16 19:43 ` [PATCH 3/3] lib/crypto: riscv/poly1305: Import OpenSSL/CRYPTOGAMS implementation 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=20250821041445.GH185832@quark \
    --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=zhihang.shao.iscas@gmail.com \
    /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