diff options
author | Andy Polyakov <appro@openssl.org> | 2016-05-15 17:01:15 +0200 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2016-05-19 22:33:00 +0200 |
commit | e33826f01bd78af76e0135c8dfab3387927a82bb (patch) | |
tree | a44459e3859610fe7ce35bc4923d8af6d6110e09 /crypto/x86cpuid.pl | |
parent | rand/randfile.c: remove _XOPEN_SOURCE definition. (diff) | |
download | openssl-e33826f01bd78af76e0135c8dfab3387927a82bb.tar.xz openssl-e33826f01bd78af76e0135c8dfab3387927a82bb.zip |
Add assembly CRYPTO_memcmp.
GH: #102
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/x86cpuid.pl')
-rw-r--r-- | crypto/x86cpuid.pl | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/crypto/x86cpuid.pl b/crypto/x86cpuid.pl index 2b110ba896..99ffa1d2fb 100644 --- a/crypto/x86cpuid.pl +++ b/crypto/x86cpuid.pl @@ -365,6 +365,31 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); } &ret (); &function_end_B("OPENSSL_cleanse"); +&function_begin_B("CRYPTO_memcmp"); + &push ("esi"); + &push ("edi"); + &mov ("esi",&wparam(0)); + &mov ("edi",&wparam(1)); + &mov ("ecx",&wparam(2)); + &xor ("eax","eax"); + &xor ("edx","edx"); + &cmp ("ecx",0); + &je (&label("no_data")); +&set_label("loop"); + &mov ("dl",&BP(0,"esi")); + &lea ("esi",&DWP(1,"esi")); + &xor ("dl",&BP(0,"edi")); + &lea ("edi",&DWP(1,"edi")); + &or ("al","dl"); + &dec ("ecx"); + &jnz (&label("loop")); + &neg ("eax"); + &shr ("eax",31); +&set_label("no_data"); + &pop ("edi"); + &pop ("esi"); + &ret (); +&function_end_B("CRYPTO_memcmp"); { my $lasttick = "esi"; my $lastdiff = "ebx"; |