clarify the purpose of this project
[nyanglibc.git] / crypt / md5-crypt.s
blobc6da684e109ddd81f60792c851d85d3b2198736e
1 .text
2 #APP
3 .section __libc_freeres_ptrs, "aw", %nobits
4 .previous
5 .section .rodata.str1.1,"aMS",@progbits,1
6 .LC0:
7 .string "$"
8 #NO_APP
9 .text
10 .p2align 4,,15
11 .globl __md5_crypt_r
12 .type __md5_crypt_r, @function
13 __md5_crypt_r:
14 pushq %rbp
15 movq %rsp, %rbp
16 pushq %r15
17 pushq %r14
18 pushq %r13
19 pushq %r12
20 movq %rdi, %r15
21 pushq %rbx
22 leaq md5_salt_prefix(%rip), %rdi
23 movq %rsi, %rbx
24 subq $456, %rsp
25 movq %rdx, -440(%rbp)
26 movl $3, %edx
27 movl %ecx, -404(%rbp)
28 call strncmp@PLT
29 leaq 3(%rbx), %rdx
30 testl %eax, %eax
31 leaq .LC0(%rip), %rsi
32 cmovne %rbx, %rdx
33 movq %rdx, %rdi
34 movq %rdx, -432(%rbp)
35 call strcspn@PLT
36 cmpq $8, %rax
37 movq %rax, %rcx
38 movl $8, %eax
39 cmovb %rcx, %rax
40 movq %r15, %rdi
41 movq %rax, -424(%rbp)
42 call strlen@PLT
43 testb $3, %r15b
44 movq %rax, -416(%rbp)
45 je .L34
46 leaq 4(%rax), %rbx
47 movq %rbx, %rdi
48 call __libc_alloca_cutoff@PLT
49 testl %eax, %eax
50 jne .L5
51 cmpq $4096, %rbx
52 ja .L68
53 .L5:
54 addq $30, %rbx
55 movq $0, -456(%rbp)
56 andq $-16, %rbx
57 subq %rbx, %rsp
58 leaq 15(%rsp), %rbx
59 andq $-16, %rbx
60 .L7:
61 movq -416(%rbp), %rdx
62 leaq 4(%rbx), %rdi
63 movq %r15, %rsi
64 call memcpy@PLT
65 movq %rax, %r15
66 movq %rax, -464(%rbp)
67 .L4:
68 testb $3, -432(%rbp)
69 movq $0, -448(%rbp)
70 jne .L69
71 .L8:
72 leaq -368(%rbp), %r12
73 leaq -208(%rbp), %rbx
74 movq %r12, %rdi
75 call __md5_init_ctx@PLT
76 movq -416(%rbp), %r14
77 movq %r12, %rdx
78 movq %r15, %rdi
79 movq %r14, %rsi
80 call __md5_process_bytes@PLT
81 leaq md5_salt_prefix(%rip), %rdi
82 movq %r12, %rdx
83 movl $3, %esi
84 call __md5_process_bytes@PLT
85 movq -432(%rbp), %r13
86 movq -424(%rbp), %rsi
87 movq %r12, %rdx
88 movq %r13, %rdi
89 call __md5_process_bytes@PLT
90 movq %rbx, %rdi
91 movq %rbx, -472(%rbp)
92 call __md5_init_ctx@PLT
93 movq %rbx, %rdx
94 movq %r14, %rsi
95 movq %r15, %rdi
96 call __md5_process_bytes@PLT
97 movq -424(%rbp), %rsi
98 movq %r13, %rdi
99 movq %rbx, %rdx
100 leaq -384(%rbp), %r13
101 call __md5_process_bytes@PLT
102 movq %rbx, %rdx
103 movq %r14, %rsi
104 movq %r15, %rdi
105 call __md5_process_bytes@PLT
106 movq %r13, %rsi
107 movq %rbx, %rdi
108 call __md5_finish_ctx@PLT
109 cmpq $16, %r14
110 jbe .L15
111 leaq -17(%r14), %rax
112 leaq -16(%r14), %rcx
113 movq %rax, -488(%rbp)
114 andq $-16, %rax
115 movq %rcx, -480(%rbp)
116 subq %rax, %rcx
117 movq %rcx, %rbx
118 .p2align 4,,10
119 .p2align 3
120 .L16:
121 movq %r12, %rdx
122 movl $16, %esi
123 movq %r13, %rdi
124 subq $16, %r14
125 call __md5_process_bytes@PLT
126 cmpq %rbx, %r14
127 jne .L16
128 movq -488(%rbp), %r14
129 movq -480(%rbp), %rsi
130 movq %r12, %rdx
131 movq %r13, %rdi
132 andq $-16, %r14
133 subq %r14, %rsi
134 call __md5_process_bytes@PLT
135 movb $0, -384(%rbp)
136 .L17:
137 movq -416(%rbp), %rbx
138 .p2align 4,,10
139 .p2align 3
140 .L20:
141 testb $1, %bl
142 movq %r15, %rdi
143 movq %r12, %rdx
144 cmovne %r13, %rdi
145 movl $1, %esi
146 call __md5_process_bytes@PLT
147 shrq %rbx
148 jne .L20
149 .L18:
150 movq %r13, %rsi
151 movq %r12, %rdi
152 xorl %ebx, %ebx
153 call __md5_finish_ctx@PLT
154 jmp .L27
155 .p2align 4,,10
156 .p2align 3
157 .L73:
158 movq -416(%rbp), %rsi
159 movq %r15, %rdi
160 call __md5_process_bytes@PLT
161 .L22:
162 movabsq $-6148914691236517205, %rax
163 mulq %rbx
164 shrq %rdx
165 leaq (%rdx,%rdx,2), %rax
166 cmpq %rax, %rbx
167 jne .L70
168 .L23:
169 movabsq $5270498306774157605, %rax
170 imulq %rbx
171 movq %rbx, %rax
172 sarq $63, %rax
173 sarq %rdx
174 subq %rax, %rdx
175 leaq 0(,%rdx,8), %rax
176 subq %rdx, %rax
177 cmpq %rax, %rbx
178 jne .L71
179 .L24:
180 testq %r14, %r14
181 movq %r12, %rdx
182 je .L25
183 movl $16, %esi
184 movq %r13, %rdi
185 call __md5_process_bytes@PLT
186 .L26:
187 movq %r13, %rsi
188 movq %r12, %rdi
189 addq $1, %rbx
190 call __md5_finish_ctx@PLT
191 cmpq $1000, %rbx
192 je .L72
193 .L27:
194 movq %r12, %rdi
195 movq %rbx, %r14
196 call __md5_init_ctx@PLT
197 andl $1, %r14d
198 movq %r12, %rdx
199 jne .L73
200 movl $16, %esi
201 movq %r13, %rdi
202 call __md5_process_bytes@PLT
203 jmp .L22
204 .p2align 4,,10
205 .p2align 3
206 .L25:
207 movq -416(%rbp), %rsi
208 movq %r15, %rdi
209 call __md5_process_bytes@PLT
210 jmp .L26
211 .p2align 4,,10
212 .p2align 3
213 .L71:
214 movq -416(%rbp), %rsi
215 movq %r12, %rdx
216 movq %r15, %rdi
217 call __md5_process_bytes@PLT
218 jmp .L24
219 .p2align 4,,10
220 .p2align 3
221 .L70:
222 movq -424(%rbp), %rsi
223 movq -432(%rbp), %rdi
224 movq %r12, %rdx
225 call __md5_process_bytes@PLT
226 jmp .L23
227 .p2align 4,,10
228 .p2align 3
229 .L72:
230 movl -404(%rbp), %edx
231 xorl %ebx, %ebx
232 movq -440(%rbp), %rdi
233 leaq md5_salt_prefix(%rip), %rsi
234 testl %edx, %edx
235 movl %ebx, %edx
236 cmovns -404(%rbp), %edx
237 movslq %edx, %rdx
238 call __stpncpy@PLT
239 movl -404(%rbp), %ecx
240 movq -424(%rbp), %r15
241 movq %rax, %rdi
242 movq -432(%rbp), %rsi
243 movq %rax, -392(%rbp)
244 leal -3(%rcx), %edx
245 testl %edx, %edx
246 movl %edx, -404(%rbp)
247 cmovs %ebx, %edx
248 movslq %edx, %rdx
249 cmpq %r15, %rdx
250 cmova %r15, %rdx
251 call __stpncpy@PLT
252 movl -404(%rbp), %ecx
253 movq %rax, -392(%rbp)
254 testl %ecx, %ecx
255 cmovns %ecx, %ebx
256 movslq %ebx, %rdx
257 cmpq %r15, %rdx
258 cmova %r15, %rdx
259 subl %edx, %ecx
260 testl %ecx, %ecx
261 movl %ecx, -404(%rbp)
262 jle .L28
263 leaq 1(%rax), %rdx
264 movq %rdx, -392(%rbp)
265 movb $36, (%rax)
266 subl $1, -404(%rbp)
267 .L28:
268 movzbl -378(%rbp), %ecx
269 movzbl -384(%rbp), %edx
270 leaq -404(%rbp), %rbx
271 movzbl -372(%rbp), %r8d
272 leaq -392(%rbp), %r14
273 movl $4, %r9d
274 movq %rbx, %rsi
275 movq %r14, %rdi
276 call __b64_from_24bit@PLT
277 movzbl -377(%rbp), %ecx
278 movzbl -383(%rbp), %edx
279 movl $4, %r9d
280 movzbl -371(%rbp), %r8d
281 movq %rbx, %rsi
282 movq %r14, %rdi
283 call __b64_from_24bit@PLT
284 movzbl -376(%rbp), %ecx
285 movzbl -382(%rbp), %edx
286 movl $4, %r9d
287 movzbl -370(%rbp), %r8d
288 movq %rbx, %rsi
289 movq %r14, %rdi
290 call __b64_from_24bit@PLT
291 movzbl -375(%rbp), %ecx
292 movzbl -381(%rbp), %edx
293 movl $4, %r9d
294 movzbl -369(%rbp), %r8d
295 movq %rbx, %rsi
296 movq %r14, %rdi
297 call __b64_from_24bit@PLT
298 movzbl -374(%rbp), %ecx
299 movzbl -380(%rbp), %edx
300 movl $4, %r9d
301 movzbl -379(%rbp), %r8d
302 movq %rbx, %rsi
303 movq %r14, %rdi
304 call __b64_from_24bit@PLT
305 movzbl -373(%rbp), %r8d
306 xorl %ecx, %ecx
307 xorl %edx, %edx
308 movl $2, %r9d
309 movq %rbx, %rsi
310 movq %r14, %rdi
311 call __b64_from_24bit@PLT
312 movl -404(%rbp), %eax
313 testl %eax, %eax
314 jle .L74
315 movq -392(%rbp), %rax
316 movq -440(%rbp), %rbx
317 movb $0, (%rax)
318 .L30:
319 movq %r12, %rdi
320 call __md5_init_ctx@PLT
321 movq %r13, %rsi
322 movq %r12, %rdi
323 call __md5_finish_ctx@PLT
324 movl $156, %edx
325 movl $156, %esi
326 movq %r12, %rdi
327 call __explicit_bzero_chk@PLT
328 movq -472(%rbp), %rdi
329 movl $156, %edx
330 movl $156, %esi
331 call __explicit_bzero_chk@PLT
332 movq -464(%rbp), %rax
333 testq %rax, %rax
334 je .L31
335 movq -416(%rbp), %rsi
336 movq $-1, %rdx
337 movq %rax, %rdi
338 call __explicit_bzero_chk@PLT
339 .L31:
340 movq -448(%rbp), %rax
341 testq %rax, %rax
342 je .L32
343 movq -424(%rbp), %rsi
344 movq $-1, %rdx
345 movq %rax, %rdi
346 call __explicit_bzero_chk@PLT
347 .L32:
348 movq -456(%rbp), %rdi
349 call free@PLT
350 .L1:
351 leaq -40(%rbp), %rsp
352 movq %rbx, %rax
353 popq %rbx
354 popq %r12
355 popq %r13
356 popq %r14
357 popq %r15
358 popq %rbp
360 .L34:
361 movq $0, -456(%rbp)
362 movq $0, -464(%rbp)
363 jmp .L4
364 .L74:
365 movq errno@gottpoff(%rip), %rax
366 xorl %ebx, %ebx
367 movl $34, %fs:(%rax)
368 jmp .L30
369 .L69:
370 movq -424(%rbp), %rsi
371 leaq 34(%rsi), %rax
372 andq $-16, %rax
373 subq %rax, %rsp
374 movl %esi, %eax
375 leaq 15(%rsp), %rdx
376 andq $-16, %rdx
377 cmpl $8, %esi
378 leaq 4(%rdx), %rcx
379 jnb .L9
380 andl $4, %esi
381 jne .L75
382 testl %eax, %eax
383 je .L10
384 movq -432(%rbp), %rsi
385 testb $2, %al
386 movzbl (%rsi), %esi
387 movb %sil, 4(%rdx)
388 jne .L76
389 .L10:
390 movq %rcx, -432(%rbp)
391 movq %rcx, -448(%rbp)
392 jmp .L8
393 .L9:
394 movq -432(%rbp), %rdi
395 addq $8, %rdx
396 movq (%rdi), %rax
397 movq %rax, -4(%rdx)
398 movq -424(%rbp), %rbx
399 movl %ebx, %eax
400 movq -8(%rdi,%rax), %rsi
401 movq %rsi, -8(%rcx,%rax)
402 movq %rcx, %rax
403 subq %rdx, %rax
404 subq %rax, %rdi
405 addl %ebx, %eax
406 andl $-8, %eax
407 movq %rdi, %r8
408 cmpl $8, %eax
409 jb .L10
410 andl $-8, %eax
411 xorl %esi, %esi
412 .L13:
413 movl %esi, %edi
414 addl $8, %esi
415 movq (%r8,%rdi), %r9
416 cmpl %eax, %esi
417 movq %r9, (%rdx,%rdi)
418 jb .L13
419 jmp .L10
420 .L15:
421 movq -416(%rbp), %rbx
422 movq %r12, %rdx
423 movq %r13, %rdi
424 movq %rbx, %rsi
425 call __md5_process_bytes@PLT
426 testq %rbx, %rbx
427 movb $0, -384(%rbp)
428 je .L18
429 jmp .L17
430 .p2align 4,,10
431 .p2align 3
432 .L75:
433 movq -432(%rbp), %rdi
434 movl (%rdi), %esi
435 movl %esi, 4(%rdx)
436 movl -4(%rdi,%rax), %edx
437 movl %edx, -4(%rcx,%rax)
438 jmp .L10
439 .L68:
440 movq %rbx, %rdi
441 call malloc@PLT
442 testq %rax, %rax
443 movq %rax, %rbx
444 je .L1
445 movq %rax, -456(%rbp)
446 jmp .L7
447 .L76:
448 movq -432(%rbp), %rsi
449 movzwl -2(%rsi,%rax), %edx
450 movw %dx, -2(%rcx,%rax)
451 jmp .L10
452 .size __md5_crypt_r, .-__md5_crypt_r
453 .p2align 4,,15
454 .globl __md5_crypt
455 .type __md5_crypt, @function
456 __md5_crypt:
457 pushq %r12
458 pushq %rbp
459 movq %rdi, %r12
460 pushq %rbx
461 movq %rsi, %rdi
462 movq %rsi, %rbp
463 call strlen@PLT
464 movl buflen.5407(%rip), %ecx
465 leal 31(%rax), %ebx
466 movq buffer(%rip), %rdx
467 cmpl %ebx, %ecx
468 jge .L78
469 movq %rdx, %rdi
470 movslq %ebx, %rsi
471 call realloc@PLT
472 testq %rax, %rax
473 movq %rax, %rdx
474 je .L77
475 movq %rax, buffer(%rip)
476 movl %ebx, buflen.5407(%rip)
477 movl %ebx, %ecx
478 .L78:
479 popq %rbx
480 movq %rbp, %rsi
481 movq %r12, %rdi
482 popq %rbp
483 popq %r12
484 jmp __md5_crypt_r
485 .p2align 4,,10
486 .p2align 3
487 .L77:
488 popq %rbx
489 xorl %eax, %eax
490 popq %rbp
491 popq %r12
493 .size __md5_crypt, .-__md5_crypt
494 .local buflen.5407
495 .comm buflen.5407,4,4
496 .section __libc_freeres_ptrs
497 #,"aw",@progbits
498 .align 8
499 .type buffer, @object
500 .size buffer, 8
501 buffer:
502 .zero 8
503 .section .rodata.str1.1
504 .type md5_salt_prefix, @object
505 .size md5_salt_prefix, 4
506 md5_salt_prefix:
507 .string "$1$"