clarify the purpose of this project
[nyanglibc.git] / crypt / crypt-entry.shared.s
blob2f22d19fc96292cf1c4fec7e4ac69bb10c8b47b8
1 .text
2 #APP
3 .symver fcrypt,fcrypt@GLIBC_2.2.5
4 .section .rodata.str1.1,"aMS",@progbits,1
5 .LC0:
6 .string "/proc/sys/crypto/fips_enabled"
7 #NO_APP
8 .text
9 .p2align 4,,15
10 .type fips_enabled_p, @function
11 fips_enabled_p:
12 movl checked.8337(%rip), %eax
13 testl %eax, %eax
14 je .L2
15 cmpl $1, %eax
16 sete %al
17 ret
18 .p2align 4,,10
19 .p2align 3
20 .L2:
21 pushq %r12
22 pushq %rbp
23 leaq .LC0(%rip), %rdi
24 pushq %rbx
25 xorl %esi, %esi
26 xorl %eax, %eax
27 subq $48, %rsp
28 call __open_nocancel@PLT
29 cmpl $-1, %eax
30 movl %eax, %ebp
31 leaq 16(%rsp), %r12
32 jne .L4
33 jmp .L27
34 .p2align 4,,10
35 .p2align 3
36 .L30:
37 movq errno@gottpoff(%rip), %rax
38 cmpl $4, %fs:(%rax)
39 jne .L29
40 .L4:
41 movl $31, %edx
42 movq %r12, %rsi
43 movl %ebp, %edi
44 call __read_nocancel@PLT
45 cmpq $-1, %rax
46 movq %rax, %rbx
47 je .L30
48 movl %ebp, %edi
49 call __close_nocancel@PLT
50 testq %rbx, %rbx
51 jle .L27
52 leaq 8(%rsp), %rsi
53 movl $10, %edx
54 movq %r12, %rdi
55 movb $0, 16(%rsp,%rbx)
56 call strtol@PLT
57 movq 8(%rsp), %rdx
58 cmpq %r12, %rdx
59 je .L27
60 movzbl (%rdx), %edx
61 testb %dl, %dl
62 je .L16
63 cmpb $10, %dl
64 je .L16
65 .p2align 4,,10
66 .p2align 3
67 .L27:
68 movl checked.8337(%rip), %eax
69 testl %eax, %eax
70 jne .L14
71 .L15:
72 movl $-2, checked.8337(%rip)
73 addq $48, %rsp
74 xorl %eax, %eax
75 popq %rbx
76 popq %rbp
77 popq %r12
78 ret
79 .p2align 4,,10
80 .p2align 3
81 .L16:
82 testq %rax, %rax
83 jle .L13
84 movl $1, checked.8337(%rip)
85 movl $1, %eax
86 .L14:
87 cmpl $1, %eax
88 sete %al
89 addq $48, %rsp
90 popq %rbx
91 popq %rbp
92 popq %r12
93 ret
94 .p2align 4,,10
95 .p2align 3
96 .L29:
97 movl %ebp, %edi
98 call __close_nocancel@PLT
99 movl checked.8337(%rip), %eax
100 testl %eax, %eax
101 je .L15
102 jmp .L14
103 .L13:
104 movl $-1, checked.8337(%rip)
105 movl $-1, %eax
106 jmp .L14
107 .size fips_enabled_p, .-fips_enabled_p
108 .p2align 4,,15
109 .globl __crypt_r
110 .type __crypt_r, @function
111 __crypt_r:
112 pushq %r13
113 pushq %r12
114 movq %rdi, %r12
115 pushq %rbp
116 pushq %rbx
117 leaq md5_salt_prefix(%rip), %rdi
118 movq %rdx, %rbx
119 movl $3, %edx
120 movq %rsi, %rbp
121 subq $56, %rsp
122 call strncmp@PLT
123 testl %eax, %eax
124 je .L42
125 leaq sha256_salt_prefix(%rip), %rdi
126 movl $3, %edx
127 movq %rbp, %rsi
128 call strncmp@PLT
129 testl %eax, %eax
130 je .L43
131 leaq sha512_salt_prefix(%rip), %rdi
132 movl $3, %edx
133 movq %rbp, %rsi
134 call strncmp@PLT
135 testl %eax, %eax
136 je .L44
137 movq %rbx, %rsi
138 movq %rbp, %rdi
139 call _ufc_setup_salt_r@PLT
140 testb %al, %al
141 je .L45
142 call fips_enabled_p
143 testb %al, %al
144 jne .L41
145 leaq 7(%rsp), %r13
146 movl $8, %edx
147 movq %r12, %rsi
148 movq $0, 7(%rsp)
149 movb $0, 15(%rsp)
150 leaq 16(%rsp), %r12
151 movq %r13, %rdi
152 call strncpy@PLT
153 movq %rbx, %rsi
154 movq %r13, %rdi
155 call _ufc_mk_keytab_r@PLT
156 pxor %xmm0, %xmm0
157 movq %r12, %rdx
158 movq %rbx, %rsi
159 movl $25, %edi
160 movaps %xmm0, 16(%rsp)
161 movaps %xmm0, 32(%rsp)
162 call _ufc_doit_r@PLT
163 movq %rbx, %rsi
164 movq %r12, %rdi
165 call _ufc_dofinalperm_r@PLT
166 movq 24(%rsp), %rsi
167 movq 16(%rsp), %rdi
168 movq %rbx, %rcx
169 movq %rbp, %rdx
170 call _ufc_output_conversion_r@PLT
171 movq %r13, %rdi
172 movl $9, %edx
173 movl $9, %esi
174 call __explicit_bzero_chk@PLT
175 movq %rbx, %rdi
176 movq $-1, %rdx
177 movl $128, %esi
178 call __explicit_bzero_chk@PLT
179 movq %r12, %rdi
180 movl $32, %edx
181 movl $32, %esi
182 call __explicit_bzero_chk@PLT
183 addq $56, %rsp
184 leaq 131200(%rbx), %rax
185 popq %rbx
186 popq %rbp
187 popq %r12
188 popq %r13
190 .p2align 4,,10
191 .p2align 3
192 .L42:
193 call fips_enabled_p
194 testb %al, %al
195 jne .L41
196 movl $131232, %ecx
197 movq %rbx, %rdx
198 movq %rbp, %rsi
199 movq %r12, %rdi
200 call __md5_crypt_r@PLT
201 .L31:
202 addq $56, %rsp
203 popq %rbx
204 popq %rbp
205 popq %r12
206 popq %r13
208 .p2align 4,,10
209 .p2align 3
210 .L44:
211 movq %rbx, %rdx
212 movq %rbp, %rsi
213 movq %r12, %rdi
214 movl $131232, %ecx
215 call __sha512_crypt_r@PLT
216 addq $56, %rsp
217 popq %rbx
218 popq %rbp
219 popq %r12
220 popq %r13
222 .p2align 4,,10
223 .p2align 3
224 .L43:
225 movq %rbx, %rdx
226 movq %rbp, %rsi
227 movq %r12, %rdi
228 movl $131232, %ecx
229 call __sha256_crypt_r@PLT
230 addq $56, %rsp
231 popq %rbx
232 popq %rbp
233 popq %r12
234 popq %r13
236 .p2align 4,,10
237 .p2align 3
238 .L41:
239 movq errno@gottpoff(%rip), %rax
240 movl $1, %fs:(%rax)
241 xorl %eax, %eax
242 jmp .L31
243 .p2align 4,,10
244 .p2align 3
245 .L45:
246 movq errno@gottpoff(%rip), %rax
247 movl $22, %fs:(%rax)
248 xorl %eax, %eax
249 jmp .L31
250 .size __crypt_r, .-__crypt_r
251 .weak crypt_r
252 .set crypt_r,__crypt_r
253 .p2align 4,,15
254 .globl crypt
255 .type crypt, @function
256 crypt:
257 pushq %rbp
258 pushq %rbx
259 movq %rdi, %rbp
260 leaq md5_salt_prefix(%rip), %rdi
261 movl $3, %edx
262 movq %rsi, %rbx
263 subq $8, %rsp
264 call strncmp@PLT
265 testl %eax, %eax
266 je .L51
267 .L47:
268 leaq sha256_salt_prefix(%rip), %rdi
269 movl $3, %edx
270 movq %rbx, %rsi
271 call strncmp@PLT
272 testl %eax, %eax
273 je .L52
274 leaq sha512_salt_prefix(%rip), %rdi
275 movl $3, %edx
276 movq %rbx, %rsi
277 call strncmp@PLT
278 testl %eax, %eax
279 je .L53
280 movq _ufc_foobar@GOTPCREL(%rip), %rdx
281 addq $8, %rsp
282 movq %rbx, %rsi
283 movq %rbp, %rdi
284 popq %rbx
285 popq %rbp
286 jmp __crypt_r@PLT
287 .p2align 4,,10
288 .p2align 3
289 .L53:
290 addq $8, %rsp
291 movq %rbx, %rsi
292 movq %rbp, %rdi
293 popq %rbx
294 popq %rbp
295 jmp __sha512_crypt@PLT
296 .p2align 4,,10
297 .p2align 3
298 .L51:
299 call fips_enabled_p
300 testb %al, %al
301 jne .L47
302 addq $8, %rsp
303 movq %rbx, %rsi
304 movq %rbp, %rdi
305 popq %rbx
306 popq %rbp
307 jmp __md5_crypt@PLT
308 .p2align 4,,10
309 .p2align 3
310 .L52:
311 addq $8, %rsp
312 movq %rbx, %rsi
313 movq %rbp, %rdi
314 popq %rbx
315 popq %rbp
316 jmp __sha256_crypt@PLT
317 .size crypt, .-crypt
318 .weak fcrypt
319 .set fcrypt,crypt
320 .local checked.8337
321 .comm checked.8337,4,4
322 .section .rodata.str1.1
323 .type sha512_salt_prefix, @object
324 .size sha512_salt_prefix, 4
325 sha512_salt_prefix:
326 .string "$6$"
327 .type sha256_salt_prefix, @object
328 .size sha256_salt_prefix, 4
329 sha256_salt_prefix:
330 .string "$5$"
331 .type md5_salt_prefix, @object
332 .size md5_salt_prefix, 4
333 md5_salt_prefix:
334 .string "$1$"