diff options
Diffstat (limited to 'crypto/bf')
-rw-r--r-- | crypto/bf/asm/bf586.pl | 159 | ||||
-rw-r--r-- | crypto/bf/asm/bx86-cpp.s | 666 | ||||
-rw-r--r-- | crypto/bf/asm/win32.asm | 663 | ||||
-rw-r--r-- | crypto/bf/bf_locl | 243 |
4 files changed, 0 insertions, 1731 deletions
diff --git a/crypto/bf/asm/bf586.pl b/crypto/bf/asm/bf586.pl deleted file mode 100644 index bcb53cf3f5..0000000000 --- a/crypto/bf/asm/bf586.pl +++ /dev/null @@ -1,159 +0,0 @@ -#!/usr/local/bin/perl -#!/usr/local/bin/perl
-
-$prog="bf586.pl";
-
-# base code is in microsft
-# op dest, source
-# format.
-#
-
-if ( ($ARGV[0] eq "elf"))
- { require "x86unix.pl"; }
-elsif ( ($ARGV[0] eq "a.out"))
- { $aout=1; require "x86unix.pl"; }
-elsif ( ($ARGV[0] eq "sol"))
- { $sol=1; require "x86unix.pl"; }
-elsif ( ($ARGV[0] eq "cpp"))
- { $cpp=1; require "x86unix.pl"; }
-elsif ( ($ARGV[0] eq "win32"))
- { require "x86ms.pl"; }
-else
- {
- print STDERR <<"EOF";
-Pick one target type from
- elf - linux, FreeBSD etc
- a.out - old linux
- sol - x86 solaris
- cpp - format so x86unix.cpp can be used
- win32 - Windows 95/Windows NT
-EOF
- exit(1);
- }
-
-&comment("Don't even think of reading this code");
-&comment("It was automatically generated by $prog");
-&comment("Which is a perl program used to generate the x86 assember for");
-&comment("any of elf, a.out, Win32, or Solaris");
-&comment("It can be found in SSLeay 0.7.0+");
-&comment("eric <eay\@cryptsoft.com>");
-&comment("");
-
-&file("bfx86xxxx");
-
-$BF_ROUNDS=16;
-$BF_OFF=($BF_ROUNDS+2)*4;
-$L="ecx";
-$R="edx";
-$P="edi";
-$tot="esi";
-$tmp1="eax";
-$tmp2="ebx";
-$tmp3="ebp";
-
-&des_encrypt("BF_encrypt");
-
-&file_end();
-
-sub des_encrypt
- {
- local($name)=@_;
-
- &function_begin($name,3,"");
-
- &comment("");
- &comment("Load the 2 words");
- &mov("eax",&wparam(0));
- &mov($L,&DWP(0,"eax","",0));
- &mov($R,&DWP(4,"eax","",0));
-
- &comment("");
- &comment("P pointer, s and enc flag");
- &mov($P,&wparam(1));
-
- &xor( $tmp1, $tmp1);
- &xor( $tmp2, $tmp2);
-
- # encrypting part
-
- &mov("ebp",&wparam(2)); # get encrypt flag
- &cmp("ebp","0");
- &je(&label("start_decrypt"));
-
- &xor($L,&DWP(0,$P,"",0));
- for ($i=0; $i<$BF_ROUNDS; $i+=2)
- {
- &comment("");
- &comment("Round $i");
- &BF_ENCRYPT($i+1,$R,$L,$P,$tot,$tmp1,$tmp2,$tmp3);
-
- &comment("");
- &comment("Round ".sprintf("%d",$i+1));
- &BF_ENCRYPT($i+2,$L,$R,$P,$tot,$tmp1,$tmp2,$tmp3);
- }
- &xor($R,&DWP(($BF_ROUNDS+1)*4,$P,"",0));
-
- &mov("eax",&wparam(0));
- &mov(&DWP(0,"eax","",0),$R);
- &mov(&DWP(4,"eax","",0),$L);
- &function_end_A($name);
-
- &set_label("start_decrypt");
-
- &xor($L,&DWP(($BF_ROUNDS+1)*4,$P,"",0));
- for ($i=$BF_ROUNDS; $i>0; $i-=2)
- {
- &comment("");
- &comment("Round $i");
- &BF_ENCRYPT($i,$R,$L,$P,$tot,$tmp1,$tmp2,$tmp3);
- &comment("");
- &comment("Round ".sprintf("%d",$i-1));
- &BF_ENCRYPT($i-1,$L,$R,$P,$tot,$tmp1,$tmp2,$tmp3);
- }
- &xor($R,&DWP(0,$P,"",0));
-
- &mov("eax",&wparam(0));
- &mov(&DWP(0,"eax","",0),$R);
- &mov(&DWP(4,"eax","",0),$L);
- &function_end_A($name);
-
- &function_end_B($name);
- }
-
-sub BF_ENCRYPT
- {
- local($i,$L,$R,$P,$tot,$tmp1,$tmp2,$tmp3)=@_;
-
- &rotr( $R, 16);
- &mov( $tot, &DWP(&n2a($i*4),$P,"",0));
-
- &movb( &LB($tmp1), &HB($R));
- &movb( &LB($tmp2), &LB($R));
-
- &rotr( $R, 16);
- &xor( $L, $tot);
-
- &mov( $tot, &DWP(&n2a($BF_OFF+0x0000),$P,$tmp1,4));
- &mov( $tmp3, &DWP(&n2a($BF_OFF+0x0400),$P,$tmp2,4));
-
- &movb( &LB($tmp1), &HB($R));
- &movb( &LB($tmp2), &LB($R));
-
- &add( $tot, $tmp3);
- &mov( $tmp1, &DWP(&n2a($BF_OFF+0x0800),$P,$tmp1,4)); # delay
-
- &xor( $tot, $tmp1);
- &mov( $tmp3, &DWP(&n2a($BF_OFF+0x0C00),$P,$tmp2,4));
-
- &add( $tot, $tmp3);
- &xor( $tmp1, $tmp1);
-
- &xor( $L, $tot);
- # delay
- }
-
-sub n2a
- {
- sprintf("%d",$_[0]);
- }
-
diff --git a/crypto/bf/asm/bx86-cpp.s b/crypto/bf/asm/bx86-cpp.s deleted file mode 100644 index 0925137a6d..0000000000 --- a/crypto/bf/asm/bx86-cpp.s +++ /dev/null @@ -1,666 +0,0 @@ - /* Don't even think of reading this code */ - /* It was automatically generated by bf586.pl */ - /* Which is a perl program used to generate the x86 assember for */ - /* any of elf, a.out, Win32, or Solaris */ - /* It can be found in SSLeay 0.7.0+ */ - /* eric <eay@cryptsoft.com> */ - - .file "bfx86xxxx.s" - .version "01.01" -gcc2_compiled.: -.text - .align ALIGN -.globl BF_encrypt - TYPE(BF_encrypt,@function) -BF_encrypt: - pushl %ebp - pushl %ebx - pushl %esi - 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 - movl 28(%esp), %ebp - cmpl $0, %ebp - je .L000start_decrypt - xorl (%edi), %ecx - - /* Round 0 */ - rorl $16, %ecx - movl 4(%edi), %esi - movb %ch, %al - movb %cl, %bl - rorl $16, %ecx - xorl %esi, %edx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %ch, %al - movb %cl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %edx - - /* Round 1 */ - rorl $16, %edx - movl 8(%edi), %esi - movb %dh, %al - movb %dl, %bl - rorl $16, %edx - xorl %esi, %ecx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %dh, %al - movb %dl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %ecx - - /* Round 2 */ - rorl $16, %ecx - movl 12(%edi), %esi - movb %ch, %al - movb %cl, %bl - rorl $16, %ecx - xorl %esi, %edx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %ch, %al - movb %cl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %edx - - /* Round 3 */ - rorl $16, %edx - movl 16(%edi), %esi - movb %dh, %al - movb %dl, %bl - rorl $16, %edx - xorl %esi, %ecx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %dh, %al - movb %dl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %ecx - - /* Round 4 */ - rorl $16, %ecx - movl 20(%edi), %esi - movb %ch, %al - movb %cl, %bl - rorl $16, %ecx - xorl %esi, %edx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %ch, %al - movb %cl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %edx - - /* Round 5 */ - rorl $16, %edx - movl 24(%edi), %esi - movb %dh, %al - movb %dl, %bl - rorl $16, %edx - xorl %esi, %ecx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %dh, %al - movb %dl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %ecx - - /* Round 6 */ - rorl $16, %ecx - movl 28(%edi), %esi - movb %ch, %al - movb %cl, %bl - rorl $16, %ecx - xorl %esi, %edx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %ch, %al - movb %cl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %edx - - /* Round 7 */ - rorl $16, %edx - movl 32(%edi), %esi - movb %dh, %al - movb %dl, %bl - rorl $16, %edx - xorl %esi, %ecx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %dh, %al - movb %dl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %ecx - - /* Round 8 */ - rorl $16, %ecx - movl 36(%edi), %esi - movb %ch, %al - movb %cl, %bl - rorl $16, %ecx - xorl %esi, %edx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %ch, %al - movb %cl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %edx - - /* Round 9 */ - rorl $16, %edx - movl 40(%edi), %esi - movb %dh, %al - movb %dl, %bl - rorl $16, %edx - xorl %esi, %ecx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %dh, %al - movb %dl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %ecx - - /* Round 10 */ - rorl $16, %ecx - movl 44(%edi), %esi - movb %ch, %al - movb %cl, %bl - rorl $16, %ecx - xorl %esi, %edx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %ch, %al - movb %cl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %edx - - /* Round 11 */ - rorl $16, %edx - movl 48(%edi), %esi - movb %dh, %al - movb %dl, %bl - rorl $16, %edx - xorl %esi, %ecx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %dh, %al - movb %dl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %ecx - - /* Round 12 */ - rorl $16, %ecx - movl 52(%edi), %esi - movb %ch, %al - movb %cl, %bl - rorl $16, %ecx - xorl %esi, %edx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %ch, %al - movb %cl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %edx - - /* Round 13 */ - rorl $16, %edx - movl 56(%edi), %esi - movb %dh, %al - movb %dl, %bl - rorl $16, %edx - xorl %esi, %ecx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %dh, %al - movb %dl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %ecx - - /* Round 14 */ - rorl $16, %ecx - movl 60(%edi), %esi - movb %ch, %al - movb %cl, %bl - rorl $16, %ecx - xorl %esi, %edx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %ch, %al - movb %cl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %edx - - /* Round 15 */ - rorl $16, %edx - movl 64(%edi), %esi - movb %dh, %al - movb %dl, %bl - rorl $16, %edx - xorl %esi, %ecx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %dh, %al - movb %dl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %ecx - xorl 68(%edi), %edx - movl 20(%esp), %eax - movl %edx, (%eax) - movl %ecx, 4(%eax) - popl %edi - popl %esi - popl %ebx - popl %ebp - ret -.align ALIGN -.L000start_decrypt: - xorl 68(%edi), %ecx - - /* Round 16 */ - rorl $16, %ecx - movl 64(%edi), %esi - movb %ch, %al - movb %cl, %bl - rorl $16, %ecx - xorl %esi, %edx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %ch, %al - movb %cl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %edx - - /* Round 15 */ - rorl $16, %edx - movl 60(%edi), %esi - movb %dh, %al - movb %dl, %bl - rorl $16, %edx - xorl %esi, %ecx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %dh, %al - movb %dl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %ecx - - /* Round 14 */ - rorl $16, %ecx - movl 56(%edi), %esi - movb %ch, %al - movb %cl, %bl - rorl $16, %ecx - xorl %esi, %edx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %ch, %al - movb %cl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %edx - - /* Round 13 */ - rorl $16, %edx - movl 52(%edi), %esi - movb %dh, %al - movb %dl, %bl - rorl $16, %edx - xorl %esi, %ecx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %dh, %al - movb %dl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %ecx - - /* Round 12 */ - rorl $16, %ecx - movl 48(%edi), %esi - movb %ch, %al - movb %cl, %bl - rorl $16, %ecx - xorl %esi, %edx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %ch, %al - movb %cl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %edx - - /* Round 11 */ - rorl $16, %edx - movl 44(%edi), %esi - movb %dh, %al - movb %dl, %bl - rorl $16, %edx - xorl %esi, %ecx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %dh, %al - movb %dl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %ecx - - /* Round 10 */ - rorl $16, %ecx - movl 40(%edi), %esi - movb %ch, %al - movb %cl, %bl - rorl $16, %ecx - xorl %esi, %edx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %ch, %al - movb %cl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %edx - - /* Round 9 */ - rorl $16, %edx - movl 36(%edi), %esi - movb %dh, %al - movb %dl, %bl - rorl $16, %edx - xorl %esi, %ecx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %dh, %al - movb %dl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %ecx - - /* Round 8 */ - rorl $16, %ecx - movl 32(%edi), %esi - movb %ch, %al - movb %cl, %bl - rorl $16, %ecx - xorl %esi, %edx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %ch, %al - movb %cl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %edx - - /* Round 7 */ - rorl $16, %edx - movl 28(%edi), %esi - movb %dh, %al - movb %dl, %bl - rorl $16, %edx - xorl %esi, %ecx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %dh, %al - movb %dl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %ecx - - /* Round 6 */ - rorl $16, %ecx - movl 24(%edi), %esi - movb %ch, %al - movb %cl, %bl - rorl $16, %ecx - xorl %esi, %edx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %ch, %al - movb %cl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %edx - - /* Round 5 */ - rorl $16, %edx - movl 20(%edi), %esi - movb %dh, %al - movb %dl, %bl - rorl $16, %edx - xorl %esi, %ecx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %dh, %al - movb %dl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %ecx - - /* Round 4 */ - rorl $16, %ecx - movl 16(%edi), %esi - movb %ch, %al - movb %cl, %bl - rorl $16, %ecx - xorl %esi, %edx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %ch, %al - movb %cl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %edx - - /* Round 3 */ - rorl $16, %edx - movl 12(%edi), %esi - movb %dh, %al - movb %dl, %bl - rorl $16, %edx - xorl %esi, %ecx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %dh, %al - movb %dl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %ecx - - /* Round 2 */ - rorl $16, %ecx - movl 8(%edi), %esi - movb %ch, %al - movb %cl, %bl - rorl $16, %ecx - xorl %esi, %edx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %ch, %al - movb %cl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %edx - - /* Round 1 */ - rorl $16, %edx - movl 4(%edi), %esi - movb %dh, %al - movb %dl, %bl - rorl $16, %edx - xorl %esi, %ecx - movl 72(%edi,%eax,4),%esi - movl 1096(%edi,%ebx,4),%ebp - movb %dh, %al - movb %dl, %bl - addl %ebp, %esi - movl 2120(%edi,%eax,4),%eax - xorl %eax, %esi - movl 3144(%edi,%ebx,4),%ebp - addl %ebp, %esi - xorl %eax, %eax - xorl %esi, %ecx - xorl (%edi), %edx - movl 20(%esp), %eax - movl %edx, (%eax) - movl %ecx, 4(%eax) - popl %edi - popl %esi - popl %ebx - popl %ebp - ret -.BF_encrypt_end: - SIZE(BF_encrypt,.BF_encrypt_end-BF_encrypt) -.ident "desasm.pl" diff --git a/crypto/bf/asm/win32.asm b/crypto/bf/asm/win32.asm deleted file mode 100644 index 6d2333f323..0000000000 --- a/crypto/bf/asm/win32.asm +++ /dev/null @@ -1,663 +0,0 @@ - ; Don't even think of reading this code - ; It was automatically generated by bf586.pl - ; Which is a perl program used to generate the x86 assember for - ; any of elf, a.out, Win32, or Solaris - ; It can be found in SSLeay 0.7.0+ - ; eric <eay@cryptsoft.com> - ; - TITLE bfx86xxxx.asm - .386 -.model FLAT -_TEXT SEGMENT -PUBLIC _BF_encrypt -EXTRN _des_SPtrans:DWORD -_BF_encrypt PROC NEAR - push ebp - push ebx - push esi - push edi - ; - ; Load the 2 words - mov eax, DWORD PTR 20[esp] - mov ecx, DWORD PTR [eax] - mov edx, DWORD PTR 4[eax] - ; - ; P pointer, s and enc flag - mov edi, DWORD PTR 24[esp] - xor eax, eax - xor ebx, ebx - mov ebp, DWORD PTR 28[esp] - cmp ebp, 0 - je $L000start_decrypt - xor ecx, DWORD PTR [edi] - ; - ; Round 0 - ror ecx, 16 - mov esi, DWORD PTR 4[edi] - mov al, ch - mov bl, cl - ror ecx, 16 - xor edx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, ch - mov bl, cl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor edx, esi - ; - ; Round 1 - ror edx, 16 - mov esi, DWORD PTR 8[edi] - mov al, dh - mov bl, dl - ror edx, 16 - xor ecx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, dh - mov bl, dl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor ecx, esi - ; - ; Round 2 - ror ecx, 16 - mov esi, DWORD PTR 12[edi] - mov al, ch - mov bl, cl - ror ecx, 16 - xor edx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, ch - mov bl, cl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor edx, esi - ; - ; Round 3 - ror edx, 16 - mov esi, DWORD PTR 16[edi] - mov al, dh - mov bl, dl - ror edx, 16 - xor ecx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, dh - mov bl, dl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor ecx, esi - ; - ; Round 4 - ror ecx, 16 - mov esi, DWORD PTR 20[edi] - mov al, ch - mov bl, cl - ror ecx, 16 - xor edx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, ch - mov bl, cl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor edx, esi - ; - ; Round 5 - ror edx, 16 - mov esi, DWORD PTR 24[edi] - mov al, dh - mov bl, dl - ror edx, 16 - xor ecx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, dh - mov bl, dl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor ecx, esi - ; - ; Round 6 - ror ecx, 16 - mov esi, DWORD PTR 28[edi] - mov al, ch - mov bl, cl - ror ecx, 16 - xor edx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, ch - mov bl, cl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor edx, esi - ; - ; Round 7 - ror edx, 16 - mov esi, DWORD PTR 32[edi] - mov al, dh - mov bl, dl - ror edx, 16 - xor ecx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, dh - mov bl, dl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor ecx, esi - ; - ; Round 8 - ror ecx, 16 - mov esi, DWORD PTR 36[edi] - mov al, ch - mov bl, cl - ror ecx, 16 - xor edx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, ch - mov bl, cl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor edx, esi - ; - ; Round 9 - ror edx, 16 - mov esi, DWORD PTR 40[edi] - mov al, dh - mov bl, dl - ror edx, 16 - xor ecx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, dh - mov bl, dl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor ecx, esi - ; - ; Round 10 - ror ecx, 16 - mov esi, DWORD PTR 44[edi] - mov al, ch - mov bl, cl - ror ecx, 16 - xor edx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, ch - mov bl, cl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor edx, esi - ; - ; Round 11 - ror edx, 16 - mov esi, DWORD PTR 48[edi] - mov al, dh - mov bl, dl - ror edx, 16 - xor ecx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, dh - mov bl, dl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor ecx, esi - ; - ; Round 12 - ror ecx, 16 - mov esi, DWORD PTR 52[edi] - mov al, ch - mov bl, cl - ror ecx, 16 - xor edx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, ch - mov bl, cl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor edx, esi - ; - ; Round 13 - ror edx, 16 - mov esi, DWORD PTR 56[edi] - mov al, dh - mov bl, dl - ror edx, 16 - xor ecx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, dh - mov bl, dl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor ecx, esi - ; - ; Round 14 - ror ecx, 16 - mov esi, DWORD PTR 60[edi] - mov al, ch - mov bl, cl - ror ecx, 16 - xor edx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, ch - mov bl, cl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor edx, esi - ; - ; Round 15 - ror edx, 16 - mov esi, DWORD PTR 64[edi] - mov al, dh - mov bl, dl - ror edx, 16 - xor ecx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, dh - mov bl, dl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor ecx, esi - xor edx, DWORD PTR 68[edi] - mov eax, DWORD PTR 20[esp] - mov DWORD PTR [eax],edx - mov DWORD PTR 4[eax],ecx - pop edi - pop esi - pop ebx - pop ebp - ret -$L000start_decrypt: - xor ecx, DWORD PTR 68[edi] - ; - ; Round 16 - ror ecx, 16 - mov esi, DWORD PTR 64[edi] - mov al, ch - mov bl, cl - ror ecx, 16 - xor edx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, ch - mov bl, cl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor edx, esi - ; - ; Round 15 - ror edx, 16 - mov esi, DWORD PTR 60[edi] - mov al, dh - mov bl, dl - ror edx, 16 - xor ecx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, dh - mov bl, dl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor ecx, esi - ; - ; Round 14 - ror ecx, 16 - mov esi, DWORD PTR 56[edi] - mov al, ch - mov bl, cl - ror ecx, 16 - xor edx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, ch - mov bl, cl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor edx, esi - ; - ; Round 13 - ror edx, 16 - mov esi, DWORD PTR 52[edi] - mov al, dh - mov bl, dl - ror edx, 16 - xor ecx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, dh - mov bl, dl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor ecx, esi - ; - ; Round 12 - ror ecx, 16 - mov esi, DWORD PTR 48[edi] - mov al, ch - mov bl, cl - ror ecx, 16 - xor edx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, ch - mov bl, cl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor edx, esi - ; - ; Round 11 - ror edx, 16 - mov esi, DWORD PTR 44[edi] - mov al, dh - mov bl, dl - ror edx, 16 - xor ecx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, dh - mov bl, dl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor ecx, esi - ; - ; Round 10 - ror ecx, 16 - mov esi, DWORD PTR 40[edi] - mov al, ch - mov bl, cl - ror ecx, 16 - xor edx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, ch - mov bl, cl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor edx, esi - ; - ; Round 9 - ror edx, 16 - mov esi, DWORD PTR 36[edi] - mov al, dh - mov bl, dl - ror edx, 16 - xor ecx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, dh - mov bl, dl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor ecx, esi - ; - ; Round 8 - ror ecx, 16 - mov esi, DWORD PTR 32[edi] - mov al, ch - mov bl, cl - ror ecx, 16 - xor edx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, ch - mov bl, cl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor edx, esi - ; - ; Round 7 - ror edx, 16 - mov esi, DWORD PTR 28[edi] - mov al, dh - mov bl, dl - ror edx, 16 - xor ecx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, dh - mov bl, dl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor ecx, esi - ; - ; Round 6 - ror ecx, 16 - mov esi, DWORD PTR 24[edi] - mov al, ch - mov bl, cl - ror ecx, 16 - xor edx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, ch - mov bl, cl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor edx, esi - ; - ; Round 5 - ror edx, 16 - mov esi, DWORD PTR 20[edi] - mov al, dh - mov bl, dl - ror edx, 16 - xor ecx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, dh - mov bl, dl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor ecx, esi - ; - ; Round 4 - ror ecx, 16 - mov esi, DWORD PTR 16[edi] - mov al, ch - mov bl, cl - ror ecx, 16 - xor edx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, ch - mov bl, cl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor edx, esi - ; - ; Round 3 - ror edx, 16 - mov esi, DWORD PTR 12[edi] - mov al, dh - mov bl, dl - ror edx, 16 - xor ecx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, dh - mov bl, dl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor ecx, esi - ; - ; Round 2 - ror ecx, 16 - mov esi, DWORD PTR 8[edi] - mov al, ch - mov bl, cl - ror ecx, 16 - xor edx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, ch - mov bl, cl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor edx, esi - ; - ; Round 1 - ror edx, 16 - mov esi, DWORD PTR 4[edi] - mov al, dh - mov bl, dl - ror edx, 16 - xor ecx, esi - mov esi, DWORD PTR 72[eax*4+edi] - mov ebp, DWORD PTR 1096[ebx*4+edi] - mov al, dh - mov bl, dl - add esi, ebp - mov eax, DWORD PTR 2120[eax*4+edi] - xor esi, eax - mov ebp, DWORD PTR 3144[ebx*4+edi] - add esi, ebp - xor eax, eax - xor ecx, esi - xor edx, DWORD PTR [edi] - mov eax, DWORD PTR 20[esp] - mov DWORD PTR [eax],edx - mov DWORD PTR 4[eax],ecx - pop edi - pop esi - pop ebx - pop ebp - ret -_BF_encrypt ENDP -_TEXT ENDS -END diff --git a/crypto/bf/bf_locl b/crypto/bf/bf_locl deleted file mode 100644 index abc23d7060..0000000000 --- a/crypto/bf/bf_locl +++ /dev/null @@ -1,243 +0,0 @@ -/* crypto/bf/bf_local.h */ -/* Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@mincom.oz.au). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@mincom.oz.au). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@mincom.oz.au)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@mincom.oz.au)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ -/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING - * - * Always modify bf_locl.org since bf_locl.h is automatically generated from - * it during SSLeay configuration. - * - * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING - */ - -/* Special defines which change the way the code is built depending on the - CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find - even newer MIPS CPU's, but at the moment one size fits all for - optimization options. Older Sparc's work better with only UNROLL, but - there's no way to tell at compile time what it is you're running on */ - -#if defined( sun ) /* Newer Sparc's */ -# define BF_PTR -#elif defined( __ultrix ) /* Older MIPS */ -# define BF_PTR -#elif defined( __osf1__ ) /* Alpha */ - /* None */ -#elif defined ( _AIX ) /* RS6000 */ - /* Unknown */ -#elif defined( __hpux ) /* HP-PA */ - /* None */ -#elif defined( __aux ) /* 68K */ - /* Unknown */ -#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ - /* Unknown */ -#elif defined( __sgi ) /* Newer MIPS */ -# define BF_PTR -#elif defined( i386 ) /* x86 boxes, should be gcc */ -# define BF_PTR2 -#elif defined( _MSC_VER ) /* x86 boxes, Visual C */ -# define BF_PTR2 -#endif /* Systems-specific speed defines */ - -#undef c2l -#define c2l(c,l) (l =((unsigned long)(*((c)++))) , \ - l|=((unsigned long)(*((c)++)))<< 8L, \ - l|=((unsigned long)(*((c)++)))<<16L, \ - l|=((unsigned long)(*((c)++)))<<24L) - -/* NOTE - c is not incremented as per c2l */ -#undef c2ln -#define c2ln(c,l1,l2,n) { \ - c+=n; \ - l1=l2=0; \ - switch (n) { \ - case 8: l2 =((unsigned long)(*(--(c))))<<24L; \ - case 7: l2|=((unsigned long)(*(--(c))))<<16L; \ - case 6: l2|=((unsigned long)(*(--(c))))<< 8L; \ - case 5: l2|=((unsigned long)(*(--(c)))); \ - case 4: l1 =((unsigned long)(*(--(c))))<<24L; \ - case 3: l1|=((unsigned long)(*(--(c))))<<16L; \ - case 2: l1|=((unsigned long)(*(--(c))))<< 8L; \ - case 1: l1|=((unsigned long)(*(--(c)))); \ - } \ - } - -#undef l2c -#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ - *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>24L)&0xff)) - -/* NOTE - c is not incremented as per l2c */ -#undef l2cn -#define l2cn(l1,l2,c,n) { \ - c+=n; \ - switch (n) { \ - case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ - case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ - case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ - case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ - case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ - case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ - case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ - case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ - } \ - } - -/* NOTE - c is not incremented as per n2l */ -#define n2ln(c,l1,l2,n) { \ - c+=n; \ - l1=l2=0; \ - switch (n) { \ - case 8: l2 =((unsigned long)(*(--(c)))) ; \ - case 7: l2|=((unsigned long)(*(--(c))))<< 8; \ - case 6: l2|=((unsigned long)(*(--(c))))<<16; \ - case 5: l2|=((unsigned long)(*(--(c))))<<24; \ - case 4: l1 =((unsigned long)(*(--(c)))) ; \ - case 3: l1|=((unsigned long)(*(--(c))))<< 8; \ - case 2: l1|=((unsigned long)(*(--(c))))<<16; \ - case 1: l1|=((unsigned long)(*(--(c))))<<24; \ - } \ - } - -/* NOTE - c is not incremented as per l2n */ -#define l2nn(l1,l2,c,n) { \ - c+=n; \ - switch (n) { \ - case 8: *(--(c))=(unsigned char)(((l2) )&0xff); \ - case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \ - case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \ - case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \ - case 4: *(--(c))=(unsigned char)(((l1) )&0xff); \ - case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \ - case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \ - case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \ - } \ - } - -#undef n2l -#define n2l(c,l) (l =((unsigned long)(*((c)++)))<<24L, \ - l|=((unsigned long)(*((c)++)))<<16L, \ - l|=((unsigned long)(*((c)++)))<< 8L, \ - l|=((unsigned long)(*((c)++)))) - -#undef l2n -#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ - *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ - *((c)++)=(unsigned char)(((l) )&0xff)) - -/* This is actually a big endian algorithm, the most significate byte - * is used to lookup array 0 */ - -/* use BF_PTR2 for intel boxes, - * BF_PTR for sparc and MIPS/SGI - * use nothing for Alpha and HP. - */ -#if !defined(BF_PTR) && !defined(BF_PTR2) -#undef BF_PTR -#endif - -#define BF_M 0x3fc -#define BF_0 22L -#define BF_1 14L -#define BF_2 6L -#define BF_3 2L /* left shift */ - -#if defined(BF_PTR2) - -/* This is basically a special pentium verson */ -#define BF_ENC(LL,R,S,P) \ - { \ - BF_LONG t,u,v; \ - u=R>>BF_0; \ - v=R>>BF_1; \ - u&=BF_M; \ - v&=BF_M; \ - t= *(BF_LONG *)((unsigned char *)&(S[ 0])+u); \ - u=R>>BF_2; \ - t+= *(BF_LONG *)((unsigned char *)&(S[256])+v); \ - v=R<<BF_3; \ - u&=BF_M; \ - v&=BF_M; \ - t^= *(BF_LONG *)((unsigned char *)&(S[512])+u); \ - LL^=P; \ - t+= *(BF_LONG *)((unsigned char *)&(S[768])+v); \ - LL^=t; \ - } - -#elif defined(BF_PTR) - -/* This is normally very good */ - -#define BF_ENC(LL,R,S,P) \ - LL^=P; \ - LL^= (((*(BF_LONG *)((unsigned char *)&(S[ 0])+((R>>BF_0)&BF_M))+ \ - *(BF_LONG *)((unsigned char *)&(S[256])+((R>>BF_1)&BF_M)))^ \ - *(BF_LONG *)((unsigned char *)&(S[512])+((R>>BF_2)&BF_M)))+ \ - *(BF_LONG *)((unsigned char *)&(S[768])+((R<<BF_3)&BF_M))); -#else - -/* This will always work, even on 64 bit machines and strangly enough, - * on the Alpha it is faster than the pointer versions (both 32 and 64 - * versions of BF_LONG) */ - -#define BF_ENC(LL,R,S,P) \ - LL^=P; \ - LL^=((( S[ (int)(R>>24L) ] + \ - S[0x0100+((int)(R>>16L)&0xff)])^ \ - S[0x0200+((int)(R>> 8L)&0xff)])+ \ - S[0x0300+((int)(R )&0xff)])&0xffffffffL; -#endif |