1 %ifidn __OUTPUT_FORMAT__
,obj
2 section code use32 class
=code
align=64
3 %elifidn __OUTPUT_FORMAT__
,win32
4 %ifdef __YASM_VERSION_ID__
5 %if __YASM_VERSION_ID__
< 01010000h
6 %error yasm version
1.1.0 or later needed.
8 ; Yasm automatically includes .00 and complains about redefining it.
9 ; https://www.tortall.net/projects/yasm/manual/html/objfmt-win32-safeseh.html
13 section .text code
align=64
17 ;extern _OPENSSL_ia32cap_P
26 mov edi,DWORD [20+esp]
27 mov edx,DWORD [24+esp]
28 mov esi,DWORD [28+esp]
29 mov ebp,DWORD [32+esp]
39 mov DWORD [24+esp],ecx
41 cmp DWORD [256+edi],-1
43 mov ecx,DWORD [eax*4+edi]
46 mov DWORD [32+esp],ebp
49 lea ebp,[_OPENSSL_ia32cap_P
]
51 jnc NEAR L
$003go4loop4
52 mov ebp,DWORD [32+esp]
57 mov edx,DWORD [ebx*4+edi]
58 mov DWORD [ebx*4+edi],ecx
59 mov DWORD [eax*4+edi],edx
65 mov ecx,DWORD [eax*4+edi]
66 movd mm2
,DWORD [edx*4+edi]
67 jmp NEAR L
$004loop_mmx_enter
72 mov edx,DWORD [ebx*4+edi]
73 mov DWORD [ebx*4+edi],ecx
74 mov DWORD [eax*4+edi],edx
81 movq
[esi*1+ebp-8],mm2
82 mov ecx,DWORD [eax*4+edi]
83 movd mm2
,DWORD [edx*4+edi]
86 mov edx,DWORD [ebx*4+edi]
87 mov DWORD [ebx*4+edi],ecx
88 mov DWORD [eax*4+edi],edx
94 mov ecx,DWORD [eax*4+edi]
95 movd mm1
,DWORD [edx*4+edi]
98 mov edx,DWORD [ebx*4+edi]
99 mov DWORD [ebx*4+edi],ecx
100 mov DWORD [eax*4+edi],edx
106 mov ecx,DWORD [eax*4+edi]
107 movd mm1
,DWORD [edx*4+edi]
110 mov edx,DWORD [ebx*4+edi]
111 mov DWORD [ebx*4+edi],ecx
112 mov DWORD [eax*4+edi],edx
118 mov ecx,DWORD [eax*4+edi]
119 movd mm1
,DWORD [edx*4+edi]
122 mov edx,DWORD [ebx*4+edi]
123 mov DWORD [ebx*4+edi],ecx
124 mov DWORD [eax*4+edi],edx
130 mov ecx,DWORD [eax*4+edi]
131 movd mm1
,DWORD [edx*4+edi]
134 mov edx,DWORD [ebx*4+edi]
135 mov DWORD [ebx*4+edi],ecx
136 mov DWORD [eax*4+edi],edx
142 mov ecx,DWORD [eax*4+edi]
143 movd mm1
,DWORD [edx*4+edi]
146 mov edx,DWORD [ebx*4+edi]
147 mov DWORD [ebx*4+edi],ecx
148 mov DWORD [eax*4+edi],edx
154 mov ecx,DWORD [eax*4+edi]
155 movd mm1
,DWORD [edx*4+edi]
158 mov edx,DWORD [ebx*4+edi]
159 mov DWORD [ebx*4+edi],ecx
160 mov DWORD [eax*4+edi],edx
166 mov ecx,DWORD [eax*4+edi]
167 movd mm1
,DWORD [edx*4+edi]
171 cmp esi,DWORD [edi-4]
173 jb NEAR L
$005loop_mmx
176 movq
[esi*1+ebp-8],mm2
178 cmp esi,DWORD [24+esp]
183 lea edx,[edx*1+esi-4]
184 mov DWORD [28+esp],edx
187 mov edx,DWORD [ebx*4+edi]
188 mov DWORD [ebx*4+edi],ecx
189 mov DWORD [eax*4+edi],edx
193 mov ecx,DWORD [eax*4+edi]
194 mov ebp,DWORD [edx*4+edi]
196 mov edx,DWORD [ebx*4+edi]
197 mov DWORD [ebx*4+edi],ecx
198 mov DWORD [eax*4+edi],edx
203 mov ecx,DWORD [eax*4+edi]
204 or ebp,DWORD [edx*4+edi]
206 mov edx,DWORD [ebx*4+edi]
207 mov DWORD [ebx*4+edi],ecx
208 mov DWORD [eax*4+edi],edx
213 mov ecx,DWORD [eax*4+edi]
214 or ebp,DWORD [edx*4+edi]
216 mov edx,DWORD [ebx*4+edi]
217 mov DWORD [ebx*4+edi],ecx
218 mov DWORD [eax*4+edi],edx
223 mov ecx,DWORD [32+esp]
224 or ebp,DWORD [edx*4+edi]
227 cmp esi,DWORD [28+esp]
228 mov DWORD [esi*1+ecx],ebp
230 mov ecx,DWORD [eax*4+edi]
232 cmp esi,DWORD [24+esp]
234 mov ebp,DWORD [32+esp]
238 mov edx,DWORD [ebx*4+edi]
239 mov DWORD [ebx*4+edi],ecx
240 mov DWORD [eax*4+edi],edx
244 mov edx,DWORD [edx*4+edi]
247 mov ecx,DWORD [eax*4+edi]
248 cmp esi,DWORD [24+esp]
249 mov BYTE [esi*1+ebp-1],dl
254 movzx ecx,BYTE [eax*1+edi]
257 movzx edx,BYTE [ebx*1+edi]
258 mov BYTE [ebx*1+edi],cl
259 mov BYTE [eax*1+edi],dl
261 movzx edx,BYTE [edx*1+edi]
265 movzx ecx,BYTE [eax*1+edi]
266 cmp esi,DWORD [24+esp]
267 mov BYTE [esi*1+ebp-1],dl
271 mov DWORD [edi-4],ebx
279 global _asm_RC4_set_key
282 L$
_asm_RC4_set_key_begin:
287 mov edi,DWORD [20+esp]
288 mov ebp,DWORD [24+esp]
289 mov esi,DWORD [28+esp]
290 lea edx,[_OPENSSL_ia32cap_P
]
295 mov DWORD [edi-4],ebp
297 jc NEAR L
$009c1stloop
300 mov DWORD [eax*4+edi],eax
302 jnc NEAR L
$010w1stloop
307 mov eax,DWORD [ecx*4+edi]
308 add dl,BYTE [ebp*1+esi]
311 mov ebx,DWORD [edx*4+edi]
312 jnz NEAR L
$012wnowrap
313 mov ebp,DWORD [edi-4]
315 mov DWORD [edx*4+edi],eax
316 mov DWORD [ecx*4+edi],ebx
318 jnc NEAR L
$011w2ndloop
322 mov BYTE [eax*1+edi],al
324 jnc NEAR L
$009c1stloop
330 mov al,BYTE [ecx*1+edi]
331 add dl,BYTE [ebp*1+esi]
334 mov bl,BYTE [edx*1+edi]
335 jnz NEAR L
$015cnowrap
336 mov ebp,DWORD [edi-4]
338 mov BYTE [edx*1+edi],al
339 mov BYTE [ecx*1+edi],bl
341 jnc NEAR L
$014c2ndloop
342 mov DWORD [256+edi],-1
345 mov DWORD [edi-8],eax
346 mov DWORD [edi-4],eax
355 L$
_RC4_options_begin:
359 lea eax,[(L
$017opts
-L
$016pic_point
)+eax]
360 lea edx,[_OPENSSL_ia32cap_P
]
374 db 114,99,52,40,52,120,44,105,110,116,41,0
375 db 114,99,52,40,49,120,44,99,104,97,114,41,0
376 db 114,99,52,40,56,120,44,109,109,120,41,0
377 db 82,67,52,32,102,111,114,32,120,56,54,44,32,67,82,89
378 db 80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114
379 db 111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
382 common _OPENSSL_ia32cap_P
16