From 15b011e0bea1723745df54c0e56949923c617827 Mon Sep 17 00:00:00 2001 From: Alexey Moksyakov Date: Wed, 22 Jan 2025 11:01:42 +0300 Subject: [PATCH] [chacha_sve][aarch64] Move constant to .rodata section MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Saša Nedvědický Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/26509) --- crypto/chacha/asm/chacha-armv8-sve.pl | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/crypto/chacha/asm/chacha-armv8-sve.pl b/crypto/chacha/asm/chacha-armv8-sve.pl index 0e19bffc4de..cf541920056 100755 --- a/crypto/chacha/asm/chacha-armv8-sve.pl +++ b/crypto/chacha/asm/chacha-armv8-sve.pl @@ -30,6 +30,7 @@ sub AUTOLOAD() # thunk [simplified] x86-style perlasm $code .= "\t$opcode\t".join(',',@_,$arg)."\n"; } +$prefix="chacha_sve"; my ($outp,$inp,$len,$key,$ctr) = map("x$_",(0..4)); my ($veclen) = ("x5"); my ($counter) = ("x6"); @@ -721,11 +722,19 @@ $code.=<<___; .hidden OPENSSL_armcap_P .text + +.rodata .align 5 +.type _${prefix}_consts,%object +_${prefix}_consts: .Lchacha20_consts: .quad 0x3320646e61707865,0x6b20657479622d32 // endian-neutral .Lrot8: .word 0x02010003,0x04040404,0x02010003,0x04040404 +.size _${prefix}_consts,.-_${prefix}_consts + +.previous + .globl ChaCha20_ctr32_sve .type ChaCha20_ctr32_sve,%function .align 5 @@ -744,7 +753,8 @@ ChaCha20_ctr32_sve: 1: cmp $veclen,4 b.le .Lreturn - adr $tmp,.Lrot8 + adrp $tmp,.Lrot8 + add $tmp,$tmp,#:lo12:.Lrot8 ldp $tmpw0,$tmpw1,[$tmp] index $rot8.s,$tmpw0,$tmpw1 2: @@ -762,7 +772,8 @@ ChaCha20_ctr32_sve: stp x28,x29,[sp,160] str x30,[sp,176] - adr $tmp,.Lchacha20_consts + adrp $tmp,.Lchacha20_consts + add $tmp,$tmp,#:lo12:.Lchacha20_consts ldp @K[0],@K[1],[$tmp] ldp @K[2],@K[3],[$key] ldp @K[4],@K[5],[$key, 16] -- 2.47.2