summaryrefslogtreecommitdiffstats
path: root/crypto/arm64cpuid.pl
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2016-05-15 17:01:15 +0200
committerAndy Polyakov <appro@openssl.org>2016-05-19 22:33:00 +0200
commite33826f01bd78af76e0135c8dfab3387927a82bb (patch)
treea44459e3859610fe7ce35bc4923d8af6d6110e09 /crypto/arm64cpuid.pl
parentrand/randfile.c: remove _XOPEN_SOURCE definition. (diff)
downloadopenssl-e33826f01bd78af76e0135c8dfab3387927a82bb.tar.xz
openssl-e33826f01bd78af76e0135c8dfab3387927a82bb.zip
Add assembly CRYPTO_memcmp.
GH: #102 Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/arm64cpuid.pl')
-rwxr-xr-xcrypto/arm64cpuid.pl20
1 files changed, 20 insertions, 0 deletions
diff --git a/crypto/arm64cpuid.pl b/crypto/arm64cpuid.pl
index c0af608142..caa33875c9 100755
--- a/crypto/arm64cpuid.pl
+++ b/crypto/arm64cpuid.pl
@@ -100,6 +100,26 @@ OPENSSL_cleanse:
cbnz x1,.Little // len!=0?
ret
.size OPENSSL_cleanse,.-OPENSSL_cleanse
+
+.globl CRYPTO_memcmp
+.type CRYPTO_memcmp,%function
+.align 4
+CRYPTO_memcmp:
+ eor w3,w3,w3
+ cbz x2,.Lno_data // len==0?
+.Loop_cmp:
+ ldrb w4,[x0],#1
+ ldrb w5,[x1],#1
+ eor w4,w4,w5
+ orr w3,w3,w4
+ subs x2,x2,#1
+ b.ne .Loop_cmp
+
+.Lno_data:
+ neg w0,w3
+ lsr w0,w0,#31
+ ret
+.size CRYPTO_memcmp,.-CRYPTO_memcmp
___
print $code;