diff options
author | Andy Polyakov <appro@openssl.org> | 2018-05-20 12:13:16 +0200 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2018-06-03 21:15:18 +0200 |
commit | 9a708bf982da1d2c9739339d16d7b021da955e00 (patch) | |
tree | df89472c5fd490b136366a612dae57acb7147cbe /crypto/x86_64cpuid.pl | |
parent | modes/gcm128.c: coalesce calls to GHASH. (diff) | |
download | openssl-9a708bf982da1d2c9739339d16d7b021da955e00.tar.xz openssl-9a708bf982da1d2c9739339d16d7b021da955e00.zip |
{arm64|x86_64}cpuid.pl: add special 16-byte case to OPENSSL_memcmp.
OPENSSL_memcmp is a must in GCM decrypt and general-purpose loop takes
quite a portion of execution time for short inputs, more than GHASH for
few-byte inputs according to profiler. Special 16-byte case takes it off
top five list in profiler output.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6312)
Diffstat (limited to 'crypto/x86_64cpuid.pl')
-rw-r--r-- | crypto/x86_64cpuid.pl | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crypto/x86_64cpuid.pl b/crypto/x86_64cpuid.pl index 513d00560c..6423e803b7 100644 --- a/crypto/x86_64cpuid.pl +++ b/crypto/x86_64cpuid.pl @@ -271,6 +271,18 @@ CRYPTO_memcmp: xor %r10,%r10 cmp \$0,$arg3 je .Lno_data + cmp \$16,$arg3 + jne .Loop_cmp + mov ($arg1),%r10 + mov 8($arg1),%r11 + mov \$1,$arg3 + xor ($arg2),%r10 + xor 8($arg2),%r11 + or %r11,%r10 + cmovnz $arg3,%rax + ret + +.align 16 .Loop_cmp: mov ($arg1),%r10b lea 1($arg1),$arg1 |