1#include <machine/asm.h> 2.text 3.globl RC4 4.type RC4,@function 5.align 16 6RC4: 7.L_RC4_begin: 8 pushl %ebp 9 pushl %ebx 10 pushl %esi 11 pushl %edi 12 movl 20(%esp),%edi 13 movl 24(%esp),%edx 14 movl 28(%esp),%esi 15 movl 32(%esp),%ebp 16 xorl %eax,%eax 17 xorl %ebx,%ebx 18 cmpl $0,%edx 19 je .L000abort 20 movb (%edi),%al 21 movb 4(%edi),%bl 22 addl $8,%edi 23 leal (%esi,%edx,1),%ecx 24 subl %esi,%ebp 25 movl %ecx,24(%esp) 26 incb %al 27 cmpl $-1,256(%edi) 28 je .L001RC4_CHAR 29 movl (%edi,%eax,4),%ecx 30 andl $-4,%edx 31 jz .L002loop1 32 testl $-8,%edx 33 movl %ebp,32(%esp) 34 jz .L003go4loop4 35 call .L004PIC_me_up 36.L004PIC_me_up: 37 popl %ebp 38 leal _GLOBAL_OFFSET_TABLE_+[.-.L004PIC_me_up](%ebp),%ebp 39 movl OPENSSL_ia32cap_P@GOT(%ebp),%ebp 40 btl $26,(%ebp) 41 jnc .L003go4loop4 42 movl 32(%esp),%ebp 43 andl $-8,%edx 44 leal -8(%esi,%edx,1),%edx 45 movl %edx,-4(%edi) 46 addb %cl,%bl 47 movl (%edi,%ebx,4),%edx 48 movl %ecx,(%edi,%ebx,4) 49 movl %edx,(%edi,%eax,4) 50 incl %eax 51 addl %ecx,%edx 52 movzbl %al,%eax 53 movzbl %dl,%edx 54 movq (%esi),%mm0 55 movl (%edi,%eax,4),%ecx 56 movd (%edi,%edx,4),%mm2 57 jmp .L005loop_mmx_enter 58.align 16 59.L006loop_mmx: 60 addb %cl,%bl 61 psllq $56,%mm1 62 movl (%edi,%ebx,4),%edx 63 movl %ecx,(%edi,%ebx,4) 64 movl %edx,(%edi,%eax,4) 65 incl %eax 66 addl %ecx,%edx 67 movzbl %al,%eax 68 movzbl %dl,%edx 69 pxor %mm1,%mm2 70 movq (%esi),%mm0 71 movq %mm2,-8(%ebp,%esi,1) 72 movl (%edi,%eax,4),%ecx 73 movd (%edi,%edx,4),%mm2 74.L005loop_mmx_enter: 75 addb %cl,%bl 76 movl (%edi,%ebx,4),%edx 77 movl %ecx,(%edi,%ebx,4) 78 movl %edx,(%edi,%eax,4) 79 incl %eax 80 addl %ecx,%edx 81 movzbl %al,%eax 82 movzbl %dl,%edx 83 pxor %mm0,%mm2 84 movl (%edi,%eax,4),%ecx 85 movd (%edi,%edx,4),%mm1 86 addb %cl,%bl 87 psllq $8,%mm1 88 movl (%edi,%ebx,4),%edx 89 movl %ecx,(%edi,%ebx,4) 90 movl %edx,(%edi,%eax,4) 91 incl %eax 92 addl %ecx,%edx 93 movzbl %al,%eax 94 movzbl %dl,%edx 95 pxor %mm1,%mm2 96 movl (%edi,%eax,4),%ecx 97 movd (%edi,%edx,4),%mm1 98 addb %cl,%bl 99 psllq $16,%mm1 100 movl (%edi,%ebx,4),%edx 101 movl %ecx,(%edi,%ebx,4) 102 movl %edx,(%edi,%eax,4) 103 incl %eax 104 addl %ecx,%edx 105 movzbl %al,%eax 106 movzbl %dl,%edx 107 pxor %mm1,%mm2 108 movl (%edi,%eax,4),%ecx 109 movd (%edi,%edx,4),%mm1 110 addb %cl,%bl 111 psllq $24,%mm1 112 movl (%edi,%ebx,4),%edx 113 movl %ecx,(%edi,%ebx,4) 114 movl %edx,(%edi,%eax,4) 115 incl %eax 116 addl %ecx,%edx 117 movzbl %al,%eax 118 movzbl %dl,%edx 119 pxor %mm1,%mm2 120 movl (%edi,%eax,4),%ecx 121 movd (%edi,%edx,4),%mm1 122 addb %cl,%bl 123 psllq $32,%mm1 124 movl (%edi,%ebx,4),%edx 125 movl %ecx,(%edi,%ebx,4) 126 movl %edx,(%edi,%eax,4) 127 incl %eax 128 addl %ecx,%edx 129 movzbl %al,%eax 130 movzbl %dl,%edx 131 pxor %mm1,%mm2 132 movl (%edi,%eax,4),%ecx 133 movd (%edi,%edx,4),%mm1 134 addb %cl,%bl 135 psllq $40,%mm1 136 movl (%edi,%ebx,4),%edx 137 movl %ecx,(%edi,%ebx,4) 138 movl %edx,(%edi,%eax,4) 139 incl %eax 140 addl %ecx,%edx 141 movzbl %al,%eax 142 movzbl %dl,%edx 143 pxor %mm1,%mm2 144 movl (%edi,%eax,4),%ecx 145 movd (%edi,%edx,4),%mm1 146 addb %cl,%bl 147 psllq $48,%mm1 148 movl (%edi,%ebx,4),%edx 149 movl %ecx,(%edi,%ebx,4) 150 movl %edx,(%edi,%eax,4) 151 incl %eax 152 addl %ecx,%edx 153 movzbl %al,%eax 154 movzbl %dl,%edx 155 pxor %mm1,%mm2 156 movl (%edi,%eax,4),%ecx 157 movd (%edi,%edx,4),%mm1 158 movl %ebx,%edx 159 xorl %ebx,%ebx 160 movb %dl,%bl 161 cmpl -4(%edi),%esi 162 leal 8(%esi),%esi 163 jb .L006loop_mmx 164 psllq $56,%mm1 165 pxor %mm1,%mm2 166 movq %mm2,-8(%ebp,%esi,1) 167 emms 168 cmpl 24(%esp),%esi 169 je .L007done 170 jmp .L002loop1 171.align 16 172.L003go4loop4: 173 leal -4(%esi,%edx,1),%edx 174 movl %edx,28(%esp) 175.L008loop4: 176 addb %cl,%bl 177 movl (%edi,%ebx,4),%edx 178 movl %ecx,(%edi,%ebx,4) 179 movl %edx,(%edi,%eax,4) 180 addl %ecx,%edx 181 incb %al 182 andl $255,%edx 183 movl (%edi,%eax,4),%ecx 184 movl (%edi,%edx,4),%ebp 185 addb %cl,%bl 186 movl (%edi,%ebx,4),%edx 187 movl %ecx,(%edi,%ebx,4) 188 movl %edx,(%edi,%eax,4) 189 addl %ecx,%edx 190 incb %al 191 andl $255,%edx 192 rorl $8,%ebp 193 movl (%edi,%eax,4),%ecx 194 orl (%edi,%edx,4),%ebp 195 addb %cl,%bl 196 movl (%edi,%ebx,4),%edx 197 movl %ecx,(%edi,%ebx,4) 198 movl %edx,(%edi,%eax,4) 199 addl %ecx,%edx 200 incb %al 201 andl $255,%edx 202 rorl $8,%ebp 203 movl (%edi,%eax,4),%ecx 204 orl (%edi,%edx,4),%ebp 205 addb %cl,%bl 206 movl (%edi,%ebx,4),%edx 207 movl %ecx,(%edi,%ebx,4) 208 movl %edx,(%edi,%eax,4) 209 addl %ecx,%edx 210 incb %al 211 andl $255,%edx 212 rorl $8,%ebp 213 movl 32(%esp),%ecx 214 orl (%edi,%edx,4),%ebp 215 rorl $8,%ebp 216 xorl (%esi),%ebp 217 cmpl 28(%esp),%esi 218 movl %ebp,(%ecx,%esi,1) 219 leal 4(%esi),%esi 220 movl (%edi,%eax,4),%ecx 221 jb .L008loop4 222 cmpl 24(%esp),%esi 223 je .L007done 224 movl 32(%esp),%ebp 225.align 16 226.L002loop1: 227 addb %cl,%bl 228 movl (%edi,%ebx,4),%edx 229 movl %ecx,(%edi,%ebx,4) 230 movl %edx,(%edi,%eax,4) 231 addl %ecx,%edx 232 incb %al 233 andl $255,%edx 234 movl (%edi,%edx,4),%edx 235 xorb (%esi),%dl 236 leal 1(%esi),%esi 237 movl (%edi,%eax,4),%ecx 238 cmpl 24(%esp),%esi 239 movb %dl,-1(%ebp,%esi,1) 240 jb .L002loop1 241 jmp .L007done 242.align 16 243.L001RC4_CHAR: 244 movzbl (%edi,%eax,1),%ecx 245.L009cloop1: 246 addb %cl,%bl 247 movzbl (%edi,%ebx,1),%edx 248 movb %cl,(%edi,%ebx,1) 249 movb %dl,(%edi,%eax,1) 250 addb %cl,%dl 251 movzbl (%edi,%edx,1),%edx 252 addb $1,%al 253 xorb (%esi),%dl 254 leal 1(%esi),%esi 255 movzbl (%edi,%eax,1),%ecx 256 cmpl 24(%esp),%esi 257 movb %dl,-1(%ebp,%esi,1) 258 jb .L009cloop1 259.L007done: 260 decb %al 261 movl %ebx,-4(%edi) 262 movb %al,-8(%edi) 263.L000abort: 264 popl %edi 265 popl %esi 266 popl %ebx 267 popl %ebp 268 ret 269.size RC4,.-.L_RC4_begin 270.globl private_RC4_set_key 271.type private_RC4_set_key,@function 272.align 16 273private_RC4_set_key: 274.L_private_RC4_set_key_begin: 275 pushl %ebp 276 pushl %ebx 277 pushl %esi 278 pushl %edi 279 movl 20(%esp),%edi 280 movl 24(%esp),%ebp 281 movl 28(%esp),%esi 282 call .L010PIC_me_up 283.L010PIC_me_up: 284 popl %edx 285 leal _GLOBAL_OFFSET_TABLE_+[.-.L010PIC_me_up](%edx),%edx 286 movl OPENSSL_ia32cap_P@GOT(%edx),%edx 287 leal 8(%edi),%edi 288 leal (%esi,%ebp,1),%esi 289 negl %ebp 290 xorl %eax,%eax 291 movl %ebp,-4(%edi) 292 btl $20,(%edx) 293 jc .L011c1stloop 294.align 16 295.L012w1stloop: 296 movl %eax,(%edi,%eax,4) 297 addb $1,%al 298 jnc .L012w1stloop 299 xorl %ecx,%ecx 300 xorl %edx,%edx 301.align 16 302.L013w2ndloop: 303 movl (%edi,%ecx,4),%eax 304 addb (%esi,%ebp,1),%dl 305 addb %al,%dl 306 addl $1,%ebp 307 movl (%edi,%edx,4),%ebx 308 jnz .L014wnowrap 309 movl -4(%edi),%ebp 310.L014wnowrap: 311 movl %eax,(%edi,%edx,4) 312 movl %ebx,(%edi,%ecx,4) 313 addb $1,%cl 314 jnc .L013w2ndloop 315 jmp .L015exit 316.align 16 317.L011c1stloop: 318 movb %al,(%edi,%eax,1) 319 addb $1,%al 320 jnc .L011c1stloop 321 xorl %ecx,%ecx 322 xorl %edx,%edx 323 xorl %ebx,%ebx 324.align 16 325.L016c2ndloop: 326 movb (%edi,%ecx,1),%al 327 addb (%esi,%ebp,1),%dl 328 addb %al,%dl 329 addl $1,%ebp 330 movb (%edi,%edx,1),%bl 331 jnz .L017cnowrap 332 movl -4(%edi),%ebp 333.L017cnowrap: 334 movb %al,(%edi,%edx,1) 335 movb %bl,(%edi,%ecx,1) 336 addb $1,%cl 337 jnc .L016c2ndloop 338 movl $-1,256(%edi) 339.L015exit: 340 xorl %eax,%eax 341 movl %eax,-8(%edi) 342 movl %eax,-4(%edi) 343 popl %edi 344 popl %esi 345 popl %ebx 346 popl %ebp 347 ret 348.size private_RC4_set_key,.-.L_private_RC4_set_key_begin 349.globl RC4_options 350.type RC4_options,@function 351.align 16 352RC4_options: 353.L_RC4_options_begin: 354 call .L018pic_point 355.L018pic_point: 356 popl %eax 357 leal .L019opts-.L018pic_point(%eax),%eax 358 call .L020PIC_me_up 359.L020PIC_me_up: 360 popl %edx 361 leal _GLOBAL_OFFSET_TABLE_+[.-.L020PIC_me_up](%edx),%edx 362 movl OPENSSL_ia32cap_P@GOT(%edx),%edx 363 movl (%edx),%edx 364 btl $20,%edx 365 jc .L0211xchar 366 btl $26,%edx 367 jnc .L022ret 368 addl $25,%eax 369 ret 370.L0211xchar: 371 addl $12,%eax 372.L022ret: 373 ret 374.align 64 375.L019opts: 376.byte 114,99,52,40,52,120,44,105,110,116,41,0 377.byte 114,99,52,40,49,120,44,99,104,97,114,41,0 378.byte 114,99,52,40,56,120,44,109,109,120,41,0 379.byte 82,67,52,32,102,111,114,32,120,56,54,44,32,67,82,89 380.byte 80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114 381.byte 111,64,111,112,101,110,115,115,108,46,111,114,103,62,0 382.align 64 383.size RC4_options,.-.L_RC4_options_begin 384.comm OPENSSL_ia32cap_P,8,4 385