Skip to content

Commit f569ca1

Browse files
ardbiesheuvelherbertx
authored andcommitted
crypto: arm64/poly1305 - incorporate OpenSSL/CRYPTOGAMS NEON implementation
This is a straight import of the OpenSSL/CRYPTOGAMS Poly1305 implementation for NEON authored by Andy Polyakov, and contributed by him to the OpenSSL project. The file 'poly1305-armv8.pl' is taken straight from this upstream GitHub repository [0] at commit ec55a08dc0244ce570c4fc7cade330c60798952f, and already contains all the changes required to build it as part of a Linux kernel module. [0] https://github.com/dot-asm/cryptogams Co-developed-by: Andy Polyakov <[email protected]> Signed-off-by: Andy Polyakov <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent f0e89bc commit f569ca1

File tree

6 files changed

+2001
-1
lines changed

6 files changed

+2001
-1
lines changed

arch/arm64/crypto/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ config CRYPTO_CHACHA20_NEON
106106
select CRYPTO_LIB_CHACHA_GENERIC
107107
select CRYPTO_ARCH_HAVE_LIB_CHACHA
108108

109+
config CRYPTO_POLY1305_NEON
110+
tristate "Poly1305 hash function using scalar or NEON instructions"
111+
depends on KERNEL_MODE_NEON
112+
select CRYPTO_HASH
113+
select CRYPTO_ARCH_HAVE_LIB_POLY1305
114+
109115
config CRYPTO_NHPOLY1305_NEON
110116
tristate "NHPoly1305 hash function using NEON instructions (for Adiantum)"
111117
depends on KERNEL_MODE_NEON

arch/arm64/crypto/Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ sha512-arm64-y := sha512-glue.o sha512-core.o
5050
obj-$(CONFIG_CRYPTO_CHACHA20_NEON) += chacha-neon.o
5151
chacha-neon-y := chacha-neon-core.o chacha-neon-glue.o
5252

53+
obj-$(CONFIG_CRYPTO_POLY1305_NEON) += poly1305-neon.o
54+
poly1305-neon-y := poly1305-core.o poly1305-glue.o
55+
AFLAGS_poly1305-core.o += -Dpoly1305_init=poly1305_init_arm64
56+
5357
obj-$(CONFIG_CRYPTO_NHPOLY1305_NEON) += nhpoly1305-neon.o
5458
nhpoly1305-neon-y := nh-neon-core.o nhpoly1305-neon-glue.o
5559

@@ -68,11 +72,15 @@ ifdef REGENERATE_ARM64_CRYPTO
6872
quiet_cmd_perlasm = PERLASM $@
6973
cmd_perlasm = $(PERL) $(<) void $(@)
7074

75+
$(src)/poly1305-core.S_shipped: $(src)/poly1305-armv8.pl
76+
$(call cmd,perlasm)
77+
7178
$(src)/sha256-core.S_shipped: $(src)/sha512-armv8.pl
7279
$(call cmd,perlasm)
7380

7481
$(src)/sha512-core.S_shipped: $(src)/sha512-armv8.pl
7582
$(call cmd,perlasm)
83+
7684
endif
7785

78-
clean-files += sha256-core.S sha512-core.S
86+
clean-files += poly1305-core.S sha256-core.S sha512-core.S

0 commit comments

Comments
 (0)