aboutsummaryrefslogtreecommitdiff
path: root/libbb/hash_md5_sha_x86-64.S
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/hash_md5_sha_x86-64.S')
-rw-r--r--libbb/hash_md5_sha_x86-64.S60
1 files changed, 30 insertions, 30 deletions
diff --git a/libbb/hash_md5_sha_x86-64.S b/libbb/hash_md5_sha_x86-64.S
index 95b85d80a..ff78fc049 100644
--- a/libbb/hash_md5_sha_x86-64.S
+++ b/libbb/hash_md5_sha_x86-64.S
@@ -6,14 +6,14 @@
6 .hidden sha1_process_block64 6 .hidden sha1_process_block64
7 .type sha1_process_block64, @function 7 .type sha1_process_block64, @function
8 8
9 .balign 8 # allow decoders to fetch at least 4 first insns 9 .balign 8 # allow decoders to fetch at least 5 first insns
10sha1_process_block64: 10sha1_process_block64:
11 pushq %r15 # 11 pushq %rbp # 1 byte insn
12 pushq %r14 # 12 pushq %rbx # 1 byte insn
13 pushq %r13 # 13 pushq %r15 # 2 byte insn
14 pushq %r12 # 14 pushq %r14 # 2 byte insn
15 pushq %rbp # 15 pushq %r13 # 2 byte insn
16 pushq %rbx # 16 pushq %r12 # 2 byte insn
17 pushq %rdi # we need ctx at the end 17 pushq %rdi # we need ctx at the end
18 18
19#Register and stack use: 19#Register and stack use:
@@ -22,24 +22,6 @@ sha1_process_block64:
22# esi,edi: temps 22# esi,edi: temps
23# -32+4*n(%rsp),r8...r15: W[0..7,8..15] 23# -32+4*n(%rsp),r8...r15: W[0..7,8..15]
24# (TODO: actually W[0..7] are used a bit more often, put _them_ into r8..r15?) 24# (TODO: actually W[0..7] are used a bit more often, put _them_ into r8..r15?)
25
26 movq 4*8(%rdi), %r8
27 bswapq %r8
28 movl %r8d, %r9d
29 shrq $32, %r8
30 movq 4*10(%rdi), %r10
31 bswapq %r10
32 movl %r10d, %r11d
33 shrq $32, %r10
34 movq 4*12(%rdi), %r12
35 bswapq %r12
36 movl %r12d, %r13d
37 shrq $32, %r12
38 movq 4*14(%rdi), %r14
39 bswapq %r14
40 movl %r14d, %r15d
41 shrq $32, %r14
42
43 movl $3, %eax 25 movl $3, %eax
441: 261:
45 movq (%rdi,%rax,8), %rsi 27 movq (%rdi,%rax,8), %rsi
@@ -48,12 +30,30 @@ sha1_process_block64:
48 movq %rsi, -32(%rsp,%rax,8) 30 movq %rsi, -32(%rsp,%rax,8)
49 decl %eax 31 decl %eax
50 jns 1b 32 jns 1b
33
51 movl 80(%rdi), %eax # a = ctx->hash[0] 34 movl 80(%rdi), %eax # a = ctx->hash[0]
52 movl 84(%rdi), %ebx # b = ctx->hash[1] 35 movl 84(%rdi), %ebx # b = ctx->hash[1]
53 movl 88(%rdi), %ecx # c = ctx->hash[2] 36 movl 88(%rdi), %ecx # c = ctx->hash[2]
54 movl 92(%rdi), %edx # d = ctx->hash[3] 37 movl 92(%rdi), %edx # d = ctx->hash[3]
55 movl 96(%rdi), %ebp # e = ctx->hash[4] 38 movl 96(%rdi), %ebp # e = ctx->hash[4]
56 39
40 movq 4*8(%rdi), %r8
41 movq 4*10(%rdi), %r10
42 bswapq %r8
43 bswapq %r10
44 movq 4*12(%rdi), %r12
45 movq 4*14(%rdi), %r14
46 bswapq %r12
47 bswapq %r14
48 movl %r8d, %r9d
49 shrq $32, %r8
50 movl %r10d, %r11d
51 shrq $32, %r10
52 movl %r12d, %r13d
53 shrq $32, %r12
54 movl %r14d, %r15d
55 shrq $32, %r14
56
57# 0 57# 0
58 # W[0], already in %esi 58 # W[0], already in %esi
59 movl %ecx, %edi # c 59 movl %ecx, %edi # c
@@ -1272,17 +1272,17 @@ sha1_process_block64:
1272 rorl $2, %ecx # b = rotl32(b,30) 1272 rorl $2, %ecx # b = rotl32(b,30)
1273 1273
1274 popq %rdi # 1274 popq %rdi #
1275 popq %r12 #
1275 addl %eax, 80(%rdi) # ctx->hash[0] += a 1276 addl %eax, 80(%rdi) # ctx->hash[0] += a
1277 popq %r13 #
1276 addl %ebx, 84(%rdi) # ctx->hash[1] += b 1278 addl %ebx, 84(%rdi) # ctx->hash[1] += b
1279 popq %r14 #
1277 addl %ecx, 88(%rdi) # ctx->hash[2] += c 1280 addl %ecx, 88(%rdi) # ctx->hash[2] += c
1281 popq %r15 #
1278 addl %edx, 92(%rdi) # ctx->hash[3] += d 1282 addl %edx, 92(%rdi) # ctx->hash[3] += d
1279 addl %ebp, 96(%rdi) # ctx->hash[4] += e
1280 popq %rbx # 1283 popq %rbx #
1284 addl %ebp, 96(%rdi) # ctx->hash[4] += e
1281 popq %rbp # 1285 popq %rbp #
1282 popq %r12 #
1283 popq %r13 #
1284 popq %r14 #
1285 popq %r15 #
1286 1286
1287 ret 1287 ret
1288 .size sha1_process_block64, .-sha1_process_block64 1288 .size sha1_process_block64, .-sha1_process_block64