summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Cosgrove <tom.cosgrove@arm.com>2022-02-07 14:44:56 +0000
committerPauli <pauli@openssl.org>2022-02-09 13:24:31 +1100
commit3a23f01268ec47bf3423b849cc226be220745522 (patch)
tree4c2c9f5ab86beb273992ee67d99eab3451fc09bb
parent09030ee73693411c19b596cb0e0f43eb512ac0e6 (diff)
aarch64: fix branch target indications in arm64cpuid.pl and keccak1600
Add missing AARCH64_VALID_CALL_TARGET to armv8_rng_probe(). Also add these to the functions defined by gen_random(), and note that this Perl sub prints the assembler out directly, not going via the $code xlate mechanism (and therefore coming before the include of arm_arch.h). So fix this too. In KeccakF1600_int, AARCH64_SIGN_LINK_REGISTER functions as AARCH64_VALID_CALL_TARGET on BTI-only builds, so it needs to come before the 'adr' line. Change-Id: If241efe71591c88253a3e36647ced00300c3c1a3 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17653)
-rwxr-xr-xcrypto/arm64cpuid.pl9
-rwxr-xr-xcrypto/sha/asm/keccak1600-armv8.pl2
2 files changed, 7 insertions, 4 deletions
diff --git a/crypto/arm64cpuid.pl b/crypto/arm64cpuid.pl
index ebea4be59c..3ba593a488 100755
--- a/crypto/arm64cpuid.pl
+++ b/crypto/arm64cpuid.pl
@@ -189,6 +189,7 @@ CRYPTO_memcmp:
.globl _armv8_rng_probe
.type _armv8_rng_probe,%function
_armv8_rng_probe:
+ AARCH64_VALID_CALL_TARGET
mrs x0, s3_3_c2_c4_0 // rndr
mrs x0, s3_3_c2_c4_1 // rndrrs
ret
@@ -199,7 +200,7 @@ sub gen_random {
my $rdop = shift;
my $rand_reg = $rdop eq "rndr" ? "s3_3_c2_c4_0" : "s3_3_c2_c4_1";
-print<<___;
+return <<___;
// Fill buffer with Randomly Generated Bytes
// inputs: char * in x0 - Pointer to buffer
// size_t in x1 - Number of bytes to write to buffer
@@ -208,6 +209,7 @@ print<<___;
.type OPENSSL_${rdop}_asm,%function
.align 4
OPENSSL_${rdop}_asm:
+ AARCH64_VALID_CALL_TARGET
mov x2,xzr
mov x3,xzr
@@ -244,8 +246,9 @@ OPENSSL_${rdop}_asm:
.size OPENSSL_${rdop}_asm,.-OPENSSL_${rdop}_asm
___
}
-gen_random("rndr");
-gen_random("rndrrs");
+
+$code .= gen_random("rndr");
+$code .= gen_random("rndrrs");
print $code;
close STDOUT or die "error closing STDOUT: $!";
diff --git a/crypto/sha/asm/keccak1600-armv8.pl b/crypto/sha/asm/keccak1600-armv8.pl
index cf54b62c63..40f7aa7a69 100755
--- a/crypto/sha/asm/keccak1600-armv8.pl
+++ b/crypto/sha/asm/keccak1600-armv8.pl
@@ -126,8 +126,8 @@ $code.=<<___;
.type KeccakF1600_int,%function
.align 5
KeccakF1600_int:
- adr $C[2],iotas
AARCH64_SIGN_LINK_REGISTER
+ adr $C[2],iotas
stp $C[2],x30,[sp,#16] // 32 bytes on top are mine
b .Loop
.align 4