diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2022-02-08 15:34:02 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2022-02-08 15:34:02 +0100 |
commit | eb8d5f3b8f3c91f3ed82a52b4ce52a154c146ede (patch) | |
tree | 036c4cf2bebabfe4ff5a738529db3604c8f00ee7 /libbb | |
parent | eb52e7fa522d829fb400461ca4c808ee5c1d6428 (diff) | |
download | busybox-w32-eb8d5f3b8f3c91f3ed82a52b4ce52a154c146ede.tar.gz busybox-w32-eb8d5f3b8f3c91f3ed82a52b4ce52a154c146ede.tar.bz2 busybox-w32-eb8d5f3b8f3c91f3ed82a52b4ce52a154c146ede.zip |
libbb/sha1: shrink x86 hardware accelerated hashing (32-bit)
function old new delta
sha1_process_block64_shaNI 511 507 -4
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/hash_md5_sha_x86-32_shaNI.S | 9 | ||||
-rw-r--r-- | libbb/hash_md5_sha_x86-64_shaNI.S | 3 |
2 files changed, 5 insertions, 7 deletions
diff --git a/libbb/hash_md5_sha_x86-32_shaNI.S b/libbb/hash_md5_sha_x86-32_shaNI.S index ad814a21b..a61b3cbed 100644 --- a/libbb/hash_md5_sha_x86-32_shaNI.S +++ b/libbb/hash_md5_sha_x86-32_shaNI.S | |||
@@ -53,8 +53,8 @@ sha1_process_block64_shaNI: | |||
53 | pshufb %xmm7, MSG3 | 53 | pshufb %xmm7, MSG3 |
54 | 54 | ||
55 | /* Save hash values for addition after rounds */ | 55 | /* Save hash values for addition after rounds */ |
56 | movu128 E0, %xmm7 | 56 | mova128 E0, %xmm7 |
57 | /*movu128 ABCD, %xmm8 - NOPE, 32bit has no xmm8 */ | 57 | /*mova128 ABCD, %xmm8 - NOPE, 32bit has no xmm8 */ |
58 | 58 | ||
59 | /* Rounds 0-3 */ | 59 | /* Rounds 0-3 */ |
60 | paddd MSG0, E0 | 60 | paddd MSG0, E0 |
@@ -207,12 +207,11 @@ sha1_process_block64_shaNI: | |||
207 | /* Add current hash values with previously saved */ | 207 | /* Add current hash values with previously saved */ |
208 | sha1nexte %xmm7, E0 | 208 | sha1nexte %xmm7, E0 |
209 | /*paddd %xmm8, ABCD - 32-bit mode has no xmm8 */ | 209 | /*paddd %xmm8, ABCD - 32-bit mode has no xmm8 */ |
210 | movu128 76(%eax), %xmm7 # recreate original ABCD | 210 | movu128 76(%eax), %xmm7 # get original ABCD (not shuffled)... |
211 | shuf128_32 $0x1B, %xmm7, %xmm7 # DCBA -> ABCD | ||
212 | paddd %xmm7, ABCD | ||
213 | 211 | ||
214 | /* Write hash values back in the correct order */ | 212 | /* Write hash values back in the correct order */ |
215 | shuf128_32 $0x1B, ABCD, ABCD | 213 | shuf128_32 $0x1B, ABCD, ABCD |
214 | paddd %xmm7, ABCD # ...add it to final ABCD | ||
216 | movu128 ABCD, 76(%eax) | 215 | movu128 ABCD, 76(%eax) |
217 | extr128_32 $3, E0, 76+4*4(%eax) | 216 | extr128_32 $3, E0, 76+4*4(%eax) |
218 | 217 | ||
diff --git a/libbb/hash_md5_sha_x86-64_shaNI.S b/libbb/hash_md5_sha_x86-64_shaNI.S index fc2ca92e8..b32029360 100644 --- a/libbb/hash_md5_sha_x86-64_shaNI.S +++ b/libbb/hash_md5_sha_x86-64_shaNI.S | |||
@@ -36,9 +36,8 @@ | |||
36 | .balign 8 # allow decoders to fetch at least 2 first insns | 36 | .balign 8 # allow decoders to fetch at least 2 first insns |
37 | sha1_process_block64_shaNI: | 37 | sha1_process_block64_shaNI: |
38 | /* load initial hash values */ | 38 | /* load initial hash values */ |
39 | |||
40 | xor128 E0, E0 | ||
41 | movu128 80(%rdi), ABCD | 39 | movu128 80(%rdi), ABCD |
40 | xor128 E0, E0 | ||
42 | pinsrd $3, 80+4*4(%rdi), E0 # load to uppermost 32-bit word | 41 | pinsrd $3, 80+4*4(%rdi), E0 # load to uppermost 32-bit word |
43 | shuf128_32 $0x1B, ABCD, ABCD # DCBA -> ABCD | 42 | shuf128_32 $0x1B, ABCD, ABCD # DCBA -> ABCD |
44 | 43 | ||