aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/des/asm/d-win32.asm
diff options
context:
space:
mode:
authorRalf S. Engelschall <rse@openssl.org>1998-12-21 10:56:39 +0000
committerRalf S. Engelschall <rse@openssl.org>1998-12-21 10:56:39 +0000
commit58964a492275ca9a59a0cd9c8155cb2491b4b909 (patch)
treec7b16876a5789463bbbb468ef4829c8129b3d718 /crypto/des/asm/d-win32.asm
parentd02b48c63a58ea4367a0e905979f140b7d090f86 (diff)
downloadopenssl-58964a492275ca9a59a0cd9c8155cb2491b4b909.tar.gz
Import of old SSLeay release: SSLeay 0.9.0b
Diffstat (limited to 'crypto/des/asm/d-win32.asm')
-rw-r--r--crypto/des/asm/d-win32.asm475
1 files changed, 421 insertions, 54 deletions
diff --git a/crypto/des/asm/d-win32.asm b/crypto/des/asm/d-win32.asm
index fc62e3b785..9e3dc9cd87 100644
--- a/crypto/des/asm/d-win32.asm
+++ b/crypto/des/asm/d-win32.asm
@@ -1,27 +1,24 @@
; Don't even think of reading this code
- ; It was automatically generated by des-som3.pl
+ ; It was automatically generated by des-586.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.6.5+ or in libdes 3.26+
+ ; any of elf, a.out, BSDI,Win32, or Solaris
; eric <eay@cryptsoft.com>
- ; The inner loop instruction sequence and the IP/FP modifications
- ; are from Svend Olaf Mikkelsen <svolaf@inet.uni-c.dk>
;
- TITLE dx86xxxx.asm
+ TITLE des-586.asm
.386
.model FLAT
_TEXT SEGMENT
PUBLIC _des_encrypt
-EXTRN _des_SPtrans:DWORD
+EXTRN _des_SPtrans:DWORD
_des_encrypt PROC NEAR
- push ebp
- push ebx
push esi
push edi
;
; Load the 2 words
- mov esi, DWORD PTR 20[esp]
+ mov esi, DWORD PTR 12[esp]
xor ecx, ecx
+ push ebx
+ push ebp
mov eax, DWORD PTR [esi]
mov ebx, DWORD PTR 28[esp]
mov edi, DWORD PTR 4[esi]
@@ -63,8 +60,8 @@ _des_encrypt PROC NEAR
xor edi, eax
;
rol edi, 1
- cmp ebx, 0
mov ebp, DWORD PTR 24[esp]
+ cmp ebx, 0
je $L000start_decrypt
;
; Round 0
@@ -1294,32 +1291,32 @@ $L001end:
ror eax, 4
mov DWORD PTR [edx],eax
mov DWORD PTR 4[edx],esi
+ pop ebp
+ pop ebx
pop edi
pop esi
- pop ebx
- pop ebp
ret
_des_encrypt ENDP
_TEXT ENDS
_TEXT SEGMENT
PUBLIC _des_encrypt2
-EXTRN _des_SPtrans:DWORD
+EXTRN _des_SPtrans:DWORD
_des_encrypt2 PROC NEAR
- push ebp
- push ebx
push esi
push edi
;
; Load the 2 words
- mov eax, DWORD PTR 20[esp]
+ mov eax, DWORD PTR 12[esp]
xor ecx, ecx
+ push ebx
+ push ebp
mov esi, DWORD PTR [eax]
mov ebx, DWORD PTR 28[esp]
rol esi, 3
mov edi, DWORD PTR 4[eax]
rol edi, 3
- cmp ebx, 0
mov ebp, DWORD PTR 24[esp]
+ cmp ebx, 0
je $L002start_decrypt
;
; Round 0
@@ -2515,26 +2512,27 @@ $L003end:
ror esi, 3
mov DWORD PTR [eax],edi
mov DWORD PTR 4[eax],esi
+ pop ebp
+ pop ebx
pop edi
pop esi
- pop ebx
- pop ebp
ret
_des_encrypt2 ENDP
_TEXT ENDS
_TEXT SEGMENT
PUBLIC _des_encrypt3
-EXTRN _des_SPtrans:DWORD
+
_des_encrypt3 PROC NEAR
- push ebp
push ebx
+ mov ebx, DWORD PTR 8[esp]
+ push ebp
push esi
push edi
;
; Load the data words
- mov ebx, DWORD PTR 20[esp]
mov edi, DWORD PTR [ebx]
mov esi, DWORD PTR 4[ebx]
+ sub esp, 12
;
; IP
rol edi, 4
@@ -2575,24 +2573,24 @@ _des_encrypt3 PROC NEAR
ror edx, 3
ror esi, 2
mov DWORD PTR 4[ebx],esi
- mov eax, DWORD PTR 24[esp]
+ mov eax, DWORD PTR 36[esp]
mov DWORD PTR [ebx],edx
- mov edi, DWORD PTR 28[esp]
- mov esi, DWORD PTR 32[esp]
- push 1
- push eax
- push ebx
+ mov edi, DWORD PTR 40[esp]
+ mov esi, DWORD PTR 44[esp]
+ mov DWORD PTR 8[esp],1
+ mov DWORD PTR 4[esp],eax
+ mov DWORD PTR [esp],ebx
call _des_encrypt2
- push 0
- push edi
- push ebx
+ mov DWORD PTR 8[esp],0
+ mov DWORD PTR 4[esp],edi
+ mov DWORD PTR [esp],ebx
call _des_encrypt2
- push 1
- push esi
- push ebx
+ mov DWORD PTR 8[esp],1
+ mov DWORD PTR 4[esp],esi
+ mov DWORD PTR [esp],ebx
call _des_encrypt2
+ add esp, 12
mov edi, DWORD PTR [ebx]
- add esp, 36
mov esi, DWORD PTR 4[ebx]
;
; FP
@@ -2637,24 +2635,25 @@ _des_encrypt3 PROC NEAR
mov DWORD PTR 4[ebx],esi
pop edi
pop esi
- pop ebx
pop ebp
+ pop ebx
ret
_des_encrypt3 ENDP
_TEXT ENDS
_TEXT SEGMENT
PUBLIC _des_decrypt3
-EXTRN _des_SPtrans:DWORD
+
_des_decrypt3 PROC NEAR
- push ebp
push ebx
+ mov ebx, DWORD PTR 8[esp]
+ push ebp
push esi
push edi
;
; Load the data words
- mov ebx, DWORD PTR 20[esp]
mov edi, DWORD PTR [ebx]
mov esi, DWORD PTR 4[ebx]
+ sub esp, 12
;
; IP
rol edi, 4
@@ -2695,24 +2694,24 @@ _des_decrypt3 PROC NEAR
ror edx, 3
ror esi, 2
mov DWORD PTR 4[ebx],esi
- mov esi, DWORD PTR 24[esp]
+ mov esi, DWORD PTR 36[esp]
mov DWORD PTR [ebx],edx
- mov edi, DWORD PTR 28[esp]
- mov eax, DWORD PTR 32[esp]
- push 0
- push eax
- push ebx
+ mov edi, DWORD PTR 40[esp]
+ mov eax, DWORD PTR 44[esp]
+ mov DWORD PTR 8[esp],0
+ mov DWORD PTR 4[esp],eax
+ mov DWORD PTR [esp],ebx
call _des_encrypt2
- push 1
- push edi
- push ebx
+ mov DWORD PTR 8[esp],1
+ mov DWORD PTR 4[esp],edi
+ mov DWORD PTR [esp],ebx
call _des_encrypt2
- push 0
- push esi
- push ebx
+ mov DWORD PTR 8[esp],0
+ mov DWORD PTR 4[esp],esi
+ mov DWORD PTR [esp],ebx
call _des_encrypt2
+ add esp, 12
mov edi, DWORD PTR [ebx]
- add esp, 36
mov esi, DWORD PTR 4[ebx]
;
; FP
@@ -2757,9 +2756,377 @@ _des_decrypt3 PROC NEAR
mov DWORD PTR 4[ebx],esi
pop edi
pop esi
- pop ebx
pop ebp
+ pop ebx
ret
_des_decrypt3 ENDP
_TEXT ENDS
+_TEXT SEGMENT
+PUBLIC _des_ncbc_encrypt
+
+_des_ncbc_encrypt PROC NEAR
+ ;
+ push ebp
+ push ebx
+ push esi
+ push edi
+ mov ebp, DWORD PTR 28[esp]
+ ; getting iv ptr from parameter 4
+ mov ebx, DWORD PTR 36[esp]
+ mov esi, DWORD PTR [ebx]
+ mov edi, DWORD PTR 4[ebx]
+ push edi
+ push esi
+ push edi
+ push esi
+ mov ebx, esp
+ mov esi, DWORD PTR 36[esp]
+ mov edi, DWORD PTR 40[esp]
+ ; getting encrypt flag from parameter 5
+ mov ecx, DWORD PTR 56[esp]
+ ; get and push parameter 5
+ push ecx
+ ; get and push parameter 3
+ mov eax, DWORD PTR 52[esp]
+ push eax
+ push ebx
+ cmp ecx, 0
+ jz $L004decrypt
+ and ebp, 4294967288
+ mov eax, DWORD PTR 12[esp]
+ mov ebx, DWORD PTR 16[esp]
+ jz $L005encrypt_finish
+L006encrypt_loop:
+ mov ecx, DWORD PTR [esi]
+ mov edx, DWORD PTR 4[esi]
+ xor eax, ecx
+ xor ebx, edx
+ mov DWORD PTR 12[esp],eax
+ mov DWORD PTR 16[esp],ebx
+ call _des_encrypt
+ mov eax, DWORD PTR 12[esp]
+ mov ebx, DWORD PTR 16[esp]
+ mov DWORD PTR [edi],eax
+ mov DWORD PTR 4[edi],ebx
+ add esi, 8
+ add edi, 8
+ sub ebp, 8
+ jnz L006encrypt_loop
+$L005encrypt_finish:
+ mov ebp, DWORD PTR 56[esp]
+ and ebp, 7
+ jz $L007finish
+ xor ecx, ecx
+ xor edx, edx
+ mov ebp, DWORD PTR $L008cbc_enc_jmp_table[ebp*4]
+ jmp ebp
+L009ej7:
+ mov dh, BYTE PTR 6[esi]
+ shl edx, 8
+L010ej6:
+ mov dh, BYTE PTR 5[esi]
+L011ej5:
+ mov dl, BYTE PTR 4[esi]
+L012ej4:
+ mov ecx, DWORD PTR [esi]
+ jmp $L013ejend
+L014ej3:
+ mov ch, BYTE PTR 2[esi]
+ shl ecx, 8
+L015ej2:
+ mov ch, BYTE PTR 1[esi]
+L016ej1:
+ mov cl, BYTE PTR [esi]
+$L013ejend:
+ xor eax, ecx
+ xor ebx, edx
+ mov DWORD PTR 12[esp],eax
+ mov DWORD PTR 16[esp],ebx
+ call _des_encrypt
+ mov eax, DWORD PTR 12[esp]
+ mov ebx, DWORD PTR 16[esp]
+ mov DWORD PTR [edi],eax
+ mov DWORD PTR 4[edi],ebx
+ jmp $L007finish
+$L004decrypt:
+ and ebp, 4294967288
+ mov eax, DWORD PTR 20[esp]
+ mov ebx, DWORD PTR 24[esp]
+ jz $L017decrypt_finish
+L018decrypt_loop:
+ mov eax, DWORD PTR [esi]
+ mov ebx, DWORD PTR 4[esi]
+ mov DWORD PTR 12[esp],eax
+ mov DWORD PTR 16[esp],ebx
+ call _des_encrypt
+ mov eax, DWORD PTR 12[esp]
+ mov ebx, DWORD PTR 16[esp]
+ mov ecx, DWORD PTR 20[esp]
+ mov edx, DWORD PTR 24[esp]
+ xor ecx, eax
+ xor edx, ebx
+ mov eax, DWORD PTR [esi]
+ mov ebx, DWORD PTR 4[esi]
+ mov DWORD PTR [edi],ecx
+ mov DWORD PTR 4[edi],edx
+ mov DWORD PTR 20[esp],eax
+ mov DWORD PTR 24[esp],ebx
+ add esi, 8
+ add edi, 8
+ sub ebp, 8
+ jnz L018decrypt_loop
+$L017decrypt_finish:
+ mov ebp, DWORD PTR 56[esp]
+ and ebp, 7
+ jz $L007finish
+ mov eax, DWORD PTR [esi]
+ mov ebx, DWORD PTR 4[esi]
+ mov DWORD PTR 12[esp],eax
+ mov DWORD PTR 16[esp],ebx
+ call _des_encrypt
+ mov eax, DWORD PTR 12[esp]
+ mov ebx, DWORD PTR 16[esp]
+ mov ecx, DWORD PTR 20[esp]
+ mov edx, DWORD PTR 24[esp]
+ xor ecx, eax
+ xor edx, ebx
+ mov eax, DWORD PTR [esi]
+ mov ebx, DWORD PTR 4[esi]
+L019dj7:
+ ror edx, 16
+ mov BYTE PTR 6[edi],dl
+ shr edx, 16
+L020dj6:
+ mov BYTE PTR 5[edi],dh
+L021dj5:
+ mov BYTE PTR 4[edi],dl
+L022dj4:
+ mov DWORD PTR [edi],ecx
+ jmp $L023djend
+L024dj3:
+ ror ecx, 16
+ mov BYTE PTR 2[edi],cl
+ shl ecx, 16
+L025dj2:
+ mov BYTE PTR 1[esi],ch
+L026dj1:
+ mov BYTE PTR [esi], cl
+$L023djend:
+ jmp $L007finish
+$L007finish:
+ mov ecx, DWORD PTR 64[esp]
+ add esp, 28
+ mov DWORD PTR [ecx],eax
+ mov DWORD PTR 4[ecx],ebx
+ pop edi
+ pop esi
+ pop ebx
+ pop ebp
+ ret
+$L008cbc_enc_jmp_table:
+ DD 0
+ DD L016ej1
+ DD L015ej2
+ DD L014ej3
+ DD L012ej4
+ DD L011ej5
+ DD L010ej6
+ DD L009ej7
+L027cbc_dec_jmp_table:
+ DD 0
+ DD L026dj1
+ DD L025dj2
+ DD L024dj3
+ DD L022dj4
+ DD L021dj5
+ DD L020dj6
+ DD L019dj7
+_des_ncbc_encrypt ENDP
+_TEXT ENDS
+_TEXT SEGMENT
+PUBLIC _des_ede3_cbc_encrypt
+
+_des_ede3_cbc_encrypt PROC NEAR
+ ;
+ push ebp
+ push ebx
+ push esi
+ push edi
+ mov ebp, DWORD PTR 28[esp]
+ ; getting iv ptr from parameter 6
+ mov ebx, DWORD PTR 44[esp]
+ mov esi, DWORD PTR [ebx]
+ mov edi, DWORD PTR 4[ebx]
+ push edi
+ push esi
+ push edi
+ push esi
+ mov ebx, esp
+ mov esi, DWORD PTR 36[esp]
+ mov edi, DWORD PTR 40[esp]
+ ; getting encrypt flag from parameter 7
+ mov ecx, DWORD PTR 64[esp]
+ ; get and push parameter 5
+ mov eax, DWORD PTR 56[esp]
+ push eax
+ ; get and push parameter 4
+ mov eax, DWORD PTR 56[esp]
+ push eax
+ ; get and push parameter 3
+ mov eax, DWORD PTR 56[esp]
+ push eax
+ push ebx
+ cmp ecx, 0
+ jz $L028decrypt
+ and ebp, 4294967288
+ mov eax, DWORD PTR 16[esp]
+ mov ebx, DWORD PTR 20[esp]
+ jz $L029encrypt_finish
+L030encrypt_loop:
+ mov ecx, DWORD PTR [esi]
+ mov edx, DWORD PTR 4[esi]
+ xor eax, ecx
+ xor ebx, edx
+ mov DWORD PTR 16[esp],eax
+ mov DWORD PTR 20[esp],ebx
+ call _des_encrypt3
+ mov eax, DWORD PTR 16[esp]
+ mov ebx, DWORD PTR 20[esp]
+ mov DWORD PTR [edi],eax
+ mov DWORD PTR 4[edi],ebx
+ add esi, 8
+ add edi, 8
+ sub ebp, 8
+ jnz L030encrypt_loop
+$L029encrypt_finish:
+ mov ebp, DWORD PTR 60[esp]
+ and ebp, 7
+ jz $L031finish
+ xor ecx, ecx
+ xor edx, edx
+ mov ebp, DWORD PTR $L032cbc_enc_jmp_table[ebp*4]
+ jmp ebp
+L033ej7:
+ mov dh, BYTE PTR 6[esi]
+ shl edx, 8
+L034ej6:
+ mov dh, BYTE PTR 5[esi]
+L035ej5:
+ mov dl, BYTE PTR 4[esi]
+L036ej4:
+ mov ecx, DWORD PTR [esi]
+ jmp $L037ejend
+L038ej3:
+ mov ch, BYTE PTR 2[esi]
+ shl ecx, 8
+L039ej2:
+ mov ch, BYTE PTR 1[esi]
+L040ej1:
+ mov cl, BYTE PTR [esi]
+$L037ejend:
+ xor eax, ecx
+ xor ebx, edx
+ mov DWORD PTR 16[esp],eax
+ mov DWORD PTR 20[esp],ebx
+ call _des_encrypt3
+ mov eax, DWORD PTR 16[esp]
+ mov ebx, DWORD PTR 20[esp]
+ mov DWORD PTR [edi],eax
+ mov DWORD PTR 4[edi],ebx
+ jmp $L031finish
+$L028decrypt:
+ and ebp, 4294967288
+ mov eax, DWORD PTR 24[esp]
+ mov ebx, DWORD PTR 28[esp]
+ jz $L041decrypt_finish
+L042decrypt_loop:
+ mov eax, DWORD PTR [esi]
+ mov ebx, DWORD PTR 4[esi]
+ mov DWORD PTR 16[esp],eax
+ mov DWORD PTR 20[esp],ebx
+ call _des_decrypt3
+ mov eax, DWORD PTR 16[esp]
+ mov ebx, DWORD PTR 20[esp]
+ mov ecx, DWORD PTR 24[esp]
+ mov edx, DWORD PTR 28[esp]
+ xor ecx, eax
+ xor edx, ebx
+ mov eax, DWORD PTR [esi]
+ mov ebx, DWORD PTR 4[esi]
+ mov DWORD PTR [edi],ecx
+ mov DWORD PTR 4[edi],edx
+ mov DWORD PTR 24[esp],eax
+ mov DWORD PTR 28[esp],ebx
+ add esi, 8
+ add edi, 8
+ sub ebp, 8
+ jnz L042decrypt_loop
+$L041decrypt_finish:
+ mov ebp, DWORD PTR 60[esp]
+ and ebp, 7
+ jz $L031finish
+ mov eax, DWORD PTR [esi]
+ mov ebx, DWORD PTR 4[esi]
+ mov DWORD PTR 16[esp],eax
+ mov DWORD PTR 20[esp],ebx
+ call _des_decrypt3
+ mov eax, DWORD PTR 16[esp]
+ mov ebx, DWORD PTR 20[esp]
+ mov ecx, DWORD PTR 24[esp]
+ mov edx, DWORD PTR 28[esp]
+ xor ecx, eax
+ xor edx, ebx
+ mov eax, DWORD PTR [esi]
+ mov ebx, DWORD PTR 4[esi]
+L043dj7:
+ ror edx, 16
+ mov BYTE PTR 6[edi],dl
+ shr edx, 16
+L044dj6:
+ mov BYTE PTR 5[edi],dh
+L045dj5:
+ mov BYTE PTR 4[edi],dl
+L046dj4:
+ mov DWORD PTR [edi],ecx
+ jmp $L047djend
+L048dj3:
+ ror ecx, 16
+ mov BYTE PTR 2[edi],cl
+ shl ecx, 16
+L049dj2:
+ mov BYTE PTR 1[esi],ch
+L050dj1:
+ mov BYTE PTR [esi], cl
+$L047djend:
+ jmp $L031finish
+$L031finish:
+ mov ecx, DWORD PTR 76[esp]
+ add esp, 32
+ mov DWORD PTR [ecx],eax
+ mov DWORD PTR 4[ecx],ebx
+ pop edi
+ pop esi
+ pop ebx
+ pop ebp
+ ret
+$L032cbc_enc_jmp_table:
+ DD 0
+ DD L040ej1
+ DD L039ej2
+ DD L038ej3
+ DD L036ej4
+ DD L035ej5
+ DD L034ej6
+ DD L033ej7
+L051cbc_dec_jmp_table:
+ DD 0
+ DD L050dj1
+ DD L049dj2
+ DD L048dj3
+ DD L046dj4
+ DD L045dj5
+ DD L044dj6
+ DD L043dj7
+_des_ede3_cbc_encrypt ENDP
+_TEXT ENDS
END