From 3a23f01268ec47bf3423b849cc226be220745522 Mon Sep 17 00:00:00 2001 From: Tom Cosgrove Date: Mon, 7 Feb 2022 14:44:56 +0000 Subject: 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 Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/17653) --- crypto/arm64cpuid.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'crypto/arm64cpuid.pl') 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: $!"; -- cgit v1.2.3