Skip to contentSkip to conversation

crypto: arm: generate *.S by Perl at build time instead of shipping them

PATCH In review Masahiro Yamada 4 participants 8 messages Apr 25, 2021 – May 14, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 crypto: arm: generate *.S by Perl at build time instead of shipping them

Generate *.S by Perl like arch/{mips,x86}/crypto/Makefile.

---

 arch/arm/crypto/Makefile                |    8 +-
 arch/arm/crypto/poly1305-core.S_shipped | 1158 ----------
 arch/arm/crypto/sha256-core.S_shipped   | 2816 -----------------------
 arch/arm/crypto/sha512-core.S_shipped   | 1869 ---------------
 4 files changed, 3 insertions(+), 5848 deletions(-)
 delete mode 100644 arch/arm/crypto/poly1305-core.S_shipped
 delete mode 100644 arch/arm/crypto/sha256-core.S_shipped
 delete mode 100644 arch/arm/crypto/sha512-core.S_shipped
arch/arm/crypto/Makefile +3 -5
index 8f26c454ea12..51f160c61740 100644
@@ -45,19 +45,17 @@ poly1305-arm-y := poly1305-core.o poly1305-glue.o
 nhpoly1305-neon-y := nh-neon-core.o nhpoly1305-neon-glue.o
 curve25519-neon-y := curve25519-core.o curve25519-glue.o
 
-ifdef REGENERATE_ARM_CRYPTO
 quiet_cmd_perl = PERL    $@
       cmd_perl = $(PERL) $(<) > $(@)
 
-$(src)/poly1305-core.S_shipped: $(src)/poly1305-armv4.pl
+$(obj)/poly1305-core.S: $(src)/poly1305-armv4.pl
 	$(call cmd,perl)
 
-$(src)/sha256-core.S_shipped: $(src)/sha256-armv4.pl
+$(obj)/sha256-core.S: $(src)/sha256-armv4.pl
 	$(call cmd,perl)
 
-$(src)/sha512-core.S_shipped: $(src)/sha512-armv4.pl
+$(obj)/sha512-core.S: $(src)/sha512-armv4.pl
 	$(call cmd,perl)
-endif
 
 clean-files += poly1305-core.S sha256-core.S sha512-core.S
 
arch/arm/crypto/poly1305-core.S_shipped deleted +0 -1158

1,158 lines not on this page · raw message

arch/arm/crypto/sha256-core.S_shipped deleted +0 -2816

1,820 lines not on this page · raw message

arch/arm/crypto/sha512-core.S_shipped deleted +0 -1869

1,869 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.27.0

Part of the diff is not shown here. View the raw message.

#1 lore raw

PATCH 2/4 crypto: arm: use a pattern rule for generating *.S files

Unify similar build rules.

---

 arch/arm/crypto/Makefile | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
arch/arm/crypto/Makefile +1 -7
index 51f160c61740..eafa898ba6a7 100644
@@ -48,13 +48,7 @@ curve25519-neon-y := curve25519-core.o curve25519-glue.o
 quiet_cmd_perl = PERL    $@
       cmd_perl = $(PERL) $(<) > $(@)
 
-$(obj)/poly1305-core.S: $(src)/poly1305-armv4.pl
-	$(call cmd,perl)
-
-$(obj)/sha256-core.S: $(src)/sha256-armv4.pl
-	$(call cmd,perl)
-
-$(obj)/sha512-core.S: $(src)/sha512-armv4.pl
+$(obj)/%-core.S: $(src)/%-armv4.pl
 	$(call cmd,perl)
 
 clean-files += poly1305-core.S sha256-core.S sha512-core.S
Signature · 1 line
2.27.0
#2 lore raw

PATCH 3/4 crypto: arm64: generate *.S by Perl at build time instead of shipping them

In reply to Masahiro Yamada

Generate *.S by Perl like arch/{mips,x86}/crypto/Makefile.

---

 arch/arm64/crypto/Makefile                |    9 +-
 arch/arm64/crypto/poly1305-core.S_shipped |  835 ---------
 arch/arm64/crypto/sha256-core.S_shipped   | 2069 ---------------------
 arch/arm64/crypto/sha512-core.S_shipped   | 1093 -----------
 4 files changed, 3 insertions(+), 4003 deletions(-)
 delete mode 100644 arch/arm64/crypto/poly1305-core.S_shipped
 delete mode 100644 arch/arm64/crypto/sha256-core.S_shipped
 delete mode 100644 arch/arm64/crypto/sha512-core.S_shipped
arch/arm64/crypto/Makefile +3 -6
index d0901e610df3..592e52a08c62 100644
@@ -68,19 +68,16 @@ CFLAGS_aes-glue-ce.o	:= -DUSE_V8_CRYPTO_EXTENSIONS
 $(obj)/aes-glue-%.o: $(src)/aes-glue.c FORCE
 	$(call if_changed_rule,cc_o_c)
 
-ifdef REGENERATE_ARM64_CRYPTO
 quiet_cmd_perlasm = PERLASM $@
       cmd_perlasm = $(PERL) $(<) void $(@)
 
-$(src)/poly1305-core.S_shipped: $(src)/poly1305-armv8.pl
+$(obj)/poly1305-core.S: $(src)/poly1305-armv8.pl
 	$(call cmd,perlasm)
 
-$(src)/sha256-core.S_shipped: $(src)/sha512-armv8.pl
+$(obj)/sha256-core.S: $(src)/sha512-armv8.pl
 	$(call cmd,perlasm)
 
-$(src)/sha512-core.S_shipped: $(src)/sha512-armv8.pl
+$(obj)/sha512-core.S: $(src)/sha512-armv8.pl
 	$(call cmd,perlasm)
 
-endif
-
 clean-files += poly1305-core.S sha256-core.S sha512-core.S
arch/arm64/crypto/poly1305-core.S_shipped deleted +0 -835

835 lines not on this page · raw message

arch/arm64/crypto/sha256-core.S_shipped deleted +0 -2069

2,069 lines not on this page · raw message

arch/arm64/crypto/sha512-core.S_shipped deleted +0 -1093

74 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.27.0

Part of the diff is not shown here. View the raw message.

maintainer
#3 lore raw

Re: [PATCH 3/4] crypto: arm64: generate *.S by Perl at build time instead of shipping them

[+Ard]

Quoted 5 lines · Masahiro Yamada

Generate *.S by Perl like arch/{mips,x86}/crypto/Makefile.

---

Quoted 8 lines
 arch/arm64/crypto/Makefile                |    9 +-
 arch/arm64/crypto/poly1305-core.S_shipped |  835 ---------
 arch/arm64/crypto/sha256-core.S_shipped   | 2069 ---------------------
 arch/arm64/crypto/sha512-core.S_shipped   | 1093 -----------
 4 files changed, 3 insertions(+), 4003 deletions(-)
 delete mode 100644 arch/arm64/crypto/poly1305-core.S_shipped
 delete mode 100644 arch/arm64/crypto/sha256-core.S_shipped
 delete mode 100644 arch/arm64/crypto/sha512-core.S_shipped

What's the advantage of removing the _shipped files? We included them originally so that we didn't require perl for the kernel build -- is that no longer an issue?

I guess I'm just missing the justification for the change.

Cheers,

Will

#4 lore raw

Re: [PATCH 3/4] crypto: arm64: generate *.S by Perl at build time instead of shipping them

Quoted 18 lines · Will Deacon

[+Ard]

Quoted 5 lines · Masahiro Yamada

Generate *.S by Perl like arch/{mips,x86}/crypto/Makefile.

---

Quoted 8 lines
 arch/arm64/crypto/Makefile                |    9 +-
 arch/arm64/crypto/poly1305-core.S_shipped |  835 ---------
 arch/arm64/crypto/sha256-core.S_shipped   | 2069 ---------------------
 arch/arm64/crypto/sha512-core.S_shipped   | 1093 -----------
 4 files changed, 3 insertions(+), 4003 deletions(-)
 delete mode 100644 arch/arm64/crypto/poly1305-core.S_shipped
 delete mode 100644 arch/arm64/crypto/sha256-core.S_shipped
 delete mode 100644 arch/arm64/crypto/sha512-core.S_shipped
Quoted 5 lines

What's the advantage of removing the _shipped files? We included them originally so that we didn't require perl for the kernel build -- is that no longer an issue?

I guess I'm just missing the justification for the change.

Removing 4000 lines of code is an improvement in itself, I suppose, but I have no preference either way,

#5 lore raw

Re: [PATCH 3/4] crypto: arm64: generate *.S by Perl at build time instead of shipping them

Quoted 20 lines · Ard Biesheuvel
Quoted 18 lines · Will Deacon

[+Ard]

Quoted 13 lines · Masahiro Yamada

Generate *.S by Perl like arch/{mips,x86}/crypto/Makefile.

---

 arch/arm64/crypto/Makefile                |    9 +-
 arch/arm64/crypto/poly1305-core.S_shipped |  835 ---------
 arch/arm64/crypto/sha256-core.S_shipped   | 2069 ---------------------
 arch/arm64/crypto/sha512-core.S_shipped   | 1093 -----------
 4 files changed, 3 insertions(+), 4003 deletions(-)
 delete mode 100644 arch/arm64/crypto/poly1305-core.S_shipped
 delete mode 100644 arch/arm64/crypto/sha256-core.S_shipped
 delete mode 100644 arch/arm64/crypto/sha512-core.S_shipped
Quoted 8 lines
Quoted 5 lines

What's the advantage of removing the _shipped files? We included them originally so that we didn't require perl for the kernel build -- is that no longer an issue?

I guess I'm just missing the justification for the change.

Removing 4000 lines of code is an improvement in itself, I suppose, but I have no preference either way,

If necessary, I can send v2 with the following info added.

------------------------------>8--------------------------------- People building the arm64 kernel are likely to have Perl already installed on the system.

ARCH=arm64 defconfig sets CONFIG_OID_REGISTRY=y, so Perl is required to generate lib/oid_registery_data.c anyway.

Also, Documentation/process/changes.rst says:

You will need perl 5 and the following modules: ``Getopt::Long``, ``Getopt::Std``, ``File::Basename``, and ``File::Find`` to build the kernel. ------------------------------>8---------------------------------

--
Best Regards
Masahiro Yamada

#6 lore raw

PATCH 4/4 crypto: arm64: use a pattern rule for generating *.S files

In reply to Masahiro Yamada

Unify similar build rules.

sha256-core.S opts out it because it is generated from sha512-armv8.pl.

---

 arch/arm64/crypto/Makefile | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
arch/arm64/crypto/Makefile +1 -4
index 592e52a08c62..09a805cc32d7 100644
@@ -71,13 +71,10 @@ $(obj)/aes-glue-%.o: $(src)/aes-glue.c FORCE
 quiet_cmd_perlasm = PERLASM $@
       cmd_perlasm = $(PERL) $(<) void $(@)
 
-$(obj)/poly1305-core.S: $(src)/poly1305-armv8.pl
+$(obj)/%-core.S: $(src)/%-armv8.pl
 	$(call cmd,perlasm)
 
 $(obj)/sha256-core.S: $(src)/sha512-armv8.pl
 	$(call cmd,perlasm)
 
-$(obj)/sha512-core.S: $(src)/sha512-armv8.pl
-	$(call cmd,perlasm)
-
 clean-files += poly1305-core.S sha256-core.S sha512-core.S
Signature · 1 line
2.27.0
maintainer
#7 lore raw
In reply to Masahiro Yamada
Quoted 5 lines · Masahiro Yamada

Generate *.S by Perl like arch/{mips,x86}/crypto/Makefile.

---

Quoted 8 lines
 arch/arm/crypto/Makefile                |    8 +-
 arch/arm/crypto/poly1305-core.S_shipped | 1158 ----------
 arch/arm/crypto/sha256-core.S_shipped   | 2816 -----------------------
 arch/arm/crypto/sha512-core.S_shipped   | 1869 ---------------
 4 files changed, 3 insertions(+), 5848 deletions(-)
 delete mode 100644 arch/arm/crypto/poly1305-core.S_shipped
 delete mode 100644 arch/arm/crypto/sha256-core.S_shipped
 delete mode 100644 arch/arm/crypto/sha512-core.S_shipped

All applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt