rc5-586.S revision 1.1.1.1
1#include <machine/asm.h> 2.text 3.globl RC5_32_encrypt 4.type RC5_32_encrypt,@function 5.align 16 6RC5_32_encrypt: 7.L_RC5_32_encrypt_begin: 8 9 pushl %ebp 10 pushl %esi 11 pushl %edi 12 movl 16(%esp),%edx 13 movl 20(%esp),%ebp 14 15 movl (%edx),%edi 16 movl 4(%edx),%esi 17 pushl %ebx 18 movl (%ebp),%ebx 19 addl 4(%ebp),%edi 20 addl 8(%ebp),%esi 21 xorl %esi,%edi 22 movl 12(%ebp),%eax 23 movl %esi,%ecx 24 roll %cl,%edi 25 addl %eax,%edi 26 xorl %edi,%esi 27 movl 16(%ebp),%eax 28 movl %edi,%ecx 29 roll %cl,%esi 30 addl %eax,%esi 31 xorl %esi,%edi 32 movl 20(%ebp),%eax 33 movl %esi,%ecx 34 roll %cl,%edi 35 addl %eax,%edi 36 xorl %edi,%esi 37 movl 24(%ebp),%eax 38 movl %edi,%ecx 39 roll %cl,%esi 40 addl %eax,%esi 41 xorl %esi,%edi 42 movl 28(%ebp),%eax 43 movl %esi,%ecx 44 roll %cl,%edi 45 addl %eax,%edi 46 xorl %edi,%esi 47 movl 32(%ebp),%eax 48 movl %edi,%ecx 49 roll %cl,%esi 50 addl %eax,%esi 51 xorl %esi,%edi 52 movl 36(%ebp),%eax 53 movl %esi,%ecx 54 roll %cl,%edi 55 addl %eax,%edi 56 xorl %edi,%esi 57 movl 40(%ebp),%eax 58 movl %edi,%ecx 59 roll %cl,%esi 60 addl %eax,%esi 61 xorl %esi,%edi 62 movl 44(%ebp),%eax 63 movl %esi,%ecx 64 roll %cl,%edi 65 addl %eax,%edi 66 xorl %edi,%esi 67 movl 48(%ebp),%eax 68 movl %edi,%ecx 69 roll %cl,%esi 70 addl %eax,%esi 71 xorl %esi,%edi 72 movl 52(%ebp),%eax 73 movl %esi,%ecx 74 roll %cl,%edi 75 addl %eax,%edi 76 xorl %edi,%esi 77 movl 56(%ebp),%eax 78 movl %edi,%ecx 79 roll %cl,%esi 80 addl %eax,%esi 81 xorl %esi,%edi 82 movl 60(%ebp),%eax 83 movl %esi,%ecx 84 roll %cl,%edi 85 addl %eax,%edi 86 xorl %edi,%esi 87 movl 64(%ebp),%eax 88 movl %edi,%ecx 89 roll %cl,%esi 90 addl %eax,%esi 91 xorl %esi,%edi 92 movl 68(%ebp),%eax 93 movl %esi,%ecx 94 roll %cl,%edi 95 addl %eax,%edi 96 xorl %edi,%esi 97 movl 72(%ebp),%eax 98 movl %edi,%ecx 99 roll %cl,%esi 100 addl %eax,%esi 101 cmpl $8,%ebx 102 je .L000rc5_exit 103 xorl %esi,%edi 104 movl 76(%ebp),%eax 105 movl %esi,%ecx 106 roll %cl,%edi 107 addl %eax,%edi 108 xorl %edi,%esi 109 movl 80(%ebp),%eax 110 movl %edi,%ecx 111 roll %cl,%esi 112 addl %eax,%esi 113 xorl %esi,%edi 114 movl 84(%ebp),%eax 115 movl %esi,%ecx 116 roll %cl,%edi 117 addl %eax,%edi 118 xorl %edi,%esi 119 movl 88(%ebp),%eax 120 movl %edi,%ecx 121 roll %cl,%esi 122 addl %eax,%esi 123 xorl %esi,%edi 124 movl 92(%ebp),%eax 125 movl %esi,%ecx 126 roll %cl,%edi 127 addl %eax,%edi 128 xorl %edi,%esi 129 movl 96(%ebp),%eax 130 movl %edi,%ecx 131 roll %cl,%esi 132 addl %eax,%esi 133 xorl %esi,%edi 134 movl 100(%ebp),%eax 135 movl %esi,%ecx 136 roll %cl,%edi 137 addl %eax,%edi 138 xorl %edi,%esi 139 movl 104(%ebp),%eax 140 movl %edi,%ecx 141 roll %cl,%esi 142 addl %eax,%esi 143 cmpl $12,%ebx 144 je .L000rc5_exit 145 xorl %esi,%edi 146 movl 108(%ebp),%eax 147 movl %esi,%ecx 148 roll %cl,%edi 149 addl %eax,%edi 150 xorl %edi,%esi 151 movl 112(%ebp),%eax 152 movl %edi,%ecx 153 roll %cl,%esi 154 addl %eax,%esi 155 xorl %esi,%edi 156 movl 116(%ebp),%eax 157 movl %esi,%ecx 158 roll %cl,%edi 159 addl %eax,%edi 160 xorl %edi,%esi 161 movl 120(%ebp),%eax 162 movl %edi,%ecx 163 roll %cl,%esi 164 addl %eax,%esi 165 xorl %esi,%edi 166 movl 124(%ebp),%eax 167 movl %esi,%ecx 168 roll %cl,%edi 169 addl %eax,%edi 170 xorl %edi,%esi 171 movl 128(%ebp),%eax 172 movl %edi,%ecx 173 roll %cl,%esi 174 addl %eax,%esi 175 xorl %esi,%edi 176 movl 132(%ebp),%eax 177 movl %esi,%ecx 178 roll %cl,%edi 179 addl %eax,%edi 180 xorl %edi,%esi 181 movl 136(%ebp),%eax 182 movl %edi,%ecx 183 roll %cl,%esi 184 addl %eax,%esi 185.L000rc5_exit: 186 movl %edi,(%edx) 187 movl %esi,4(%edx) 188 popl %ebx 189 popl %edi 190 popl %esi 191 popl %ebp 192 ret 193.size RC5_32_encrypt,.-.L_RC5_32_encrypt_begin 194.globl RC5_32_decrypt 195.type RC5_32_decrypt,@function 196.align 16 197RC5_32_decrypt: 198.L_RC5_32_decrypt_begin: 199 200 pushl %ebp 201 pushl %esi 202 pushl %edi 203 movl 16(%esp),%edx 204 movl 20(%esp),%ebp 205 206 movl (%edx),%edi 207 movl 4(%edx),%esi 208 pushl %ebx 209 movl (%ebp),%ebx 210 cmpl $12,%ebx 211 je .L001rc5_dec_12 212 cmpl $8,%ebx 213 je .L002rc5_dec_8 214 movl 136(%ebp),%eax 215 subl %eax,%esi 216 movl %edi,%ecx 217 rorl %cl,%esi 218 xorl %edi,%esi 219 movl 132(%ebp),%eax 220 subl %eax,%edi 221 movl %esi,%ecx 222 rorl %cl,%edi 223 xorl %esi,%edi 224 movl 128(%ebp),%eax 225 subl %eax,%esi 226 movl %edi,%ecx 227 rorl %cl,%esi 228 xorl %edi,%esi 229 movl 124(%ebp),%eax 230 subl %eax,%edi 231 movl %esi,%ecx 232 rorl %cl,%edi 233 xorl %esi,%edi 234 movl 120(%ebp),%eax 235 subl %eax,%esi 236 movl %edi,%ecx 237 rorl %cl,%esi 238 xorl %edi,%esi 239 movl 116(%ebp),%eax 240 subl %eax,%edi 241 movl %esi,%ecx 242 rorl %cl,%edi 243 xorl %esi,%edi 244 movl 112(%ebp),%eax 245 subl %eax,%esi 246 movl %edi,%ecx 247 rorl %cl,%esi 248 xorl %edi,%esi 249 movl 108(%ebp),%eax 250 subl %eax,%edi 251 movl %esi,%ecx 252 rorl %cl,%edi 253 xorl %esi,%edi 254.L001rc5_dec_12: 255 movl 104(%ebp),%eax 256 subl %eax,%esi 257 movl %edi,%ecx 258 rorl %cl,%esi 259 xorl %edi,%esi 260 movl 100(%ebp),%eax 261 subl %eax,%edi 262 movl %esi,%ecx 263 rorl %cl,%edi 264 xorl %esi,%edi 265 movl 96(%ebp),%eax 266 subl %eax,%esi 267 movl %edi,%ecx 268 rorl %cl,%esi 269 xorl %edi,%esi 270 movl 92(%ebp),%eax 271 subl %eax,%edi 272 movl %esi,%ecx 273 rorl %cl,%edi 274 xorl %esi,%edi 275 movl 88(%ebp),%eax 276 subl %eax,%esi 277 movl %edi,%ecx 278 rorl %cl,%esi 279 xorl %edi,%esi 280 movl 84(%ebp),%eax 281 subl %eax,%edi 282 movl %esi,%ecx 283 rorl %cl,%edi 284 xorl %esi,%edi 285 movl 80(%ebp),%eax 286 subl %eax,%esi 287 movl %edi,%ecx 288 rorl %cl,%esi 289 xorl %edi,%esi 290 movl 76(%ebp),%eax 291 subl %eax,%edi 292 movl %esi,%ecx 293 rorl %cl,%edi 294 xorl %esi,%edi 295.L002rc5_dec_8: 296 movl 72(%ebp),%eax 297 subl %eax,%esi 298 movl %edi,%ecx 299 rorl %cl,%esi 300 xorl %edi,%esi 301 movl 68(%ebp),%eax 302 subl %eax,%edi 303 movl %esi,%ecx 304 rorl %cl,%edi 305 xorl %esi,%edi 306 movl 64(%ebp),%eax 307 subl %eax,%esi 308 movl %edi,%ecx 309 rorl %cl,%esi 310 xorl %edi,%esi 311 movl 60(%ebp),%eax 312 subl %eax,%edi 313 movl %esi,%ecx 314 rorl %cl,%edi 315 xorl %esi,%edi 316 movl 56(%ebp),%eax 317 subl %eax,%esi 318 movl %edi,%ecx 319 rorl %cl,%esi 320 xorl %edi,%esi 321 movl 52(%ebp),%eax 322 subl %eax,%edi 323 movl %esi,%ecx 324 rorl %cl,%edi 325 xorl %esi,%edi 326 movl 48(%ebp),%eax 327 subl %eax,%esi 328 movl %edi,%ecx 329 rorl %cl,%esi 330 xorl %edi,%esi 331 movl 44(%ebp),%eax 332 subl %eax,%edi 333 movl %esi,%ecx 334 rorl %cl,%edi 335 xorl %esi,%edi 336 movl 40(%ebp),%eax 337 subl %eax,%esi 338 movl %edi,%ecx 339 rorl %cl,%esi 340 xorl %edi,%esi 341 movl 36(%ebp),%eax 342 subl %eax,%edi 343 movl %esi,%ecx 344 rorl %cl,%edi 345 xorl %esi,%edi 346 movl 32(%ebp),%eax 347 subl %eax,%esi 348 movl %edi,%ecx 349 rorl %cl,%esi 350 xorl %edi,%esi 351 movl 28(%ebp),%eax 352 subl %eax,%edi 353 movl %esi,%ecx 354 rorl %cl,%edi 355 xorl %esi,%edi 356 movl 24(%ebp),%eax 357 subl %eax,%esi 358 movl %edi,%ecx 359 rorl %cl,%esi 360 xorl %edi,%esi 361 movl 20(%ebp),%eax 362 subl %eax,%edi 363 movl %esi,%ecx 364 rorl %cl,%edi 365 xorl %esi,%edi 366 movl 16(%ebp),%eax 367 subl %eax,%esi 368 movl %edi,%ecx 369 rorl %cl,%esi 370 xorl %edi,%esi 371 movl 12(%ebp),%eax 372 subl %eax,%edi 373 movl %esi,%ecx 374 rorl %cl,%edi 375 xorl %esi,%edi 376 subl 8(%ebp),%esi 377 subl 4(%ebp),%edi 378.L003rc5_exit: 379 movl %edi,(%edx) 380 movl %esi,4(%edx) 381 popl %ebx 382 popl %edi 383 popl %esi 384 popl %ebp 385 ret 386.size RC5_32_decrypt,.-.L_RC5_32_decrypt_begin 387.globl RC5_32_cbc_encrypt 388.type RC5_32_cbc_encrypt,@function 389.align 16 390RC5_32_cbc_encrypt: 391.L_RC5_32_cbc_encrypt_begin: 392 393 pushl %ebp 394 pushl %ebx 395 pushl %esi 396 pushl %edi 397 movl 28(%esp),%ebp 398 399 movl 36(%esp),%ebx 400 movl (%ebx),%esi 401 movl 4(%ebx),%edi 402 pushl %edi 403 pushl %esi 404 pushl %edi 405 pushl %esi 406 movl %esp,%ebx 407 movl 36(%esp),%esi 408 movl 40(%esp),%edi 409 410 movl 56(%esp),%ecx 411 412 movl 48(%esp),%eax 413 pushl %eax 414 pushl %ebx 415 cmpl $0,%ecx 416 jz .L004decrypt 417 andl $4294967288,%ebp 418 movl 8(%esp),%eax 419 movl 12(%esp),%ebx 420 jz .L005encrypt_finish 421.L006encrypt_loop: 422 movl (%esi),%ecx 423 movl 4(%esi),%edx 424 xorl %ecx,%eax 425 xorl %edx,%ebx 426 movl %eax,8(%esp) 427 movl %ebx,12(%esp) 428 call .L_RC5_32_encrypt_begin 429 movl 8(%esp),%eax 430 movl 12(%esp),%ebx 431 movl %eax,(%edi) 432 movl %ebx,4(%edi) 433 addl $8,%esi 434 addl $8,%edi 435 subl $8,%ebp 436 jnz .L006encrypt_loop 437.L005encrypt_finish: 438 movl 52(%esp),%ebp 439 andl $7,%ebp 440 jz .L007finish 441 call .L008PIC_point 442.L008PIC_point: 443 popl %edx 444 leal .L009cbc_enc_jmp_table-.L008PIC_point(%edx),%ecx 445 movl (%ecx,%ebp,4),%ebp 446 addl %edx,%ebp 447 xorl %ecx,%ecx 448 xorl %edx,%edx 449 jmp *%ebp 450.L010ej7: 451 movb 6(%esi),%dh 452 shll $8,%edx 453.L011ej6: 454 movb 5(%esi),%dh 455.L012ej5: 456 movb 4(%esi),%dl 457.L013ej4: 458 movl (%esi),%ecx 459 jmp .L014ejend 460.L015ej3: 461 movb 2(%esi),%ch 462 shll $8,%ecx 463.L016ej2: 464 movb 1(%esi),%ch 465.L017ej1: 466 movb (%esi),%cl 467.L014ejend: 468 xorl %ecx,%eax 469 xorl %edx,%ebx 470 movl %eax,8(%esp) 471 movl %ebx,12(%esp) 472 call .L_RC5_32_encrypt_begin 473 movl 8(%esp),%eax 474 movl 12(%esp),%ebx 475 movl %eax,(%edi) 476 movl %ebx,4(%edi) 477 jmp .L007finish 478.L004decrypt: 479 andl $4294967288,%ebp 480 movl 16(%esp),%eax 481 movl 20(%esp),%ebx 482 jz .L018decrypt_finish 483.L019decrypt_loop: 484 movl (%esi),%eax 485 movl 4(%esi),%ebx 486 movl %eax,8(%esp) 487 movl %ebx,12(%esp) 488 call .L_RC5_32_decrypt_begin 489 movl 8(%esp),%eax 490 movl 12(%esp),%ebx 491 movl 16(%esp),%ecx 492 movl 20(%esp),%edx 493 xorl %eax,%ecx 494 xorl %ebx,%edx 495 movl (%esi),%eax 496 movl 4(%esi),%ebx 497 movl %ecx,(%edi) 498 movl %edx,4(%edi) 499 movl %eax,16(%esp) 500 movl %ebx,20(%esp) 501 addl $8,%esi 502 addl $8,%edi 503 subl $8,%ebp 504 jnz .L019decrypt_loop 505.L018decrypt_finish: 506 movl 52(%esp),%ebp 507 andl $7,%ebp 508 jz .L007finish 509 movl (%esi),%eax 510 movl 4(%esi),%ebx 511 movl %eax,8(%esp) 512 movl %ebx,12(%esp) 513 call .L_RC5_32_decrypt_begin 514 movl 8(%esp),%eax 515 movl 12(%esp),%ebx 516 movl 16(%esp),%ecx 517 movl 20(%esp),%edx 518 xorl %eax,%ecx 519 xorl %ebx,%edx 520 movl (%esi),%eax 521 movl 4(%esi),%ebx 522.L020dj7: 523 rorl $16,%edx 524 movb %dl,6(%edi) 525 shrl $16,%edx 526.L021dj6: 527 movb %dh,5(%edi) 528.L022dj5: 529 movb %dl,4(%edi) 530.L023dj4: 531 movl %ecx,(%edi) 532 jmp .L024djend 533.L025dj3: 534 rorl $16,%ecx 535 movb %cl,2(%edi) 536 shll $16,%ecx 537.L026dj2: 538 movb %ch,1(%esi) 539.L027dj1: 540 movb %cl,(%esi) 541.L024djend: 542 jmp .L007finish 543.L007finish: 544 movl 60(%esp),%ecx 545 addl $24,%esp 546 movl %eax,(%ecx) 547 movl %ebx,4(%ecx) 548 popl %edi 549 popl %esi 550 popl %ebx 551 popl %ebp 552 ret 553.align 64 554.L009cbc_enc_jmp_table: 555.long 0 556.long .L017ej1-.L008PIC_point 557.long .L016ej2-.L008PIC_point 558.long .L015ej3-.L008PIC_point 559.long .L013ej4-.L008PIC_point 560.long .L012ej5-.L008PIC_point 561.long .L011ej6-.L008PIC_point 562.long .L010ej7-.L008PIC_point 563.align 64 564.size RC5_32_cbc_encrypt,.-.L_RC5_32_cbc_encrypt_begin 565