diff options
author | fangming.fang <fangming.fang@arm.com> | 2023-01-11 03:49:28 +0000 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2023-01-16 17:04:26 +0100 |
commit | a419d3aa8d0f72e2ef88394f2db7654a872b8954 (patch) | |
tree | b03930c9f67b71162a2ecf4b03bea1883c9b2ebd /crypto/chacha | |
parent | c9d7c0b349b03d2fad5e11c630501cf223a569d7 (diff) |
Fix big-endian issue in chacha20 SVE implementation on aarch64
Fixes: #19902
Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20028)
(cherry picked from commit cd7a8e96bbdbedb05f7f13a8fb13fb5d9d0d17a6)
Diffstat (limited to 'crypto/chacha')
-rwxr-xr-x | crypto/chacha/asm/chacha-armv8-sve.pl | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/crypto/chacha/asm/chacha-armv8-sve.pl b/crypto/chacha/asm/chacha-armv8-sve.pl index 0c25564c3a..6afc629368 100755 --- a/crypto/chacha/asm/chacha-armv8-sve.pl +++ b/crypto/chacha/asm/chacha-armv8-sve.pl @@ -247,6 +247,9 @@ sub load_regs() { my $next_offset = $offset + 1; $code.=<<___; ld1w {$reg.s},p0/z,[$inp,#$offset,MUL VL] +#ifdef __AARCH64EB__ + revb $reg.s,p0/m,$reg.s +#endif ___ if (@_) { &load_regs($next_offset, @_); @@ -268,6 +271,9 @@ sub store_regs() { my $reg = shift; my $next_offset = $offset + 1; $code.=<<___; +#ifdef __AARCH64EB__ + revb $reg.s,p0/m,$reg.s +#endif st1w {$reg.s},p0,[$outp,#$offset,MUL VL] ___ if (@_) { @@ -472,14 +478,14 @@ ___ sub SVE_TRANSFORMS() { $code.=<<___; #ifdef __AARCH64EB__ - rev @x[0],@x[0] - rev @x[2],@x[2] - rev @x[4],@x[4] - rev @x[6],@x[6] - rev @x[8],@x[8] - rev @x[10],@x[10] - rev @x[12],@x[12] - rev @x[14],@x[14] + rev @sxx[0],@sxx[0] + rev @sxx[2],@sxx[2] + rev @sxx[4],@sxx[4] + rev @sxx[6],@sxx[6] + rev @sxx[8],@sxx[8] + rev @sxx[10],@sxx[10] + rev @sxx[12],@sxx[12] + rev @sxx[14],@sxx[14] #endif .if mixin == 1 add @K[6],@K[6],#1 @@ -858,7 +864,8 @@ my %opcode_pred = ( "ld1w" => 0xA540A000, "ld1rw" => 0x8540C000, "lasta" => 0x0520A000, - "revh" => 0x05258000); + "revh" => 0x05258000, + "revb" => 0x05248000); my %tsize = ( 'b' => 0, |