2 # Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.
4 # Licensed under the Apache License 2.0 (the "License"). You may not use
5 # this file except in compliance with the License. You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
10 # $output is the last argument if it looks like a file (it has an extension)
11 # $flavour is the first argument if it doesn't look like a file
12 $output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m
|\
.\w
+$| ?
pop : undef;
13 $flavour = $#ARGV >= 0 && $ARGV[0] !~ m
|\
.| ?
shift : undef;
15 $0 =~ m/(.*[\/\\])[^\
/\\]+$/; $dir=$1;
16 ( $xlate="${dir}arm-xlate.pl" and -f
$xlate ) or
17 ( $xlate="${dir}perlasm/arm-xlate.pl" and -f
$xlate) or
18 die "can't locate arm-xlate.pl";
20 open OUT
,"| \"$^X\" $xlate $flavour \"$output\""
21 or die "can't call $xlate: $!";
31 .globl _armv7_neon_probe
32 .type _armv7_neon_probe
,%function
34 AARCH64_VALID_CALL_TARGET
35 orr v15
.16b
, v15
.16b
, v15
.16b
37 .size _armv7_neon_probe
,.-_armv7_neon_probe
40 .type _armv7_tick
,%function
42 AARCH64_VALID_CALL_TARGET
49 .size _armv7_tick
,.-_armv7_tick
51 .globl _armv8_aes_probe
52 .type _armv8_aes_probe
,%function
54 AARCH64_VALID_CALL_TARGET
57 .size _armv8_aes_probe
,.-_armv8_aes_probe
59 .globl _armv8_sha1_probe
60 .type _armv8_sha1_probe
,%function
62 AARCH64_VALID_CALL_TARGET
65 .size _armv8_sha1_probe
,.-_armv8_sha1_probe
67 .globl _armv8_sha256_probe
68 .type _armv8_sha256_probe
,%function
70 AARCH64_VALID_CALL_TARGET
71 sha256su0 v0
.4s
, v0
.4s
73 .size _armv8_sha256_probe
,.-_armv8_sha256_probe
75 .globl _armv8_pmull_probe
76 .type _armv8_pmull_probe
,%function
78 AARCH64_VALID_CALL_TARGET
79 pmull v0
.1q
, v0
.1d
, v0
.1d
81 .size _armv8_pmull_probe
,.-_armv8_pmull_probe
83 .globl _armv8_sm4_probe
84 .type _armv8_sm4_probe
,%function
86 AARCH64_VALID_CALL_TARGET
87 .inst
0xcec08400 // sm4e v0
.4s
, v0
.4s
89 .size _armv8_sm4_probe
,.-_armv8_sm4_probe
91 .globl _armv8_sha512_probe
92 .type _armv8_sha512_probe
,%function
94 AARCH64_VALID_CALL_TARGET
95 .inst
0xcec08000 // sha512su0 v0
.2d
,v0
.2d
97 .size _armv8_sha512_probe
,.-_armv8_sha512_probe
99 .globl _armv8_eor3_probe
100 .type _armv8_eor3_probe
,%function
102 AARCH64_VALID_CALL_TARGET
103 .inst
0xce010800 // eor3 v0
.16b
, v0
.16b
, v1
.16b
, v2
.16b
105 .size _armv8_eor3_probe
,.-_armv8_eor3_probe
107 .globl _armv8_sve_probe
108 .type _armv8_sve_probe
,%function
110 AARCH64_VALID_CALL_TARGET
111 .inst
0x04a03000 // eor z0
.d
,z0
.d
,z0
.d
113 .size _armv8_sve_probe
,.-_armv8_sve_probe
115 .globl _armv8_sve2_probe
116 .type _armv8_sve2_probe
,%function
118 AARCH64_VALID_CALL_TARGET
119 .inst
0x04e03400 // xar z0
.d
,z0
.d
,z0
.d
121 .size _armv8_sve2_probe
,.-_armv8_sve2_probe
123 .globl _armv8_cpuid_probe
124 .type _armv8_cpuid_probe
,%function
126 AARCH64_VALID_CALL_TARGET
129 .size _armv8_cpuid_probe
,.-_armv8_cpuid_probe
131 .globl _armv8_sm3_probe
132 .type _armv8_sm3_probe
,%function
134 AARCH64_VALID_CALL_TARGET
135 .inst
0xce63c004 // sm3partw1 v4
.4s
, v0
.4s
, v3
.4s
137 .size _armv8_sm3_probe
,.-_armv8_sm3_probe
139 .globl OPENSSL_cleanse
140 .type OPENSSL_cleanse
,%function
143 AARCH64_VALID_CALL_TARGET
144 cbz x1
,.Lret
// len
==0?
149 strb wzr
,[x0
],#1 // store byte-by-byte
156 b
.eq .Laligned
// inp is aligned
157 strb wzr
,[x0
],#1 // store byte-by-byte
163 str xzr
,[x0
],#8 // store word-by-word
166 b
.ne .Laligned
// len
>=8
167 cbnz x1
,.Little
// len
!=0?
169 .size OPENSSL_cleanse
,.-OPENSSL_cleanse
172 .type CRYPTO_memcmp
,%function
175 AARCH64_VALID_CALL_TARGET
177 cbz x2
,.Lno_data
// len
==0?
203 .size CRYPTO_memcmp
,.-CRYPTO_memcmp
205 .globl _armv8_rng_probe
206 .type _armv8_rng_probe
,%function
208 AARCH64_VALID_CALL_TARGET
209 mrs x0
, s3_3_c2_c4_0
// rndr
210 mrs x0
, s3_3_c2_c4_1
// rndrrs
212 .size _armv8_rng_probe
,.-_armv8_rng_probe
217 my $rand_reg = $rdop eq "rndr" ?
"s3_3_c2_c4_0" : "s3_3_c2_c4_1";
220 // Fill buffer with Randomly Generated Bytes
221 // inputs
: char
* in x0
- Pointer to buffer
222 // size_t
in x1
- Number of bytes to
write to buffer
223 // outputs
: size_t
in x0
- Number of bytes successfully written to buffer
224 .globl OPENSSL_
${rdop
}_asm
225 .type OPENSSL_
${rdop
}_asm
,%function
228 AARCH64_VALID_CALL_TARGET
241 b
.lt .Loop_single_byte_
${rdop
}
250 .Loop_single_byte_
${rdop
}:
256 b
.gt .Loop_single_byte_
${rdop
}
262 .size OPENSSL_
${rdop
}_asm
,.-OPENSSL_
${rdop
}_asm
266 $code .= gen_random
("rndr");
267 $code .= gen_random
("rndrrs");
270 close STDOUT
or die "error closing STDOUT: $!";