1 | %ifidn __OUTPUT_FORMAT__,obj
|
---|
2 | section code use32 class=code align=64
|
---|
3 | %elifidn __OUTPUT_FORMAT__,win32
|
---|
4 | section .text code align=64
|
---|
5 | %else
|
---|
6 | section .text code
|
---|
7 | %endif
|
---|
8 | global _OPENSSL_ia32_cpuid
|
---|
9 | align 16
|
---|
10 | _OPENSSL_ia32_cpuid:
|
---|
11 | L$_OPENSSL_ia32_cpuid_begin:
|
---|
12 | push ebp
|
---|
13 | push ebx
|
---|
14 | push esi
|
---|
15 | push edi
|
---|
16 | xor edx,edx
|
---|
17 | pushfd
|
---|
18 | pop eax
|
---|
19 | mov ecx,eax
|
---|
20 | xor eax,2097152
|
---|
21 | push eax
|
---|
22 | popfd
|
---|
23 | pushfd
|
---|
24 | pop eax
|
---|
25 | xor ecx,eax
|
---|
26 | xor eax,eax
|
---|
27 | mov esi,DWORD [20+esp]
|
---|
28 | mov DWORD [8+esi],eax
|
---|
29 | bt ecx,21
|
---|
30 | jnc NEAR L$000nocpuid
|
---|
31 | cpuid
|
---|
32 | mov edi,eax
|
---|
33 | xor eax,eax
|
---|
34 | cmp ebx,1970169159
|
---|
35 | setne al
|
---|
36 | mov ebp,eax
|
---|
37 | cmp edx,1231384169
|
---|
38 | setne al
|
---|
39 | or ebp,eax
|
---|
40 | cmp ecx,1818588270
|
---|
41 | setne al
|
---|
42 | or ebp,eax
|
---|
43 | jz NEAR L$001intel
|
---|
44 | cmp ebx,1752462657
|
---|
45 | setne al
|
---|
46 | mov esi,eax
|
---|
47 | cmp edx,1769238117
|
---|
48 | setne al
|
---|
49 | or esi,eax
|
---|
50 | cmp ecx,1145913699
|
---|
51 | setne al
|
---|
52 | or esi,eax
|
---|
53 | jnz NEAR L$001intel
|
---|
54 | mov eax,2147483648
|
---|
55 | cpuid
|
---|
56 | cmp eax,2147483649
|
---|
57 | jb NEAR L$001intel
|
---|
58 | mov esi,eax
|
---|
59 | mov eax,2147483649
|
---|
60 | cpuid
|
---|
61 | or ebp,ecx
|
---|
62 | and ebp,2049
|
---|
63 | cmp esi,2147483656
|
---|
64 | jb NEAR L$001intel
|
---|
65 | mov eax,2147483656
|
---|
66 | cpuid
|
---|
67 | movzx esi,cl
|
---|
68 | inc esi
|
---|
69 | mov eax,1
|
---|
70 | xor ecx,ecx
|
---|
71 | cpuid
|
---|
72 | bt edx,28
|
---|
73 | jnc NEAR L$002generic
|
---|
74 | shr ebx,16
|
---|
75 | and ebx,255
|
---|
76 | cmp ebx,esi
|
---|
77 | ja NEAR L$002generic
|
---|
78 | and edx,4026531839
|
---|
79 | jmp NEAR L$002generic
|
---|
80 | L$001intel:
|
---|
81 | cmp edi,4
|
---|
82 | mov esi,-1
|
---|
83 | jb NEAR L$003nocacheinfo
|
---|
84 | mov eax,4
|
---|
85 | mov ecx,0
|
---|
86 | cpuid
|
---|
87 | mov esi,eax
|
---|
88 | shr esi,14
|
---|
89 | and esi,4095
|
---|
90 | L$003nocacheinfo:
|
---|
91 | mov eax,1
|
---|
92 | xor ecx,ecx
|
---|
93 | cpuid
|
---|
94 | and edx,3220176895
|
---|
95 | cmp ebp,0
|
---|
96 | jne NEAR L$004notintel
|
---|
97 | or edx,1073741824
|
---|
98 | and ah,15
|
---|
99 | cmp ah,15
|
---|
100 | jne NEAR L$004notintel
|
---|
101 | or edx,1048576
|
---|
102 | L$004notintel:
|
---|
103 | bt edx,28
|
---|
104 | jnc NEAR L$002generic
|
---|
105 | and edx,4026531839
|
---|
106 | cmp esi,0
|
---|
107 | je NEAR L$002generic
|
---|
108 | or edx,268435456
|
---|
109 | shr ebx,16
|
---|
110 | cmp bl,1
|
---|
111 | ja NEAR L$002generic
|
---|
112 | and edx,4026531839
|
---|
113 | L$002generic:
|
---|
114 | and ebp,2048
|
---|
115 | and ecx,4294965247
|
---|
116 | mov esi,edx
|
---|
117 | or ebp,ecx
|
---|
118 | cmp edi,7
|
---|
119 | mov edi,DWORD [20+esp]
|
---|
120 | jb NEAR L$005no_extended_info
|
---|
121 | mov eax,7
|
---|
122 | xor ecx,ecx
|
---|
123 | cpuid
|
---|
124 | mov DWORD [8+edi],ebx
|
---|
125 | L$005no_extended_info:
|
---|
126 | bt ebp,27
|
---|
127 | jnc NEAR L$006clear_avx
|
---|
128 | xor ecx,ecx
|
---|
129 | db 15,1,208
|
---|
130 | and eax,6
|
---|
131 | cmp eax,6
|
---|
132 | je NEAR L$007done
|
---|
133 | cmp eax,2
|
---|
134 | je NEAR L$006clear_avx
|
---|
135 | L$008clear_xmm:
|
---|
136 | and ebp,4261412861
|
---|
137 | and esi,4278190079
|
---|
138 | L$006clear_avx:
|
---|
139 | and ebp,4026525695
|
---|
140 | and DWORD [8+edi],4294967263
|
---|
141 | L$007done:
|
---|
142 | mov eax,esi
|
---|
143 | mov edx,ebp
|
---|
144 | L$000nocpuid:
|
---|
145 | pop edi
|
---|
146 | pop esi
|
---|
147 | pop ebx
|
---|
148 | pop ebp
|
---|
149 | ret
|
---|
150 | ;extern _OPENSSL_ia32cap_P
|
---|
151 | global _OPENSSL_rdtsc
|
---|
152 | align 16
|
---|
153 | _OPENSSL_rdtsc:
|
---|
154 | L$_OPENSSL_rdtsc_begin:
|
---|
155 | xor eax,eax
|
---|
156 | xor edx,edx
|
---|
157 | lea ecx,[_OPENSSL_ia32cap_P]
|
---|
158 | bt DWORD [ecx],4
|
---|
159 | jnc NEAR L$009notsc
|
---|
160 | rdtsc
|
---|
161 | L$009notsc:
|
---|
162 | ret
|
---|
163 | global _OPENSSL_instrument_halt
|
---|
164 | align 16
|
---|
165 | _OPENSSL_instrument_halt:
|
---|
166 | L$_OPENSSL_instrument_halt_begin:
|
---|
167 | lea ecx,[_OPENSSL_ia32cap_P]
|
---|
168 | bt DWORD [ecx],4
|
---|
169 | jnc NEAR L$010nohalt
|
---|
170 | dd 2421723150
|
---|
171 | and eax,3
|
---|
172 | jnz NEAR L$010nohalt
|
---|
173 | pushfd
|
---|
174 | pop eax
|
---|
175 | bt eax,9
|
---|
176 | jnc NEAR L$010nohalt
|
---|
177 | rdtsc
|
---|
178 | push edx
|
---|
179 | push eax
|
---|
180 | hlt
|
---|
181 | rdtsc
|
---|
182 | sub eax,DWORD [esp]
|
---|
183 | sbb edx,DWORD [4+esp]
|
---|
184 | add esp,8
|
---|
185 | ret
|
---|
186 | L$010nohalt:
|
---|
187 | xor eax,eax
|
---|
188 | xor edx,edx
|
---|
189 | ret
|
---|
190 | global _OPENSSL_far_spin
|
---|
191 | align 16
|
---|
192 | _OPENSSL_far_spin:
|
---|
193 | L$_OPENSSL_far_spin_begin:
|
---|
194 | pushfd
|
---|
195 | pop eax
|
---|
196 | bt eax,9
|
---|
197 | jnc NEAR L$011nospin
|
---|
198 | mov eax,DWORD [4+esp]
|
---|
199 | mov ecx,DWORD [8+esp]
|
---|
200 | dd 2430111262
|
---|
201 | xor eax,eax
|
---|
202 | mov edx,DWORD [ecx]
|
---|
203 | jmp NEAR L$012spin
|
---|
204 | align 16
|
---|
205 | L$012spin:
|
---|
206 | inc eax
|
---|
207 | cmp edx,DWORD [ecx]
|
---|
208 | je NEAR L$012spin
|
---|
209 | dd 529567888
|
---|
210 | ret
|
---|
211 | L$011nospin:
|
---|
212 | xor eax,eax
|
---|
213 | xor edx,edx
|
---|
214 | ret
|
---|
215 | global _OPENSSL_wipe_cpu
|
---|
216 | align 16
|
---|
217 | _OPENSSL_wipe_cpu:
|
---|
218 | L$_OPENSSL_wipe_cpu_begin:
|
---|
219 | xor eax,eax
|
---|
220 | xor edx,edx
|
---|
221 | lea ecx,[_OPENSSL_ia32cap_P]
|
---|
222 | mov ecx,DWORD [ecx]
|
---|
223 | bt DWORD [ecx],1
|
---|
224 | jnc NEAR L$013no_x87
|
---|
225 | dd 4007259865,4007259865,4007259865,4007259865,2430851995
|
---|
226 | L$013no_x87:
|
---|
227 | lea eax,[4+esp]
|
---|
228 | ret
|
---|
229 | global _OPENSSL_atomic_add
|
---|
230 | align 16
|
---|
231 | _OPENSSL_atomic_add:
|
---|
232 | L$_OPENSSL_atomic_add_begin:
|
---|
233 | mov edx,DWORD [4+esp]
|
---|
234 | mov ecx,DWORD [8+esp]
|
---|
235 | push ebx
|
---|
236 | nop
|
---|
237 | mov eax,DWORD [edx]
|
---|
238 | L$014spin:
|
---|
239 | lea ebx,[ecx*1+eax]
|
---|
240 | nop
|
---|
241 | dd 447811568
|
---|
242 | jne NEAR L$014spin
|
---|
243 | mov eax,ebx
|
---|
244 | pop ebx
|
---|
245 | ret
|
---|
246 | global _OPENSSL_cleanse
|
---|
247 | align 16
|
---|
248 | _OPENSSL_cleanse:
|
---|
249 | L$_OPENSSL_cleanse_begin:
|
---|
250 | mov edx,DWORD [4+esp]
|
---|
251 | mov ecx,DWORD [8+esp]
|
---|
252 | xor eax,eax
|
---|
253 | cmp ecx,7
|
---|
254 | jae NEAR L$015lot
|
---|
255 | cmp ecx,0
|
---|
256 | je NEAR L$016ret
|
---|
257 | L$017little:
|
---|
258 | mov BYTE [edx],al
|
---|
259 | sub ecx,1
|
---|
260 | lea edx,[1+edx]
|
---|
261 | jnz NEAR L$017little
|
---|
262 | L$016ret:
|
---|
263 | ret
|
---|
264 | align 16
|
---|
265 | L$015lot:
|
---|
266 | test edx,3
|
---|
267 | jz NEAR L$018aligned
|
---|
268 | mov BYTE [edx],al
|
---|
269 | lea ecx,[ecx-1]
|
---|
270 | lea edx,[1+edx]
|
---|
271 | jmp NEAR L$015lot
|
---|
272 | L$018aligned:
|
---|
273 | mov DWORD [edx],eax
|
---|
274 | lea ecx,[ecx-4]
|
---|
275 | test ecx,-4
|
---|
276 | lea edx,[4+edx]
|
---|
277 | jnz NEAR L$018aligned
|
---|
278 | cmp ecx,0
|
---|
279 | jne NEAR L$017little
|
---|
280 | ret
|
---|
281 | global _CRYPTO_memcmp
|
---|
282 | align 16
|
---|
283 | _CRYPTO_memcmp:
|
---|
284 | L$_CRYPTO_memcmp_begin:
|
---|
285 | push esi
|
---|
286 | push edi
|
---|
287 | mov esi,DWORD [12+esp]
|
---|
288 | mov edi,DWORD [16+esp]
|
---|
289 | mov ecx,DWORD [20+esp]
|
---|
290 | xor eax,eax
|
---|
291 | xor edx,edx
|
---|
292 | cmp ecx,0
|
---|
293 | je NEAR L$019no_data
|
---|
294 | L$020loop:
|
---|
295 | mov dl,BYTE [esi]
|
---|
296 | lea esi,[1+esi]
|
---|
297 | xor dl,BYTE [edi]
|
---|
298 | lea edi,[1+edi]
|
---|
299 | or al,dl
|
---|
300 | dec ecx
|
---|
301 | jnz NEAR L$020loop
|
---|
302 | neg eax
|
---|
303 | shr eax,31
|
---|
304 | L$019no_data:
|
---|
305 | pop edi
|
---|
306 | pop esi
|
---|
307 | ret
|
---|
308 | global _OPENSSL_instrument_bus
|
---|
309 | align 16
|
---|
310 | _OPENSSL_instrument_bus:
|
---|
311 | L$_OPENSSL_instrument_bus_begin:
|
---|
312 | push ebp
|
---|
313 | push ebx
|
---|
314 | push esi
|
---|
315 | push edi
|
---|
316 | mov eax,0
|
---|
317 | pop edi
|
---|
318 | pop esi
|
---|
319 | pop ebx
|
---|
320 | pop ebp
|
---|
321 | ret
|
---|
322 | global _OPENSSL_instrument_bus2
|
---|
323 | align 16
|
---|
324 | _OPENSSL_instrument_bus2:
|
---|
325 | L$_OPENSSL_instrument_bus2_begin:
|
---|
326 | push ebp
|
---|
327 | push ebx
|
---|
328 | push esi
|
---|
329 | push edi
|
---|
330 | mov eax,0
|
---|
331 | pop edi
|
---|
332 | pop esi
|
---|
333 | pop ebx
|
---|
334 | pop ebp
|
---|
335 | ret
|
---|
336 | global _OPENSSL_ia32_rdrand_bytes
|
---|
337 | align 16
|
---|
338 | _OPENSSL_ia32_rdrand_bytes:
|
---|
339 | L$_OPENSSL_ia32_rdrand_bytes_begin:
|
---|
340 | push edi
|
---|
341 | push ebx
|
---|
342 | xor eax,eax
|
---|
343 | mov edi,DWORD [12+esp]
|
---|
344 | mov ebx,DWORD [16+esp]
|
---|
345 | cmp ebx,0
|
---|
346 | je NEAR L$021done
|
---|
347 | mov ecx,8
|
---|
348 | L$022loop:
|
---|
349 | db 15,199,242
|
---|
350 | jc NEAR L$023break
|
---|
351 | loop L$022loop
|
---|
352 | jmp NEAR L$021done
|
---|
353 | align 16
|
---|
354 | L$023break:
|
---|
355 | cmp ebx,4
|
---|
356 | jb NEAR L$024tail
|
---|
357 | mov DWORD [edi],edx
|
---|
358 | lea edi,[4+edi]
|
---|
359 | add eax,4
|
---|
360 | sub ebx,4
|
---|
361 | jz NEAR L$021done
|
---|
362 | mov ecx,8
|
---|
363 | jmp NEAR L$022loop
|
---|
364 | align 16
|
---|
365 | L$024tail:
|
---|
366 | mov BYTE [edi],dl
|
---|
367 | lea edi,[1+edi]
|
---|
368 | inc eax
|
---|
369 | shr edx,8
|
---|
370 | dec ebx
|
---|
371 | jnz NEAR L$024tail
|
---|
372 | L$021done:
|
---|
373 | xor edx,edx
|
---|
374 | pop ebx
|
---|
375 | pop edi
|
---|
376 | ret
|
---|
377 | global _OPENSSL_ia32_rdseed_bytes
|
---|
378 | align 16
|
---|
379 | _OPENSSL_ia32_rdseed_bytes:
|
---|
380 | L$_OPENSSL_ia32_rdseed_bytes_begin:
|
---|
381 | push edi
|
---|
382 | push ebx
|
---|
383 | xor eax,eax
|
---|
384 | mov edi,DWORD [12+esp]
|
---|
385 | mov ebx,DWORD [16+esp]
|
---|
386 | cmp ebx,0
|
---|
387 | je NEAR L$025done
|
---|
388 | mov ecx,8
|
---|
389 | L$026loop:
|
---|
390 | db 15,199,250
|
---|
391 | jc NEAR L$027break
|
---|
392 | loop L$026loop
|
---|
393 | jmp NEAR L$025done
|
---|
394 | align 16
|
---|
395 | L$027break:
|
---|
396 | cmp ebx,4
|
---|
397 | jb NEAR L$028tail
|
---|
398 | mov DWORD [edi],edx
|
---|
399 | lea edi,[4+edi]
|
---|
400 | add eax,4
|
---|
401 | sub ebx,4
|
---|
402 | jz NEAR L$025done
|
---|
403 | mov ecx,8
|
---|
404 | jmp NEAR L$026loop
|
---|
405 | align 16
|
---|
406 | L$028tail:
|
---|
407 | mov BYTE [edi],dl
|
---|
408 | lea edi,[1+edi]
|
---|
409 | inc eax
|
---|
410 | shr edx,8
|
---|
411 | dec ebx
|
---|
412 | jnz NEAR L$028tail
|
---|
413 | L$025done:
|
---|
414 | xor edx,edx
|
---|
415 | pop ebx
|
---|
416 | pop edi
|
---|
417 | ret
|
---|
418 | segment .bss
|
---|
419 | common _OPENSSL_ia32cap_P 16
|
---|
420 | segment .CRT$XCU data align=4
|
---|
421 | extern _OPENSSL_cpuid_setup
|
---|
422 | dd _OPENSSL_cpuid_setup
|
---|