diff options
author | markm <markm@FreeBSD.org> | 2004-03-23 08:32:29 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 2004-03-23 08:32:29 +0000 |
commit | 1d9f598c393032e703ef42b49dd7589627f4b697 (patch) | |
tree | ba54db684d8a0eb785c25b140318a0bd26ae6abc /secure/lib/libcrypto/i386/bf-686.s | |
parent | 1a0675878118e9b1a4e9ad46a2bf8b1ed7c95381 (diff) | |
download | FreeBSD-src-1d9f598c393032e703ef42b49dd7589627f4b697.zip FreeBSD-src-1d9f598c393032e703ef42b49dd7589627f4b697.tar.gz |
Re-add the hand-optimised assembler versions of some of the ciphers
to the build.
Should have done this ages ago: markm
Reminded above to do this: peter
Diffstat (limited to 'secure/lib/libcrypto/i386/bf-686.s')
-rw-r--r-- | secure/lib/libcrypto/i386/bf-686.s | 197 |
1 files changed, 96 insertions, 101 deletions
diff --git a/secure/lib/libcrypto/i386/bf-686.s b/secure/lib/libcrypto/i386/bf-686.s index bb3b9c7..d3b4cb8 100644 --- a/secure/lib/libcrypto/i386/bf-686.s +++ b/secure/lib/libcrypto/i386/bf-686.s @@ -1,9 +1,9 @@ # $FreeBSD$ - # Dont even think of reading this code - # It was automatically generated by bf-686.pl - # Which is a perl program used to generate the x86 assember for - # any of elf, a.out, BSDI, Win32, gaswin (for GNU as on Win32) or Solaris - # eric <eay@cryptsoft.com> + + + + + .file "bf-686.s" .version "01.01" @@ -19,18 +19,18 @@ BF_encrypt: pushl %edi - # Load the 2 words + movl 20(%esp), %eax movl (%eax), %ecx movl 4(%eax), %edx - # P pointer, s and enc flag + movl 24(%esp), %edi xorl %eax, %eax xorl %ebx, %ebx xorl (%edi), %ecx - # Round 0 + rorl $16, %ecx movl 4(%edi), %esi movb %ch, %al @@ -49,7 +49,7 @@ BF_encrypt: xorl %eax, %eax xorl %esi, %edx - # Round 1 + rorl $16, %edx movl 8(%edi), %esi movb %dh, %al @@ -68,7 +68,7 @@ BF_encrypt: xorl %eax, %eax xorl %esi, %ecx - # Round 2 + rorl $16, %ecx movl 12(%edi), %esi movb %ch, %al @@ -87,7 +87,7 @@ BF_encrypt: xorl %eax, %eax xorl %esi, %edx - # Round 3 + rorl $16, %edx movl 16(%edi), %esi movb %dh, %al @@ -106,7 +106,7 @@ BF_encrypt: xorl %eax, %eax xorl %esi, %ecx - # Round 4 + rorl $16, %ecx movl 20(%edi), %esi movb %ch, %al @@ -125,7 +125,7 @@ BF_encrypt: xorl %eax, %eax xorl %esi, %edx - # Round 5 + rorl $16, %edx movl 24(%edi), %esi movb %dh, %al @@ -144,7 +144,7 @@ BF_encrypt: xorl %eax, %eax xorl %esi, %ecx - # Round 6 + rorl $16, %ecx movl 28(%edi), %esi movb %ch, %al @@ -163,7 +163,7 @@ BF_encrypt: xorl %eax, %eax xorl %esi, %edx - # Round 7 + rorl $16, %edx movl 32(%edi), %esi movb %dh, %al @@ -182,7 +182,7 @@ BF_encrypt: xorl %eax, %eax xorl %esi, %ecx - # Round 8 + rorl $16, %ecx movl 36(%edi), %esi movb %ch, %al @@ -201,7 +201,7 @@ BF_encrypt: xorl %eax, %eax xorl %esi, %edx - # Round 9 + rorl $16, %edx movl 40(%edi), %esi movb %dh, %al @@ -220,7 +220,7 @@ BF_encrypt: xorl %eax, %eax xorl %esi, %ecx - # Round 10 + rorl $16, %ecx movl 44(%edi), %esi movb %ch, %al @@ -239,7 +239,7 @@ BF_encrypt: xorl %eax, %eax xorl %esi, %edx - # Round 11 + rorl $16, %edx movl 48(%edi), %esi movb %dh, %al @@ -258,7 +258,7 @@ BF_encrypt: xorl %eax, %eax xorl %esi, %ecx - # Round 12 + rorl $16, %ecx movl 52(%edi), %esi movb %ch, %al @@ -277,7 +277,7 @@ BF_encrypt: xorl %eax, %eax xorl %esi, %edx - # Round 13 + rorl $16, %edx movl 56(%edi), %esi movb %dh, %al @@ -296,7 +296,7 @@ BF_encrypt: xorl %eax, %eax xorl %esi, %ecx - # Round 14 + rorl $16, %ecx movl 60(%edi), %esi movb %ch, %al @@ -315,7 +315,7 @@ BF_encrypt: xorl %eax, %eax xorl %esi, %edx - # Round 15 + rorl $16, %edx movl 64(%edi), %esi movb %dh, %al @@ -356,18 +356,18 @@ BF_decrypt: pushl %edi - # Load the 2 words + movl 20(%esp), %eax movl (%eax), %ecx movl 4(%eax), %edx - # P pointer, s and enc flag + movl 24(%esp), %edi xorl %eax, %eax xorl %ebx, %ebx xorl 68(%edi), %ecx - # Round 16 + rorl $16, %ecx movl 64(%edi), %esi movb %ch, %al @@ -386,7 +386,7 @@ BF_decrypt: xorl %eax, %eax xorl %esi, %edx - # Round 15 + rorl $16, %edx movl 60(%edi), %esi movb %dh, %al @@ -405,7 +405,7 @@ BF_decrypt: xorl %eax, %eax xorl %esi, %ecx - # Round 14 + rorl $16, %ecx movl 56(%edi), %esi movb %ch, %al @@ -424,7 +424,7 @@ BF_decrypt: xorl %eax, %eax xorl %esi, %edx - # Round 13 + rorl $16, %edx movl 52(%edi), %esi movb %dh, %al @@ -443,7 +443,7 @@ BF_decrypt: xorl %eax, %eax xorl %esi, %ecx - # Round 12 + rorl $16, %ecx movl 48(%edi), %esi movb %ch, %al @@ -462,7 +462,7 @@ BF_decrypt: xorl %eax, %eax xorl %esi, %edx - # Round 11 + rorl $16, %edx movl 44(%edi), %esi movb %dh, %al @@ -481,7 +481,7 @@ BF_decrypt: xorl %eax, %eax xorl %esi, %ecx - # Round 10 + rorl $16, %ecx movl 40(%edi), %esi movb %ch, %al @@ -500,7 +500,7 @@ BF_decrypt: xorl %eax, %eax xorl %esi, %edx - # Round 9 + rorl $16, %edx movl 36(%edi), %esi movb %dh, %al @@ -519,7 +519,7 @@ BF_decrypt: xorl %eax, %eax xorl %esi, %ecx - # Round 8 + rorl $16, %ecx movl 32(%edi), %esi movb %ch, %al @@ -538,7 +538,7 @@ BF_decrypt: xorl %eax, %eax xorl %esi, %edx - # Round 7 + rorl $16, %edx movl 28(%edi), %esi movb %dh, %al @@ -557,7 +557,7 @@ BF_decrypt: xorl %eax, %eax xorl %esi, %ecx - # Round 6 + rorl $16, %ecx movl 24(%edi), %esi movb %ch, %al @@ -576,7 +576,7 @@ BF_decrypt: xorl %eax, %eax xorl %esi, %edx - # Round 5 + rorl $16, %edx movl 20(%edi), %esi movb %dh, %al @@ -595,7 +595,7 @@ BF_decrypt: xorl %eax, %eax xorl %esi, %ecx - # Round 4 + rorl $16, %ecx movl 16(%edi), %esi movb %ch, %al @@ -614,7 +614,7 @@ BF_decrypt: xorl %eax, %eax xorl %esi, %edx - # Round 3 + rorl $16, %edx movl 12(%edi), %esi movb %dh, %al @@ -633,7 +633,7 @@ BF_decrypt: xorl %eax, %eax xorl %esi, %ecx - # Round 2 + rorl $16, %ecx movl 8(%edi), %esi movb %ch, %al @@ -652,7 +652,7 @@ BF_decrypt: xorl %eax, %eax xorl %esi, %edx - # Round 1 + rorl $16, %edx movl 4(%edi), %esi movb %dh, %al @@ -693,7 +693,7 @@ BF_cbc_encrypt: pushl %esi pushl %edi movl 28(%esp), %ebp - # getting iv ptr from parameter 4 + movl 36(%esp), %ebx movl (%ebx), %esi movl 4(%ebx), %edi @@ -704,9 +704,9 @@ BF_cbc_encrypt: movl %esp, %ebx movl 36(%esp), %esi movl 40(%esp), %edi - # getting encrypt flag from parameter 5 + movl 56(%esp), %ecx - # get and push parameter 3 + movl 48(%esp), %eax pushl %eax pushl %ebx @@ -722,18 +722,18 @@ BF_cbc_encrypt: xorl %ecx, %eax xorl %edx, %ebx .byte 15 -.byte 200 # bswapl %eax +.byte 200 .byte 15 -.byte 203 # bswapl %ebx +.byte 203 movl %eax, 8(%esp) movl %ebx, 12(%esp) call BF_encrypt movl 8(%esp), %eax movl 12(%esp), %ebx .byte 15 -.byte 200 # bswapl %eax +.byte 200 .byte 15 -.byte 203 # bswapl %ebx +.byte 203 movl %eax, (%edi) movl %ebx, 4(%edi) addl $8, %esi @@ -744,43 +744,48 @@ BF_cbc_encrypt: movl 52(%esp), %ebp andl $7, %ebp jz .L003finish + call .L004PIC_point +.L004PIC_point: + popl %edx + leal .L005cbc_enc_jmp_table-.L004PIC_point(%edx),%ecx + movl (%ecx,%ebp,4), %ebp + addl %edx, %ebp xorl %ecx, %ecx xorl %edx, %edx - movl .L004cbc_enc_jmp_table(,%ebp,4),%ebp jmp *%ebp -.L005ej7: +.L006ej7: movb 6(%esi), %dh sall $8, %edx -.L006ej6: +.L007ej6: movb 5(%esi), %dh -.L007ej5: +.L008ej5: movb 4(%esi), %dl -.L008ej4: +.L009ej4: movl (%esi), %ecx - jmp .L009ejend -.L010ej3: + jmp .L010ejend +.L011ej3: movb 2(%esi), %ch sall $8, %ecx -.L011ej2: +.L012ej2: movb 1(%esi), %ch -.L012ej1: +.L013ej1: movb (%esi), %cl -.L009ejend: +.L010ejend: xorl %ecx, %eax xorl %edx, %ebx .byte 15 -.byte 200 # bswapl %eax +.byte 200 .byte 15 -.byte 203 # bswapl %ebx +.byte 203 movl %eax, 8(%esp) movl %ebx, 12(%esp) call BF_encrypt movl 8(%esp), %eax movl 12(%esp), %ebx .byte 15 -.byte 200 # bswapl %eax +.byte 200 .byte 15 -.byte 203 # bswapl %ebx +.byte 203 movl %eax, (%edi) movl %ebx, 4(%edi) jmp .L003finish @@ -789,23 +794,23 @@ BF_cbc_encrypt: andl $4294967288, %ebp movl 16(%esp), %eax movl 20(%esp), %ebx - jz .L013decrypt_finish -.L014decrypt_loop: + jz .L014decrypt_finish +.L015decrypt_loop: movl (%esi), %eax movl 4(%esi), %ebx .byte 15 -.byte 200 # bswapl %eax +.byte 200 .byte 15 -.byte 203 # bswapl %ebx +.byte 203 movl %eax, 8(%esp) movl %ebx, 12(%esp) call BF_decrypt movl 8(%esp), %eax movl 12(%esp), %ebx .byte 15 -.byte 200 # bswapl %eax +.byte 200 .byte 15 -.byte 203 # bswapl %ebx +.byte 203 movl 16(%esp), %ecx movl 20(%esp), %edx xorl %eax, %ecx @@ -819,52 +824,52 @@ BF_cbc_encrypt: addl $8, %esi addl $8, %edi subl $8, %ebp - jnz .L014decrypt_loop -.L013decrypt_finish: + jnz .L015decrypt_loop +.L014decrypt_finish: movl 52(%esp), %ebp andl $7, %ebp jz .L003finish movl (%esi), %eax movl 4(%esi), %ebx .byte 15 -.byte 200 # bswapl %eax +.byte 200 .byte 15 -.byte 203 # bswapl %ebx +.byte 203 movl %eax, 8(%esp) movl %ebx, 12(%esp) call BF_decrypt movl 8(%esp), %eax movl 12(%esp), %ebx .byte 15 -.byte 200 # bswapl %eax +.byte 200 .byte 15 -.byte 203 # bswapl %ebx +.byte 203 movl 16(%esp), %ecx movl 20(%esp), %edx xorl %eax, %ecx xorl %ebx, %edx movl (%esi), %eax movl 4(%esi), %ebx -.L015dj7: +.L016dj7: rorl $16, %edx movb %dl, 6(%edi) shrl $16, %edx -.L016dj6: +.L017dj6: movb %dh, 5(%edi) -.L017dj5: +.L018dj5: movb %dl, 4(%edi) -.L018dj4: +.L019dj4: movl %ecx, (%edi) - jmp .L019djend -.L020dj3: + jmp .L020djend +.L021dj3: rorl $16, %ecx movb %cl, 2(%edi) sall $16, %ecx -.L021dj2: +.L022dj2: movb %ch, 1(%esi) -.L022dj1: +.L023dj1: movb %cl, (%esi) -.L019djend: +.L020djend: jmp .L003finish .align 16 .L003finish: @@ -878,25 +883,15 @@ BF_cbc_encrypt: popl %ebp ret .align 16 -.L004cbc_enc_jmp_table: - .long 0 - .long .L012ej1 - .long .L011ej2 - .long .L010ej3 - .long .L008ej4 - .long .L007ej5 - .long .L006ej6 - .long .L005ej7 -.align 16 -.L023cbc_dec_jmp_table: +.L005cbc_enc_jmp_table: .long 0 - .long .L022dj1 - .long .L021dj2 - .long .L020dj3 - .long .L018dj4 - .long .L017dj5 - .long .L016dj6 - .long .L015dj7 + .long .L013ej1-.L004PIC_point + .long .L012ej2-.L004PIC_point + .long .L011ej3-.L004PIC_point + .long .L009ej4-.L004PIC_point + .long .L008ej5-.L004PIC_point + .long .L007ej6-.L004PIC_point + .long .L006ej7-.L004PIC_point .L_BF_cbc_encrypt_end: .size BF_cbc_encrypt,.L_BF_cbc_encrypt_end-BF_cbc_encrypt .ident "desasm.pl" |