summaryrefslogtreecommitdiffstats
path: root/crypto/arm64cpuid.pl
diff options
context:
space:
mode:
authorTom Cosgrove <tom.cosgrove@arm.com>2022-02-07 15:44:56 +0100
committerPauli <pauli@openssl.org>2022-02-09 03:24:31 +0100
commit3a23f01268ec47bf3423b849cc226be220745522 (patch)
tree4c2c9f5ab86beb273992ee67d99eab3451fc09bb /crypto/arm64cpuid.pl
parentAdd the check after calling OPENSSL_strdup (diff)
downloadopenssl-3a23f01268ec47bf3423b849cc226be220745522.tar.xz
openssl-3a23f01268ec47bf3423b849cc226be220745522.zip
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)
Diffstat (limited to 'crypto/arm64cpuid.pl')
-rwxr-xr-xcrypto/arm64cpuid.pl9
1 files changed, 6 insertions, 3 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: $!";