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