diff options
Diffstat (limited to 'crypto/bf/asm/b-win32.asm')
-rw-r--r-- | crypto/bf/asm/b-win32.asm | 1568 |
1 files changed, 906 insertions, 662 deletions
diff --git a/crypto/bf/asm/b-win32.asm b/crypto/bf/asm/b-win32.asm index bef272eebb..138c99d0aa 100644 --- a/crypto/bf/asm/b-win32.asm +++ b/crypto/bf/asm/b-win32.asm @@ -1,662 +1,906 @@ - ; 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
-_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
+ ; Don't even think of reading this code + ; It was automatically generated by bf-586.pl + ; Which is a perl program used to generate the x86 assember for + ; any of elf, a.out, BSDI,Win32, or Solaris + ; eric <eay@cryptsoft.com> + ; + TITLE bf-586.asm + .486 +.model FLAT +_TEXT SEGMENT +PUBLIC _BF_encrypt + +_BF_encrypt PROC NEAR + ; + push ebp + push ebx + mov ebx, DWORD PTR 12[esp] + mov ebp, DWORD PTR 16[esp] + push esi + push edi + ; Load the 2 words + mov edi, DWORD PTR [ebx] + mov esi, DWORD PTR 4[ebx] + xor eax, eax + mov ebx, DWORD PTR [ebp] + xor ecx, ecx + xor edi, ebx + ; + ; Round 0 + mov edx, DWORD PTR 4[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 1 + mov edx, DWORD PTR 8[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 2 + mov edx, DWORD PTR 12[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 3 + mov edx, DWORD PTR 16[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 4 + mov edx, DWORD PTR 20[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 5 + mov edx, DWORD PTR 24[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 6 + mov edx, DWORD PTR 28[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 7 + mov edx, DWORD PTR 32[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 8 + mov edx, DWORD PTR 36[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 9 + mov edx, DWORD PTR 40[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 10 + mov edx, DWORD PTR 44[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 11 + mov edx, DWORD PTR 48[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 12 + mov edx, DWORD PTR 52[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 13 + mov edx, DWORD PTR 56[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 14 + mov edx, DWORD PTR 60[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 15 + mov edx, DWORD PTR 64[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + ; Load parameter 0 (16) enc=1 + mov eax, DWORD PTR 20[esp] + xor edi, ebx + mov edx, DWORD PTR 68[ebp] + xor esi, edx + mov DWORD PTR 4[eax],edi + mov DWORD PTR [eax],esi + pop edi + pop esi + pop ebx + pop ebp + ret +_BF_encrypt ENDP +_TEXT ENDS +_TEXT SEGMENT +PUBLIC _BF_decrypt + +_BF_decrypt PROC NEAR + ; + push ebp + push ebx + mov ebx, DWORD PTR 12[esp] + mov ebp, DWORD PTR 16[esp] + push esi + push edi + ; Load the 2 words + mov edi, DWORD PTR [ebx] + mov esi, DWORD PTR 4[ebx] + xor eax, eax + mov ebx, DWORD PTR 68[ebp] + xor ecx, ecx + xor edi, ebx + ; + ; Round 16 + mov edx, DWORD PTR 64[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 15 + mov edx, DWORD PTR 60[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 14 + mov edx, DWORD PTR 56[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 13 + mov edx, DWORD PTR 52[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 12 + mov edx, DWORD PTR 48[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 11 + mov edx, DWORD PTR 44[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 10 + mov edx, DWORD PTR 40[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 9 + mov edx, DWORD PTR 36[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 8 + mov edx, DWORD PTR 32[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 7 + mov edx, DWORD PTR 28[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 6 + mov edx, DWORD PTR 24[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 5 + mov edx, DWORD PTR 20[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 4 + mov edx, DWORD PTR 16[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 3 + mov edx, DWORD PTR 12[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor edi, ebx + ; + ; Round 2 + mov edx, DWORD PTR 8[ebp] + mov ebx, edi + xor esi, edx + shr ebx, 16 + mov edx, edi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PTR 2120[ecx*4+ebp] + xor ebx, eax + mov edx, DWORD PTR 3144[edx*4+ebp] + add ebx, edx + xor eax, eax + xor esi, ebx + ; + ; Round 1 + mov edx, DWORD PTR 4[ebp] + mov ebx, esi + xor edi, edx + shr ebx, 16 + mov edx, esi + mov al, bh + and ebx, 255 + mov cl, dh + and edx, 255 + mov eax, DWORD PTR 72[eax*4+ebp] + mov ebx, DWORD PTR 1096[ebx*4+ebp] + add ebx, eax + mov eax, DWORD PT |