diff options
author | ryker <> | 1998-10-05 20:13:16 +0000 |
---|---|---|
committer | ryker <> | 1998-10-05 20:13:16 +0000 |
commit | 9e43e2ac1373d5be5c6500c1bc3b1dd6ee9584b4 (patch) | |
tree | 51ff319f3510104698e541954d10ad98f9125f36 /src/lib/libcrypto/des | |
parent | 9e77c62555877f9a64805c49d0dcd7dbfbb40f4e (diff) | |
download | openbsd-9e43e2ac1373d5be5c6500c1bc3b1dd6ee9584b4.tar.gz openbsd-9e43e2ac1373d5be5c6500c1bc3b1dd6ee9584b4.tar.bz2 openbsd-9e43e2ac1373d5be5c6500c1bc3b1dd6ee9584b4.zip |
Import of SSLeay-0.9.0b with RSA and IDEA stubbed + OpenBSD build
functionality for shared libs.
Note that routines such as sslv2_init and friends that use RSA will
not work due to lack of RSA in this library.
Needs documentation and help from ports for easy upgrade to full
functionality where legally possible.
Diffstat (limited to 'src/lib/libcrypto/des')
27 files changed, 12320 insertions, 0 deletions
diff --git a/src/lib/libcrypto/des/DES.pod b/src/lib/libcrypto/des/DES.pod new file mode 100644 index 0000000000..8a739e7ca0 --- /dev/null +++ b/src/lib/libcrypto/des/DES.pod | |||
@@ -0,0 +1,16 @@ | |||
1 | crypt <= crypt(buf,salt) | ||
2 | key <= set_odd_parity(key) | ||
3 | int <= is_weak_key(key) | ||
4 | keysched<= set_key(key) | ||
5 | key <= ecb_encrypt(string8,ks,enc) | ||
6 | key <= ecb3_encrypt(input,ks1,ks2,enc) | ||
7 | string <= cbc_encrypt(input,ks,ivec,enc) => ivec | ||
8 | string <= cbc3_encrypt(input,ks1,ks2,ivec1,ivec2,enc) => ivec1&ivec2 | ||
9 | ck1,ck2 <= cbc_cksum(input,ks,ivec) => ivec | ||
10 | string <= pcbc_encrypt(input,ks,ivec,enc) => ivec | ||
11 | string <= ofb_encrypt(input,numbits,ks,ivec) => ivec | ||
12 | string <= cfb_encrypt(input,numbits,ks,ivec,enc) => ivec | ||
13 | key <= random_key() | ||
14 | key <= string_to_key(string) | ||
15 | key1,key2<= string_to_2keys(string) | ||
16 | |||
diff --git a/src/lib/libcrypto/des/MODES.DES b/src/lib/libcrypto/des/MODES.DES new file mode 100644 index 0000000000..0cbc44f51d --- /dev/null +++ b/src/lib/libcrypto/des/MODES.DES | |||
@@ -0,0 +1,84 @@ | |||
1 | Modes of DES | ||
2 | Quite a bit of the following information has been taken from | ||
3 | AS 2805.5.2 | ||
4 | Australian Standard | ||
5 | Electronic funds transfer - Requirements for interfaces, | ||
6 | Part 5.2: Modes of operation for an n-bit block cipher algorithm | ||
7 | Appendix A | ||
8 | |||
9 | There are several different modes in which DES can be used, they are | ||
10 | as follows. | ||
11 | |||
12 | Electronic Codebook Mode (ECB) (des_ecb_encrypt()) | ||
13 | - 64 bits are enciphered at a time. | ||
14 | - The order of the blocks can be rearranged without detection. | ||
15 | - The same plaintext block always produces the same ciphertext block | ||
16 | (for the same key) making it vulnerable to a 'dictionary attack'. | ||
17 | - An error will only affect one ciphertext block. | ||
18 | |||
19 | Cipher Block Chaining Mode (CBC) (des_cbc_encrypt()) | ||
20 | - a multiple of 64 bits are enciphered at a time. | ||
21 | - The CBC mode produces the same ciphertext whenever the same | ||
22 | plaintext is encrypted using the same key and starting variable. | ||
23 | - The chaining operation makes the ciphertext blocks dependent on the | ||
24 | current and all preceding plaintext blocks and therefore blocks can not | ||
25 | be rearranged. | ||
26 | - The use of different starting variables prevents the same plaintext | ||
27 | enciphering to the same ciphertext. | ||
28 | - An error will affect the current and the following ciphertext blocks. | ||
29 | |||
30 | Cipher Feedback Mode (CFB) (des_cfb_encrypt()) | ||
31 | - a number of bits (j) <= 64 are enciphered at a time. | ||
32 | - The CFB mode produces the same ciphertext whenever the same | ||
33 | plaintext is encrypted using the same key and starting variable. | ||
34 | - The chaining operation makes the ciphertext variables dependent on the | ||
35 | current and all preceding variables and therefore j-bit variables are | ||
36 | chained together and con not be rearranged. | ||
37 | - The use of different starting variables prevents the same plaintext | ||
38 | enciphering to the same ciphertext. | ||
39 | - The strength of the CFB mode depends on the size of k (maximal if | ||
40 | j == k). In my implementation this is always the case. | ||
41 | - Selection of a small value for j will require more cycles through | ||
42 | the encipherment algorithm per unit of plaintext and thus cause | ||
43 | greater processing overheads. | ||
44 | - Only multiples of j bits can be enciphered. | ||
45 | - An error will affect the current and the following ciphertext variables. | ||
46 | |||
47 | Output Feedback Mode (OFB) (des_ofb_encrypt()) | ||
48 | - a number of bits (j) <= 64 are enciphered at a time. | ||
49 | - The OFB mode produces the same ciphertext whenever the same | ||
50 | plaintext enciphered using the same key and starting variable. More | ||
51 | over, in the OFB mode the same key stream is produced when the same | ||
52 | key and start variable are used. Consequently, for security reasons | ||
53 | a specific start variable should be used only once for a given key. | ||
54 | - The absence of chaining makes the OFB more vulnerable to specific attacks. | ||
55 | - The use of different start variables values prevents the same | ||
56 | plaintext enciphering to the same ciphertext, by producing different | ||
57 | key streams. | ||
58 | - Selection of a small value for j will require more cycles through | ||
59 | the encipherment algorithm per unit of plaintext and thus cause | ||
60 | greater processing overheads. | ||
61 | - Only multiples of j bits can be enciphered. | ||
62 | - OFB mode of operation does not extend ciphertext errors in the | ||
63 | resultant plaintext output. Every bit error in the ciphertext causes | ||
64 | only one bit to be in error in the deciphered plaintext. | ||
65 | - OFB mode is not self-synchronising. If the two operation of | ||
66 | encipherment and decipherment get out of synchronism, the system needs | ||
67 | to be re-initialised. | ||
68 | - Each re-initialisation should use a value of the start variable | ||
69 | different from the start variable values used before with the same | ||
70 | key. The reason for this is that an identical bit stream would be | ||
71 | produced each time from the same parameters. This would be | ||
72 | susceptible to a 'known plaintext' attack. | ||
73 | |||
74 | Triple ECB Mode (des_ecb3_encrypt()) | ||
75 | - Encrypt with key1, decrypt with key2 and encrypt with key1 again. | ||
76 | - As for ECB encryption but increases the effective key length to 112 bits. | ||
77 | - If both keys are the same it is equivalent to encrypting once with | ||
78 | just one key. | ||
79 | |||
80 | Triple CBC Mode (des_3cbc_encrypt()) | ||
81 | - Encrypt with key1, decrypt with key2 and encrypt with key1 again. | ||
82 | - As for CBC encryption but increases the effective key length to 112 bits. | ||
83 | - If both keys are the same it is equivalent to encrypting once with | ||
84 | just one key. | ||
diff --git a/src/lib/libcrypto/des/Makefile.PL b/src/lib/libcrypto/des/Makefile.PL new file mode 100644 index 0000000000..b54a24387c --- /dev/null +++ b/src/lib/libcrypto/des/Makefile.PL | |||
@@ -0,0 +1,14 @@ | |||
1 | use ExtUtils::MakeMaker; | ||
2 | # See lib/ExtUtils/MakeMaker.pm for details of how to influence | ||
3 | # the contents of the Makefile being created. | ||
4 | &writeMakefile( | ||
5 | 'potential_libs' => '', # e.g., '-lm' | ||
6 | 'INC' => '', # e.g., '-I/usr/include/other' | ||
7 | 'DISTNAME' => 'DES', | ||
8 | 'VERSION' => '0.1', | ||
9 | 'DEFINE' => '-DPERL5', | ||
10 | 'OBJECT' => 'DES.o cbc_cksm.o cbc_enc.o ecb_enc.o pcbc_enc.o \ | ||
11 | rand_key.o set_key.o str2key.o \ | ||
12 | enc_read.o enc_writ.o fcrypt.o cfb_enc.o \ | ||
13 | ecb3_enc.o ofb_enc.o cbc3_enc.o des_enc.o', | ||
14 | ); | ||
diff --git a/src/lib/libcrypto/des/Makefile.lit b/src/lib/libcrypto/des/Makefile.lit new file mode 100644 index 0000000000..c09f6969da --- /dev/null +++ b/src/lib/libcrypto/des/Makefile.lit | |||
@@ -0,0 +1,250 @@ | |||
1 | # You must select the correct terminal control system to be used to | ||
2 | # turn character echo off when reading passwords. There a 5 systems | ||
3 | # SGTTY - the old BSD system | ||
4 | # TERMIO - most system V boxes | ||
5 | # TERMIOS - SGI (ala IRIX). | ||
6 | # VMS - the DEC operating system | ||
7 | # MSDOS - we all know what it is :-) | ||
8 | # read_pwd.c makes a reasonable guess at what is correct. | ||
9 | |||
10 | # Targets | ||
11 | # make - twidle the options yourself :-) | ||
12 | # make cc - standard cc options | ||
13 | # make gcc - standard gcc options | ||
14 | # make x86-elf - linux-elf etc | ||
15 | # make x86-out - linux-a.out, FreeBSD etc | ||
16 | # make x86-solaris | ||
17 | # make x86-bdsi | ||
18 | |||
19 | # If you are on a DEC Alpha, edit des.h and change the DES_LONG | ||
20 | # define to 'unsigned int'. I have seen this give a %20 speedup. | ||
21 | |||
22 | OPTS0= -DLIBDES_LIT -DRAND -DTERMIO #-DNOCONST | ||
23 | |||
24 | # Version 1.94 has changed the strings_to_key function so that it is | ||
25 | # now compatible with MITs when the string is longer than 8 characters. | ||
26 | # If you wish to keep the old version, uncomment the following line. | ||
27 | # This will affect the -E/-D options on des(1). | ||
28 | #OPTS1= -DOLD_STR_TO_KEY | ||
29 | |||
30 | # There are 4 possible performance options | ||
31 | # -DDES_PTR | ||
32 | # -DDES_RISC1 | ||
33 | # -DDES_RISC2 (only one of DES_RISC1 and DES_RISC2) | ||
34 | # -DDES_UNROLL | ||
35 | # after the initial build, run 'des_opts' to see which options are best | ||
36 | # for your platform. There are some listed in options.txt | ||
37 | #OPTS2= -DDES_PTR | ||
38 | #OPTS3= -DDES_RISC1 # or DES_RISC2 | ||
39 | #OPTS4= -DDES_UNROLL | ||
40 | |||
41 | OPTS= $(OPTS0) $(OPTS1) $(OPTS2) $(OPTS3) $(OPTS4) | ||
42 | |||
43 | MAKE=make -f Makefile | ||
44 | #CC=cc | ||
45 | #CFLAG= -O | ||
46 | |||
47 | CC=gcc | ||
48 | #CFLAG= -O4 -funroll-loops -fomit-frame-pointer | ||
49 | CFLAG= -O3 -fomit-frame-pointer | ||
50 | |||
51 | CFLAGS=$(OPTS) $(CFLAG) | ||
52 | CPP=$(CC) -E | ||
53 | AS=as | ||
54 | |||
55 | # Assember version of des_encrypt*(). | ||
56 | DES_ENC=des_enc.o fcrypt_b.o # normal C version | ||
57 | #DES_ENC=asm/dx86-elf.o asm/yx86-elf.o # elf format x86 | ||
58 | #DES_ENC=asm/dx86-out.o asm/yx86-out.o # a.out format x86 | ||
59 | #DES_ENC=asm/dx86-sol.o asm/yx86-sol.o # solaris format x86 | ||
60 | #DES_ENC=asm/dx86bsdi.o asm/yx86basi.o # bsdi format x86 | ||
61 | |||
62 | LIBDIR=/usr/local/lib | ||
63 | BINDIR=/usr/local/bin | ||
64 | INCDIR=/usr/local/include | ||
65 | MANDIR=/usr/local/man | ||
66 | MAN1=1 | ||
67 | MAN3=3 | ||
68 | SHELL=/bin/sh | ||
69 | OBJ_LIT=cbc_enc.o ecb_enc.o $(DES_ENC) fcrypt.o set_key.o | ||
70 | OBJ_FULL=cbc_cksm.o $(OBJ_LIT) pcbc_enc.o \ | ||
71 | xcbc_enc.o qud_cksm.o \ | ||
72 | cfb64ede.o cfb64enc.o cfb_enc.o ecb3_enc.o \ | ||
73 | enc_read.o enc_writ.o ofb64ede.o ofb64enc.o ofb_enc.o \ | ||
74 | rand_key.o read_pwd.o read2pwd.o rpc_enc.o str2key.o supp.o | ||
75 | |||
76 | GENERAL_LIT=COPYRIGHT INSTALL README VERSION Makefile des_crypt.man \ | ||
77 | des.doc options.txt asm | ||
78 | GENERAL_FULL=$(GENERAL_LIT) FILES Imakefile times vms.com KERBEROS MODES.DES \ | ||
79 | des.man DES.pm DES.pod DES.xs Makefile.PL dess.cpp des3s.cpp \ | ||
80 | Makefile.uni typemap t Makefile.ssl makefile.bc Makefile.lit \ | ||
81 | des.org des_locl.org | ||
82 | TESTING_LIT= destest speed des_opts | ||
83 | TESTING_FULL= rpw $(TESTING_LIT) | ||
84 | TESTING_SRC_LIT=destest.c speed.c des_opts.c | ||
85 | TESTING_SRC_FULL=rpw.c $(TESTING_SRC_LIT) | ||
86 | HEADERS_LIT=des_ver.h des.h des_locl.h podd.h sk.h spr.h | ||
87 | HEADERS_FULL= $(HEADERS_LIT) rpc_des.h | ||
88 | LIBDES_LIT=cbc_enc.c ecb_enc.c fcrypt.c set_key.c des_enc.c fcrypt_b.c | ||
89 | LIBDES_FULL= cbc_cksm.c pcbc_enc.c qud_cksm.c \ | ||
90 | cfb64ede.c cfb64enc.c cfb_enc.c ecb3_enc.c \ | ||
91 | enc_read.c enc_writ.c ofb64ede.c ofb64enc.c ofb_enc.c \ | ||
92 | rand_key.c rpc_enc.c str2key.c supp.c \ | ||
93 | xcbc_enc.c $(LIBDES_LIT) read_pwd.c read2pwd.c | ||
94 | |||
95 | PERL= des.pl testdes.pl doIP doPC1 doPC2 PC1 PC2 shifts.pl | ||
96 | |||
97 | OBJ= $(OBJ_LIT) | ||
98 | GENERAL=$(GENERAL_LIT) | ||
99 | TESTING=$(TESTING_LIT) | ||
100 | TESTING_SRC=$(TESTING_SRC_LIT) | ||
101 | HEADERS=$(HEADERS_LIT) | ||
102 | LIBDES= $(LIBDES_LIT) | ||
103 | |||
104 | ALL= $(GENERAL) $(TESTING_SRC) $(LIBDES) $(PERL) $(HEADERS) | ||
105 | |||
106 | DLIB= libdes.a | ||
107 | |||
108 | all: $(DLIB) $(TESTING) | ||
109 | |||
110 | cc: | ||
111 | $(MAKE) CC=cc CFLAGS="-O $(OPTS) $(CFLAG)" all | ||
112 | |||
113 | gcc: | ||
114 | $(MAKE) CC=gcc CFLAGS="-O3 -fomit-frame-pointer $(OPTS) $(CFLAG)" all | ||
115 | |||
116 | x86-elf: | ||
117 | $(MAKE) DES_ENC='asm/dx86-elf.o asm/yx86-elf.o' CC=$(CC) CFLAGS="-DELF $(OPTS) $(CFLAG)" all | ||
118 | |||
119 | x86-out: | ||
120 | $(MAKE) DES_ENC='asm/dx86-out.o asm/yx86-out.o' CC=$(CC) CFLAGS="-DOUT $(OPTS) $(CFLAG)" all | ||
121 | |||
122 | x86-solaris: | ||
123 | $(MAKE) DES_ENC='asm/dx86-sol.o asm/yx86-sol.o' CC=$(CC) CFLAGS="-DSOL $(OPTS) $(CFLAG)" all | ||
124 | |||
125 | x86-bsdi: | ||
126 | $(MAKE) DES_ENC='asm/dx86bsdi.o asm/yx86bsdi.o' CC=$(CC) CFLAGS="-DBSDI $(OPTS) $(CFLAG)" all | ||
127 | |||
128 | # elf | ||
129 | asm/dx86-elf.o: asm/dx86unix.cpp | ||
130 | $(CPP) -DELF asm/dx86unix.cpp | $(AS) -o asm/dx86-elf.o | ||
131 | |||
132 | asm/yx86-elf.o: asm/yx86unix.cpp | ||
133 | $(CPP) -DELF asm/yx86unix.cpp | $(AS) -o asm/yx86-elf.o | ||
134 | |||
135 | # solaris | ||
136 | asm/dx86-sol.o: asm/dx86unix.cpp | ||
137 | $(CC) -E -DSOL asm/dx86unix.cpp | sed 's/^#.*//' > asm/dx86-sol.s | ||
138 | as -o asm/dx86-sol.o asm/dx86-sol.s | ||
139 | rm -f asm/dx86-sol.s | ||
140 | |||
141 | asm/yx86-sol.o: asm/yx86unix.cpp | ||
142 | $(CC) -E -DSOL asm/yx86unix.cpp | sed 's/^#.*//' > asm/yx86-sol.s | ||
143 | as -o asm/yx86-sol.o asm/yx86-sol.s | ||
144 | rm -f asm/yx86-sol.s | ||
145 | |||
146 | # a.out | ||
147 | asm/dx86-out.o: asm/dx86unix.cpp | ||
148 | $(CPP) -DOUT asm/dx86unix.cpp | $(AS) -o asm/dx86-out.o | ||
149 | |||
150 | asm/yx86-out.o: asm/yx86unix.cpp | ||
151 | $(CPP) -DOUT asm/yx86unix.cpp | $(AS) -o asm/yx86-out.o | ||
152 | |||
153 | # bsdi | ||
154 | asm/dx86bsdi.o: asm/dx86unix.cpp | ||
155 | $(CPP) -DBSDI asm/dx86unix.cpp | $(AS) -o asm/dx86bsdi.o | ||
156 | |||
157 | asm/yx86bsdi.o: asm/yx86unix.cpp | ||
158 | $(CPP) -DBSDI asm/yx86unix.cpp | $(AS) -o asm/yx86bsdi.o | ||
159 | |||
160 | asm/dx86unix.cpp: | ||
161 | (cd asm; perl des-586.pl cpp >dx86unix.cpp) | ||
162 | |||
163 | asm/yx86unix.cpp: | ||
164 | (cd asm; perl crypt586.pl cpp >yx86unix.cpp) | ||
165 | |||
166 | test: all | ||
167 | ./destest | ||
168 | |||
169 | $(DLIB): $(OBJ) | ||
170 | /bin/rm -f $(DLIB) | ||
171 | ar cr $(DLIB) $(OBJ) | ||
172 | -if test -s /bin/ranlib; then /bin/ranlib $(DLIB); \ | ||
173 | else if test -s /usr/bin/ranlib; then /usr/bin/ranlib $(DLIB); \ | ||
174 | else exit 0; fi; fi | ||
175 | |||
176 | des_opts: des_opts.o $(DLIB) | ||
177 | $(CC) $(CFLAGS) -o des_opts des_opts.o $(DLIB) | ||
178 | |||
179 | destest: destest.o $(DLIB) | ||
180 | $(CC) $(CFLAGS) -o destest destest.o $(DLIB) | ||
181 | |||
182 | rpw: rpw.o $(DLIB) | ||
183 | $(CC) $(CFLAGS) -o rpw rpw.o $(DLIB) | ||
184 | |||
185 | speed: speed.o $(DLIB) | ||
186 | $(CC) $(CFLAGS) -o speed speed.o $(DLIB) | ||
187 | |||
188 | des: des.o $(DLIB) | ||
189 | $(CC) $(CFLAGS) -o des des.o $(DLIB) | ||
190 | |||
191 | tags: | ||
192 | ctags $(TESTING_SRC) $(LIBDES) | ||
193 | |||
194 | tar_lit: | ||
195 | /bin/mv Makefile Makefile.tmp | ||
196 | /bin/cp Makefile.lit Makefile | ||
197 | tar chf libdes-l.tar $(LIBDES_LIT) $(HEADERS_LIT) \ | ||
198 | $(GENERAL_LIT) $(TESTING_SRC_LIT) | ||
199 | /bin/rm -f Makefile | ||
200 | /bin/mv Makefile.tmp Makefile | ||
201 | |||
202 | tar: | ||
203 | tar chf libdes.tar $(ALL) | ||
204 | |||
205 | shar: | ||
206 | shar $(ALL) >libdes.shar | ||
207 | |||
208 | depend: | ||
209 | makedepend $(LIBDES) $(TESTING_SRC) | ||
210 | |||
211 | clean: | ||
212 | /bin/rm -f *.o tags core $(TESTING) $(DLIB) .nfs* *.old *.bak asm/*.o | ||
213 | |||
214 | dclean: | ||
215 | sed -e '/^# DO NOT DELETE THIS LINE/ q' Makefile >Makefile.new | ||
216 | mv -f Makefile.new Makefile | ||
217 | |||
218 | # Eric is probably going to choke when he next looks at this --tjh | ||
219 | install: | ||
220 | if test $(INSTALLTOP); then \ | ||
221 | echo SSL style install; \ | ||
222 | cp $(DLIB) $(INSTALLTOP)/lib; \ | ||
223 | if test -s /bin/ranlib; then \ | ||
224 | /bin/ranlib $(INSTALLTOP)/lib/$(DLIB); \ | ||
225 | else \ | ||
226 | if test -s /usr/bin/ranlib; then \ | ||
227 | /usr/bin/ranlib $(INSTALLTOP)/lib/$(DLIB); \ | ||
228 | fi; fi; \ | ||
229 | chmod 644 $(INSTALLTOP)/lib/$(DLIB); \ | ||
230 | cp des.h $(INSTALLTOP)/include; \ | ||
231 | chmod 644 $(INSTALLTOP)/include/des.h; \ | ||
232 | else \ | ||
233 | echo Standalone install; \ | ||
234 | cp $(DLIB) $(LIBDIR)/$(DLIB); \ | ||
235 | if test -s /bin/ranlib; then \ | ||
236 | /bin/ranlib $(LIBDIR)/$(DLIB); \ | ||
237 | else \ | ||
238 | if test -s /usr/bin/ranlib; then \ | ||
239 | /usr/bin/ranlib $(LIBDIR)/$(DLIB); \ | ||
240 | fi; \ | ||
241 | fi; \ | ||
242 | chmod 644 $(LIBDIR)/$(DLIB); \ | ||
243 | cp des_crypt.man $(MANDIR)/man$(MAN3)/des_crypt.$(MAN3); \ | ||
244 | chmod 644 $(MANDIR)/man$(MAN3)/des_crypt.$(MAN3); \ | ||
245 | cp des.man $(MANDIR)/man$(MAN1)/des.$(MAN1); \ | ||
246 | chmod 644 $(MANDIR)/man$(MAN1)/des.$(MAN1); \ | ||
247 | cp des.h $(INCDIR)/des.h; \ | ||
248 | chmod 644 $(INCDIR)/des.h; \ | ||
249 | fi | ||
250 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
diff --git a/src/lib/libcrypto/des/Makefile.uni b/src/lib/libcrypto/des/Makefile.uni new file mode 100644 index 0000000000..8f1759748a --- /dev/null +++ b/src/lib/libcrypto/des/Makefile.uni | |||
@@ -0,0 +1,263 @@ | |||
1 | # You must select the correct terminal control system to be used to | ||
2 | # turn character echo off when reading passwords. There a 5 systems | ||
3 | # SGTTY - the old BSD system | ||
4 | # TERMIO - most system V boxes | ||
5 | # TERMIOS - SGI (ala IRIX). | ||
6 | # VMS - the DEC operating system | ||
7 | # MSDOS - we all know what it is :-) | ||
8 | # read_pwd.c makes a reasonable guess at what is correct. | ||
9 | |||
10 | # Targets | ||
11 | # make - twidle the options yourself :-) | ||
12 | # make cc - standard cc options | ||
13 | # make gcc - standard gcc options | ||
14 | # make x86-elf - linux-elf etc | ||
15 | # make x86-out - linux-a.out, FreeBSD etc | ||
16 | # make x86-solaris | ||
17 | # make x86-bdsi | ||
18 | |||
19 | # If you are on a DEC Alpha, edit des.h and change the DES_LONG | ||
20 | # define to 'unsigned int'. I have seen this give a %20 speedup. | ||
21 | |||
22 | OPTS0= -DRAND -DTERMIO #-DNOCONST | ||
23 | |||
24 | # Version 1.94 has changed the strings_to_key function so that it is | ||
25 | # now compatible with MITs when the string is longer than 8 characters. | ||
26 | # If you wish to keep the old version, uncomment the following line. | ||
27 | # This will affect the -E/-D options on des(1). | ||
28 | #OPTS1= -DOLD_STR_TO_KEY | ||
29 | |||
30 | # There are 4 possible performance options | ||
31 | # -DDES_PTR | ||
32 | # -DDES_RISC1 | ||
33 | # -DDES_RISC2 (only one of DES_RISC1 and DES_RISC2) | ||
34 | # -DDES_UNROLL | ||
35 | # after the initial build, run 'des_opts' to see which options are best | ||
36 | # for your platform. There are some listed in options.txt | ||
37 | #OPTS2= -DDES_PTR | ||
38 | #OPTS3= -DDES_RISC1 # or DES_RISC2 | ||
39 | #OPTS4= -DDES_UNROLL | ||
40 | |||
41 | OPTS= $(OPTS0) $(OPTS1) $(OPTS2) $(OPTS3) $(OPTS4) | ||
42 | |||
43 | MAKE=make -f Makefile | ||
44 | #CC=cc | ||
45 | #CFLAG= -O | ||
46 | |||
47 | CC=gcc | ||
48 | #CFLAG= -O4 -funroll-loops -fomit-frame-pointer | ||
49 | CFLAG= -O3 -fomit-frame-pointer | ||
50 | |||
51 | CFLAGS=$(OPTS) $(CFLAG) | ||
52 | CPP=$(CC) -E | ||
53 | AS=as | ||
54 | |||
55 | # Assember version of des_encrypt*(). | ||
56 | DES_ENC=des_enc.o fcrypt_b.o # normal C version | ||
57 | #DES_ENC=asm/dx86-elf.o asm/yx86-elf.o # elf format x86 | ||
58 | #DES_ENC=asm/dx86-out.o asm/yx86-out.o # a.out format x86 | ||
59 | #DES_ENC=asm/dx86-sol.o asm/yx86-sol.o # solaris format x86 | ||
60 | #DES_ENC=asm/dx86bsdi.o asm/yx86basi.o # bsdi format x86 | ||
61 | |||
62 | LIBDIR=/usr/local/lib | ||
63 | BINDIR=/usr/local/bin | ||
64 | INCDIR=/usr/local/include | ||
65 | MANDIR=/usr/local/man | ||
66 | MAN1=1 | ||
67 | MAN3=3 | ||
68 | SHELL=/bin/sh | ||
69 | OBJ_LIT=cbc_enc.o ecb_enc.o $(DES_ENC) fcrypt.o set_key.o | ||
70 | OBJ_FULL=cbc_cksm.o $(OBJ_LIT) pcbc_enc.o \ | ||
71 | xcbc_enc.o qud_cksm.o cbc3_enc.o \ | ||
72 | cfb64ede.o cfb64enc.o cfb_enc.o ecb3_enc.o \ | ||
73 | enc_read.o enc_writ.o ofb64ede.o ofb64enc.o ofb_enc.o \ | ||
74 | rand_key.o read_pwd.o read2pwd.o rpc_enc.o str2key.o supp.o | ||
75 | |||
76 | GENERAL_LIT=COPYRIGHT INSTALL README VERSION Makefile des_crypt.man \ | ||
77 | des.doc options.txt asm | ||
78 | GENERAL_FULL=$(GENERAL_LIT) FILES Imakefile times vms.com KERBEROS MODES.DES \ | ||
79 | des.man DES.pm DES.pod DES.xs Makefile.PL dess.cpp des3s.cpp \ | ||
80 | Makefile.uni typemap t Makefile.ssl makefile.bc Makefile.lit \ | ||
81 | des.org des_locl.org | ||
82 | TESTING_LIT= destest speed des_opts | ||
83 | TESTING_FULL= rpw des $(TESTING_LIT) | ||
84 | TESTING_SRC_LIT=destest.c speed.c des_opts.c | ||
85 | TESTING_SRC_FULL=rpw.c des.c $(TESTING_SRC_LIT) | ||
86 | HEADERS_LIT=des_ver.h des.h des_locl.h podd.h sk.h spr.h | ||
87 | HEADERS_FULL= $(HEADERS_LIT) rpc_des.h | ||
88 | LIBDES_LIT=cbc_enc.c ecb_enc.c fcrypt.c set_key.c des_enc.c fcrypt_b.c | ||
89 | LIBDES_FULL= cbc_cksm.c pcbc_enc.c qud_cksm.c cbc3_enc.c \ | ||
90 | cfb64ede.c cfb64enc.c cfb_enc.c ecb3_enc.c \ | ||
91 | enc_read.c enc_writ.c ofb64ede.c ofb64enc.c ofb_enc.c \ | ||
92 | rand_key.c rpc_enc.c str2key.c supp.c \ | ||
93 | xcbc_enc.c $(LIBDES_LIT) read_pwd.c read2pwd.c | ||
94 | |||
95 | PERL= des.pl testdes.pl doIP doPC1 doPC2 PC1 PC2 shifts.pl | ||
96 | |||
97 | OBJ= $(OBJ_FULL) | ||
98 | GENERAL=$(GENERAL_FULL) | ||
99 | TESTING=$(TESTING_FULL) | ||
100 | TESTING_SRC=$(TESTING_SRC_FULL) | ||
101 | HEADERS=$(HEADERS_FULL) | ||
102 | LIBDES= $(LIBDES_FULL) | ||
103 | |||
104 | ALL= $(GENERAL) $(TESTING_SRC) $(LIBDES) $(PERL) $(HEADERS) | ||
105 | |||
106 | DLIB= libdes.a | ||
107 | |||
108 | all: $(DLIB) $(TESTING) | ||
109 | |||
110 | cc: | ||
111 | $(MAKE) CC=cc CFLAGS="-O $(OPTS) $(CFLAG)" all | ||
112 | |||
113 | gcc: | ||
114 | $(MAKE) CC=gcc CFLAGS="-O3 -fomit-frame-pointer $(OPTS) $(CFLAG)" all | ||
115 | |||
116 | x86-elf: | ||
117 | $(MAKE) DES_ENC='asm/dx86-elf.o asm/yx86-elf.o' CC=$(CC) CFLAGS="-DELF $(OPTS) $(CFLAG)" all | ||
118 | |||
119 | x86-out: | ||
120 | $(MAKE) DES_ENC='asm/dx86-out.o asm/yx86-out.o' CC=$(CC) CFLAGS="-DOUT $(OPTS) $(CFLAG)" all | ||
121 | |||
122 | x86-solaris: | ||
123 | $(MAKE) DES_ENC='asm/dx86-sol.o asm/yx86-sol.o' CC=$(CC) CFLAGS="-DSOL $(OPTS) $(CFLAG)" all | ||
124 | |||
125 | x86-bsdi: | ||
126 | $(MAKE) DES_ENC='asm/dx86bsdi.o asm/yx86bsdi.o' CC=$(CC) CFLAGS="-DBSDI $(OPTS) $(CFLAG)" all | ||
127 | |||
128 | # elf | ||
129 | asm/dx86-elf.o: asm/dx86unix.cpp | ||
130 | $(CPP) -DELF asm/dx86unix.cpp | $(AS) -o asm/dx86-elf.o | ||
131 | |||
132 | asm/yx86-elf.o: asm/yx86unix.cpp | ||
133 | $(CPP) -DELF asm/yx86unix.cpp | $(AS) -o asm/yx86-elf.o | ||
134 | |||
135 | # solaris | ||
136 | asm/dx86-sol.o: asm/dx86unix.cpp | ||
137 | $(CC) -E -DSOL asm/dx86unix.cpp | sed 's/^#.*//' > asm/dx86-sol.s | ||
138 | as -o asm/dx86-sol.o asm/dx86-sol.s | ||
139 | rm -f asm/dx86-sol.s | ||
140 | |||
141 | asm/yx86-sol.o: asm/yx86unix.cpp | ||
142 | $(CC) -E -DSOL asm/yx86unix.cpp | sed 's/^#.*//' > asm/yx86-sol.s | ||
143 | as -o asm/yx86-sol.o asm/yx86-sol.s | ||
144 | rm -f asm/yx86-sol.s | ||
145 | |||
146 | # a.out | ||
147 | asm/dx86-out.o: asm/dx86unix.cpp | ||
148 | $(CPP) -DOUT asm/dx86unix.cpp | $(AS) -o asm/dx86-out.o | ||
149 | |||
150 | asm/yx86-out.o: asm/yx86unix.cpp | ||
151 | $(CPP) -DOUT asm/yx86unix.cpp | $(AS) -o asm/yx86-out.o | ||
152 | |||
153 | # bsdi | ||
154 | asm/dx86bsdi.o: asm/dx86unix.cpp | ||
155 | $(CPP) -DBSDI asm/dx86unix.cpp | $(AS) -o asm/dx86bsdi.o | ||
156 | |||
157 | asm/yx86bsdi.o: asm/yx86unix.cpp | ||
158 | $(CPP) -DBSDI asm/yx86unix.cpp | $(AS) -o asm/yx86bsdi.o | ||
159 | |||
160 | asm/dx86unix.cpp: | ||
161 | (cd asm; perl des-586.pl cpp >dx86unix.cpp) | ||
162 | |||
163 | asm/yx86unix.cpp: | ||
164 | (cd asm; perl crypt586.pl cpp >yx86unix.cpp) | ||
165 | |||
166 | test: all | ||
167 | ./destest | ||
168 | |||
169 | $(DLIB): $(OBJ) | ||
170 | /bin/rm -f $(DLIB) | ||
171 | ar cr $(DLIB) $(OBJ) | ||
172 | -if test -s /bin/ranlib; then /bin/ranlib $(DLIB); \ | ||
173 | else if test -s /usr/bin/ranlib; then /usr/bin/ranlib $(DLIB); \ | ||
174 | else exit 0; fi; fi | ||
175 | |||
176 | des_opts: des_opts.o $(DLIB) | ||
177 | $(CC) $(CFLAGS) -o des_opts des_opts.o $(DLIB) | ||
178 | |||
179 | destest: destest.o $(DLIB) | ||
180 | $(CC) $(CFLAGS) -o destest destest.o $(DLIB) | ||
181 | |||
182 | rpw: rpw.o $(DLIB) | ||
183 | $(CC) $(CFLAGS) -o rpw rpw.o $(DLIB) | ||
184 | |||
185 | speed: speed.o $(DLIB) | ||
186 | $(CC) $(CFLAGS) -o speed speed.o $(DLIB) | ||
187 | |||
188 | des: des.o $(DLIB) | ||
189 | $(CC) $(CFLAGS) -o des des.o $(DLIB) | ||
190 | |||
191 | tags: | ||
192 | ctags $(TESTING_SRC) $(LIBDES) | ||
193 | |||
194 | tar_lit: | ||
195 | /bin/mv Makefile Makefile.tmp | ||
196 | /bin/cp Makefile.lit Makefile | ||
197 | for i in $(HEADERS_LIT) $(LIBDES_LIT) $(GENERAL_LIT) $(TESTING_SRC_LIT) ;\ | ||
198 | do \ | ||
199 | n="$$n des/$$i"; \ | ||
200 | done; \ | ||
201 | ( cd .. ; tar chf - $$n )| gzip > libdes-l.tgz | ||
202 | /bin/rm -f Makefile | ||
203 | /bin/mv Makefile.tmp Makefile | ||
204 | |||
205 | tar: | ||
206 | mv Makefile Makefile.tmp | ||
207 | /bin/cp Makefile.uni Makefile | ||
208 | for i in $(ALL) ;\ | ||
209 | do \ | ||
210 | n="$$n des/$$i"; \ | ||
211 | done; \ | ||
212 | ( cd .. ; tar chf - $$n )| gzip > libdes.tgz | ||
213 | /bin/rm -f Makefile | ||
214 | /bin/mv Makefile.tmp Makefile | ||
215 | |||
216 | shar: | ||
217 | shar $(ALL) >libdes.shar | ||
218 | |||
219 | depend: | ||
220 | makedepend $(LIBDES) $(TESTING_SRC) | ||
221 | |||
222 | clean: | ||
223 | /bin/rm -f *.o tags core $(TESTING) $(DLIB) .nfs* *.old *.bak asm/*.o | ||
224 | |||
225 | dclean: | ||
226 | sed -e '/^# DO NOT DELETE THIS LINE/ q' Makefile >Makefile.new | ||
227 | mv -f Makefile.new Makefile | ||
228 | |||
229 | # Eric is probably going to choke when he next looks at this --tjh | ||
230 | install: des | ||
231 | if test $(INSTALLTOP); then \ | ||
232 | echo SSL style install; \ | ||
233 | cp $(DLIB) $(INSTALLTOP)/lib; \ | ||
234 | if test -s /bin/ranlib; then \ | ||
235 | /bin/ranlib $(INSTALLTOP)/lib/$(DLIB); \ | ||
236 | else \ | ||
237 | if test -s /usr/bin/ranlib; then \ | ||
238 | /usr/bin/ranlib $(INSTALLTOP)/lib/$(DLIB); \ | ||
239 | fi; fi; \ | ||
240 | chmod 644 $(INSTALLTOP)/lib/$(DLIB); \ | ||
241 | cp des.h $(INSTALLTOP)/include; \ | ||
242 | chmod 644 $(INSTALLTOP)/include/des.h; \ | ||
243 | else \ | ||
244 | echo Standalone install; \ | ||
245 | cp $(DLIB) $(LIBDIR)/$(DLIB); \ | ||
246 | if test -s /bin/ranlib; then \ | ||
247 | /bin/ranlib $(LIBDIR)/$(DLIB); \ | ||
248 | else \ | ||
249 | if test -s /usr/bin/ranlib; then \ | ||
250 | /usr/bin/ranlib $(LIBDIR)/$(DLIB); \ | ||
251 | fi; \ | ||
252 | fi; \ | ||
253 | chmod 644 $(LIBDIR)/$(DLIB); \ | ||
254 | cp des $(BINDIR)/des; \ | ||
255 | chmod 711 $(BINDIR)/des; \ | ||
256 | cp des_crypt.man $(MANDIR)/man$(MAN3)/des_crypt.$(MAN3); \ | ||
257 | chmod 644 $(MANDIR)/man$(MAN3)/des_crypt.$(MAN3); \ | ||
258 | cp des.man $(MANDIR)/man$(MAN1)/des.$(MAN1); \ | ||
259 | chmod 644 $(MANDIR)/man$(MAN1)/des.$(MAN1); \ | ||
260 | cp des.h $(INCDIR)/des.h; \ | ||
261 | chmod 644 $(INCDIR)/des.h; \ | ||
262 | fi | ||
263 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
diff --git a/src/lib/libcrypto/des/PC1 b/src/lib/libcrypto/des/PC1 new file mode 100644 index 0000000000..efb8348b72 --- /dev/null +++ b/src/lib/libcrypto/des/PC1 | |||
@@ -0,0 +1,28 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | |||
3 | @PC1=( 57,49,41,33,25,17, 9, | ||
4 | 1,58,50,42,34,26,18, | ||
5 | 10, 2,59,51,43,35,27, | ||
6 | 19,11, 3,60,52,44,36, | ||
7 | "-","-","-","-", | ||
8 | 63,55,47,39,31,23,15, | ||
9 | 7,62,54,46,38,30,22, | ||
10 | 14, 6,61,53,45,37,29, | ||
11 | 21,13, 5,28,20,12, 4, | ||
12 | "-","-","-","-", | ||
13 | ); | ||
14 | |||
15 | foreach (@PC1) | ||
16 | { | ||
17 | if ($_ ne "-") | ||
18 | { | ||
19 | $_--; | ||
20 | $_=int($_/8)*8+7-($_%8); | ||
21 | printf "%2d ",$_; | ||
22 | } | ||
23 | else | ||
24 | { print "-- "; } | ||
25 | print "\n" if (((++$i) % 8) == 0); | ||
26 | print "\n" if ((($i) % 32) == 0); | ||
27 | } | ||
28 | |||
diff --git a/src/lib/libcrypto/des/PC2 b/src/lib/libcrypto/des/PC2 new file mode 100644 index 0000000000..2d560270ec --- /dev/null +++ b/src/lib/libcrypto/des/PC2 | |||
@@ -0,0 +1,57 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | |||
3 | @PC2_C=(14,17,11,24, 1, 5, | ||
4 | 3,28,15, 6,21,10, | ||
5 | 23,19,12, 4,26, 8, | ||
6 | 16, 7,27,20,13, 2, | ||
7 | ); | ||
8 | |||
9 | @PC2_D=(41,52,31,37,47,55, | ||
10 | 30,40,51,45,33,48, | ||
11 | 44,49,39,56,34,53, | ||
12 | 46,42,50,36,29,32, | ||
13 | ); | ||
14 | |||
15 | foreach (@PC2_C) { | ||
16 | if ($_ ne "-") | ||
17 | { | ||
18 | $_--; | ||
19 | printf "%2d ",$_; } | ||
20 | else { print "-- "; } | ||
21 | $C{$_}=1; | ||
22 | print "\n" if (((++$i) % 8) == 0); | ||
23 | } | ||
24 | $i=0; | ||
25 | print "\n"; | ||
26 | foreach (@PC2_D) { | ||
27 | if ($_ ne "-") | ||
28 | { | ||
29 | $_-=29; | ||
30 | printf "%2d ",$_; } | ||
31 | else { print "-- "; } | ||
32 | $D{$_}=1; | ||
33 | print "\n" if (((++$i) % 8) == 0); } | ||
34 | |||
35 | print "\n"; | ||
36 | foreach $i (0 .. 27) | ||
37 | { | ||
38 | $_=$C{$i}; | ||
39 | if ($_ ne "-") {printf "%2d ",$_;} | ||
40 | else { print "-- "; } | ||
41 | print "\n" if (((++$i) % 8) == 0); | ||
42 | } | ||
43 | print "\n"; | ||
44 | |||
45 | print "\n"; | ||
46 | foreach $i (0 .. 27) | ||
47 | { | ||
48 | $_=$D{$i}; | ||
49 | if ($_ ne "-") {printf "%2d ",$_;} | ||
50 | else { print "-- "; } | ||
51 | print "\n" if (((++$i) % 8) == 0); | ||
52 | } | ||
53 | print "\n"; | ||
54 | sub numsort | ||
55 | { | ||
56 | $a-$b; | ||
57 | } | ||
diff --git a/src/lib/libcrypto/des/asm/d-win32.asm b/src/lib/libcrypto/des/asm/d-win32.asm new file mode 100644 index 0000000000..9e3dc9cd87 --- /dev/null +++ b/src/lib/libcrypto/des/asm/d-win32.asm | |||
@@ -0,0 +1,3132 @@ | |||
1 | ; Don't even think of reading this code | ||
2 | ; It was automatically generated by des-586.pl | ||
3 | ; Which is a perl program used to generate the x86 assember for | ||
4 | ; any of elf, a.out, BSDI,Win32, or Solaris | ||
5 | ; eric <eay@cryptsoft.com> | ||
6 | ; | ||
7 | TITLE des-586.asm | ||
8 | .386 | ||
9 | .model FLAT | ||
10 | _TEXT SEGMENT | ||
11 | PUBLIC _des_encrypt | ||
12 | EXTRN _des_SPtrans:DWORD | ||
13 | _des_encrypt PROC NEAR | ||
14 | push esi | ||
15 | push edi | ||
16 | ; | ||
17 | ; Load the 2 words | ||
18 | mov esi, DWORD PTR 12[esp] | ||
19 | xor ecx, ecx | ||
20 | push ebx | ||
21 | push ebp | ||
22 | mov eax, DWORD PTR [esi] | ||
23 | mov ebx, DWORD PTR 28[esp] | ||
24 | mov edi, DWORD PTR 4[esi] | ||
25 | ; | ||
26 | ; IP | ||
27 | rol eax, 4 | ||
28 | mov esi, eax | ||
29 | xor eax, edi | ||
30 | and eax, 0f0f0f0f0h | ||
31 | xor esi, eax | ||
32 | xor edi, eax | ||
33 | ; | ||
34 | rol edi, 20 | ||
35 | mov eax, edi | ||
36 | xor edi, esi | ||
37 | and edi, 0fff0000fh | ||
38 | xor eax, edi | ||
39 | xor esi, edi | ||
40 | ; | ||
41 | rol eax, 14 | ||
42 | mov edi, eax | ||
43 | xor eax, esi | ||
44 | and eax, 033333333h | ||
45 | xor edi, eax | ||
46 | xor esi, eax | ||
47 | ; | ||
48 | rol esi, 22 | ||
49 | mov eax, esi | ||
50 | xor esi, edi | ||
51 | and esi, 003fc03fch | ||
52 | xor eax, esi | ||
53 | xor edi, esi | ||
54 | ; | ||
55 | rol eax, 9 | ||
56 | mov esi, eax | ||
57 | xor eax, edi | ||
58 | and eax, 0aaaaaaaah | ||
59 | xor esi, eax | ||
60 | xor edi, eax | ||
61 | ; | ||
62 | rol edi, 1 | ||
63 | mov ebp, DWORD PTR 24[esp] | ||
64 | cmp ebx, 0 | ||
65 | je $L000start_decrypt | ||
66 | ; | ||
67 | ; Round 0 | ||
68 | mov eax, DWORD PTR [ebp] | ||
69 | xor ebx, ebx | ||
70 | mov edx, DWORD PTR 4[ebp] | ||
71 | xor eax, esi | ||
72 | xor edx, esi | ||
73 | and eax, 0fcfcfcfch | ||
74 | and edx, 0cfcfcfcfh | ||
75 | mov bl, al | ||
76 | mov cl, ah | ||
77 | ror edx, 4 | ||
78 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
79 | mov bl, dl | ||
80 | xor edi, ebp | ||
81 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
82 | xor edi, ebp | ||
83 | mov cl, dh | ||
84 | shr eax, 16 | ||
85 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
86 | xor edi, ebp | ||
87 | mov bl, ah | ||
88 | shr edx, 16 | ||
89 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
90 | xor edi, ebp | ||
91 | mov ebp, DWORD PTR 24[esp] | ||
92 | mov cl, dh | ||
93 | and eax, 0ffh | ||
94 | and edx, 0ffh | ||
95 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
96 | xor edi, ebx | ||
97 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
98 | xor edi, ebx | ||
99 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
100 | xor edi, ebx | ||
101 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
102 | xor edi, ebx | ||
103 | ; | ||
104 | ; Round 1 | ||
105 | mov eax, DWORD PTR 8[ebp] | ||
106 | xor ebx, ebx | ||
107 | mov edx, DWORD PTR 12[ebp] | ||
108 | xor eax, edi | ||
109 | xor edx, edi | ||
110 | and eax, 0fcfcfcfch | ||
111 | and edx, 0cfcfcfcfh | ||
112 | mov bl, al | ||
113 | mov cl, ah | ||
114 | ror edx, 4 | ||
115 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
116 | mov bl, dl | ||
117 | xor esi, ebp | ||
118 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
119 | xor esi, ebp | ||
120 | mov cl, dh | ||
121 | shr eax, 16 | ||
122 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
123 | xor esi, ebp | ||
124 | mov bl, ah | ||
125 | shr edx, 16 | ||
126 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
127 | xor esi, ebp | ||
128 | mov ebp, DWORD PTR 24[esp] | ||
129 | mov cl, dh | ||
130 | and eax, 0ffh | ||
131 | and edx, 0ffh | ||
132 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
133 | xor esi, ebx | ||
134 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
135 | xor esi, ebx | ||
136 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
137 | xor esi, ebx | ||
138 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
139 | xor esi, ebx | ||
140 | ; | ||
141 | ; Round 2 | ||
142 | mov eax, DWORD PTR 16[ebp] | ||
143 | xor ebx, ebx | ||
144 | mov edx, DWORD PTR 20[ebp] | ||
145 | xor eax, esi | ||
146 | xor edx, esi | ||
147 | and eax, 0fcfcfcfch | ||
148 | and edx, 0cfcfcfcfh | ||
149 | mov bl, al | ||
150 | mov cl, ah | ||
151 | ror edx, 4 | ||
152 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
153 | mov bl, dl | ||
154 | xor edi, ebp | ||
155 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
156 | xor edi, ebp | ||
157 | mov cl, dh | ||
158 | shr eax, 16 | ||
159 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
160 | xor edi, ebp | ||
161 | mov bl, ah | ||
162 | shr edx, 16 | ||
163 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
164 | xor edi, ebp | ||
165 | mov ebp, DWORD PTR 24[esp] | ||
166 | mov cl, dh | ||
167 | and eax, 0ffh | ||
168 | and edx, 0ffh | ||
169 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
170 | xor edi, ebx | ||
171 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
172 | xor edi, ebx | ||
173 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
174 | xor edi, ebx | ||
175 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
176 | xor edi, ebx | ||
177 | ; | ||
178 | ; Round 3 | ||
179 | mov eax, DWORD PTR 24[ebp] | ||
180 | xor ebx, ebx | ||
181 | mov edx, DWORD PTR 28[ebp] | ||
182 | xor eax, edi | ||
183 | xor edx, edi | ||
184 | and eax, 0fcfcfcfch | ||
185 | and edx, 0cfcfcfcfh | ||
186 | mov bl, al | ||
187 | mov cl, ah | ||
188 | ror edx, 4 | ||
189 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
190 | mov bl, dl | ||
191 | xor esi, ebp | ||
192 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
193 | xor esi, ebp | ||
194 | mov cl, dh | ||
195 | shr eax, 16 | ||
196 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
197 | xor esi, ebp | ||
198 | mov bl, ah | ||
199 | shr edx, 16 | ||
200 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
201 | xor esi, ebp | ||
202 | mov ebp, DWORD PTR 24[esp] | ||
203 | mov cl, dh | ||
204 | and eax, 0ffh | ||
205 | and edx, 0ffh | ||
206 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
207 | xor esi, ebx | ||
208 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
209 | xor esi, ebx | ||
210 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
211 | xor esi, ebx | ||
212 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
213 | xor esi, ebx | ||
214 | ; | ||
215 | ; Round 4 | ||
216 | mov eax, DWORD PTR 32[ebp] | ||
217 | xor ebx, ebx | ||
218 | mov edx, DWORD PTR 36[ebp] | ||
219 | xor eax, esi | ||
220 | xor edx, esi | ||
221 | and eax, 0fcfcfcfch | ||
222 | and edx, 0cfcfcfcfh | ||
223 | mov bl, al | ||
224 | mov cl, ah | ||
225 | ror edx, 4 | ||
226 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
227 | mov bl, dl | ||
228 | xor edi, ebp | ||
229 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
230 | xor edi, ebp | ||
231 | mov cl, dh | ||
232 | shr eax, 16 | ||
233 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
234 | xor edi, ebp | ||
235 | mov bl, ah | ||
236 | shr edx, 16 | ||
237 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
238 | xor edi, ebp | ||
239 | mov ebp, DWORD PTR 24[esp] | ||
240 | mov cl, dh | ||
241 | and eax, 0ffh | ||
242 | and edx, 0ffh | ||
243 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
244 | xor edi, ebx | ||
245 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
246 | xor edi, ebx | ||
247 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
248 | xor edi, ebx | ||
249 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
250 | xor edi, ebx | ||
251 | ; | ||
252 | ; Round 5 | ||
253 | mov eax, DWORD PTR 40[ebp] | ||
254 | xor ebx, ebx | ||
255 | mov edx, DWORD PTR 44[ebp] | ||
256 | xor eax, edi | ||
257 | xor edx, edi | ||
258 | and eax, 0fcfcfcfch | ||
259 | and edx, 0cfcfcfcfh | ||
260 | mov bl, al | ||
261 | mov cl, ah | ||
262 | ror edx, 4 | ||
263 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
264 | mov bl, dl | ||
265 | xor esi, ebp | ||
266 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
267 | xor esi, ebp | ||
268 | mov cl, dh | ||
269 | shr eax, 16 | ||
270 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
271 | xor esi, ebp | ||
272 | mov bl, ah | ||
273 | shr edx, 16 | ||
274 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
275 | xor esi, ebp | ||
276 | mov ebp, DWORD PTR 24[esp] | ||
277 | mov cl, dh | ||
278 | and eax, 0ffh | ||
279 | and edx, 0ffh | ||
280 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
281 | xor esi, ebx | ||
282 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
283 | xor esi, ebx | ||
284 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
285 | xor esi, ebx | ||
286 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
287 | xor esi, ebx | ||
288 | ; | ||
289 | ; Round 6 | ||
290 | mov eax, DWORD PTR 48[ebp] | ||
291 | xor ebx, ebx | ||
292 | mov edx, DWORD PTR 52[ebp] | ||
293 | xor eax, esi | ||
294 | xor edx, esi | ||
295 | and eax, 0fcfcfcfch | ||
296 | and edx, 0cfcfcfcfh | ||
297 | mov bl, al | ||
298 | mov cl, ah | ||
299 | ror edx, 4 | ||
300 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
301 | mov bl, dl | ||
302 | xor edi, ebp | ||
303 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
304 | xor edi, ebp | ||
305 | mov cl, dh | ||
306 | shr eax, 16 | ||
307 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
308 | xor edi, ebp | ||
309 | mov bl, ah | ||
310 | shr edx, 16 | ||
311 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
312 | xor edi, ebp | ||
313 | mov ebp, DWORD PTR 24[esp] | ||
314 | mov cl, dh | ||
315 | and eax, 0ffh | ||
316 | and edx, 0ffh | ||
317 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
318 | xor edi, ebx | ||
319 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
320 | xor edi, ebx | ||
321 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
322 | xor edi, ebx | ||
323 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
324 | xor edi, ebx | ||
325 | ; | ||
326 | ; Round 7 | ||
327 | mov eax, DWORD PTR 56[ebp] | ||
328 | xor ebx, ebx | ||
329 | mov edx, DWORD PTR 60[ebp] | ||
330 | xor eax, edi | ||
331 | xor edx, edi | ||
332 | and eax, 0fcfcfcfch | ||
333 | and edx, 0cfcfcfcfh | ||
334 | mov bl, al | ||
335 | mov cl, ah | ||
336 | ror edx, 4 | ||
337 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
338 | mov bl, dl | ||
339 | xor esi, ebp | ||
340 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
341 | xor esi, ebp | ||
342 | mov cl, dh | ||
343 | shr eax, 16 | ||
344 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
345 | xor esi, ebp | ||
346 | mov bl, ah | ||
347 | shr edx, 16 | ||
348 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
349 | xor esi, ebp | ||
350 | mov ebp, DWORD PTR 24[esp] | ||
351 | mov cl, dh | ||
352 | and eax, 0ffh | ||
353 | and edx, 0ffh | ||
354 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
355 | xor esi, ebx | ||
356 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
357 | xor esi, ebx | ||
358 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
359 | xor esi, ebx | ||
360 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
361 | xor esi, ebx | ||
362 | ; | ||
363 | ; Round 8 | ||
364 | mov eax, DWORD PTR 64[ebp] | ||
365 | xor ebx, ebx | ||
366 | mov edx, DWORD PTR 68[ebp] | ||
367 | xor eax, esi | ||
368 | xor edx, esi | ||
369 | and eax, 0fcfcfcfch | ||
370 | and edx, 0cfcfcfcfh | ||
371 | mov bl, al | ||
372 | mov cl, ah | ||
373 | ror edx, 4 | ||
374 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
375 | mov bl, dl | ||
376 | xor edi, ebp | ||
377 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
378 | xor edi, ebp | ||
379 | mov cl, dh | ||
380 | shr eax, 16 | ||
381 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
382 | xor edi, ebp | ||
383 | mov bl, ah | ||
384 | shr edx, 16 | ||
385 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
386 | xor edi, ebp | ||
387 | mov ebp, DWORD PTR 24[esp] | ||
388 | mov cl, dh | ||
389 | and eax, 0ffh | ||
390 | and edx, 0ffh | ||
391 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
392 | xor edi, ebx | ||
393 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
394 | xor edi, ebx | ||
395 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
396 | xor edi, ebx | ||
397 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
398 | xor edi, ebx | ||
399 | ; | ||
400 | ; Round 9 | ||
401 | mov eax, DWORD PTR 72[ebp] | ||
402 | xor ebx, ebx | ||
403 | mov edx, DWORD PTR 76[ebp] | ||
404 | xor eax, edi | ||
405 | xor edx, edi | ||
406 | and eax, 0fcfcfcfch | ||
407 | and edx, 0cfcfcfcfh | ||
408 | mov bl, al | ||
409 | mov cl, ah | ||
410 | ror edx, 4 | ||
411 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
412 | mov bl, dl | ||
413 | xor esi, ebp | ||
414 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
415 | xor esi, ebp | ||
416 | mov cl, dh | ||
417 | shr eax, 16 | ||
418 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
419 | xor esi, ebp | ||
420 | mov bl, ah | ||
421 | shr edx, 16 | ||
422 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
423 | xor esi, ebp | ||
424 | mov ebp, DWORD PTR 24[esp] | ||
425 | mov cl, dh | ||
426 | and eax, 0ffh | ||
427 | and edx, 0ffh | ||
428 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
429 | xor esi, ebx | ||
430 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
431 | xor esi, ebx | ||
432 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
433 | xor esi, ebx | ||
434 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
435 | xor esi, ebx | ||
436 | ; | ||
437 | ; Round 10 | ||
438 | mov eax, DWORD PTR 80[ebp] | ||
439 | xor ebx, ebx | ||
440 | mov edx, DWORD PTR 84[ebp] | ||
441 | xor eax, esi | ||
442 | xor edx, esi | ||
443 | and eax, 0fcfcfcfch | ||
444 | and edx, 0cfcfcfcfh | ||
445 | mov bl, al | ||
446 | mov cl, ah | ||
447 | ror edx, 4 | ||
448 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
449 | mov bl, dl | ||
450 | xor edi, ebp | ||
451 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
452 | xor edi, ebp | ||
453 | mov cl, dh | ||
454 | shr eax, 16 | ||
455 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
456 | xor edi, ebp | ||
457 | mov bl, ah | ||
458 | shr edx, 16 | ||
459 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
460 | xor edi, ebp | ||
461 | mov ebp, DWORD PTR 24[esp] | ||
462 | mov cl, dh | ||
463 | and eax, 0ffh | ||
464 | and edx, 0ffh | ||
465 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
466 | xor edi, ebx | ||
467 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
468 | xor edi, ebx | ||
469 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
470 | xor edi, ebx | ||
471 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
472 | xor edi, ebx | ||
473 | ; | ||
474 | ; Round 11 | ||
475 | mov eax, DWORD PTR 88[ebp] | ||
476 | xor ebx, ebx | ||
477 | mov edx, DWORD PTR 92[ebp] | ||
478 | xor eax, edi | ||
479 | xor edx, edi | ||
480 | and eax, 0fcfcfcfch | ||
481 | and edx, 0cfcfcfcfh | ||
482 | mov bl, al | ||
483 | mov cl, ah | ||
484 | ror edx, 4 | ||
485 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
486 | mov bl, dl | ||
487 | xor esi, ebp | ||
488 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
489 | xor esi, ebp | ||
490 | mov cl, dh | ||
491 | shr eax, 16 | ||
492 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
493 | xor esi, ebp | ||
494 | mov bl, ah | ||
495 | shr edx, 16 | ||
496 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
497 | xor esi, ebp | ||
498 | mov ebp, DWORD PTR 24[esp] | ||
499 | mov cl, dh | ||
500 | and eax, 0ffh | ||
501 | and edx, 0ffh | ||
502 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
503 | xor esi, ebx | ||
504 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
505 | xor esi, ebx | ||
506 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
507 | xor esi, ebx | ||
508 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
509 | xor esi, ebx | ||
510 | ; | ||
511 | ; Round 12 | ||
512 | mov eax, DWORD PTR 96[ebp] | ||
513 | xor ebx, ebx | ||
514 | mov edx, DWORD PTR 100[ebp] | ||
515 | xor eax, esi | ||
516 | xor edx, esi | ||
517 | and eax, 0fcfcfcfch | ||
518 | and edx, 0cfcfcfcfh | ||
519 | mov bl, al | ||
520 | mov cl, ah | ||
521 | ror edx, 4 | ||
522 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
523 | mov bl, dl | ||
524 | xor edi, ebp | ||
525 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
526 | xor edi, ebp | ||
527 | mov cl, dh | ||
528 | shr eax, 16 | ||
529 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
530 | xor edi, ebp | ||
531 | mov bl, ah | ||
532 | shr edx, 16 | ||
533 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
534 | xor edi, ebp | ||
535 | mov ebp, DWORD PTR 24[esp] | ||
536 | mov cl, dh | ||
537 | and eax, 0ffh | ||
538 | and edx, 0ffh | ||
539 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
540 | xor edi, ebx | ||
541 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
542 | xor edi, ebx | ||
543 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
544 | xor edi, ebx | ||
545 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
546 | xor edi, ebx | ||
547 | ; | ||
548 | ; Round 13 | ||
549 | mov eax, DWORD PTR 104[ebp] | ||
550 | xor ebx, ebx | ||
551 | mov edx, DWORD PTR 108[ebp] | ||
552 | xor eax, edi | ||
553 | xor edx, edi | ||
554 | and eax, 0fcfcfcfch | ||
555 | and edx, 0cfcfcfcfh | ||
556 | mov bl, al | ||
557 | mov cl, ah | ||
558 | ror edx, 4 | ||
559 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
560 | mov bl, dl | ||
561 | xor esi, ebp | ||
562 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
563 | xor esi, ebp | ||
564 | mov cl, dh | ||
565 | shr eax, 16 | ||
566 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
567 | xor esi, ebp | ||
568 | mov bl, ah | ||
569 | shr edx, 16 | ||
570 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
571 | xor esi, ebp | ||
572 | mov ebp, DWORD PTR 24[esp] | ||
573 | mov cl, dh | ||
574 | and eax, 0ffh | ||
575 | and edx, 0ffh | ||
576 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
577 | xor esi, ebx | ||
578 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
579 | xor esi, ebx | ||
580 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
581 | xor esi, ebx | ||
582 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
583 | xor esi, ebx | ||
584 | ; | ||
585 | ; Round 14 | ||
586 | mov eax, DWORD PTR 112[ebp] | ||
587 | xor ebx, ebx | ||
588 | mov edx, DWORD PTR 116[ebp] | ||
589 | xor eax, esi | ||
590 | xor edx, esi | ||
591 | and eax, 0fcfcfcfch | ||
592 | and edx, 0cfcfcfcfh | ||
593 | mov bl, al | ||
594 | mov cl, ah | ||
595 | ror edx, 4 | ||
596 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
597 | mov bl, dl | ||
598 | xor edi, ebp | ||
599 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
600 | xor edi, ebp | ||
601 | mov cl, dh | ||
602 | shr eax, 16 | ||
603 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
604 | xor edi, ebp | ||
605 | mov bl, ah | ||
606 | shr edx, 16 | ||
607 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
608 | xor edi, ebp | ||
609 | mov ebp, DWORD PTR 24[esp] | ||
610 | mov cl, dh | ||
611 | and eax, 0ffh | ||
612 | and edx, 0ffh | ||
613 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
614 | xor edi, ebx | ||
615 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
616 | xor edi, ebx | ||
617 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
618 | xor edi, ebx | ||
619 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
620 | xor edi, ebx | ||
621 | ; | ||
622 | ; Round 15 | ||
623 | mov eax, DWORD PTR 120[ebp] | ||
624 | xor ebx, ebx | ||
625 | mov edx, DWORD PTR 124[ebp] | ||
626 | xor eax, edi | ||
627 | xor edx, edi | ||
628 | and eax, 0fcfcfcfch | ||
629 | and edx, 0cfcfcfcfh | ||
630 | mov bl, al | ||
631 | mov cl, ah | ||
632 | ror edx, 4 | ||
633 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
634 | mov bl, dl | ||
635 | xor esi, ebp | ||
636 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
637 | xor esi, ebp | ||
638 | mov cl, dh | ||
639 | shr eax, 16 | ||
640 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
641 | xor esi, ebp | ||
642 | mov bl, ah | ||
643 | shr edx, 16 | ||
644 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
645 | xor esi, ebp | ||
646 | mov ebp, DWORD PTR 24[esp] | ||
647 | mov cl, dh | ||
648 | and eax, 0ffh | ||
649 | and edx, 0ffh | ||
650 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
651 | xor esi, ebx | ||
652 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
653 | xor esi, ebx | ||
654 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
655 | xor esi, ebx | ||
656 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
657 | xor esi, ebx | ||
658 | jmp $L001end | ||
659 | $L000start_decrypt: | ||
660 | ; | ||
661 | ; Round 15 | ||
662 | mov eax, DWORD PTR 120[ebp] | ||
663 | xor ebx, ebx | ||
664 | mov edx, DWORD PTR 124[ebp] | ||
665 | xor eax, esi | ||
666 | xor edx, esi | ||
667 | and eax, 0fcfcfcfch | ||
668 | and edx, 0cfcfcfcfh | ||
669 | mov bl, al | ||
670 | mov cl, ah | ||
671 | ror edx, 4 | ||
672 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
673 | mov bl, dl | ||
674 | xor edi, ebp | ||
675 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
676 | xor edi, ebp | ||
677 | mov cl, dh | ||
678 | shr eax, 16 | ||
679 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
680 | xor edi, ebp | ||
681 | mov bl, ah | ||
682 | shr edx, 16 | ||
683 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
684 | xor edi, ebp | ||
685 | mov ebp, DWORD PTR 24[esp] | ||
686 | mov cl, dh | ||
687 | and eax, 0ffh | ||
688 | and edx, 0ffh | ||
689 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
690 | xor edi, ebx | ||
691 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
692 | xor edi, ebx | ||
693 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
694 | xor edi, ebx | ||
695 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
696 | xor edi, ebx | ||
697 | ; | ||
698 | ; Round 14 | ||
699 | mov eax, DWORD PTR 112[ebp] | ||
700 | xor ebx, ebx | ||
701 | mov edx, DWORD PTR 116[ebp] | ||
702 | xor eax, edi | ||
703 | xor edx, edi | ||
704 | and eax, 0fcfcfcfch | ||
705 | and edx, 0cfcfcfcfh | ||
706 | mov bl, al | ||
707 | mov cl, ah | ||
708 | ror edx, 4 | ||
709 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
710 | mov bl, dl | ||
711 | xor esi, ebp | ||
712 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
713 | xor esi, ebp | ||
714 | mov cl, dh | ||
715 | shr eax, 16 | ||
716 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
717 | xor esi, ebp | ||
718 | mov bl, ah | ||
719 | shr edx, 16 | ||
720 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
721 | xor esi, ebp | ||
722 | mov ebp, DWORD PTR 24[esp] | ||
723 | mov cl, dh | ||
724 | and eax, 0ffh | ||
725 | and edx, 0ffh | ||
726 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
727 | xor esi, ebx | ||
728 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
729 | xor esi, ebx | ||
730 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
731 | xor esi, ebx | ||
732 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
733 | xor esi, ebx | ||
734 | ; | ||
735 | ; Round 13 | ||
736 | mov eax, DWORD PTR 104[ebp] | ||
737 | xor ebx, ebx | ||
738 | mov edx, DWORD PTR 108[ebp] | ||
739 | xor eax, esi | ||
740 | xor edx, esi | ||
741 | and eax, 0fcfcfcfch | ||
742 | and edx, 0cfcfcfcfh | ||
743 | mov bl, al | ||
744 | mov cl, ah | ||
745 | ror edx, 4 | ||
746 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
747 | mov bl, dl | ||
748 | xor edi, ebp | ||
749 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
750 | xor edi, ebp | ||
751 | mov cl, dh | ||
752 | shr eax, 16 | ||
753 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
754 | xor edi, ebp | ||
755 | mov bl, ah | ||
756 | shr edx, 16 | ||
757 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
758 | xor edi, ebp | ||
759 | mov ebp, DWORD PTR 24[esp] | ||
760 | mov cl, dh | ||
761 | and eax, 0ffh | ||
762 | and edx, 0ffh | ||
763 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
764 | xor edi, ebx | ||
765 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
766 | xor edi, ebx | ||
767 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
768 | xor edi, ebx | ||
769 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
770 | xor edi, ebx | ||
771 | ; | ||
772 | ; Round 12 | ||
773 | mov eax, DWORD PTR 96[ebp] | ||
774 | xor ebx, ebx | ||
775 | mov edx, DWORD PTR 100[ebp] | ||
776 | xor eax, edi | ||
777 | xor edx, edi | ||
778 | and eax, 0fcfcfcfch | ||
779 | and edx, 0cfcfcfcfh | ||
780 | mov bl, al | ||
781 | mov cl, ah | ||
782 | ror edx, 4 | ||
783 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
784 | mov bl, dl | ||
785 | xor esi, ebp | ||
786 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
787 | xor esi, ebp | ||
788 | mov cl, dh | ||
789 | shr eax, 16 | ||
790 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
791 | xor esi, ebp | ||
792 | mov bl, ah | ||
793 | shr edx, 16 | ||
794 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
795 | xor esi, ebp | ||
796 | mov ebp, DWORD PTR 24[esp] | ||
797 | mov cl, dh | ||
798 | and eax, 0ffh | ||
799 | and edx, 0ffh | ||
800 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
801 | xor esi, ebx | ||
802 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
803 | xor esi, ebx | ||
804 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
805 | xor esi, ebx | ||
806 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
807 | xor esi, ebx | ||
808 | ; | ||
809 | ; Round 11 | ||
810 | mov eax, DWORD PTR 88[ebp] | ||
811 | xor ebx, ebx | ||
812 | mov edx, DWORD PTR 92[ebp] | ||
813 | xor eax, esi | ||
814 | xor edx, esi | ||
815 | and eax, 0fcfcfcfch | ||
816 | and edx, 0cfcfcfcfh | ||
817 | mov bl, al | ||
818 | mov cl, ah | ||
819 | ror edx, 4 | ||
820 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
821 | mov bl, dl | ||
822 | xor edi, ebp | ||
823 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
824 | xor edi, ebp | ||
825 | mov cl, dh | ||
826 | shr eax, 16 | ||
827 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
828 | xor edi, ebp | ||
829 | mov bl, ah | ||
830 | shr edx, 16 | ||
831 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
832 | xor edi, ebp | ||
833 | mov ebp, DWORD PTR 24[esp] | ||
834 | mov cl, dh | ||
835 | and eax, 0ffh | ||
836 | and edx, 0ffh | ||
837 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
838 | xor edi, ebx | ||
839 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
840 | xor edi, ebx | ||
841 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
842 | xor edi, ebx | ||
843 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
844 | xor edi, ebx | ||
845 | ; | ||
846 | ; Round 10 | ||
847 | mov eax, DWORD PTR 80[ebp] | ||
848 | xor ebx, ebx | ||
849 | mov edx, DWORD PTR 84[ebp] | ||
850 | xor eax, edi | ||
851 | xor edx, edi | ||
852 | and eax, 0fcfcfcfch | ||
853 | and edx, 0cfcfcfcfh | ||
854 | mov bl, al | ||
855 | mov cl, ah | ||
856 | ror edx, 4 | ||
857 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
858 | mov bl, dl | ||
859 | xor esi, ebp | ||
860 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
861 | xor esi, ebp | ||
862 | mov cl, dh | ||
863 | shr eax, 16 | ||
864 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
865 | xor esi, ebp | ||
866 | mov bl, ah | ||
867 | shr edx, 16 | ||
868 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
869 | xor esi, ebp | ||
870 | mov ebp, DWORD PTR 24[esp] | ||
871 | mov cl, dh | ||
872 | and eax, 0ffh | ||
873 | and edx, 0ffh | ||
874 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
875 | xor esi, ebx | ||
876 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
877 | xor esi, ebx | ||
878 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
879 | xor esi, ebx | ||
880 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
881 | xor esi, ebx | ||
882 | ; | ||
883 | ; Round 9 | ||
884 | mov eax, DWORD PTR 72[ebp] | ||
885 | xor ebx, ebx | ||
886 | mov edx, DWORD PTR 76[ebp] | ||
887 | xor eax, esi | ||
888 | xor edx, esi | ||
889 | and eax, 0fcfcfcfch | ||
890 | and edx, 0cfcfcfcfh | ||
891 | mov bl, al | ||
892 | mov cl, ah | ||
893 | ror edx, 4 | ||
894 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
895 | mov bl, dl | ||
896 | xor edi, ebp | ||
897 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
898 | xor edi, ebp | ||
899 | mov cl, dh | ||
900 | shr eax, 16 | ||
901 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
902 | xor edi, ebp | ||
903 | mov bl, ah | ||
904 | shr edx, 16 | ||
905 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
906 | xor edi, ebp | ||
907 | mov ebp, DWORD PTR 24[esp] | ||
908 | mov cl, dh | ||
909 | and eax, 0ffh | ||
910 | and edx, 0ffh | ||
911 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
912 | xor edi, ebx | ||
913 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
914 | xor edi, ebx | ||
915 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
916 | xor edi, ebx | ||
917 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
918 | xor edi, ebx | ||
919 | ; | ||
920 | ; Round 8 | ||
921 | mov eax, DWORD PTR 64[ebp] | ||
922 | xor ebx, ebx | ||
923 | mov edx, DWORD PTR 68[ebp] | ||
924 | xor eax, edi | ||
925 | xor edx, edi | ||
926 | and eax, 0fcfcfcfch | ||
927 | and edx, 0cfcfcfcfh | ||
928 | mov bl, al | ||
929 | mov cl, ah | ||
930 | ror edx, 4 | ||
931 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
932 | mov bl, dl | ||
933 | xor esi, ebp | ||
934 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
935 | xor esi, ebp | ||
936 | mov cl, dh | ||
937 | shr eax, 16 | ||
938 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
939 | xor esi, ebp | ||
940 | mov bl, ah | ||
941 | shr edx, 16 | ||
942 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
943 | xor esi, ebp | ||
944 | mov ebp, DWORD PTR 24[esp] | ||
945 | mov cl, dh | ||
946 | and eax, 0ffh | ||
947 | and edx, 0ffh | ||
948 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
949 | xor esi, ebx | ||
950 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
951 | xor esi, ebx | ||
952 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
953 | xor esi, ebx | ||
954 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
955 | xor esi, ebx | ||
956 | ; | ||
957 | ; Round 7 | ||
958 | mov eax, DWORD PTR 56[ebp] | ||
959 | xor ebx, ebx | ||
960 | mov edx, DWORD PTR 60[ebp] | ||
961 | xor eax, esi | ||
962 | xor edx, esi | ||
963 | and eax, 0fcfcfcfch | ||
964 | and edx, 0cfcfcfcfh | ||
965 | mov bl, al | ||
966 | mov cl, ah | ||
967 | ror edx, 4 | ||
968 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
969 | mov bl, dl | ||
970 | xor edi, ebp | ||
971 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
972 | xor edi, ebp | ||
973 | mov cl, dh | ||
974 | shr eax, 16 | ||
975 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
976 | xor edi, ebp | ||
977 | mov bl, ah | ||
978 | shr edx, 16 | ||
979 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
980 | xor edi, ebp | ||
981 | mov ebp, DWORD PTR 24[esp] | ||
982 | mov cl, dh | ||
983 | and eax, 0ffh | ||
984 | and edx, 0ffh | ||
985 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
986 | xor edi, ebx | ||
987 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
988 | xor edi, ebx | ||
989 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
990 | xor edi, ebx | ||
991 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
992 | xor edi, ebx | ||
993 | ; | ||
994 | ; Round 6 | ||
995 | mov eax, DWORD PTR 48[ebp] | ||
996 | xor ebx, ebx | ||
997 | mov edx, DWORD PTR 52[ebp] | ||
998 | xor eax, edi | ||
999 | xor edx, edi | ||
1000 | and eax, 0fcfcfcfch | ||
1001 | and edx, 0cfcfcfcfh | ||
1002 | mov bl, al | ||
1003 | mov cl, ah | ||
1004 | ror edx, 4 | ||
1005 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1006 | mov bl, dl | ||
1007 | xor esi, ebp | ||
1008 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1009 | xor esi, ebp | ||
1010 | mov cl, dh | ||
1011 | shr eax, 16 | ||
1012 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1013 | xor esi, ebp | ||
1014 | mov bl, ah | ||
1015 | shr edx, 16 | ||
1016 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1017 | xor esi, ebp | ||
1018 | mov ebp, DWORD PTR 24[esp] | ||
1019 | mov cl, dh | ||
1020 | and eax, 0ffh | ||
1021 | and edx, 0ffh | ||
1022 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1023 | xor esi, ebx | ||
1024 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1025 | xor esi, ebx | ||
1026 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1027 | xor esi, ebx | ||
1028 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1029 | xor esi, ebx | ||
1030 | ; | ||
1031 | ; Round 5 | ||
1032 | mov eax, DWORD PTR 40[ebp] | ||
1033 | xor ebx, ebx | ||
1034 | mov edx, DWORD PTR 44[ebp] | ||
1035 | xor eax, esi | ||
1036 | xor edx, esi | ||
1037 | and eax, 0fcfcfcfch | ||
1038 | and edx, 0cfcfcfcfh | ||
1039 | mov bl, al | ||
1040 | mov cl, ah | ||
1041 | ror edx, 4 | ||
1042 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1043 | mov bl, dl | ||
1044 | xor edi, ebp | ||
1045 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1046 | xor edi, ebp | ||
1047 | mov cl, dh | ||
1048 | shr eax, 16 | ||
1049 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1050 | xor edi, ebp | ||
1051 | mov bl, ah | ||
1052 | shr edx, 16 | ||
1053 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1054 | xor edi, ebp | ||
1055 | mov ebp, DWORD PTR 24[esp] | ||
1056 | mov cl, dh | ||
1057 | and eax, 0ffh | ||
1058 | and edx, 0ffh | ||
1059 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1060 | xor edi, ebx | ||
1061 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1062 | xor edi, ebx | ||
1063 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1064 | xor edi, ebx | ||
1065 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1066 | xor edi, ebx | ||
1067 | ; | ||
1068 | ; Round 4 | ||
1069 | mov eax, DWORD PTR 32[ebp] | ||
1070 | xor ebx, ebx | ||
1071 | mov edx, DWORD PTR 36[ebp] | ||
1072 | xor eax, edi | ||
1073 | xor edx, edi | ||
1074 | and eax, 0fcfcfcfch | ||
1075 | and edx, 0cfcfcfcfh | ||
1076 | mov bl, al | ||
1077 | mov cl, ah | ||
1078 | ror edx, 4 | ||
1079 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1080 | mov bl, dl | ||
1081 | xor esi, ebp | ||
1082 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1083 | xor esi, ebp | ||
1084 | mov cl, dh | ||
1085 | shr eax, 16 | ||
1086 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1087 | xor esi, ebp | ||
1088 | mov bl, ah | ||
1089 | shr edx, 16 | ||
1090 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1091 | xor esi, ebp | ||
1092 | mov ebp, DWORD PTR 24[esp] | ||
1093 | mov cl, dh | ||
1094 | and eax, 0ffh | ||
1095 | and edx, 0ffh | ||
1096 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1097 | xor esi, ebx | ||
1098 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1099 | xor esi, ebx | ||
1100 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1101 | xor esi, ebx | ||
1102 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1103 | xor esi, ebx | ||
1104 | ; | ||
1105 | ; Round 3 | ||
1106 | mov eax, DWORD PTR 24[ebp] | ||
1107 | xor ebx, ebx | ||
1108 | mov edx, DWORD PTR 28[ebp] | ||
1109 | xor eax, esi | ||
1110 | xor edx, esi | ||
1111 | and eax, 0fcfcfcfch | ||
1112 | and edx, 0cfcfcfcfh | ||
1113 | mov bl, al | ||
1114 | mov cl, ah | ||
1115 | ror edx, 4 | ||
1116 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1117 | mov bl, dl | ||
1118 | xor edi, ebp | ||
1119 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1120 | xor edi, ebp | ||
1121 | mov cl, dh | ||
1122 | shr eax, 16 | ||
1123 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1124 | xor edi, ebp | ||
1125 | mov bl, ah | ||
1126 | shr edx, 16 | ||
1127 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1128 | xor edi, ebp | ||
1129 | mov ebp, DWORD PTR 24[esp] | ||
1130 | mov cl, dh | ||
1131 | and eax, 0ffh | ||
1132 | and edx, 0ffh | ||
1133 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1134 | xor edi, ebx | ||
1135 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1136 | xor edi, ebx | ||
1137 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1138 | xor edi, ebx | ||
1139 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1140 | xor edi, ebx | ||
1141 | ; | ||
1142 | ; Round 2 | ||
1143 | mov eax, DWORD PTR 16[ebp] | ||
1144 | xor ebx, ebx | ||
1145 | mov edx, DWORD PTR 20[ebp] | ||
1146 | xor eax, edi | ||
1147 | xor edx, edi | ||
1148 | and eax, 0fcfcfcfch | ||
1149 | and edx, 0cfcfcfcfh | ||
1150 | mov bl, al | ||
1151 | mov cl, ah | ||
1152 | ror edx, 4 | ||
1153 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1154 | mov bl, dl | ||
1155 | xor esi, ebp | ||
1156 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1157 | xor esi, ebp | ||
1158 | mov cl, dh | ||
1159 | shr eax, 16 | ||
1160 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1161 | xor esi, ebp | ||
1162 | mov bl, ah | ||
1163 | shr edx, 16 | ||
1164 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1165 | xor esi, ebp | ||
1166 | mov ebp, DWORD PTR 24[esp] | ||
1167 | mov cl, dh | ||
1168 | and eax, 0ffh | ||
1169 | and edx, 0ffh | ||
1170 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1171 | xor esi, ebx | ||
1172 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1173 | xor esi, ebx | ||
1174 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1175 | xor esi, ebx | ||
1176 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1177 | xor esi, ebx | ||
1178 | ; | ||
1179 | ; Round 1 | ||
1180 | mov eax, DWORD PTR 8[ebp] | ||
1181 | xor ebx, ebx | ||
1182 | mov edx, DWORD PTR 12[ebp] | ||
1183 | xor eax, esi | ||
1184 | xor edx, esi | ||
1185 | and eax, 0fcfcfcfch | ||
1186 | and edx, 0cfcfcfcfh | ||
1187 | mov bl, al | ||
1188 | mov cl, ah | ||
1189 | ror edx, 4 | ||
1190 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1191 | mov bl, dl | ||
1192 | xor edi, ebp | ||
1193 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1194 | xor edi, ebp | ||
1195 | mov cl, dh | ||
1196 | shr eax, 16 | ||
1197 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1198 | xor edi, ebp | ||
1199 | mov bl, ah | ||
1200 | shr edx, 16 | ||
1201 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1202 | xor edi, ebp | ||
1203 | mov ebp, DWORD PTR 24[esp] | ||
1204 | mov cl, dh | ||
1205 | and eax, 0ffh | ||
1206 | and edx, 0ffh | ||
1207 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1208 | xor edi, ebx | ||
1209 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1210 | xor edi, ebx | ||
1211 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1212 | xor edi, ebx | ||
1213 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1214 | xor edi, ebx | ||
1215 | ; | ||
1216 | ; Round 0 | ||
1217 | mov eax, DWORD PTR [ebp] | ||
1218 | xor ebx, ebx | ||
1219 | mov edx, DWORD PTR 4[ebp] | ||
1220 | xor eax, edi | ||
1221 | xor edx, edi | ||
1222 | and eax, 0fcfcfcfch | ||
1223 | and edx, 0cfcfcfcfh | ||
1224 | mov bl, al | ||
1225 | mov cl, ah | ||
1226 | ror edx, 4 | ||
1227 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1228 | mov bl, dl | ||
1229 | xor esi, ebp | ||
1230 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1231 | xor esi, ebp | ||
1232 | mov cl, dh | ||
1233 | shr eax, 16 | ||
1234 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1235 | xor esi, ebp | ||
1236 | mov bl, ah | ||
1237 | shr edx, 16 | ||
1238 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1239 | xor esi, ebp | ||
1240 | mov ebp, DWORD PTR 24[esp] | ||
1241 | mov cl, dh | ||
1242 | and eax, 0ffh | ||
1243 | and edx, 0ffh | ||
1244 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1245 | xor esi, ebx | ||
1246 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1247 | xor esi, ebx | ||
1248 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1249 | xor esi, ebx | ||
1250 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1251 | xor esi, ebx | ||
1252 | $L001end: | ||
1253 | ; | ||
1254 | ; FP | ||
1255 | mov edx, DWORD PTR 20[esp] | ||
1256 | ror esi, 1 | ||
1257 | mov eax, edi | ||
1258 | xor edi, esi | ||
1259 | and edi, 0aaaaaaaah | ||
1260 | xor eax, edi | ||
1261 | xor esi, edi | ||
1262 | ; | ||
1263 | rol eax, 23 | ||
1264 | mov edi, eax | ||
1265 | xor eax, esi | ||
1266 | and eax, 003fc03fch | ||
1267 | xor edi, eax | ||
1268 | xor esi, eax | ||
1269 | ; | ||
1270 | rol edi, 10 | ||
1271 | mov eax, edi | ||
1272 | xor edi, esi | ||
1273 | and edi, 033333333h | ||
1274 | xor eax, edi | ||
1275 | xor esi, edi | ||
1276 | ; | ||
1277 | rol esi, 18 | ||
1278 | mov edi, esi | ||
1279 | xor esi, eax | ||
1280 | and esi, 0fff0000fh | ||
1281 | xor edi, esi | ||
1282 | xor eax, esi | ||
1283 | ; | ||
1284 | rol edi, 12 | ||
1285 | mov esi, edi | ||
1286 | xor edi, eax | ||
1287 | and edi, 0f0f0f0f0h | ||
1288 | xor esi, edi | ||
1289 | xor eax, edi | ||
1290 | ; | ||
1291 | ror eax, 4 | ||
1292 | mov DWORD PTR [edx],eax | ||
1293 | mov DWORD PTR 4[edx],esi | ||
1294 | pop ebp | ||
1295 | pop ebx | ||
1296 | pop edi | ||
1297 | pop esi | ||
1298 | ret | ||
1299 | _des_encrypt ENDP | ||
1300 | _TEXT ENDS | ||
1301 | _TEXT SEGMENT | ||
1302 | PUBLIC _des_encrypt2 | ||
1303 | EXTRN _des_SPtrans:DWORD | ||
1304 | _des_encrypt2 PROC NEAR | ||
1305 | push esi | ||
1306 | push edi | ||
1307 | ; | ||
1308 | ; Load the 2 words | ||
1309 | mov eax, DWORD PTR 12[esp] | ||
1310 | xor ecx, ecx | ||
1311 | push ebx | ||
1312 | push ebp | ||
1313 | mov esi, DWORD PTR [eax] | ||
1314 | mov ebx, DWORD PTR 28[esp] | ||
1315 | rol esi, 3 | ||
1316 | mov edi, DWORD PTR 4[eax] | ||
1317 | rol edi, 3 | ||
1318 | mov ebp, DWORD PTR 24[esp] | ||
1319 | cmp ebx, 0 | ||
1320 | je $L002start_decrypt | ||
1321 | ; | ||
1322 | ; Round 0 | ||
1323 | mov eax, DWORD PTR [ebp] | ||
1324 | xor ebx, ebx | ||
1325 | mov edx, DWORD PTR 4[ebp] | ||
1326 | xor eax, esi | ||
1327 | xor edx, esi | ||
1328 | and eax, 0fcfcfcfch | ||
1329 | and edx, 0cfcfcfcfh | ||
1330 | mov bl, al | ||
1331 | mov cl, ah | ||
1332 | ror edx, 4 | ||
1333 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1334 | mov bl, dl | ||
1335 | xor edi, ebp | ||
1336 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1337 | xor edi, ebp | ||
1338 | mov cl, dh | ||
1339 | shr eax, 16 | ||
1340 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1341 | xor edi, ebp | ||
1342 | mov bl, ah | ||
1343 | shr edx, 16 | ||
1344 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1345 | xor edi, ebp | ||
1346 | mov ebp, DWORD PTR 24[esp] | ||
1347 | mov cl, dh | ||
1348 | and eax, 0ffh | ||
1349 | and edx, 0ffh | ||
1350 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1351 | xor edi, ebx | ||
1352 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1353 | xor edi, ebx | ||
1354 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1355 | xor edi, ebx | ||
1356 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1357 | xor edi, ebx | ||
1358 | ; | ||
1359 | ; Round 1 | ||
1360 | mov eax, DWORD PTR 8[ebp] | ||
1361 | xor ebx, ebx | ||
1362 | mov edx, DWORD PTR 12[ebp] | ||
1363 | xor eax, edi | ||
1364 | xor edx, edi | ||
1365 | and eax, 0fcfcfcfch | ||
1366 | and edx, 0cfcfcfcfh | ||
1367 | mov bl, al | ||
1368 | mov cl, ah | ||
1369 | ror edx, 4 | ||
1370 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1371 | mov bl, dl | ||
1372 | xor esi, ebp | ||
1373 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1374 | xor esi, ebp | ||
1375 | mov cl, dh | ||
1376 | shr eax, 16 | ||
1377 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1378 | xor esi, ebp | ||
1379 | mov bl, ah | ||
1380 | shr edx, 16 | ||
1381 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1382 | xor esi, ebp | ||
1383 | mov ebp, DWORD PTR 24[esp] | ||
1384 | mov cl, dh | ||
1385 | and eax, 0ffh | ||
1386 | and edx, 0ffh | ||
1387 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1388 | xor esi, ebx | ||
1389 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1390 | xor esi, ebx | ||
1391 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1392 | xor esi, ebx | ||
1393 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1394 | xor esi, ebx | ||
1395 | ; | ||
1396 | ; Round 2 | ||
1397 | mov eax, DWORD PTR 16[ebp] | ||
1398 | xor ebx, ebx | ||
1399 | mov edx, DWORD PTR 20[ebp] | ||
1400 | xor eax, esi | ||
1401 | xor edx, esi | ||
1402 | and eax, 0fcfcfcfch | ||
1403 | and edx, 0cfcfcfcfh | ||
1404 | mov bl, al | ||
1405 | mov cl, ah | ||
1406 | ror edx, 4 | ||
1407 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1408 | mov bl, dl | ||
1409 | xor edi, ebp | ||
1410 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1411 | xor edi, ebp | ||
1412 | mov cl, dh | ||
1413 | shr eax, 16 | ||
1414 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1415 | xor edi, ebp | ||
1416 | mov bl, ah | ||
1417 | shr edx, 16 | ||
1418 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1419 | xor edi, ebp | ||
1420 | mov ebp, DWORD PTR 24[esp] | ||
1421 | mov cl, dh | ||
1422 | and eax, 0ffh | ||
1423 | and edx, 0ffh | ||
1424 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1425 | xor edi, ebx | ||
1426 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1427 | xor edi, ebx | ||
1428 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1429 | xor edi, ebx | ||
1430 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1431 | xor edi, ebx | ||
1432 | ; | ||
1433 | ; Round 3 | ||
1434 | mov eax, DWORD PTR 24[ebp] | ||
1435 | xor ebx, ebx | ||
1436 | mov edx, DWORD PTR 28[ebp] | ||
1437 | xor eax, edi | ||
1438 | xor edx, edi | ||
1439 | and eax, 0fcfcfcfch | ||
1440 | and edx, 0cfcfcfcfh | ||
1441 | mov bl, al | ||
1442 | mov cl, ah | ||
1443 | ror edx, 4 | ||
1444 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1445 | mov bl, dl | ||
1446 | xor esi, ebp | ||
1447 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1448 | xor esi, ebp | ||
1449 | mov cl, dh | ||
1450 | shr eax, 16 | ||
1451 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1452 | xor esi, ebp | ||
1453 | mov bl, ah | ||
1454 | shr edx, 16 | ||
1455 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1456 | xor esi, ebp | ||
1457 | mov ebp, DWORD PTR 24[esp] | ||
1458 | mov cl, dh | ||
1459 | and eax, 0ffh | ||
1460 | and edx, 0ffh | ||
1461 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1462 | xor esi, ebx | ||
1463 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1464 | xor esi, ebx | ||
1465 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1466 | xor esi, ebx | ||
1467 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1468 | xor esi, ebx | ||
1469 | ; | ||
1470 | ; Round 4 | ||
1471 | mov eax, DWORD PTR 32[ebp] | ||
1472 | xor ebx, ebx | ||
1473 | mov edx, DWORD PTR 36[ebp] | ||
1474 | xor eax, esi | ||
1475 | xor edx, esi | ||
1476 | and eax, 0fcfcfcfch | ||
1477 | and edx, 0cfcfcfcfh | ||
1478 | mov bl, al | ||
1479 | mov cl, ah | ||
1480 | ror edx, 4 | ||
1481 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1482 | mov bl, dl | ||
1483 | xor edi, ebp | ||
1484 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1485 | xor edi, ebp | ||
1486 | mov cl, dh | ||
1487 | shr eax, 16 | ||
1488 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1489 | xor edi, ebp | ||
1490 | mov bl, ah | ||
1491 | shr edx, 16 | ||
1492 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1493 | xor edi, ebp | ||
1494 | mov ebp, DWORD PTR 24[esp] | ||
1495 | mov cl, dh | ||
1496 | and eax, 0ffh | ||
1497 | and edx, 0ffh | ||
1498 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1499 | xor edi, ebx | ||
1500 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1501 | xor edi, ebx | ||
1502 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1503 | xor edi, ebx | ||
1504 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1505 | xor edi, ebx | ||
1506 | ; | ||
1507 | ; Round 5 | ||
1508 | mov eax, DWORD PTR 40[ebp] | ||
1509 | xor ebx, ebx | ||
1510 | mov edx, DWORD PTR 44[ebp] | ||
1511 | xor eax, edi | ||
1512 | xor edx, edi | ||
1513 | and eax, 0fcfcfcfch | ||
1514 | and edx, 0cfcfcfcfh | ||
1515 | mov bl, al | ||
1516 | mov cl, ah | ||
1517 | ror edx, 4 | ||
1518 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1519 | mov bl, dl | ||
1520 | xor esi, ebp | ||
1521 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1522 | xor esi, ebp | ||
1523 | mov cl, dh | ||
1524 | shr eax, 16 | ||
1525 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1526 | xor esi, ebp | ||
1527 | mov bl, ah | ||
1528 | shr edx, 16 | ||
1529 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1530 | xor esi, ebp | ||
1531 | mov ebp, DWORD PTR 24[esp] | ||
1532 | mov cl, dh | ||
1533 | and eax, 0ffh | ||
1534 | and edx, 0ffh | ||
1535 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1536 | xor esi, ebx | ||
1537 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1538 | xor esi, ebx | ||
1539 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1540 | xor esi, ebx | ||
1541 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1542 | xor esi, ebx | ||
1543 | ; | ||
1544 | ; Round 6 | ||
1545 | mov eax, DWORD PTR 48[ebp] | ||
1546 | xor ebx, ebx | ||
1547 | mov edx, DWORD PTR 52[ebp] | ||
1548 | xor eax, esi | ||
1549 | xor edx, esi | ||
1550 | and eax, 0fcfcfcfch | ||
1551 | and edx, 0cfcfcfcfh | ||
1552 | mov bl, al | ||
1553 | mov cl, ah | ||
1554 | ror edx, 4 | ||
1555 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1556 | mov bl, dl | ||
1557 | xor edi, ebp | ||
1558 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1559 | xor edi, ebp | ||
1560 | mov cl, dh | ||
1561 | shr eax, 16 | ||
1562 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1563 | xor edi, ebp | ||
1564 | mov bl, ah | ||
1565 | shr edx, 16 | ||
1566 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1567 | xor edi, ebp | ||
1568 | mov ebp, DWORD PTR 24[esp] | ||
1569 | mov cl, dh | ||
1570 | and eax, 0ffh | ||
1571 | and edx, 0ffh | ||
1572 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1573 | xor edi, ebx | ||
1574 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1575 | xor edi, ebx | ||
1576 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1577 | xor edi, ebx | ||
1578 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1579 | xor edi, ebx | ||
1580 | ; | ||
1581 | ; Round 7 | ||
1582 | mov eax, DWORD PTR 56[ebp] | ||
1583 | xor ebx, ebx | ||
1584 | mov edx, DWORD PTR 60[ebp] | ||
1585 | xor eax, edi | ||
1586 | xor edx, edi | ||
1587 | and eax, 0fcfcfcfch | ||
1588 | and edx, 0cfcfcfcfh | ||
1589 | mov bl, al | ||
1590 | mov cl, ah | ||
1591 | ror edx, 4 | ||
1592 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1593 | mov bl, dl | ||
1594 | xor esi, ebp | ||
1595 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1596 | xor esi, ebp | ||
1597 | mov cl, dh | ||
1598 | shr eax, 16 | ||
1599 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1600 | xor esi, ebp | ||
1601 | mov bl, ah | ||
1602 | shr edx, 16 | ||
1603 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1604 | xor esi, ebp | ||
1605 | mov ebp, DWORD PTR 24[esp] | ||
1606 | mov cl, dh | ||
1607 | and eax, 0ffh | ||
1608 | and edx, 0ffh | ||
1609 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1610 | xor esi, ebx | ||
1611 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1612 | xor esi, ebx | ||
1613 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1614 | xor esi, ebx | ||
1615 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1616 | xor esi, ebx | ||
1617 | ; | ||
1618 | ; Round 8 | ||
1619 | mov eax, DWORD PTR 64[ebp] | ||
1620 | xor ebx, ebx | ||
1621 | mov edx, DWORD PTR 68[ebp] | ||
1622 | xor eax, esi | ||
1623 | xor edx, esi | ||
1624 | and eax, 0fcfcfcfch | ||
1625 | and edx, 0cfcfcfcfh | ||
1626 | mov bl, al | ||
1627 | mov cl, ah | ||
1628 | ror edx, 4 | ||
1629 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1630 | mov bl, dl | ||
1631 | xor edi, ebp | ||
1632 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1633 | xor edi, ebp | ||
1634 | mov cl, dh | ||
1635 | shr eax, 16 | ||
1636 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1637 | xor edi, ebp | ||
1638 | mov bl, ah | ||
1639 | shr edx, 16 | ||
1640 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1641 | xor edi, ebp | ||
1642 | mov ebp, DWORD PTR 24[esp] | ||
1643 | mov cl, dh | ||
1644 | and eax, 0ffh | ||
1645 | and edx, 0ffh | ||
1646 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1647 | xor edi, ebx | ||
1648 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1649 | xor edi, ebx | ||
1650 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1651 | xor edi, ebx | ||
1652 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1653 | xor edi, ebx | ||
1654 | ; | ||
1655 | ; Round 9 | ||
1656 | mov eax, DWORD PTR 72[ebp] | ||
1657 | xor ebx, ebx | ||
1658 | mov edx, DWORD PTR 76[ebp] | ||
1659 | xor eax, edi | ||
1660 | xor edx, edi | ||
1661 | and eax, 0fcfcfcfch | ||
1662 | and edx, 0cfcfcfcfh | ||
1663 | mov bl, al | ||
1664 | mov cl, ah | ||
1665 | ror edx, 4 | ||
1666 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1667 | mov bl, dl | ||
1668 | xor esi, ebp | ||
1669 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1670 | xor esi, ebp | ||
1671 | mov cl, dh | ||
1672 | shr eax, 16 | ||
1673 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1674 | xor esi, ebp | ||
1675 | mov bl, ah | ||
1676 | shr edx, 16 | ||
1677 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1678 | xor esi, ebp | ||
1679 | mov ebp, DWORD PTR 24[esp] | ||
1680 | mov cl, dh | ||
1681 | and eax, 0ffh | ||
1682 | and edx, 0ffh | ||
1683 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1684 | xor esi, ebx | ||
1685 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1686 | xor esi, ebx | ||
1687 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1688 | xor esi, ebx | ||
1689 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1690 | xor esi, ebx | ||
1691 | ; | ||
1692 | ; Round 10 | ||
1693 | mov eax, DWORD PTR 80[ebp] | ||
1694 | xor ebx, ebx | ||
1695 | mov edx, DWORD PTR 84[ebp] | ||
1696 | xor eax, esi | ||
1697 | xor edx, esi | ||
1698 | and eax, 0fcfcfcfch | ||
1699 | and edx, 0cfcfcfcfh | ||
1700 | mov bl, al | ||
1701 | mov cl, ah | ||
1702 | ror edx, 4 | ||
1703 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1704 | mov bl, dl | ||
1705 | xor edi, ebp | ||
1706 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1707 | xor edi, ebp | ||
1708 | mov cl, dh | ||
1709 | shr eax, 16 | ||
1710 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1711 | xor edi, ebp | ||
1712 | mov bl, ah | ||
1713 | shr edx, 16 | ||
1714 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1715 | xor edi, ebp | ||
1716 | mov ebp, DWORD PTR 24[esp] | ||
1717 | mov cl, dh | ||
1718 | and eax, 0ffh | ||
1719 | and edx, 0ffh | ||
1720 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1721 | xor edi, ebx | ||
1722 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1723 | xor edi, ebx | ||
1724 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1725 | xor edi, ebx | ||
1726 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1727 | xor edi, ebx | ||
1728 | ; | ||
1729 | ; Round 11 | ||
1730 | mov eax, DWORD PTR 88[ebp] | ||
1731 | xor ebx, ebx | ||
1732 | mov edx, DWORD PTR 92[ebp] | ||
1733 | xor eax, edi | ||
1734 | xor edx, edi | ||
1735 | and eax, 0fcfcfcfch | ||
1736 | and edx, 0cfcfcfcfh | ||
1737 | mov bl, al | ||
1738 | mov cl, ah | ||
1739 | ror edx, 4 | ||
1740 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1741 | mov bl, dl | ||
1742 | xor esi, ebp | ||
1743 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1744 | xor esi, ebp | ||
1745 | mov cl, dh | ||
1746 | shr eax, 16 | ||
1747 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1748 | xor esi, ebp | ||
1749 | mov bl, ah | ||
1750 | shr edx, 16 | ||
1751 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1752 | xor esi, ebp | ||
1753 | mov ebp, DWORD PTR 24[esp] | ||
1754 | mov cl, dh | ||
1755 | and eax, 0ffh | ||
1756 | and edx, 0ffh | ||
1757 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1758 | xor esi, ebx | ||
1759 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1760 | xor esi, ebx | ||
1761 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1762 | xor esi, ebx | ||
1763 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1764 | xor esi, ebx | ||
1765 | ; | ||
1766 | ; Round 12 | ||
1767 | mov eax, DWORD PTR 96[ebp] | ||
1768 | xor ebx, ebx | ||
1769 | mov edx, DWORD PTR 100[ebp] | ||
1770 | xor eax, esi | ||
1771 | xor edx, esi | ||
1772 | and eax, 0fcfcfcfch | ||
1773 | and edx, 0cfcfcfcfh | ||
1774 | mov bl, al | ||
1775 | mov cl, ah | ||
1776 | ror edx, 4 | ||
1777 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1778 | mov bl, dl | ||
1779 | xor edi, ebp | ||
1780 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1781 | xor edi, ebp | ||
1782 | mov cl, dh | ||
1783 | shr eax, 16 | ||
1784 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1785 | xor edi, ebp | ||
1786 | mov bl, ah | ||
1787 | shr edx, 16 | ||
1788 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1789 | xor edi, ebp | ||
1790 | mov ebp, DWORD PTR 24[esp] | ||
1791 | mov cl, dh | ||
1792 | and eax, 0ffh | ||
1793 | and edx, 0ffh | ||
1794 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1795 | xor edi, ebx | ||
1796 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1797 | xor edi, ebx | ||
1798 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1799 | xor edi, ebx | ||
1800 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1801 | xor edi, ebx | ||
1802 | ; | ||
1803 | ; Round 13 | ||
1804 | mov eax, DWORD PTR 104[ebp] | ||
1805 | xor ebx, ebx | ||
1806 | mov edx, DWORD PTR 108[ebp] | ||
1807 | xor eax, edi | ||
1808 | xor edx, edi | ||
1809 | and eax, 0fcfcfcfch | ||
1810 | and edx, 0cfcfcfcfh | ||
1811 | mov bl, al | ||
1812 | mov cl, ah | ||
1813 | ror edx, 4 | ||
1814 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1815 | mov bl, dl | ||
1816 | xor esi, ebp | ||
1817 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1818 | xor esi, ebp | ||
1819 | mov cl, dh | ||
1820 | shr eax, 16 | ||
1821 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1822 | xor esi, ebp | ||
1823 | mov bl, ah | ||
1824 | shr edx, 16 | ||
1825 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1826 | xor esi, ebp | ||
1827 | mov ebp, DWORD PTR 24[esp] | ||
1828 | mov cl, dh | ||
1829 | and eax, 0ffh | ||
1830 | and edx, 0ffh | ||
1831 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1832 | xor esi, ebx | ||
1833 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1834 | xor esi, ebx | ||
1835 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1836 | xor esi, ebx | ||
1837 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1838 | xor esi, ebx | ||
1839 | ; | ||
1840 | ; Round 14 | ||
1841 | mov eax, DWORD PTR 112[ebp] | ||
1842 | xor ebx, ebx | ||
1843 | mov edx, DWORD PTR 116[ebp] | ||
1844 | xor eax, esi | ||
1845 | xor edx, esi | ||
1846 | and eax, 0fcfcfcfch | ||
1847 | and edx, 0cfcfcfcfh | ||
1848 | mov bl, al | ||
1849 | mov cl, ah | ||
1850 | ror edx, 4 | ||
1851 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1852 | mov bl, dl | ||
1853 | xor edi, ebp | ||
1854 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1855 | xor edi, ebp | ||
1856 | mov cl, dh | ||
1857 | shr eax, 16 | ||
1858 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1859 | xor edi, ebp | ||
1860 | mov bl, ah | ||
1861 | shr edx, 16 | ||
1862 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1863 | xor edi, ebp | ||
1864 | mov ebp, DWORD PTR 24[esp] | ||
1865 | mov cl, dh | ||
1866 | and eax, 0ffh | ||
1867 | and edx, 0ffh | ||
1868 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1869 | xor edi, ebx | ||
1870 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1871 | xor edi, ebx | ||
1872 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1873 | xor edi, ebx | ||
1874 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1875 | xor edi, ebx | ||
1876 | ; | ||
1877 | ; Round 15 | ||
1878 | mov eax, DWORD PTR 120[ebp] | ||
1879 | xor ebx, ebx | ||
1880 | mov edx, DWORD PTR 124[ebp] | ||
1881 | xor eax, edi | ||
1882 | xor edx, edi | ||
1883 | and eax, 0fcfcfcfch | ||
1884 | and edx, 0cfcfcfcfh | ||
1885 | mov bl, al | ||
1886 | mov cl, ah | ||
1887 | ror edx, 4 | ||
1888 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1889 | mov bl, dl | ||
1890 | xor esi, ebp | ||
1891 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1892 | xor esi, ebp | ||
1893 | mov cl, dh | ||
1894 | shr eax, 16 | ||
1895 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1896 | xor esi, ebp | ||
1897 | mov bl, ah | ||
1898 | shr edx, 16 | ||
1899 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1900 | xor esi, ebp | ||
1901 | mov ebp, DWORD PTR 24[esp] | ||
1902 | mov cl, dh | ||
1903 | and eax, 0ffh | ||
1904 | and edx, 0ffh | ||
1905 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1906 | xor esi, ebx | ||
1907 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1908 | xor esi, ebx | ||
1909 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1910 | xor esi, ebx | ||
1911 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1912 | xor esi, ebx | ||
1913 | jmp $L003end | ||
1914 | $L002start_decrypt: | ||
1915 | ; | ||
1916 | ; Round 15 | ||
1917 | mov eax, DWORD PTR 120[ebp] | ||
1918 | xor ebx, ebx | ||
1919 | mov edx, DWORD PTR 124[ebp] | ||
1920 | xor eax, esi | ||
1921 | xor edx, esi | ||
1922 | and eax, 0fcfcfcfch | ||
1923 | and edx, 0cfcfcfcfh | ||
1924 | mov bl, al | ||
1925 | mov cl, ah | ||
1926 | ror edx, 4 | ||
1927 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1928 | mov bl, dl | ||
1929 | xor edi, ebp | ||
1930 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1931 | xor edi, ebp | ||
1932 | mov cl, dh | ||
1933 | shr eax, 16 | ||
1934 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1935 | xor edi, ebp | ||
1936 | mov bl, ah | ||
1937 | shr edx, 16 | ||
1938 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1939 | xor edi, ebp | ||
1940 | mov ebp, DWORD PTR 24[esp] | ||
1941 | mov cl, dh | ||
1942 | and eax, 0ffh | ||
1943 | and edx, 0ffh | ||
1944 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1945 | xor edi, ebx | ||
1946 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1947 | xor edi, ebx | ||
1948 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1949 | xor edi, ebx | ||
1950 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1951 | xor edi, ebx | ||
1952 | ; | ||
1953 | ; Round 14 | ||
1954 | mov eax, DWORD PTR 112[ebp] | ||
1955 | xor ebx, ebx | ||
1956 | mov edx, DWORD PTR 116[ebp] | ||
1957 | xor eax, edi | ||
1958 | xor edx, edi | ||
1959 | and eax, 0fcfcfcfch | ||
1960 | and edx, 0cfcfcfcfh | ||
1961 | mov bl, al | ||
1962 | mov cl, ah | ||
1963 | ror edx, 4 | ||
1964 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
1965 | mov bl, dl | ||
1966 | xor esi, ebp | ||
1967 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
1968 | xor esi, ebp | ||
1969 | mov cl, dh | ||
1970 | shr eax, 16 | ||
1971 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
1972 | xor esi, ebp | ||
1973 | mov bl, ah | ||
1974 | shr edx, 16 | ||
1975 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
1976 | xor esi, ebp | ||
1977 | mov ebp, DWORD PTR 24[esp] | ||
1978 | mov cl, dh | ||
1979 | and eax, 0ffh | ||
1980 | and edx, 0ffh | ||
1981 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
1982 | xor esi, ebx | ||
1983 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
1984 | xor esi, ebx | ||
1985 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
1986 | xor esi, ebx | ||
1987 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
1988 | xor esi, ebx | ||
1989 | ; | ||
1990 | ; Round 13 | ||
1991 | mov eax, DWORD PTR 104[ebp] | ||
1992 | xor ebx, ebx | ||
1993 | mov edx, DWORD PTR 108[ebp] | ||
1994 | xor eax, esi | ||
1995 | xor edx, esi | ||
1996 | and eax, 0fcfcfcfch | ||
1997 | and edx, 0cfcfcfcfh | ||
1998 | mov bl, al | ||
1999 | mov cl, ah | ||
2000 | ror edx, 4 | ||
2001 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2002 | mov bl, dl | ||
2003 | xor edi, ebp | ||
2004 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2005 | xor edi, ebp | ||
2006 | mov cl, dh | ||
2007 | shr eax, 16 | ||
2008 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2009 | xor edi, ebp | ||
2010 | mov bl, ah | ||
2011 | shr edx, 16 | ||
2012 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2013 | xor edi, ebp | ||
2014 | mov ebp, DWORD PTR 24[esp] | ||
2015 | mov cl, dh | ||
2016 | and eax, 0ffh | ||
2017 | and edx, 0ffh | ||
2018 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2019 | xor edi, ebx | ||
2020 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2021 | xor edi, ebx | ||
2022 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2023 | xor edi, ebx | ||
2024 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2025 | xor edi, ebx | ||
2026 | ; | ||
2027 | ; Round 12 | ||
2028 | mov eax, DWORD PTR 96[ebp] | ||
2029 | xor ebx, ebx | ||
2030 | mov edx, DWORD PTR 100[ebp] | ||
2031 | xor eax, edi | ||
2032 | xor edx, edi | ||
2033 | and eax, 0fcfcfcfch | ||
2034 | and edx, 0cfcfcfcfh | ||
2035 | mov bl, al | ||
2036 | mov cl, ah | ||
2037 | ror edx, 4 | ||
2038 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2039 | mov bl, dl | ||
2040 | xor esi, ebp | ||
2041 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2042 | xor esi, ebp | ||
2043 | mov cl, dh | ||
2044 | shr eax, 16 | ||
2045 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2046 | xor esi, ebp | ||
2047 | mov bl, ah | ||
2048 | shr edx, 16 | ||
2049 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2050 | xor esi, ebp | ||
2051 | mov ebp, DWORD PTR 24[esp] | ||
2052 | mov cl, dh | ||
2053 | and eax, 0ffh | ||
2054 | and edx, 0ffh | ||
2055 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2056 | xor esi, ebx | ||
2057 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2058 | xor esi, ebx | ||
2059 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2060 | xor esi, ebx | ||
2061 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2062 | xor esi, ebx | ||
2063 | ; | ||
2064 | ; Round 11 | ||
2065 | mov eax, DWORD PTR 88[ebp] | ||
2066 | xor ebx, ebx | ||
2067 | mov edx, DWORD PTR 92[ebp] | ||
2068 | xor eax, esi | ||
2069 | xor edx, esi | ||
2070 | and eax, 0fcfcfcfch | ||
2071 | and edx, 0cfcfcfcfh | ||
2072 | mov bl, al | ||
2073 | mov cl, ah | ||
2074 | ror edx, 4 | ||
2075 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2076 | mov bl, dl | ||
2077 | xor edi, ebp | ||
2078 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2079 | xor edi, ebp | ||
2080 | mov cl, dh | ||
2081 | shr eax, 16 | ||
2082 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2083 | xor edi, ebp | ||
2084 | mov bl, ah | ||
2085 | shr edx, 16 | ||
2086 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2087 | xor edi, ebp | ||
2088 | mov ebp, DWORD PTR 24[esp] | ||
2089 | mov cl, dh | ||
2090 | and eax, 0ffh | ||
2091 | and edx, 0ffh | ||
2092 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2093 | xor edi, ebx | ||
2094 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2095 | xor edi, ebx | ||
2096 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2097 | xor edi, ebx | ||
2098 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2099 | xor edi, ebx | ||
2100 | ; | ||
2101 | ; Round 10 | ||
2102 | mov eax, DWORD PTR 80[ebp] | ||
2103 | xor ebx, ebx | ||
2104 | mov edx, DWORD PTR 84[ebp] | ||
2105 | xor eax, edi | ||
2106 | xor edx, edi | ||
2107 | and eax, 0fcfcfcfch | ||
2108 | and edx, 0cfcfcfcfh | ||
2109 | mov bl, al | ||
2110 | mov cl, ah | ||
2111 | ror edx, 4 | ||
2112 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2113 | mov bl, dl | ||
2114 | xor esi, ebp | ||
2115 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2116 | xor esi, ebp | ||
2117 | mov cl, dh | ||
2118 | shr eax, 16 | ||
2119 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2120 | xor esi, ebp | ||
2121 | mov bl, ah | ||
2122 | shr edx, 16 | ||
2123 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2124 | xor esi, ebp | ||
2125 | mov ebp, DWORD PTR 24[esp] | ||
2126 | mov cl, dh | ||
2127 | and eax, 0ffh | ||
2128 | and edx, 0ffh | ||
2129 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2130 | xor esi, ebx | ||
2131 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2132 | xor esi, ebx | ||
2133 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2134 | xor esi, ebx | ||
2135 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2136 | xor esi, ebx | ||
2137 | ; | ||
2138 | ; Round 9 | ||
2139 | mov eax, DWORD PTR 72[ebp] | ||
2140 | xor ebx, ebx | ||
2141 | mov edx, DWORD PTR 76[ebp] | ||
2142 | xor eax, esi | ||
2143 | xor edx, esi | ||
2144 | and eax, 0fcfcfcfch | ||
2145 | and edx, 0cfcfcfcfh | ||
2146 | mov bl, al | ||
2147 | mov cl, ah | ||
2148 | ror edx, 4 | ||
2149 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2150 | mov bl, dl | ||
2151 | xor edi, ebp | ||
2152 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2153 | xor edi, ebp | ||
2154 | mov cl, dh | ||
2155 | shr eax, 16 | ||
2156 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2157 | xor edi, ebp | ||
2158 | mov bl, ah | ||
2159 | shr edx, 16 | ||
2160 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2161 | xor edi, ebp | ||
2162 | mov ebp, DWORD PTR 24[esp] | ||
2163 | mov cl, dh | ||
2164 | and eax, 0ffh | ||
2165 | and edx, 0ffh | ||
2166 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2167 | xor edi, ebx | ||
2168 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2169 | xor edi, ebx | ||
2170 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2171 | xor edi, ebx | ||
2172 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2173 | xor edi, ebx | ||
2174 | ; | ||
2175 | ; Round 8 | ||
2176 | mov eax, DWORD PTR 64[ebp] | ||
2177 | xor ebx, ebx | ||
2178 | mov edx, DWORD PTR 68[ebp] | ||
2179 | xor eax, edi | ||
2180 | xor edx, edi | ||
2181 | and eax, 0fcfcfcfch | ||
2182 | and edx, 0cfcfcfcfh | ||
2183 | mov bl, al | ||
2184 | mov cl, ah | ||
2185 | ror edx, 4 | ||
2186 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2187 | mov bl, dl | ||
2188 | xor esi, ebp | ||
2189 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2190 | xor esi, ebp | ||
2191 | mov cl, dh | ||
2192 | shr eax, 16 | ||
2193 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2194 | xor esi, ebp | ||
2195 | mov bl, ah | ||
2196 | shr edx, 16 | ||
2197 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2198 | xor esi, ebp | ||
2199 | mov ebp, DWORD PTR 24[esp] | ||
2200 | mov cl, dh | ||
2201 | and eax, 0ffh | ||
2202 | and edx, 0ffh | ||
2203 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2204 | xor esi, ebx | ||
2205 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2206 | xor esi, ebx | ||
2207 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2208 | xor esi, ebx | ||
2209 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2210 | xor esi, ebx | ||
2211 | ; | ||
2212 | ; Round 7 | ||
2213 | mov eax, DWORD PTR 56[ebp] | ||
2214 | xor ebx, ebx | ||
2215 | mov edx, DWORD PTR 60[ebp] | ||
2216 | xor eax, esi | ||
2217 | xor edx, esi | ||
2218 | and eax, 0fcfcfcfch | ||
2219 | and edx, 0cfcfcfcfh | ||
2220 | mov bl, al | ||
2221 | mov cl, ah | ||
2222 | ror edx, 4 | ||
2223 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2224 | mov bl, dl | ||
2225 | xor edi, ebp | ||
2226 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2227 | xor edi, ebp | ||
2228 | mov cl, dh | ||
2229 | shr eax, 16 | ||
2230 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2231 | xor edi, ebp | ||
2232 | mov bl, ah | ||
2233 | shr edx, 16 | ||
2234 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2235 | xor edi, ebp | ||
2236 | mov ebp, DWORD PTR 24[esp] | ||
2237 | mov cl, dh | ||
2238 | and eax, 0ffh | ||
2239 | and edx, 0ffh | ||
2240 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2241 | xor edi, ebx | ||
2242 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2243 | xor edi, ebx | ||
2244 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2245 | xor edi, ebx | ||
2246 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2247 | xor edi, ebx | ||
2248 | ; | ||
2249 | ; Round 6 | ||
2250 | mov eax, DWORD PTR 48[ebp] | ||
2251 | xor ebx, ebx | ||
2252 | mov edx, DWORD PTR 52[ebp] | ||
2253 | xor eax, edi | ||
2254 | xor edx, edi | ||
2255 | and eax, 0fcfcfcfch | ||
2256 | and edx, 0cfcfcfcfh | ||
2257 | mov bl, al | ||
2258 | mov cl, ah | ||
2259 | ror edx, 4 | ||
2260 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2261 | mov bl, dl | ||
2262 | xor esi, ebp | ||
2263 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2264 | xor esi, ebp | ||
2265 | mov cl, dh | ||
2266 | shr eax, 16 | ||
2267 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2268 | xor esi, ebp | ||
2269 | mov bl, ah | ||
2270 | shr edx, 16 | ||
2271 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2272 | xor esi, ebp | ||
2273 | mov ebp, DWORD PTR 24[esp] | ||
2274 | mov cl, dh | ||
2275 | and eax, 0ffh | ||
2276 | and edx, 0ffh | ||
2277 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2278 | xor esi, ebx | ||
2279 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2280 | xor esi, ebx | ||
2281 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2282 | xor esi, ebx | ||
2283 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2284 | xor esi, ebx | ||
2285 | ; | ||
2286 | ; Round 5 | ||
2287 | mov eax, DWORD PTR 40[ebp] | ||
2288 | xor ebx, ebx | ||
2289 | mov edx, DWORD PTR 44[ebp] | ||
2290 | xor eax, esi | ||
2291 | xor edx, esi | ||
2292 | and eax, 0fcfcfcfch | ||
2293 | and edx, 0cfcfcfcfh | ||
2294 | mov bl, al | ||
2295 | mov cl, ah | ||
2296 | ror edx, 4 | ||
2297 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2298 | mov bl, dl | ||
2299 | xor edi, ebp | ||
2300 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2301 | xor edi, ebp | ||
2302 | mov cl, dh | ||
2303 | shr eax, 16 | ||
2304 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2305 | xor edi, ebp | ||
2306 | mov bl, ah | ||
2307 | shr edx, 16 | ||
2308 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2309 | xor edi, ebp | ||
2310 | mov ebp, DWORD PTR 24[esp] | ||
2311 | mov cl, dh | ||
2312 | and eax, 0ffh | ||
2313 | and edx, 0ffh | ||
2314 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2315 | xor edi, ebx | ||
2316 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2317 | xor edi, ebx | ||
2318 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2319 | xor edi, ebx | ||
2320 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2321 | xor edi, ebx | ||
2322 | ; | ||
2323 | ; Round 4 | ||
2324 | mov eax, DWORD PTR 32[ebp] | ||
2325 | xor ebx, ebx | ||
2326 | mov edx, DWORD PTR 36[ebp] | ||
2327 | xor eax, edi | ||
2328 | xor edx, edi | ||
2329 | and eax, 0fcfcfcfch | ||
2330 | and edx, 0cfcfcfcfh | ||
2331 | mov bl, al | ||
2332 | mov cl, ah | ||
2333 | ror edx, 4 | ||
2334 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2335 | mov bl, dl | ||
2336 | xor esi, ebp | ||
2337 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2338 | xor esi, ebp | ||
2339 | mov cl, dh | ||
2340 | shr eax, 16 | ||
2341 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2342 | xor esi, ebp | ||
2343 | mov bl, ah | ||
2344 | shr edx, 16 | ||
2345 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2346 | xor esi, ebp | ||
2347 | mov ebp, DWORD PTR 24[esp] | ||
2348 | mov cl, dh | ||
2349 | and eax, 0ffh | ||
2350 | and edx, 0ffh | ||
2351 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2352 | xor esi, ebx | ||
2353 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2354 | xor esi, ebx | ||
2355 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2356 | xor esi, ebx | ||
2357 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2358 | xor esi, ebx | ||
2359 | ; | ||
2360 | ; Round 3 | ||
2361 | mov eax, DWORD PTR 24[ebp] | ||
2362 | xor ebx, ebx | ||
2363 | mov edx, DWORD PTR 28[ebp] | ||
2364 | xor eax, esi | ||
2365 | xor edx, esi | ||
2366 | and eax, 0fcfcfcfch | ||
2367 | and edx, 0cfcfcfcfh | ||
2368 | mov bl, al | ||
2369 | mov cl, ah | ||
2370 | ror edx, 4 | ||
2371 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2372 | mov bl, dl | ||
2373 | xor edi, ebp | ||
2374 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2375 | xor edi, ebp | ||
2376 | mov cl, dh | ||
2377 | shr eax, 16 | ||
2378 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2379 | xor edi, ebp | ||
2380 | mov bl, ah | ||
2381 | shr edx, 16 | ||
2382 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2383 | xor edi, ebp | ||
2384 | mov ebp, DWORD PTR 24[esp] | ||
2385 | mov cl, dh | ||
2386 | and eax, 0ffh | ||
2387 | and edx, 0ffh | ||
2388 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2389 | xor edi, ebx | ||
2390 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2391 | xor edi, ebx | ||
2392 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2393 | xor edi, ebx | ||
2394 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2395 | xor edi, ebx | ||
2396 | ; | ||
2397 | ; Round 2 | ||
2398 | mov eax, DWORD PTR 16[ebp] | ||
2399 | xor ebx, ebx | ||
2400 | mov edx, DWORD PTR 20[ebp] | ||
2401 | xor eax, edi | ||
2402 | xor edx, edi | ||
2403 | and eax, 0fcfcfcfch | ||
2404 | and edx, 0cfcfcfcfh | ||
2405 | mov bl, al | ||
2406 | mov cl, ah | ||
2407 | ror edx, 4 | ||
2408 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2409 | mov bl, dl | ||
2410 | xor esi, ebp | ||
2411 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2412 | xor esi, ebp | ||
2413 | mov cl, dh | ||
2414 | shr eax, 16 | ||
2415 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2416 | xor esi, ebp | ||
2417 | mov bl, ah | ||
2418 | shr edx, 16 | ||
2419 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2420 | xor esi, ebp | ||
2421 | mov ebp, DWORD PTR 24[esp] | ||
2422 | mov cl, dh | ||
2423 | and eax, 0ffh | ||
2424 | and edx, 0ffh | ||
2425 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2426 | xor esi, ebx | ||
2427 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2428 | xor esi, ebx | ||
2429 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2430 | xor esi, ebx | ||
2431 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2432 | xor esi, ebx | ||
2433 | ; | ||
2434 | ; Round 1 | ||
2435 | mov eax, DWORD PTR 8[ebp] | ||
2436 | xor ebx, ebx | ||
2437 | mov edx, DWORD PTR 12[ebp] | ||
2438 | xor eax, esi | ||
2439 | xor edx, esi | ||
2440 | and eax, 0fcfcfcfch | ||
2441 | and edx, 0cfcfcfcfh | ||
2442 | mov bl, al | ||
2443 | mov cl, ah | ||
2444 | ror edx, 4 | ||
2445 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2446 | mov bl, dl | ||
2447 | xor edi, ebp | ||
2448 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2449 | xor edi, ebp | ||
2450 | mov cl, dh | ||
2451 | shr eax, 16 | ||
2452 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2453 | xor edi, ebp | ||
2454 | mov bl, ah | ||
2455 | shr edx, 16 | ||
2456 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2457 | xor edi, ebp | ||
2458 | mov ebp, DWORD PTR 24[esp] | ||
2459 | mov cl, dh | ||
2460 | and eax, 0ffh | ||
2461 | and edx, 0ffh | ||
2462 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2463 | xor edi, ebx | ||
2464 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2465 | xor edi, ebx | ||
2466 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2467 | xor edi, ebx | ||
2468 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2469 | xor edi, ebx | ||
2470 | ; | ||
2471 | ; Round 0 | ||
2472 | mov eax, DWORD PTR [ebp] | ||
2473 | xor ebx, ebx | ||
2474 | mov edx, DWORD PTR 4[ebp] | ||
2475 | xor eax, edi | ||
2476 | xor edx, edi | ||
2477 | and eax, 0fcfcfcfch | ||
2478 | and edx, 0cfcfcfcfh | ||
2479 | mov bl, al | ||
2480 | mov cl, ah | ||
2481 | ror edx, 4 | ||
2482 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
2483 | mov bl, dl | ||
2484 | xor esi, ebp | ||
2485 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
2486 | xor esi, ebp | ||
2487 | mov cl, dh | ||
2488 | shr eax, 16 | ||
2489 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
2490 | xor esi, ebp | ||
2491 | mov bl, ah | ||
2492 | shr edx, 16 | ||
2493 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
2494 | xor esi, ebp | ||
2495 | mov ebp, DWORD PTR 24[esp] | ||
2496 | mov cl, dh | ||
2497 | and eax, 0ffh | ||
2498 | and edx, 0ffh | ||
2499 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
2500 | xor esi, ebx | ||
2501 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
2502 | xor esi, ebx | ||
2503 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
2504 | xor esi, ebx | ||
2505 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
2506 | xor esi, ebx | ||
2507 | $L003end: | ||
2508 | ; | ||
2509 | ; Fixup | ||
2510 | ror edi, 3 | ||
2511 | mov eax, DWORD PTR 20[esp] | ||
2512 | ror esi, 3 | ||
2513 | mov DWORD PTR [eax],edi | ||
2514 | mov DWORD PTR 4[eax],esi | ||
2515 | pop ebp | ||
2516 | pop ebx | ||
2517 | pop edi | ||
2518 | pop esi | ||
2519 | ret | ||
2520 | _des_encrypt2 ENDP | ||
2521 | _TEXT ENDS | ||
2522 | _TEXT SEGMENT | ||
2523 | PUBLIC _des_encrypt3 | ||
2524 | |||
2525 | _des_encrypt3 PROC NEAR | ||
2526 | push ebx | ||
2527 | mov ebx, DWORD PTR 8[esp] | ||
2528 | push ebp | ||
2529 | push esi | ||
2530 | push edi | ||
2531 | ; | ||
2532 | ; Load the data words | ||
2533 | mov edi, DWORD PTR [ebx] | ||
2534 | mov esi, DWORD PTR 4[ebx] | ||
2535 | sub esp, 12 | ||
2536 | ; | ||
2537 | ; IP | ||
2538 | rol edi, 4 | ||
2539 | mov edx, edi | ||
2540 | xor edi, esi | ||
2541 | and edi, 0f0f0f0f0h | ||
2542 | xor edx, edi | ||
2543 | xor esi, edi | ||
2544 | ; | ||
2545 | rol esi, 20 | ||
2546 | mov edi, esi | ||
2547 | xor esi, edx | ||
2548 | and esi, 0fff0000fh | ||
2549 | xor edi, esi | ||
2550 | xor edx, esi | ||
2551 | ; | ||
2552 | rol edi, 14 | ||
2553 | mov esi, edi | ||
2554 | xor edi, edx | ||
2555 | and edi, 033333333h | ||
2556 | xor esi, edi | ||
2557 | xor edx, edi | ||
2558 | ; | ||
2559 | rol edx, 22 | ||
2560 | mov edi, edx | ||
2561 | xor edx, esi | ||
2562 | and edx, 003fc03fch | ||
2563 | xor edi, edx | ||
2564 | xor esi, edx | ||
2565 | ; | ||
2566 | rol edi, 9 | ||
2567 | mov edx, edi | ||
2568 | xor edi, esi | ||
2569 | and edi, 0aaaaaaaah | ||
2570 | xor edx, edi | ||
2571 | xor esi, edi | ||
2572 | ; | ||
2573 | ror edx, 3 | ||
2574 | ror esi, 2 | ||
2575 | mov DWORD PTR 4[ebx],esi | ||
2576 | mov eax, DWORD PTR 36[esp] | ||
2577 | mov DWORD PTR [ebx],edx | ||
2578 | mov edi, DWORD PTR 40[esp] | ||
2579 | mov esi, DWORD PTR 44[esp] | ||
2580 | mov DWORD PTR 8[esp],1 | ||
2581 | mov DWORD PTR 4[esp],eax | ||
2582 | mov DWORD PTR [esp],ebx | ||
2583 | call _des_encrypt2 | ||
2584 | mov DWORD PTR 8[esp],0 | ||
2585 | mov DWORD PTR 4[esp],edi | ||
2586 | mov DWORD PTR [esp],ebx | ||
2587 | call _des_encrypt2 | ||
2588 | mov DWORD PTR 8[esp],1 | ||
2589 | mov DWORD PTR 4[esp],esi | ||
2590 | mov DWORD PTR [esp],ebx | ||
2591 | call _des_encrypt2 | ||
2592 | add esp, 12 | ||
2593 | mov edi, DWORD PTR [ebx] | ||
2594 | mov esi, DWORD PTR 4[ebx] | ||
2595 | ; | ||
2596 | ; FP | ||
2597 | rol esi, 2 | ||
2598 | rol edi, 3 | ||
2599 | mov eax, edi | ||
2600 | xor edi, esi | ||
2601 | and edi, 0aaaaaaaah | ||
2602 | xor eax, edi | ||
2603 | xor esi, edi | ||
2604 | ; | ||
2605 | rol eax, 23 | ||
2606 | mov edi, eax | ||
2607 | xor eax, esi | ||
2608 | and eax, 003fc03fch | ||
2609 | xor edi, eax | ||
2610 | xor esi, eax | ||
2611 | ; | ||
2612 | rol edi, 10 | ||
2613 | mov eax, edi | ||
2614 | xor edi, esi | ||
2615 | and edi, 033333333h | ||
2616 | xor eax, edi | ||
2617 | xor esi, edi | ||
2618 | ; | ||
2619 | rol esi, 18 | ||
2620 | mov edi, esi | ||
2621 | xor esi, eax | ||
2622 | and esi, 0fff0000fh | ||
2623 | xor edi, esi | ||
2624 | xor eax, esi | ||
2625 | ; | ||
2626 | rol edi, 12 | ||
2627 | mov esi, edi | ||
2628 | xor edi, eax | ||
2629 | and edi, 0f0f0f0f0h | ||
2630 | xor esi, edi | ||
2631 | xor eax, edi | ||
2632 | ; | ||
2633 | ror eax, 4 | ||
2634 | mov DWORD PTR [ebx],eax | ||
2635 | mov DWORD PTR 4[ebx],esi | ||
2636 | pop edi | ||
2637 | pop esi | ||
2638 | pop ebp | ||
2639 | pop ebx | ||
2640 | ret | ||
2641 | _des_encrypt3 ENDP | ||
2642 | _TEXT ENDS | ||
2643 | _TEXT SEGMENT | ||
2644 | PUBLIC _des_decrypt3 | ||
2645 | |||
2646 | _des_decrypt3 PROC NEAR | ||
2647 | push ebx | ||
2648 | mov ebx, DWORD PTR 8[esp] | ||
2649 | push ebp | ||
2650 | push esi | ||
2651 | push edi | ||
2652 | ; | ||
2653 | ; Load the data words | ||
2654 | mov edi, DWORD PTR [ebx] | ||
2655 | mov esi, DWORD PTR 4[ebx] | ||
2656 | sub esp, 12 | ||
2657 | ; | ||
2658 | ; IP | ||
2659 | rol edi, 4 | ||
2660 | mov edx, edi | ||
2661 | xor edi, esi | ||
2662 | and edi, 0f0f0f0f0h | ||
2663 | xor edx, edi | ||
2664 | xor esi, edi | ||
2665 | ; | ||
2666 | rol esi, 20 | ||
2667 | mov edi, esi | ||
2668 | xor esi, edx | ||
2669 | and esi, 0fff0000fh | ||
2670 | xor edi, esi | ||
2671 | xor edx, esi | ||
2672 | ; | ||
2673 | rol edi, 14 | ||
2674 | mov esi, edi | ||
2675 | xor edi, edx | ||
2676 | and edi, 033333333h | ||
2677 | xor esi, edi | ||
2678 | xor edx, edi | ||
2679 | ; | ||
2680 | rol edx, 22 | ||
2681 | mov edi, edx | ||
2682 | xor edx, esi | ||
2683 | and edx, 003fc03fch | ||
2684 | xor edi, edx | ||
2685 | xor esi, edx | ||
2686 | ; | ||
2687 | rol edi, 9 | ||
2688 | mov edx, edi | ||
2689 | xor edi, esi | ||
2690 | and edi, 0aaaaaaaah | ||
2691 | xor edx, edi | ||
2692 | xor esi, edi | ||
2693 | ; | ||
2694 | ror edx, 3 | ||
2695 | ror esi, 2 | ||
2696 | mov DWORD PTR 4[ebx],esi | ||
2697 | mov esi, DWORD PTR 36[esp] | ||
2698 | mov DWORD PTR [ebx],edx | ||
2699 | mov edi, DWORD PTR 40[esp] | ||
2700 | mov eax, DWORD PTR 44[esp] | ||
2701 | mov DWORD PTR 8[esp],0 | ||
2702 | mov DWORD PTR 4[esp],eax | ||
2703 | mov DWORD PTR [esp],ebx | ||
2704 | call _des_encrypt2 | ||
2705 | mov DWORD PTR 8[esp],1 | ||
2706 | mov DWORD PTR 4[esp],edi | ||
2707 | mov DWORD PTR [esp],ebx | ||
2708 | call _des_encrypt2 | ||
2709 | mov DWORD PTR 8[esp],0 | ||
2710 | mov DWORD PTR 4[esp],esi | ||
2711 | mov DWORD PTR [esp],ebx | ||
2712 | call _des_encrypt2 | ||
2713 | add esp, 12 | ||
2714 | mov edi, DWORD PTR [ebx] | ||
2715 | mov esi, DWORD PTR 4[ebx] | ||
2716 | ; | ||
2717 | ; FP | ||
2718 | rol esi, 2 | ||
2719 | rol edi, 3 | ||
2720 | mov eax, edi | ||
2721 | xor edi, esi | ||
2722 | and edi, 0aaaaaaaah | ||
2723 | xor eax, edi | ||
2724 | xor esi, edi | ||
2725 | ; | ||
2726 | rol eax, 23 | ||
2727 | mov edi, eax | ||
2728 | xor eax, esi | ||
2729 | and eax, 003fc03fch | ||
2730 | xor edi, eax | ||
2731 | xor esi, eax | ||
2732 | ; | ||
2733 | rol edi, 10 | ||
2734 | mov eax, edi | ||
2735 | xor edi, esi | ||
2736 | and edi, 033333333h | ||
2737 | xor eax, edi | ||
2738 | xor esi, edi | ||
2739 | ; | ||
2740 | rol esi, 18 | ||
2741 | mov edi, esi | ||
2742 | xor esi, eax | ||
2743 | and esi, 0fff0000fh | ||
2744 | xor edi, esi | ||
2745 | xor eax, esi | ||
2746 | ; | ||
2747 | rol edi, 12 | ||
2748 | mov esi, edi | ||
2749 | xor edi, eax | ||
2750 | and edi, 0f0f0f0f0h | ||
2751 | xor esi, edi | ||
2752 | xor eax, edi | ||
2753 | ; | ||
2754 | ror eax, 4 | ||
2755 | mov DWORD PTR [ebx],eax | ||
2756 | mov DWORD PTR 4[ebx],esi | ||
2757 | pop edi | ||
2758 | pop esi | ||
2759 | pop ebp | ||
2760 | pop ebx | ||
2761 | ret | ||
2762 | _des_decrypt3 ENDP | ||
2763 | _TEXT ENDS | ||
2764 | _TEXT SEGMENT | ||
2765 | PUBLIC _des_ncbc_encrypt | ||
2766 | |||
2767 | _des_ncbc_encrypt PROC NEAR | ||
2768 | ; | ||
2769 | push ebp | ||
2770 | push ebx | ||
2771 | push esi | ||
2772 | push edi | ||
2773 | mov ebp, DWORD PTR 28[esp] | ||
2774 | ; getting iv ptr from parameter 4 | ||
2775 | mov ebx, DWORD PTR 36[esp] | ||
2776 | mov esi, DWORD PTR [ebx] | ||
2777 | mov edi, DWORD PTR 4[ebx] | ||
2778 | push edi | ||
2779 | push esi | ||
2780 | push edi | ||
2781 | push esi | ||
2782 | mov ebx, esp | ||
2783 | mov esi, DWORD PTR 36[esp] | ||
2784 | mov edi, DWORD PTR 40[esp] | ||
2785 | ; getting encrypt flag from parameter 5 | ||
2786 | mov ecx, DWORD PTR 56[esp] | ||
2787 | ; get and push parameter 5 | ||
2788 | push ecx | ||
2789 | ; get and push parameter 3 | ||
2790 | mov eax, DWORD PTR 52[esp] | ||
2791 | push eax | ||
2792 | push ebx | ||
2793 | cmp ecx, 0 | ||
2794 | jz $L004decrypt | ||
2795 | and ebp, 4294967288 | ||
2796 | mov eax, DWORD PTR 12[esp] | ||
2797 | mov ebx, DWORD PTR 16[esp] | ||
2798 | jz $L005encrypt_finish | ||
2799 | L006encrypt_loop: | ||
2800 | mov ecx, DWORD PTR [esi] | ||
2801 | mov edx, DWORD PTR 4[esi] | ||
2802 | xor eax, ecx | ||
2803 | xor ebx, edx | ||
2804 | mov DWORD PTR 12[esp],eax | ||
2805 | mov DWORD PTR 16[esp],ebx | ||
2806 | call _des_encrypt | ||
2807 | mov eax, DWORD PTR 12[esp] | ||
2808 | mov ebx, DWORD PTR 16[esp] | ||
2809 | mov DWORD PTR [edi],eax | ||
2810 | mov DWORD PTR 4[edi],ebx | ||
2811 | add esi, 8 | ||
2812 | add edi, 8 | ||
2813 | sub ebp, 8 | ||
2814 | jnz L006encrypt_loop | ||
2815 | $L005encrypt_finish: | ||
2816 | mov ebp, DWORD PTR 56[esp] | ||
2817 | and ebp, 7 | ||
2818 | jz $L007finish | ||
2819 | xor ecx, ecx | ||
2820 | xor edx, edx | ||
2821 | mov ebp, DWORD PTR $L008cbc_enc_jmp_table[ebp*4] | ||
2822 | jmp ebp | ||
2823 | L009ej7: | ||
2824 | mov dh, BYTE PTR 6[esi] | ||
2825 | shl edx, 8 | ||
2826 | L010ej6: | ||
2827 | mov dh, BYTE PTR 5[esi] | ||
2828 | L011ej5: | ||
2829 | mov dl, BYTE PTR 4[esi] | ||
2830 | L012ej4: | ||
2831 | mov ecx, DWORD PTR [esi] | ||
2832 | jmp $L013ejend | ||
2833 | L014ej3: | ||
2834 | mov ch, BYTE PTR 2[esi] | ||
2835 | shl ecx, 8 | ||
2836 | L015ej2: | ||
2837 | mov ch, BYTE PTR 1[esi] | ||
2838 | L016ej1: | ||
2839 | mov cl, BYTE PTR [esi] | ||
2840 | $L013ejend: | ||
2841 | xor eax, ecx | ||
2842 | xor ebx, edx | ||
2843 | mov DWORD PTR 12[esp],eax | ||
2844 | mov DWORD PTR 16[esp],ebx | ||
2845 | call _des_encrypt | ||
2846 | mov eax, DWORD PTR 12[esp] | ||
2847 | mov ebx, DWORD PTR 16[esp] | ||
2848 | mov DWORD PTR [edi],eax | ||
2849 | mov DWORD PTR 4[edi],ebx | ||
2850 | jmp $L007finish | ||
2851 | $L004decrypt: | ||
2852 | and ebp, 4294967288 | ||
2853 | mov eax, DWORD PTR 20[esp] | ||
2854 | mov ebx, DWORD PTR 24[esp] | ||
2855 | jz $L017decrypt_finish | ||
2856 | L018decrypt_loop: | ||
2857 | mov eax, DWORD PTR [esi] | ||
2858 | mov ebx, DWORD PTR 4[esi] | ||
2859 | mov DWORD PTR 12[esp],eax | ||
2860 | mov DWORD PTR 16[esp],ebx | ||
2861 | call _des_encrypt | ||
2862 | mov eax, DWORD PTR 12[esp] | ||
2863 | mov ebx, DWORD PTR 16[esp] | ||
2864 | mov ecx, DWORD PTR 20[esp] | ||
2865 | mov edx, DWORD PTR 24[esp] | ||
2866 | xor ecx, eax | ||
2867 | xor edx, ebx | ||
2868 | mov eax, DWORD PTR [esi] | ||
2869 | mov ebx, DWORD PTR 4[esi] | ||
2870 | mov DWORD PTR [edi],ecx | ||
2871 | mov DWORD PTR 4[edi],edx | ||
2872 | mov DWORD PTR 20[esp],eax | ||
2873 | mov DWORD PTR 24[esp],ebx | ||
2874 | add esi, 8 | ||
2875 | add edi, 8 | ||
2876 | sub ebp, 8 | ||
2877 | jnz L018decrypt_loop | ||
2878 | $L017decrypt_finish: | ||
2879 | mov ebp, DWORD PTR 56[esp] | ||
2880 | and ebp, 7 | ||
2881 | jz $L007finish | ||
2882 | mov eax, DWORD PTR [esi] | ||
2883 | mov ebx, DWORD PTR 4[esi] | ||
2884 | mov DWORD PTR 12[esp],eax | ||
2885 | mov DWORD PTR 16[esp],ebx | ||
2886 | call _des_encrypt | ||
2887 | mov eax, DWORD PTR 12[esp] | ||
2888 | mov ebx, DWORD PTR 16[esp] | ||
2889 | mov ecx, DWORD PTR 20[esp] | ||
2890 | mov edx, DWORD PTR 24[esp] | ||
2891 | xor ecx, eax | ||
2892 | xor edx, ebx | ||
2893 | mov eax, DWORD PTR [esi] | ||
2894 | mov ebx, DWORD PTR 4[esi] | ||
2895 | L019dj7: | ||
2896 | ror edx, 16 | ||
2897 | mov BYTE PTR 6[edi],dl | ||
2898 | shr edx, 16 | ||
2899 | L020dj6: | ||
2900 | mov BYTE PTR 5[edi],dh | ||
2901 | L021dj5: | ||
2902 | mov BYTE PTR 4[edi],dl | ||
2903 | L022dj4: | ||
2904 | mov DWORD PTR [edi],ecx | ||
2905 | jmp $L023djend | ||
2906 | L024dj3: | ||
2907 | ror ecx, 16 | ||
2908 | mov BYTE PTR 2[edi],cl | ||
2909 | shl ecx, 16 | ||
2910 | L025dj2: | ||
2911 | mov BYTE PTR 1[esi],ch | ||
2912 | L026dj1: | ||
2913 | mov BYTE PTR [esi], cl | ||
2914 | $L023djend: | ||
2915 | jmp $L007finish | ||
2916 | $L007finish: | ||
2917 | mov ecx, DWORD PTR 64[esp] | ||
2918 | add esp, 28 | ||
2919 | mov DWORD PTR [ecx],eax | ||
2920 | mov DWORD PTR 4[ecx],ebx | ||
2921 | pop edi | ||
2922 | pop esi | ||
2923 | pop ebx | ||
2924 | pop ebp | ||
2925 | ret | ||
2926 | $L008cbc_enc_jmp_table: | ||
2927 | DD 0 | ||
2928 | DD L016ej1 | ||
2929 | DD L015ej2 | ||
2930 | DD L014ej3 | ||
2931 | DD L012ej4 | ||
2932 | DD L011ej5 | ||
2933 | DD L010ej6 | ||
2934 | DD L009ej7 | ||
2935 | L027cbc_dec_jmp_table: | ||
2936 | DD 0 | ||
2937 | DD L026dj1 | ||
2938 | DD L025dj2 | ||
2939 | DD L024dj3 | ||
2940 | DD L022dj4 | ||
2941 | DD L021dj5 | ||
2942 | DD L020dj6 | ||
2943 | DD L019dj7 | ||
2944 | _des_ncbc_encrypt ENDP | ||
2945 | _TEXT ENDS | ||
2946 | _TEXT SEGMENT | ||
2947 | PUBLIC _des_ede3_cbc_encrypt | ||
2948 | |||
2949 | _des_ede3_cbc_encrypt PROC NEAR | ||
2950 | ; | ||
2951 | push ebp | ||
2952 | push ebx | ||
2953 | push esi | ||
2954 | push edi | ||
2955 | mov ebp, DWORD PTR 28[esp] | ||
2956 | ; getting iv ptr from parameter 6 | ||
2957 | mov ebx, DWORD PTR 44[esp] | ||
2958 | mov esi, DWORD PTR [ebx] | ||
2959 | mov edi, DWORD PTR 4[ebx] | ||
2960 | push edi | ||
2961 | push esi | ||
2962 | push edi | ||
2963 | push esi | ||
2964 | mov ebx, esp | ||
2965 | mov esi, DWORD PTR 36[esp] | ||
2966 | mov edi, DWORD PTR 40[esp] | ||
2967 | ; getting encrypt flag from parameter 7 | ||
2968 | mov ecx, DWORD PTR 64[esp] | ||
2969 | ; get and push parameter 5 | ||
2970 | mov eax, DWORD PTR 56[esp] | ||
2971 | push eax | ||
2972 | ; get and push parameter 4 | ||
2973 | mov eax, DWORD PTR 56[esp] | ||
2974 | push eax | ||
2975 | ; get and push parameter 3 | ||
2976 | mov eax, DWORD PTR 56[esp] | ||
2977 | push eax | ||
2978 | push ebx | ||
2979 | cmp ecx, 0 | ||
2980 | jz $L028decrypt | ||
2981 | and ebp, 4294967288 | ||
2982 | mov eax, DWORD PTR 16[esp] | ||
2983 | mov ebx, DWORD PTR 20[esp] | ||
2984 | jz $L029encrypt_finish | ||
2985 | L030encrypt_loop: | ||
2986 | mov ecx, DWORD PTR [esi] | ||
2987 | mov edx, DWORD PTR 4[esi] | ||
2988 | xor eax, ecx | ||
2989 | xor ebx, edx | ||
2990 | mov DWORD PTR 16[esp],eax | ||
2991 | mov DWORD PTR 20[esp],ebx | ||
2992 | call _des_encrypt3 | ||
2993 | mov eax, DWORD PTR 16[esp] | ||
2994 | mov ebx, DWORD PTR 20[esp] | ||
2995 | mov DWORD PTR [edi],eax | ||
2996 | mov DWORD PTR 4[edi],ebx | ||
2997 | add esi, 8 | ||
2998 | add edi, 8 | ||
2999 | sub ebp, 8 | ||
3000 | jnz L030encrypt_loop | ||
3001 | $L029encrypt_finish: | ||
3002 | mov ebp, DWORD PTR 60[esp] | ||
3003 | and ebp, 7 | ||
3004 | jz $L031finish | ||
3005 | xor ecx, ecx | ||
3006 | xor edx, edx | ||
3007 | mov ebp, DWORD PTR $L032cbc_enc_jmp_table[ebp*4] | ||
3008 | jmp ebp | ||
3009 | L033ej7: | ||
3010 | mov dh, BYTE PTR 6[esi] | ||
3011 | shl edx, 8 | ||
3012 | L034ej6: | ||
3013 | mov dh, BYTE PTR 5[esi] | ||
3014 | L035ej5: | ||
3015 | mov dl, BYTE PTR 4[esi] | ||
3016 | L036ej4: | ||
3017 | mov ecx, DWORD PTR [esi] | ||
3018 | jmp $L037ejend | ||
3019 | L038ej3: | ||
3020 | mov ch, BYTE PTR 2[esi] | ||
3021 | shl ecx, 8 | ||
3022 | L039ej2: | ||
3023 | mov ch, BYTE PTR 1[esi] | ||
3024 | L040ej1: | ||
3025 | mov cl, BYTE PTR [esi] | ||
3026 | $L037ejend: | ||
3027 | xor eax, ecx | ||
3028 | xor ebx, edx | ||
3029 | mov DWORD PTR 16[esp],eax | ||
3030 | mov DWORD PTR 20[esp],ebx | ||
3031 | call _des_encrypt3 | ||
3032 | mov eax, DWORD PTR 16[esp] | ||
3033 | mov ebx, DWORD PTR 20[esp] | ||
3034 | mov DWORD PTR [edi],eax | ||
3035 | mov DWORD PTR 4[edi],ebx | ||
3036 | jmp $L031finish | ||
3037 | $L028decrypt: | ||
3038 | and ebp, 4294967288 | ||
3039 | mov eax, DWORD PTR 24[esp] | ||
3040 | mov ebx, DWORD PTR 28[esp] | ||
3041 | jz $L041decrypt_finish | ||
3042 | L042decrypt_loop: | ||
3043 | mov eax, DWORD PTR [esi] | ||
3044 | mov ebx, DWORD PTR 4[esi] | ||
3045 | mov DWORD PTR 16[esp],eax | ||
3046 | mov DWORD PTR 20[esp],ebx | ||
3047 | call _des_decrypt3 | ||
3048 | mov eax, DWORD PTR 16[esp] | ||
3049 | mov ebx, DWORD PTR 20[esp] | ||
3050 | mov ecx, DWORD PTR 24[esp] | ||
3051 | mov edx, DWORD PTR 28[esp] | ||
3052 | xor ecx, eax | ||
3053 | xor edx, ebx | ||
3054 | mov eax, DWORD PTR [esi] | ||
3055 | mov ebx, DWORD PTR 4[esi] | ||
3056 | mov DWORD PTR [edi],ecx | ||
3057 | mov DWORD PTR 4[edi],edx | ||
3058 | mov DWORD PTR 24[esp],eax | ||
3059 | mov DWORD PTR 28[esp],ebx | ||
3060 | add esi, 8 | ||
3061 | add edi, 8 | ||
3062 | sub ebp, 8 | ||
3063 | jnz L042decrypt_loop | ||
3064 | $L041decrypt_finish: | ||
3065 | mov ebp, DWORD PTR 60[esp] | ||
3066 | and ebp, 7 | ||
3067 | jz $L031finish | ||
3068 | mov eax, DWORD PTR [esi] | ||
3069 | mov ebx, DWORD PTR 4[esi] | ||
3070 | mov DWORD PTR 16[esp],eax | ||
3071 | mov DWORD PTR 20[esp],ebx | ||
3072 | call _des_decrypt3 | ||
3073 | mov eax, DWORD PTR 16[esp] | ||
3074 | mov ebx, DWORD PTR 20[esp] | ||
3075 | mov ecx, DWORD PTR 24[esp] | ||
3076 | mov edx, DWORD PTR 28[esp] | ||
3077 | xor ecx, eax | ||
3078 | xor edx, ebx | ||
3079 | mov eax, DWORD PTR [esi] | ||
3080 | mov ebx, DWORD PTR 4[esi] | ||
3081 | L043dj7: | ||
3082 | ror edx, 16 | ||
3083 | mov BYTE PTR 6[edi],dl | ||
3084 | shr edx, 16 | ||
3085 | L044dj6: | ||
3086 | mov BYTE PTR 5[edi],dh | ||
3087 | L045dj5: | ||
3088 | mov BYTE PTR 4[edi],dl | ||
3089 | L046dj4: | ||
3090 | mov DWORD PTR [edi],ecx | ||
3091 | jmp $L047djend | ||
3092 | L048dj3: | ||
3093 | ror ecx, 16 | ||
3094 | mov BYTE PTR 2[edi],cl | ||
3095 | shl ecx, 16 | ||
3096 | L049dj2: | ||
3097 | mov BYTE PTR 1[esi],ch | ||
3098 | L050dj1: | ||
3099 | mov BYTE PTR [esi], cl | ||
3100 | $L047djend: | ||
3101 | jmp $L031finish | ||
3102 | $L031finish: | ||
3103 | mov ecx, DWORD PTR 76[esp] | ||
3104 | add esp, 32 | ||
3105 | mov DWORD PTR [ecx],eax | ||
3106 | mov DWORD PTR 4[ecx],ebx | ||
3107 | pop edi | ||
3108 | pop esi | ||
3109 | pop ebx | ||
3110 | pop ebp | ||
3111 | ret | ||
3112 | $L032cbc_enc_jmp_table: | ||
3113 | DD 0 | ||
3114 | DD L040ej1 | ||
3115 | DD L039ej2 | ||
3116 | DD L038ej3 | ||
3117 | DD L036ej4 | ||
3118 | DD L035ej5 | ||
3119 | DD L034ej6 | ||
3120 | DD L033ej7 | ||
3121 | L051cbc_dec_jmp_table: | ||
3122 | DD 0 | ||
3123 | DD L050dj1 | ||
3124 | DD L049dj2 | ||
3125 | DD L048dj3 | ||
3126 | DD L046dj4 | ||
3127 | DD L045dj5 | ||
3128 | DD L044dj6 | ||
3129 | DD L043dj7 | ||
3130 | _des_ede3_cbc_encrypt ENDP | ||
3131 | _TEXT ENDS | ||
3132 | END | ||
diff --git a/src/lib/libcrypto/des/asm/dx86unix.cpp b/src/lib/libcrypto/des/asm/dx86unix.cpp new file mode 100644 index 0000000000..6fca9afa16 --- /dev/null +++ b/src/lib/libcrypto/des/asm/dx86unix.cpp | |||
@@ -0,0 +1,3202 @@ | |||
1 | /* Run the C pre-processor over this file with one of the following defined | ||
2 | * ELF - elf object files, | ||
3 | * OUT - a.out object files, | ||
4 | * BSDI - BSDI style a.out object files | ||
5 | * SOL - Solaris style elf | ||
6 | */ | ||
7 | |||
8 | #define TYPE(a,b) .type a,b | ||
9 | #define SIZE(a,b) .size a,b | ||
10 | |||
11 | #if defined(OUT) || defined(BSDI) | ||
12 | #define des_SPtrans _des_SPtrans | ||
13 | #define des_encrypt _des_encrypt | ||
14 | #define des_encrypt2 _des_encrypt2 | ||
15 | #define des_encrypt3 _des_encrypt3 | ||
16 | #define des_decrypt3 _des_decrypt3 | ||
17 | #define des_ncbc_encrypt _des_ncbc_encrypt | ||
18 | #define des_ede3_cbc_encrypt _des_ede3_cbc_encrypt | ||
19 | |||
20 | #endif | ||
21 | |||
22 | #ifdef OUT | ||
23 | #define OK 1 | ||
24 | #define ALIGN 4 | ||
25 | #endif | ||
26 | |||
27 | #ifdef BSDI | ||
28 | #define OK 1 | ||
29 | #define ALIGN 4 | ||
30 | #undef SIZE | ||
31 | #undef TYPE | ||
32 | #define SIZE(a,b) | ||
33 | #define TYPE(a,b) | ||
34 | #endif | ||
35 | |||
36 | #if defined(ELF) || defined(SOL) | ||
37 | #define OK 1 | ||
38 | #define ALIGN 16 | ||
39 | #endif | ||
40 | |||
41 | #ifndef OK | ||
42 | You need to define one of | ||
43 | ELF - elf systems - linux-elf, NetBSD and DG-UX | ||
44 | OUT - a.out systems - linux-a.out and FreeBSD | ||
45 | SOL - solaris systems, which are elf with strange comment lines | ||
46 | BSDI - a.out with a very primative version of as. | ||
47 | #endif | ||
48 | |||
49 | /* Let the Assembler begin :-) */ | ||
50 | /* Don't even think of reading this code */ | ||
51 | /* It was automatically generated by des-586.pl */ | ||
52 | /* Which is a perl program used to generate the x86 assember for */ | ||
53 | /* any of elf, a.out, BSDI,Win32, or Solaris */ | ||
54 | /* eric <eay@cryptsoft.com> */ | ||
55 | |||
56 | .file "des-586.s" | ||
57 | .version "01.01" | ||
58 | gcc2_compiled.: | ||
59 | .text | ||
60 | .align ALIGN | ||
61 | .globl des_encrypt | ||
62 | TYPE(des_encrypt,@function) | ||
63 | des_encrypt: | ||
64 | pushl %esi | ||
65 | pushl %edi | ||
66 | |||
67 | /* Load the 2 words */ | ||
68 | movl 12(%esp), %esi | ||
69 | xorl %ecx, %ecx | ||
70 | pushl %ebx | ||
71 | pushl %ebp | ||
72 | movl (%esi), %eax | ||
73 | movl 28(%esp), %ebx | ||
74 | movl 4(%esi), %edi | ||
75 | |||
76 | /* IP */ | ||
77 | roll $4, %eax | ||
78 | movl %eax, %esi | ||
79 | xorl %edi, %eax | ||
80 | andl $0xf0f0f0f0, %eax | ||
81 | xorl %eax, %esi | ||
82 | xorl %eax, %edi | ||
83 | |||
84 | roll $20, %edi | ||
85 | movl %edi, %eax | ||
86 | xorl %esi, %edi | ||
87 | andl $0xfff0000f, %edi | ||
88 | xorl %edi, %eax | ||
89 | xorl %edi, %esi | ||
90 | |||
91 | roll $14, %eax | ||
92 | movl %eax, %edi | ||
93 | xorl %esi, %eax | ||
94 | andl $0x33333333, %eax | ||
95 | xorl %eax, %edi | ||
96 | xorl %eax, %esi | ||
97 | |||
98 | roll $22, %esi | ||
99 | movl %esi, %eax | ||
100 | xorl %edi, %esi | ||
101 | andl $0x03fc03fc, %esi | ||
102 | xorl %esi, %eax | ||
103 | xorl %esi, %edi | ||
104 | |||
105 | roll $9, %eax | ||
106 | movl %eax, %esi | ||
107 | xorl %edi, %eax | ||
108 | andl $0xaaaaaaaa, %eax | ||
109 | xorl %eax, %esi | ||
110 | xorl %eax, %edi | ||
111 | |||
112 | .byte 209 | ||
113 | .byte 199 /* roll $1 %edi */ | ||
114 | movl 24(%esp), %ebp | ||
115 | cmpl $0, %ebx | ||
116 | je .L000start_decrypt | ||
117 | |||
118 | /* Round 0 */ | ||
119 | movl (%ebp), %eax | ||
120 | xorl %ebx, %ebx | ||
121 | movl 4(%ebp), %edx | ||
122 | xorl %esi, %eax | ||
123 | xorl %esi, %edx | ||
124 | andl $0xfcfcfcfc, %eax | ||
125 | andl $0xcfcfcfcf, %edx | ||
126 | movb %al, %bl | ||
127 | movb %ah, %cl | ||
128 | rorl $4, %edx | ||
129 | movl des_SPtrans(%ebx),%ebp | ||
130 | movb %dl, %bl | ||
131 | xorl %ebp, %edi | ||
132 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
133 | xorl %ebp, %edi | ||
134 | movb %dh, %cl | ||
135 | shrl $16, %eax | ||
136 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
137 | xorl %ebp, %edi | ||
138 | movb %ah, %bl | ||
139 | shrl $16, %edx | ||
140 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
141 | xorl %ebp, %edi | ||
142 | movl 24(%esp), %ebp | ||
143 | movb %dh, %cl | ||
144 | andl $0xff, %eax | ||
145 | andl $0xff, %edx | ||
146 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
147 | xorl %ebx, %edi | ||
148 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
149 | xorl %ebx, %edi | ||
150 | movl 0x400+des_SPtrans(%eax),%ebx | ||
151 | xorl %ebx, %edi | ||
152 | movl 0x500+des_SPtrans(%edx),%ebx | ||
153 | xorl %ebx, %edi | ||
154 | |||
155 | /* Round 1 */ | ||
156 | movl 8(%ebp), %eax | ||
157 | xorl %ebx, %ebx | ||
158 | movl 12(%ebp), %edx | ||
159 | xorl %edi, %eax | ||
160 | xorl %edi, %edx | ||
161 | andl $0xfcfcfcfc, %eax | ||
162 | andl $0xcfcfcfcf, %edx | ||
163 | movb %al, %bl | ||
164 | movb %ah, %cl | ||
165 | rorl $4, %edx | ||
166 | movl des_SPtrans(%ebx),%ebp | ||
167 | movb %dl, %bl | ||
168 | xorl %ebp, %esi | ||
169 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
170 | xorl %ebp, %esi | ||
171 | movb %dh, %cl | ||
172 | shrl $16, %eax | ||
173 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
174 | xorl %ebp, %esi | ||
175 | movb %ah, %bl | ||
176 | shrl $16, %edx | ||
177 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
178 | xorl %ebp, %esi | ||
179 | movl 24(%esp), %ebp | ||
180 | movb %dh, %cl | ||
181 | andl $0xff, %eax | ||
182 | andl $0xff, %edx | ||
183 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
184 | xorl %ebx, %esi | ||
185 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
186 | xorl %ebx, %esi | ||
187 | movl 0x400+des_SPtrans(%eax),%ebx | ||
188 | xorl %ebx, %esi | ||
189 | movl 0x500+des_SPtrans(%edx),%ebx | ||
190 | xorl %ebx, %esi | ||
191 | |||
192 | /* Round 2 */ | ||
193 | movl 16(%ebp), %eax | ||
194 | xorl %ebx, %ebx | ||
195 | movl 20(%ebp), %edx | ||
196 | xorl %esi, %eax | ||
197 | xorl %esi, %edx | ||
198 | andl $0xfcfcfcfc, %eax | ||
199 | andl $0xcfcfcfcf, %edx | ||
200 | movb %al, %bl | ||
201 | movb %ah, %cl | ||
202 | rorl $4, %edx | ||
203 | movl des_SPtrans(%ebx),%ebp | ||
204 | movb %dl, %bl | ||
205 | xorl %ebp, %edi | ||
206 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
207 | xorl %ebp, %edi | ||
208 | movb %dh, %cl | ||
209 | shrl $16, %eax | ||
210 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
211 | xorl %ebp, %edi | ||
212 | movb %ah, %bl | ||
213 | shrl $16, %edx | ||
214 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
215 | xorl %ebp, %edi | ||
216 | movl 24(%esp), %ebp | ||
217 | movb %dh, %cl | ||
218 | andl $0xff, %eax | ||
219 | andl $0xff, %edx | ||
220 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
221 | xorl %ebx, %edi | ||
222 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
223 | xorl %ebx, %edi | ||
224 | movl 0x400+des_SPtrans(%eax),%ebx | ||
225 | xorl %ebx, %edi | ||
226 | movl 0x500+des_SPtrans(%edx),%ebx | ||
227 | xorl %ebx, %edi | ||
228 | |||
229 | /* Round 3 */ | ||
230 | movl 24(%ebp), %eax | ||
231 | xorl %ebx, %ebx | ||
232 | movl 28(%ebp), %edx | ||
233 | xorl %edi, %eax | ||
234 | xorl %edi, %edx | ||
235 | andl $0xfcfcfcfc, %eax | ||
236 | andl $0xcfcfcfcf, %edx | ||
237 | movb %al, %bl | ||
238 | movb %ah, %cl | ||
239 | rorl $4, %edx | ||
240 | movl des_SPtrans(%ebx),%ebp | ||
241 | movb %dl, %bl | ||
242 | xorl %ebp, %esi | ||
243 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
244 | xorl %ebp, %esi | ||
245 | movb %dh, %cl | ||
246 | shrl $16, %eax | ||
247 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
248 | xorl %ebp, %esi | ||
249 | movb %ah, %bl | ||
250 | shrl $16, %edx | ||
251 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
252 | xorl %ebp, %esi | ||
253 | movl 24(%esp), %ebp | ||
254 | movb %dh, %cl | ||
255 | andl $0xff, %eax | ||
256 | andl $0xff, %edx | ||
257 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
258 | xorl %ebx, %esi | ||
259 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
260 | xorl %ebx, %esi | ||
261 | movl 0x400+des_SPtrans(%eax),%ebx | ||
262 | xorl %ebx, %esi | ||
263 | movl 0x500+des_SPtrans(%edx),%ebx | ||
264 | xorl %ebx, %esi | ||
265 | |||
266 | /* Round 4 */ | ||
267 | movl 32(%ebp), %eax | ||
268 | xorl %ebx, %ebx | ||
269 | movl 36(%ebp), %edx | ||
270 | xorl %esi, %eax | ||
271 | xorl %esi, %edx | ||
272 | andl $0xfcfcfcfc, %eax | ||
273 | andl $0xcfcfcfcf, %edx | ||
274 | movb %al, %bl | ||
275 | movb %ah, %cl | ||
276 | rorl $4, %edx | ||
277 | movl des_SPtrans(%ebx),%ebp | ||
278 | movb %dl, %bl | ||
279 | xorl %ebp, %edi | ||
280 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
281 | xorl %ebp, %edi | ||
282 | movb %dh, %cl | ||
283 | shrl $16, %eax | ||
284 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
285 | xorl %ebp, %edi | ||
286 | movb %ah, %bl | ||
287 | shrl $16, %edx | ||
288 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
289 | xorl %ebp, %edi | ||
290 | movl 24(%esp), %ebp | ||
291 | movb %dh, %cl | ||
292 | andl $0xff, %eax | ||
293 | andl $0xff, %edx | ||
294 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
295 | xorl %ebx, %edi | ||
296 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
297 | xorl %ebx, %edi | ||
298 | movl 0x400+des_SPtrans(%eax),%ebx | ||
299 | xorl %ebx, %edi | ||
300 | movl 0x500+des_SPtrans(%edx),%ebx | ||
301 | xorl %ebx, %edi | ||
302 | |||
303 | /* Round 5 */ | ||
304 | movl 40(%ebp), %eax | ||
305 | xorl %ebx, %ebx | ||
306 | movl 44(%ebp), %edx | ||
307 | xorl %edi, %eax | ||
308 | xorl %edi, %edx | ||
309 | andl $0xfcfcfcfc, %eax | ||
310 | andl $0xcfcfcfcf, %edx | ||
311 | movb %al, %bl | ||
312 | movb %ah, %cl | ||
313 | rorl $4, %edx | ||
314 | movl des_SPtrans(%ebx),%ebp | ||
315 | movb %dl, %bl | ||
316 | xorl %ebp, %esi | ||
317 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
318 | xorl %ebp, %esi | ||
319 | movb %dh, %cl | ||
320 | shrl $16, %eax | ||
321 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
322 | xorl %ebp, %esi | ||
323 | movb %ah, %bl | ||
324 | shrl $16, %edx | ||
325 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
326 | xorl %ebp, %esi | ||
327 | movl 24(%esp), %ebp | ||
328 | movb %dh, %cl | ||
329 | andl $0xff, %eax | ||
330 | andl $0xff, %edx | ||
331 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
332 | xorl %ebx, %esi | ||
333 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
334 | xorl %ebx, %esi | ||
335 | movl 0x400+des_SPtrans(%eax),%ebx | ||
336 | xorl %ebx, %esi | ||
337 | movl 0x500+des_SPtrans(%edx),%ebx | ||
338 | xorl %ebx, %esi | ||
339 | |||
340 | /* Round 6 */ | ||
341 | movl 48(%ebp), %eax | ||
342 | xorl %ebx, %ebx | ||
343 | movl 52(%ebp), %edx | ||
344 | xorl %esi, %eax | ||
345 | xorl %esi, %edx | ||
346 | andl $0xfcfcfcfc, %eax | ||
347 | andl $0xcfcfcfcf, %edx | ||
348 | movb %al, %bl | ||
349 | movb %ah, %cl | ||
350 | rorl $4, %edx | ||
351 | movl des_SPtrans(%ebx),%ebp | ||
352 | movb %dl, %bl | ||
353 | xorl %ebp, %edi | ||
354 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
355 | xorl %ebp, %edi | ||
356 | movb %dh, %cl | ||
357 | shrl $16, %eax | ||
358 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
359 | xorl %ebp, %edi | ||
360 | movb %ah, %bl | ||
361 | shrl $16, %edx | ||
362 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
363 | xorl %ebp, %edi | ||
364 | movl 24(%esp), %ebp | ||
365 | movb %dh, %cl | ||
366 | andl $0xff, %eax | ||
367 | andl $0xff, %edx | ||
368 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
369 | xorl %ebx, %edi | ||
370 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
371 | xorl %ebx, %edi | ||
372 | movl 0x400+des_SPtrans(%eax),%ebx | ||
373 | xorl %ebx, %edi | ||
374 | movl 0x500+des_SPtrans(%edx),%ebx | ||
375 | xorl %ebx, %edi | ||
376 | |||
377 | /* Round 7 */ | ||
378 | movl 56(%ebp), %eax | ||
379 | xorl %ebx, %ebx | ||
380 | movl 60(%ebp), %edx | ||
381 | xorl %edi, %eax | ||
382 | xorl %edi, %edx | ||
383 | andl $0xfcfcfcfc, %eax | ||
384 | andl $0xcfcfcfcf, %edx | ||
385 | movb %al, %bl | ||
386 | movb %ah, %cl | ||
387 | rorl $4, %edx | ||
388 | movl des_SPtrans(%ebx),%ebp | ||
389 | movb %dl, %bl | ||
390 | xorl %ebp, %esi | ||
391 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
392 | xorl %ebp, %esi | ||
393 | movb %dh, %cl | ||
394 | shrl $16, %eax | ||
395 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
396 | xorl %ebp, %esi | ||
397 | movb %ah, %bl | ||
398 | shrl $16, %edx | ||
399 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
400 | xorl %ebp, %esi | ||
401 | movl 24(%esp), %ebp | ||
402 | movb %dh, %cl | ||
403 | andl $0xff, %eax | ||
404 | andl $0xff, %edx | ||
405 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
406 | xorl %ebx, %esi | ||
407 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
408 | xorl %ebx, %esi | ||
409 | movl 0x400+des_SPtrans(%eax),%ebx | ||
410 | xorl %ebx, %esi | ||
411 | movl 0x500+des_SPtrans(%edx),%ebx | ||
412 | xorl %ebx, %esi | ||
413 | |||
414 | /* Round 8 */ | ||
415 | movl 64(%ebp), %eax | ||
416 | xorl %ebx, %ebx | ||
417 | movl 68(%ebp), %edx | ||
418 | xorl %esi, %eax | ||
419 | xorl %esi, %edx | ||
420 | andl $0xfcfcfcfc, %eax | ||
421 | andl $0xcfcfcfcf, %edx | ||
422 | movb %al, %bl | ||
423 | movb %ah, %cl | ||
424 | rorl $4, %edx | ||
425 | movl des_SPtrans(%ebx),%ebp | ||
426 | movb %dl, %bl | ||
427 | xorl %ebp, %edi | ||
428 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
429 | xorl %ebp, %edi | ||
430 | movb %dh, %cl | ||
431 | shrl $16, %eax | ||
432 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
433 | xorl %ebp, %edi | ||
434 | movb %ah, %bl | ||
435 | shrl $16, %edx | ||
436 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
437 | xorl %ebp, %edi | ||
438 | movl 24(%esp), %ebp | ||
439 | movb %dh, %cl | ||
440 | andl $0xff, %eax | ||
441 | andl $0xff, %edx | ||
442 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
443 | xorl %ebx, %edi | ||
444 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
445 | xorl %ebx, %edi | ||
446 | movl 0x400+des_SPtrans(%eax),%ebx | ||
447 | xorl %ebx, %edi | ||
448 | movl 0x500+des_SPtrans(%edx),%ebx | ||
449 | xorl %ebx, %edi | ||
450 | |||
451 | /* Round 9 */ | ||
452 | movl 72(%ebp), %eax | ||
453 | xorl %ebx, %ebx | ||
454 | movl 76(%ebp), %edx | ||
455 | xorl %edi, %eax | ||
456 | xorl %edi, %edx | ||
457 | andl $0xfcfcfcfc, %eax | ||
458 | andl $0xcfcfcfcf, %edx | ||
459 | movb %al, %bl | ||
460 | movb %ah, %cl | ||
461 | rorl $4, %edx | ||
462 | movl des_SPtrans(%ebx),%ebp | ||
463 | movb %dl, %bl | ||
464 | xorl %ebp, %esi | ||
465 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
466 | xorl %ebp, %esi | ||
467 | movb %dh, %cl | ||
468 | shrl $16, %eax | ||
469 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
470 | xorl %ebp, %esi | ||
471 | movb %ah, %bl | ||
472 | shrl $16, %edx | ||
473 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
474 | xorl %ebp, %esi | ||
475 | movl 24(%esp), %ebp | ||
476 | movb %dh, %cl | ||
477 | andl $0xff, %eax | ||
478 | andl $0xff, %edx | ||
479 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
480 | xorl %ebx, %esi | ||
481 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
482 | xorl %ebx, %esi | ||
483 | movl 0x400+des_SPtrans(%eax),%ebx | ||
484 | xorl %ebx, %esi | ||
485 | movl 0x500+des_SPtrans(%edx),%ebx | ||
486 | xorl %ebx, %esi | ||
487 | |||
488 | /* Round 10 */ | ||
489 | movl 80(%ebp), %eax | ||
490 | xorl %ebx, %ebx | ||
491 | movl 84(%ebp), %edx | ||
492 | xorl %esi, %eax | ||
493 | xorl %esi, %edx | ||
494 | andl $0xfcfcfcfc, %eax | ||
495 | andl $0xcfcfcfcf, %edx | ||
496 | movb %al, %bl | ||
497 | movb %ah, %cl | ||
498 | rorl $4, %edx | ||
499 | movl des_SPtrans(%ebx),%ebp | ||
500 | movb %dl, %bl | ||
501 | xorl %ebp, %edi | ||
502 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
503 | xorl %ebp, %edi | ||
504 | movb %dh, %cl | ||
505 | shrl $16, %eax | ||
506 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
507 | xorl %ebp, %edi | ||
508 | movb %ah, %bl | ||
509 | shrl $16, %edx | ||
510 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
511 | xorl %ebp, %edi | ||
512 | movl 24(%esp), %ebp | ||
513 | movb %dh, %cl | ||
514 | andl $0xff, %eax | ||
515 | andl $0xff, %edx | ||
516 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
517 | xorl %ebx, %edi | ||
518 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
519 | xorl %ebx, %edi | ||
520 | movl 0x400+des_SPtrans(%eax),%ebx | ||
521 | xorl %ebx, %edi | ||
522 | movl 0x500+des_SPtrans(%edx),%ebx | ||
523 | xorl %ebx, %edi | ||
524 | |||
525 | /* Round 11 */ | ||
526 | movl 88(%ebp), %eax | ||
527 | xorl %ebx, %ebx | ||
528 | movl 92(%ebp), %edx | ||
529 | xorl %edi, %eax | ||
530 | xorl %edi, %edx | ||
531 | andl $0xfcfcfcfc, %eax | ||
532 | andl $0xcfcfcfcf, %edx | ||
533 | movb %al, %bl | ||
534 | movb %ah, %cl | ||
535 | rorl $4, %edx | ||
536 | movl des_SPtrans(%ebx),%ebp | ||
537 | movb %dl, %bl | ||
538 | xorl %ebp, %esi | ||
539 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
540 | xorl %ebp, %esi | ||
541 | movb %dh, %cl | ||
542 | shrl $16, %eax | ||
543 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
544 | xorl %ebp, %esi | ||
545 | movb %ah, %bl | ||
546 | shrl $16, %edx | ||
547 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
548 | xorl %ebp, %esi | ||
549 | movl 24(%esp), %ebp | ||
550 | movb %dh, %cl | ||
551 | andl $0xff, %eax | ||
552 | andl $0xff, %edx | ||
553 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
554 | xorl %ebx, %esi | ||
555 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
556 | xorl %ebx, %esi | ||
557 | movl 0x400+des_SPtrans(%eax),%ebx | ||
558 | xorl %ebx, %esi | ||
559 | movl 0x500+des_SPtrans(%edx),%ebx | ||
560 | xorl %ebx, %esi | ||
561 | |||
562 | /* Round 12 */ | ||
563 | movl 96(%ebp), %eax | ||
564 | xorl %ebx, %ebx | ||
565 | movl 100(%ebp), %edx | ||
566 | xorl %esi, %eax | ||
567 | xorl %esi, %edx | ||
568 | andl $0xfcfcfcfc, %eax | ||
569 | andl $0xcfcfcfcf, %edx | ||
570 | movb %al, %bl | ||
571 | movb %ah, %cl | ||
572 | rorl $4, %edx | ||
573 | movl des_SPtrans(%ebx),%ebp | ||
574 | movb %dl, %bl | ||
575 | xorl %ebp, %edi | ||
576 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
577 | xorl %ebp, %edi | ||
578 | movb %dh, %cl | ||
579 | shrl $16, %eax | ||
580 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
581 | xorl %ebp, %edi | ||
582 | movb %ah, %bl | ||
583 | shrl $16, %edx | ||
584 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
585 | xorl %ebp, %edi | ||
586 | movl 24(%esp), %ebp | ||
587 | movb %dh, %cl | ||
588 | andl $0xff, %eax | ||
589 | andl $0xff, %edx | ||
590 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
591 | xorl %ebx, %edi | ||
592 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
593 | xorl %ebx, %edi | ||
594 | movl 0x400+des_SPtrans(%eax),%ebx | ||
595 | xorl %ebx, %edi | ||
596 | movl 0x500+des_SPtrans(%edx),%ebx | ||
597 | xorl %ebx, %edi | ||
598 | |||
599 | /* Round 13 */ | ||
600 | movl 104(%ebp), %eax | ||
601 | xorl %ebx, %ebx | ||
602 | movl 108(%ebp), %edx | ||
603 | xorl %edi, %eax | ||
604 | xorl %edi, %edx | ||
605 | andl $0xfcfcfcfc, %eax | ||
606 | andl $0xcfcfcfcf, %edx | ||
607 | movb %al, %bl | ||
608 | movb %ah, %cl | ||
609 | rorl $4, %edx | ||
610 | movl des_SPtrans(%ebx),%ebp | ||
611 | movb %dl, %bl | ||
612 | xorl %ebp, %esi | ||
613 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
614 | xorl %ebp, %esi | ||
615 | movb %dh, %cl | ||
616 | shrl $16, %eax | ||
617 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
618 | xorl %ebp, %esi | ||
619 | movb %ah, %bl | ||
620 | shrl $16, %edx | ||
621 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
622 | xorl %ebp, %esi | ||
623 | movl 24(%esp), %ebp | ||
624 | movb %dh, %cl | ||
625 | andl $0xff, %eax | ||
626 | andl $0xff, %edx | ||
627 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
628 | xorl %ebx, %esi | ||
629 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
630 | xorl %ebx, %esi | ||
631 | movl 0x400+des_SPtrans(%eax),%ebx | ||
632 | xorl %ebx, %esi | ||
633 | movl 0x500+des_SPtrans(%edx),%ebx | ||
634 | xorl %ebx, %esi | ||
635 | |||
636 | /* Round 14 */ | ||
637 | movl 112(%ebp), %eax | ||
638 | xorl %ebx, %ebx | ||
639 | movl 116(%ebp), %edx | ||
640 | xorl %esi, %eax | ||
641 | xorl %esi, %edx | ||
642 | andl $0xfcfcfcfc, %eax | ||
643 | andl $0xcfcfcfcf, %edx | ||
644 | movb %al, %bl | ||
645 | movb %ah, %cl | ||
646 | rorl $4, %edx | ||
647 | movl des_SPtrans(%ebx),%ebp | ||
648 | movb %dl, %bl | ||
649 | xorl %ebp, %edi | ||
650 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
651 | xorl %ebp, %edi | ||
652 | movb %dh, %cl | ||
653 | shrl $16, %eax | ||
654 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
655 | xorl %ebp, %edi | ||
656 | movb %ah, %bl | ||
657 | shrl $16, %edx | ||
658 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
659 | xorl %ebp, %edi | ||
660 | movl 24(%esp), %ebp | ||
661 | movb %dh, %cl | ||
662 | andl $0xff, %eax | ||
663 | andl $0xff, %edx | ||
664 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
665 | xorl %ebx, %edi | ||
666 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
667 | xorl %ebx, %edi | ||
668 | movl 0x400+des_SPtrans(%eax),%ebx | ||
669 | xorl %ebx, %edi | ||
670 | movl 0x500+des_SPtrans(%edx),%ebx | ||
671 | xorl %ebx, %edi | ||
672 | |||
673 | /* Round 15 */ | ||
674 | movl 120(%ebp), %eax | ||
675 | xorl %ebx, %ebx | ||
676 | movl 124(%ebp), %edx | ||
677 | xorl %edi, %eax | ||
678 | xorl %edi, %edx | ||
679 | andl $0xfcfcfcfc, %eax | ||
680 | andl $0xcfcfcfcf, %edx | ||
681 | movb %al, %bl | ||
682 | movb %ah, %cl | ||
683 | rorl $4, %edx | ||
684 | movl des_SPtrans(%ebx),%ebp | ||
685 | movb %dl, %bl | ||
686 | xorl %ebp, %esi | ||
687 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
688 | xorl %ebp, %esi | ||
689 | movb %dh, %cl | ||
690 | shrl $16, %eax | ||
691 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
692 | xorl %ebp, %esi | ||
693 | movb %ah, %bl | ||
694 | shrl $16, %edx | ||
695 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
696 | xorl %ebp, %esi | ||
697 | movl 24(%esp), %ebp | ||
698 | movb %dh, %cl | ||
699 | andl $0xff, %eax | ||
700 | andl $0xff, %edx | ||
701 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
702 | xorl %ebx, %esi | ||
703 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
704 | xorl %ebx, %esi | ||
705 | movl 0x400+des_SPtrans(%eax),%ebx | ||
706 | xorl %ebx, %esi | ||
707 | movl 0x500+des_SPtrans(%edx),%ebx | ||
708 | xorl %ebx, %esi | ||
709 | jmp .L001end | ||
710 | .L000start_decrypt: | ||
711 | |||
712 | /* Round 15 */ | ||
713 | movl 120(%ebp), %eax | ||
714 | xorl %ebx, %ebx | ||
715 | movl 124(%ebp), %edx | ||
716 | xorl %esi, %eax | ||
717 | xorl %esi, %edx | ||
718 | andl $0xfcfcfcfc, %eax | ||
719 | andl $0xcfcfcfcf, %edx | ||
720 | movb %al, %bl | ||
721 | movb %ah, %cl | ||
722 | rorl $4, %edx | ||
723 | movl des_SPtrans(%ebx),%ebp | ||
724 | movb %dl, %bl | ||
725 | xorl %ebp, %edi | ||
726 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
727 | xorl %ebp, %edi | ||
728 | movb %dh, %cl | ||
729 | shrl $16, %eax | ||
730 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
731 | xorl %ebp, %edi | ||
732 | movb %ah, %bl | ||
733 | shrl $16, %edx | ||
734 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
735 | xorl %ebp, %edi | ||
736 | movl 24(%esp), %ebp | ||
737 | movb %dh, %cl | ||
738 | andl $0xff, %eax | ||
739 | andl $0xff, %edx | ||
740 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
741 | xorl %ebx, %edi | ||
742 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
743 | xorl %ebx, %edi | ||
744 | movl 0x400+des_SPtrans(%eax),%ebx | ||
745 | xorl %ebx, %edi | ||
746 | movl 0x500+des_SPtrans(%edx),%ebx | ||
747 | xorl %ebx, %edi | ||
748 | |||
749 | /* Round 14 */ | ||
750 | movl 112(%ebp), %eax | ||
751 | xorl %ebx, %ebx | ||
752 | movl 116(%ebp), %edx | ||
753 | xorl %edi, %eax | ||
754 | xorl %edi, %edx | ||
755 | andl $0xfcfcfcfc, %eax | ||
756 | andl $0xcfcfcfcf, %edx | ||
757 | movb %al, %bl | ||
758 | movb %ah, %cl | ||
759 | rorl $4, %edx | ||
760 | movl des_SPtrans(%ebx),%ebp | ||
761 | movb %dl, %bl | ||
762 | xorl %ebp, %esi | ||
763 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
764 | xorl %ebp, %esi | ||
765 | movb %dh, %cl | ||
766 | shrl $16, %eax | ||
767 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
768 | xorl %ebp, %esi | ||
769 | movb %ah, %bl | ||
770 | shrl $16, %edx | ||
771 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
772 | xorl %ebp, %esi | ||
773 | movl 24(%esp), %ebp | ||
774 | movb %dh, %cl | ||
775 | andl $0xff, %eax | ||
776 | andl $0xff, %edx | ||
777 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
778 | xorl %ebx, %esi | ||
779 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
780 | xorl %ebx, %esi | ||
781 | movl 0x400+des_SPtrans(%eax),%ebx | ||
782 | xorl %ebx, %esi | ||
783 | movl 0x500+des_SPtrans(%edx),%ebx | ||
784 | xorl %ebx, %esi | ||
785 | |||
786 | /* Round 13 */ | ||
787 | movl 104(%ebp), %eax | ||
788 | xorl %ebx, %ebx | ||
789 | movl 108(%ebp), %edx | ||
790 | xorl %esi, %eax | ||
791 | xorl %esi, %edx | ||
792 | andl $0xfcfcfcfc, %eax | ||
793 | andl $0xcfcfcfcf, %edx | ||
794 | movb %al, %bl | ||
795 | movb %ah, %cl | ||
796 | rorl $4, %edx | ||
797 | movl des_SPtrans(%ebx),%ebp | ||
798 | movb %dl, %bl | ||
799 | xorl %ebp, %edi | ||
800 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
801 | xorl %ebp, %edi | ||
802 | movb %dh, %cl | ||
803 | shrl $16, %eax | ||
804 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
805 | xorl %ebp, %edi | ||
806 | movb %ah, %bl | ||
807 | shrl $16, %edx | ||
808 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
809 | xorl %ebp, %edi | ||
810 | movl 24(%esp), %ebp | ||
811 | movb %dh, %cl | ||
812 | andl $0xff, %eax | ||
813 | andl $0xff, %edx | ||
814 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
815 | xorl %ebx, %edi | ||
816 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
817 | xorl %ebx, %edi | ||
818 | movl 0x400+des_SPtrans(%eax),%ebx | ||
819 | xorl %ebx, %edi | ||
820 | movl 0x500+des_SPtrans(%edx),%ebx | ||
821 | xorl %ebx, %edi | ||
822 | |||
823 | /* Round 12 */ | ||
824 | movl 96(%ebp), %eax | ||
825 | xorl %ebx, %ebx | ||
826 | movl 100(%ebp), %edx | ||
827 | xorl %edi, %eax | ||
828 | xorl %edi, %edx | ||
829 | andl $0xfcfcfcfc, %eax | ||
830 | andl $0xcfcfcfcf, %edx | ||
831 | movb %al, %bl | ||
832 | movb %ah, %cl | ||
833 | rorl $4, %edx | ||
834 | movl des_SPtrans(%ebx),%ebp | ||
835 | movb %dl, %bl | ||
836 | xorl %ebp, %esi | ||
837 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
838 | xorl %ebp, %esi | ||
839 | movb %dh, %cl | ||
840 | shrl $16, %eax | ||
841 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
842 | xorl %ebp, %esi | ||
843 | movb %ah, %bl | ||
844 | shrl $16, %edx | ||
845 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
846 | xorl %ebp, %esi | ||
847 | movl 24(%esp), %ebp | ||
848 | movb %dh, %cl | ||
849 | andl $0xff, %eax | ||
850 | andl $0xff, %edx | ||
851 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
852 | xorl %ebx, %esi | ||
853 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
854 | xorl %ebx, %esi | ||
855 | movl 0x400+des_SPtrans(%eax),%ebx | ||
856 | xorl %ebx, %esi | ||
857 | movl 0x500+des_SPtrans(%edx),%ebx | ||
858 | xorl %ebx, %esi | ||
859 | |||
860 | /* Round 11 */ | ||
861 | movl 88(%ebp), %eax | ||
862 | xorl %ebx, %ebx | ||
863 | movl 92(%ebp), %edx | ||
864 | xorl %esi, %eax | ||
865 | xorl %esi, %edx | ||
866 | andl $0xfcfcfcfc, %eax | ||
867 | andl $0xcfcfcfcf, %edx | ||
868 | movb %al, %bl | ||
869 | movb %ah, %cl | ||
870 | rorl $4, %edx | ||
871 | movl des_SPtrans(%ebx),%ebp | ||
872 | movb %dl, %bl | ||
873 | xorl %ebp, %edi | ||
874 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
875 | xorl %ebp, %edi | ||
876 | movb %dh, %cl | ||
877 | shrl $16, %eax | ||
878 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
879 | xorl %ebp, %edi | ||
880 | movb %ah, %bl | ||
881 | shrl $16, %edx | ||
882 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
883 | xorl %ebp, %edi | ||
884 | movl 24(%esp), %ebp | ||
885 | movb %dh, %cl | ||
886 | andl $0xff, %eax | ||
887 | andl $0xff, %edx | ||
888 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
889 | xorl %ebx, %edi | ||
890 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
891 | xorl %ebx, %edi | ||
892 | movl 0x400+des_SPtrans(%eax),%ebx | ||
893 | xorl %ebx, %edi | ||
894 | movl 0x500+des_SPtrans(%edx),%ebx | ||
895 | xorl %ebx, %edi | ||
896 | |||
897 | /* Round 10 */ | ||
898 | movl 80(%ebp), %eax | ||
899 | xorl %ebx, %ebx | ||
900 | movl 84(%ebp), %edx | ||
901 | xorl %edi, %eax | ||
902 | xorl %edi, %edx | ||
903 | andl $0xfcfcfcfc, %eax | ||
904 | andl $0xcfcfcfcf, %edx | ||
905 | movb %al, %bl | ||
906 | movb %ah, %cl | ||
907 | rorl $4, %edx | ||
908 | movl des_SPtrans(%ebx),%ebp | ||
909 | movb %dl, %bl | ||
910 | xorl %ebp, %esi | ||
911 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
912 | xorl %ebp, %esi | ||
913 | movb %dh, %cl | ||
914 | shrl $16, %eax | ||
915 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
916 | xorl %ebp, %esi | ||
917 | movb %ah, %bl | ||
918 | shrl $16, %edx | ||
919 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
920 | xorl %ebp, %esi | ||
921 | movl 24(%esp), %ebp | ||
922 | movb %dh, %cl | ||
923 | andl $0xff, %eax | ||
924 | andl $0xff, %edx | ||
925 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
926 | xorl %ebx, %esi | ||
927 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
928 | xorl %ebx, %esi | ||
929 | movl 0x400+des_SPtrans(%eax),%ebx | ||
930 | xorl %ebx, %esi | ||
931 | movl 0x500+des_SPtrans(%edx),%ebx | ||
932 | xorl %ebx, %esi | ||
933 | |||
934 | /* Round 9 */ | ||
935 | movl 72(%ebp), %eax | ||
936 | xorl %ebx, %ebx | ||
937 | movl 76(%ebp), %edx | ||
938 | xorl %esi, %eax | ||
939 | xorl %esi, %edx | ||
940 | andl $0xfcfcfcfc, %eax | ||
941 | andl $0xcfcfcfcf, %edx | ||
942 | movb %al, %bl | ||
943 | movb %ah, %cl | ||
944 | rorl $4, %edx | ||
945 | movl des_SPtrans(%ebx),%ebp | ||
946 | movb %dl, %bl | ||
947 | xorl %ebp, %edi | ||
948 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
949 | xorl %ebp, %edi | ||
950 | movb %dh, %cl | ||
951 | shrl $16, %eax | ||
952 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
953 | xorl %ebp, %edi | ||
954 | movb %ah, %bl | ||
955 | shrl $16, %edx | ||
956 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
957 | xorl %ebp, %edi | ||
958 | movl 24(%esp), %ebp | ||
959 | movb %dh, %cl | ||
960 | andl $0xff, %eax | ||
961 | andl $0xff, %edx | ||
962 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
963 | xorl %ebx, %edi | ||
964 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
965 | xorl %ebx, %edi | ||
966 | movl 0x400+des_SPtrans(%eax),%ebx | ||
967 | xorl %ebx, %edi | ||
968 | movl 0x500+des_SPtrans(%edx),%ebx | ||
969 | xorl %ebx, %edi | ||
970 | |||
971 | /* Round 8 */ | ||
972 | movl 64(%ebp), %eax | ||
973 | xorl %ebx, %ebx | ||
974 | movl 68(%ebp), %edx | ||
975 | xorl %edi, %eax | ||
976 | xorl %edi, %edx | ||
977 | andl $0xfcfcfcfc, %eax | ||
978 | andl $0xcfcfcfcf, %edx | ||
979 | movb %al, %bl | ||
980 | movb %ah, %cl | ||
981 | rorl $4, %edx | ||
982 | movl des_SPtrans(%ebx),%ebp | ||
983 | movb %dl, %bl | ||
984 | xorl %ebp, %esi | ||
985 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
986 | xorl %ebp, %esi | ||
987 | movb %dh, %cl | ||
988 | shrl $16, %eax | ||
989 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
990 | xorl %ebp, %esi | ||
991 | movb %ah, %bl | ||
992 | shrl $16, %edx | ||
993 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
994 | xorl %ebp, %esi | ||
995 | movl 24(%esp), %ebp | ||
996 | movb %dh, %cl | ||
997 | andl $0xff, %eax | ||
998 | andl $0xff, %edx | ||
999 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1000 | xorl %ebx, %esi | ||
1001 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1002 | xorl %ebx, %esi | ||
1003 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1004 | xorl %ebx, %esi | ||
1005 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1006 | xorl %ebx, %esi | ||
1007 | |||
1008 | /* Round 7 */ | ||
1009 | movl 56(%ebp), %eax | ||
1010 | xorl %ebx, %ebx | ||
1011 | movl 60(%ebp), %edx | ||
1012 | xorl %esi, %eax | ||
1013 | xorl %esi, %edx | ||
1014 | andl $0xfcfcfcfc, %eax | ||
1015 | andl $0xcfcfcfcf, %edx | ||
1016 | movb %al, %bl | ||
1017 | movb %ah, %cl | ||
1018 | rorl $4, %edx | ||
1019 | movl des_SPtrans(%ebx),%ebp | ||
1020 | movb %dl, %bl | ||
1021 | xorl %ebp, %edi | ||
1022 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1023 | xorl %ebp, %edi | ||
1024 | movb %dh, %cl | ||
1025 | shrl $16, %eax | ||
1026 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1027 | xorl %ebp, %edi | ||
1028 | movb %ah, %bl | ||
1029 | shrl $16, %edx | ||
1030 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1031 | xorl %ebp, %edi | ||
1032 | movl 24(%esp), %ebp | ||
1033 | movb %dh, %cl | ||
1034 | andl $0xff, %eax | ||
1035 | andl $0xff, %edx | ||
1036 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1037 | xorl %ebx, %edi | ||
1038 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1039 | xorl %ebx, %edi | ||
1040 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1041 | xorl %ebx, %edi | ||
1042 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1043 | xorl %ebx, %edi | ||
1044 | |||
1045 | /* Round 6 */ | ||
1046 | movl 48(%ebp), %eax | ||
1047 | xorl %ebx, %ebx | ||
1048 | movl 52(%ebp), %edx | ||
1049 | xorl %edi, %eax | ||
1050 | xorl %edi, %edx | ||
1051 | andl $0xfcfcfcfc, %eax | ||
1052 | andl $0xcfcfcfcf, %edx | ||
1053 | movb %al, %bl | ||
1054 | movb %ah, %cl | ||
1055 | rorl $4, %edx | ||
1056 | movl des_SPtrans(%ebx),%ebp | ||
1057 | movb %dl, %bl | ||
1058 | xorl %ebp, %esi | ||
1059 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1060 | xorl %ebp, %esi | ||
1061 | movb %dh, %cl | ||
1062 | shrl $16, %eax | ||
1063 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1064 | xorl %ebp, %esi | ||
1065 | movb %ah, %bl | ||
1066 | shrl $16, %edx | ||
1067 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1068 | xorl %ebp, %esi | ||
1069 | movl 24(%esp), %ebp | ||
1070 | movb %dh, %cl | ||
1071 | andl $0xff, %eax | ||
1072 | andl $0xff, %edx | ||
1073 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1074 | xorl %ebx, %esi | ||
1075 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1076 | xorl %ebx, %esi | ||
1077 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1078 | xorl %ebx, %esi | ||
1079 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1080 | xorl %ebx, %esi | ||
1081 | |||
1082 | /* Round 5 */ | ||
1083 | movl 40(%ebp), %eax | ||
1084 | xorl %ebx, %ebx | ||
1085 | movl 44(%ebp), %edx | ||
1086 | xorl %esi, %eax | ||
1087 | xorl %esi, %edx | ||
1088 | andl $0xfcfcfcfc, %eax | ||
1089 | andl $0xcfcfcfcf, %edx | ||
1090 | movb %al, %bl | ||
1091 | movb %ah, %cl | ||
1092 | rorl $4, %edx | ||
1093 | movl des_SPtrans(%ebx),%ebp | ||
1094 | movb %dl, %bl | ||
1095 | xorl %ebp, %edi | ||
1096 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1097 | xorl %ebp, %edi | ||
1098 | movb %dh, %cl | ||
1099 | shrl $16, %eax | ||
1100 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1101 | xorl %ebp, %edi | ||
1102 | movb %ah, %bl | ||
1103 | shrl $16, %edx | ||
1104 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1105 | xorl %ebp, %edi | ||
1106 | movl 24(%esp), %ebp | ||
1107 | movb %dh, %cl | ||
1108 | andl $0xff, %eax | ||
1109 | andl $0xff, %edx | ||
1110 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1111 | xorl %ebx, %edi | ||
1112 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1113 | xorl %ebx, %edi | ||
1114 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1115 | xorl %ebx, %edi | ||
1116 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1117 | xorl %ebx, %edi | ||
1118 | |||
1119 | /* Round 4 */ | ||
1120 | movl 32(%ebp), %eax | ||
1121 | xorl %ebx, %ebx | ||
1122 | movl 36(%ebp), %edx | ||
1123 | xorl %edi, %eax | ||
1124 | xorl %edi, %edx | ||
1125 | andl $0xfcfcfcfc, %eax | ||
1126 | andl $0xcfcfcfcf, %edx | ||
1127 | movb %al, %bl | ||
1128 | movb %ah, %cl | ||
1129 | rorl $4, %edx | ||
1130 | movl des_SPtrans(%ebx),%ebp | ||
1131 | movb %dl, %bl | ||
1132 | xorl %ebp, %esi | ||
1133 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1134 | xorl %ebp, %esi | ||
1135 | movb %dh, %cl | ||
1136 | shrl $16, %eax | ||
1137 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1138 | xorl %ebp, %esi | ||
1139 | movb %ah, %bl | ||
1140 | shrl $16, %edx | ||
1141 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1142 | xorl %ebp, %esi | ||
1143 | movl 24(%esp), %ebp | ||
1144 | movb %dh, %cl | ||
1145 | andl $0xff, %eax | ||
1146 | andl $0xff, %edx | ||
1147 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1148 | xorl %ebx, %esi | ||
1149 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1150 | xorl %ebx, %esi | ||
1151 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1152 | xorl %ebx, %esi | ||
1153 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1154 | xorl %ebx, %esi | ||
1155 | |||
1156 | /* Round 3 */ | ||
1157 | movl 24(%ebp), %eax | ||
1158 | xorl %ebx, %ebx | ||
1159 | movl 28(%ebp), %edx | ||
1160 | xorl %esi, %eax | ||
1161 | xorl %esi, %edx | ||
1162 | andl $0xfcfcfcfc, %eax | ||
1163 | andl $0xcfcfcfcf, %edx | ||
1164 | movb %al, %bl | ||
1165 | movb %ah, %cl | ||
1166 | rorl $4, %edx | ||
1167 | movl des_SPtrans(%ebx),%ebp | ||
1168 | movb %dl, %bl | ||
1169 | xorl %ebp, %edi | ||
1170 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1171 | xorl %ebp, %edi | ||
1172 | movb %dh, %cl | ||
1173 | shrl $16, %eax | ||
1174 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1175 | xorl %ebp, %edi | ||
1176 | movb %ah, %bl | ||
1177 | shrl $16, %edx | ||
1178 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1179 | xorl %ebp, %edi | ||
1180 | movl 24(%esp), %ebp | ||
1181 | movb %dh, %cl | ||
1182 | andl $0xff, %eax | ||
1183 | andl $0xff, %edx | ||
1184 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1185 | xorl %ebx, %edi | ||
1186 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1187 | xorl %ebx, %edi | ||
1188 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1189 | xorl %ebx, %edi | ||
1190 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1191 | xorl %ebx, %edi | ||
1192 | |||
1193 | /* Round 2 */ | ||
1194 | movl 16(%ebp), %eax | ||
1195 | xorl %ebx, %ebx | ||
1196 | movl 20(%ebp), %edx | ||
1197 | xorl %edi, %eax | ||
1198 | xorl %edi, %edx | ||
1199 | andl $0xfcfcfcfc, %eax | ||
1200 | andl $0xcfcfcfcf, %edx | ||
1201 | movb %al, %bl | ||
1202 | movb %ah, %cl | ||
1203 | rorl $4, %edx | ||
1204 | movl des_SPtrans(%ebx),%ebp | ||
1205 | movb %dl, %bl | ||
1206 | xorl %ebp, %esi | ||
1207 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1208 | xorl %ebp, %esi | ||
1209 | movb %dh, %cl | ||
1210 | shrl $16, %eax | ||
1211 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1212 | xorl %ebp, %esi | ||
1213 | movb %ah, %bl | ||
1214 | shrl $16, %edx | ||
1215 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1216 | xorl %ebp, %esi | ||
1217 | movl 24(%esp), %ebp | ||
1218 | movb %dh, %cl | ||
1219 | andl $0xff, %eax | ||
1220 | andl $0xff, %edx | ||
1221 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1222 | xorl %ebx, %esi | ||
1223 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1224 | xorl %ebx, %esi | ||
1225 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1226 | xorl %ebx, %esi | ||
1227 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1228 | xorl %ebx, %esi | ||
1229 | |||
1230 | /* Round 1 */ | ||
1231 | movl 8(%ebp), %eax | ||
1232 | xorl %ebx, %ebx | ||
1233 | movl 12(%ebp), %edx | ||
1234 | xorl %esi, %eax | ||
1235 | xorl %esi, %edx | ||
1236 | andl $0xfcfcfcfc, %eax | ||
1237 | andl $0xcfcfcfcf, %edx | ||
1238 | movb %al, %bl | ||
1239 | movb %ah, %cl | ||
1240 | rorl $4, %edx | ||
1241 | movl des_SPtrans(%ebx),%ebp | ||
1242 | movb %dl, %bl | ||
1243 | xorl %ebp, %edi | ||
1244 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1245 | xorl %ebp, %edi | ||
1246 | movb %dh, %cl | ||
1247 | shrl $16, %eax | ||
1248 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1249 | xorl %ebp, %edi | ||
1250 | movb %ah, %bl | ||
1251 | shrl $16, %edx | ||
1252 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1253 | xorl %ebp, %edi | ||
1254 | movl 24(%esp), %ebp | ||
1255 | movb %dh, %cl | ||
1256 | andl $0xff, %eax | ||
1257 | andl $0xff, %edx | ||
1258 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1259 | xorl %ebx, %edi | ||
1260 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1261 | xorl %ebx, %edi | ||
1262 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1263 | xorl %ebx, %edi | ||
1264 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1265 | xorl %ebx, %edi | ||
1266 | |||
1267 | /* Round 0 */ | ||
1268 | movl (%ebp), %eax | ||
1269 | xorl %ebx, %ebx | ||
1270 | movl 4(%ebp), %edx | ||
1271 | xorl %edi, %eax | ||
1272 | xorl %edi, %edx | ||
1273 | andl $0xfcfcfcfc, %eax | ||
1274 | andl $0xcfcfcfcf, %edx | ||
1275 | movb %al, %bl | ||
1276 | movb %ah, %cl | ||
1277 | rorl $4, %edx | ||
1278 | movl des_SPtrans(%ebx),%ebp | ||
1279 | movb %dl, %bl | ||
1280 | xorl %ebp, %esi | ||
1281 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1282 | xorl %ebp, %esi | ||
1283 | movb %dh, %cl | ||
1284 | shrl $16, %eax | ||
1285 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1286 | xorl %ebp, %esi | ||
1287 | movb %ah, %bl | ||
1288 | shrl $16, %edx | ||
1289 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1290 | xorl %ebp, %esi | ||
1291 | movl 24(%esp), %ebp | ||
1292 | movb %dh, %cl | ||
1293 | andl $0xff, %eax | ||
1294 | andl $0xff, %edx | ||
1295 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1296 | xorl %ebx, %esi | ||
1297 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1298 | xorl %ebx, %esi | ||
1299 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1300 | xorl %ebx, %esi | ||
1301 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1302 | xorl %ebx, %esi | ||
1303 | .L001end: | ||
1304 | |||
1305 | /* FP */ | ||
1306 | movl 20(%esp), %edx | ||
1307 | .byte 209 | ||
1308 | .byte 206 /* rorl $1 %esi */ | ||
1309 | movl %edi, %eax | ||
1310 | xorl %esi, %edi | ||
1311 | andl $0xaaaaaaaa, %edi | ||
1312 | xorl %edi, %eax | ||
1313 | xorl %edi, %esi | ||
1314 | |||
1315 | roll $23, %eax | ||
1316 | movl %eax, %edi | ||
1317 | xorl %esi, %eax | ||
1318 | andl $0x03fc03fc, %eax | ||
1319 | xorl %eax, %edi | ||
1320 | xorl %eax, %esi | ||
1321 | |||
1322 | roll $10, %edi | ||
1323 | movl %edi, %eax | ||
1324 | xorl %esi, %edi | ||
1325 | andl $0x33333333, %edi | ||
1326 | xorl %edi, %eax | ||
1327 | xorl %edi, %esi | ||
1328 | |||
1329 | roll $18, %esi | ||
1330 | movl %esi, %edi | ||
1331 | xorl %eax, %esi | ||
1332 | andl $0xfff0000f, %esi | ||
1333 | xorl %esi, %edi | ||
1334 | xorl %esi, %eax | ||
1335 | |||
1336 | roll $12, %edi | ||
1337 | movl %edi, %esi | ||
1338 | xorl %eax, %edi | ||
1339 | andl $0xf0f0f0f0, %edi | ||
1340 | xorl %edi, %esi | ||
1341 | xorl %edi, %eax | ||
1342 | |||
1343 | rorl $4, %eax | ||
1344 | movl %eax, (%edx) | ||
1345 | movl %esi, 4(%edx) | ||
1346 | popl %ebp | ||
1347 | popl %ebx | ||
1348 | popl %edi | ||
1349 | popl %esi | ||
1350 | ret | ||
1351 | .des_encrypt_end: | ||
1352 | SIZE(des_encrypt,.des_encrypt_end-des_encrypt) | ||
1353 | .ident "desasm.pl" | ||
1354 | .text | ||
1355 | .align ALIGN | ||
1356 | .globl des_encrypt2 | ||
1357 | TYPE(des_encrypt2,@function) | ||
1358 | des_encrypt2: | ||
1359 | pushl %esi | ||
1360 | pushl %edi | ||
1361 | |||
1362 | /* Load the 2 words */ | ||
1363 | movl 12(%esp), %eax | ||
1364 | xorl %ecx, %ecx | ||
1365 | pushl %ebx | ||
1366 | pushl %ebp | ||
1367 | movl (%eax), %esi | ||
1368 | movl 28(%esp), %ebx | ||
1369 | roll $3, %esi | ||
1370 | movl 4(%eax), %edi | ||
1371 | roll $3, %edi | ||
1372 | movl 24(%esp), %ebp | ||
1373 | cmpl $0, %ebx | ||
1374 | je .L002start_decrypt | ||
1375 | |||
1376 | /* Round 0 */ | ||
1377 | movl (%ebp), %eax | ||
1378 | xorl %ebx, %ebx | ||
1379 | movl 4(%ebp), %edx | ||
1380 | xorl %esi, %eax | ||
1381 | xorl %esi, %edx | ||
1382 | andl $0xfcfcfcfc, %eax | ||
1383 | andl $0xcfcfcfcf, %edx | ||
1384 | movb %al, %bl | ||
1385 | movb %ah, %cl | ||
1386 | rorl $4, %edx | ||
1387 | movl des_SPtrans(%ebx),%ebp | ||
1388 | movb %dl, %bl | ||
1389 | xorl %ebp, %edi | ||
1390 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1391 | xorl %ebp, %edi | ||
1392 | movb %dh, %cl | ||
1393 | shrl $16, %eax | ||
1394 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1395 | xorl %ebp, %edi | ||
1396 | movb %ah, %bl | ||
1397 | shrl $16, %edx | ||
1398 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1399 | xorl %ebp, %edi | ||
1400 | movl 24(%esp), %ebp | ||
1401 | movb %dh, %cl | ||
1402 | andl $0xff, %eax | ||
1403 | andl $0xff, %edx | ||
1404 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1405 | xorl %ebx, %edi | ||
1406 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1407 | xorl %ebx, %edi | ||
1408 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1409 | xorl %ebx, %edi | ||
1410 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1411 | xorl %ebx, %edi | ||
1412 | |||
1413 | /* Round 1 */ | ||
1414 | movl 8(%ebp), %eax | ||
1415 | xorl %ebx, %ebx | ||
1416 | movl 12(%ebp), %edx | ||
1417 | xorl %edi, %eax | ||
1418 | xorl %edi, %edx | ||
1419 | andl $0xfcfcfcfc, %eax | ||
1420 | andl $0xcfcfcfcf, %edx | ||
1421 | movb %al, %bl | ||
1422 | movb %ah, %cl | ||
1423 | rorl $4, %edx | ||
1424 | movl des_SPtrans(%ebx),%ebp | ||
1425 | movb %dl, %bl | ||
1426 | xorl %ebp, %esi | ||
1427 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1428 | xorl %ebp, %esi | ||
1429 | movb %dh, %cl | ||
1430 | shrl $16, %eax | ||
1431 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1432 | xorl %ebp, %esi | ||
1433 | movb %ah, %bl | ||
1434 | shrl $16, %edx | ||
1435 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1436 | xorl %ebp, %esi | ||
1437 | movl 24(%esp), %ebp | ||
1438 | movb %dh, %cl | ||
1439 | andl $0xff, %eax | ||
1440 | andl $0xff, %edx | ||
1441 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1442 | xorl %ebx, %esi | ||
1443 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1444 | xorl %ebx, %esi | ||
1445 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1446 | xorl %ebx, %esi | ||
1447 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1448 | xorl %ebx, %esi | ||
1449 | |||
1450 | /* Round 2 */ | ||
1451 | movl 16(%ebp), %eax | ||
1452 | xorl %ebx, %ebx | ||
1453 | movl 20(%ebp), %edx | ||
1454 | xorl %esi, %eax | ||
1455 | xorl %esi, %edx | ||
1456 | andl $0xfcfcfcfc, %eax | ||
1457 | andl $0xcfcfcfcf, %edx | ||
1458 | movb %al, %bl | ||
1459 | movb %ah, %cl | ||
1460 | rorl $4, %edx | ||
1461 | movl des_SPtrans(%ebx),%ebp | ||
1462 | movb %dl, %bl | ||
1463 | xorl %ebp, %edi | ||
1464 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1465 | xorl %ebp, %edi | ||
1466 | movb %dh, %cl | ||
1467 | shrl $16, %eax | ||
1468 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1469 | xorl %ebp, %edi | ||
1470 | movb %ah, %bl | ||
1471 | shrl $16, %edx | ||
1472 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1473 | xorl %ebp, %edi | ||
1474 | movl 24(%esp), %ebp | ||
1475 | movb %dh, %cl | ||
1476 | andl $0xff, %eax | ||
1477 | andl $0xff, %edx | ||
1478 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1479 | xorl %ebx, %edi | ||
1480 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1481 | xorl %ebx, %edi | ||
1482 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1483 | xorl %ebx, %edi | ||
1484 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1485 | xorl %ebx, %edi | ||
1486 | |||
1487 | /* Round 3 */ | ||
1488 | movl 24(%ebp), %eax | ||
1489 | xorl %ebx, %ebx | ||
1490 | movl 28(%ebp), %edx | ||
1491 | xorl %edi, %eax | ||
1492 | xorl %edi, %edx | ||
1493 | andl $0xfcfcfcfc, %eax | ||
1494 | andl $0xcfcfcfcf, %edx | ||
1495 | movb %al, %bl | ||
1496 | movb %ah, %cl | ||
1497 | rorl $4, %edx | ||
1498 | movl des_SPtrans(%ebx),%ebp | ||
1499 | movb %dl, %bl | ||
1500 | xorl %ebp, %esi | ||
1501 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1502 | xorl %ebp, %esi | ||
1503 | movb %dh, %cl | ||
1504 | shrl $16, %eax | ||
1505 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1506 | xorl %ebp, %esi | ||
1507 | movb %ah, %bl | ||
1508 | shrl $16, %edx | ||
1509 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1510 | xorl %ebp, %esi | ||
1511 | movl 24(%esp), %ebp | ||
1512 | movb %dh, %cl | ||
1513 | andl $0xff, %eax | ||
1514 | andl $0xff, %edx | ||
1515 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1516 | xorl %ebx, %esi | ||
1517 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1518 | xorl %ebx, %esi | ||
1519 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1520 | xorl %ebx, %esi | ||
1521 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1522 | xorl %ebx, %esi | ||
1523 | |||
1524 | /* Round 4 */ | ||
1525 | movl 32(%ebp), %eax | ||
1526 | xorl %ebx, %ebx | ||
1527 | movl 36(%ebp), %edx | ||
1528 | xorl %esi, %eax | ||
1529 | xorl %esi, %edx | ||
1530 | andl $0xfcfcfcfc, %eax | ||
1531 | andl $0xcfcfcfcf, %edx | ||
1532 | movb %al, %bl | ||
1533 | movb %ah, %cl | ||
1534 | rorl $4, %edx | ||
1535 | movl des_SPtrans(%ebx),%ebp | ||
1536 | movb %dl, %bl | ||
1537 | xorl %ebp, %edi | ||
1538 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1539 | xorl %ebp, %edi | ||
1540 | movb %dh, %cl | ||
1541 | shrl $16, %eax | ||
1542 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1543 | xorl %ebp, %edi | ||
1544 | movb %ah, %bl | ||
1545 | shrl $16, %edx | ||
1546 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1547 | xorl %ebp, %edi | ||
1548 | movl 24(%esp), %ebp | ||
1549 | movb %dh, %cl | ||
1550 | andl $0xff, %eax | ||
1551 | andl $0xff, %edx | ||
1552 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1553 | xorl %ebx, %edi | ||
1554 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1555 | xorl %ebx, %edi | ||
1556 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1557 | xorl %ebx, %edi | ||
1558 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1559 | xorl %ebx, %edi | ||
1560 | |||
1561 | /* Round 5 */ | ||
1562 | movl 40(%ebp), %eax | ||
1563 | xorl %ebx, %ebx | ||
1564 | movl 44(%ebp), %edx | ||
1565 | xorl %edi, %eax | ||
1566 | xorl %edi, %edx | ||
1567 | andl $0xfcfcfcfc, %eax | ||
1568 | andl $0xcfcfcfcf, %edx | ||
1569 | movb %al, %bl | ||
1570 | movb %ah, %cl | ||
1571 | rorl $4, %edx | ||
1572 | movl des_SPtrans(%ebx),%ebp | ||
1573 | movb %dl, %bl | ||
1574 | xorl %ebp, %esi | ||
1575 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1576 | xorl %ebp, %esi | ||
1577 | movb %dh, %cl | ||
1578 | shrl $16, %eax | ||
1579 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1580 | xorl %ebp, %esi | ||
1581 | movb %ah, %bl | ||
1582 | shrl $16, %edx | ||
1583 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1584 | xorl %ebp, %esi | ||
1585 | movl 24(%esp), %ebp | ||
1586 | movb %dh, %cl | ||
1587 | andl $0xff, %eax | ||
1588 | andl $0xff, %edx | ||
1589 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1590 | xorl %ebx, %esi | ||
1591 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1592 | xorl %ebx, %esi | ||
1593 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1594 | xorl %ebx, %esi | ||
1595 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1596 | xorl %ebx, %esi | ||
1597 | |||
1598 | /* Round 6 */ | ||
1599 | movl 48(%ebp), %eax | ||
1600 | xorl %ebx, %ebx | ||
1601 | movl 52(%ebp), %edx | ||
1602 | xorl %esi, %eax | ||
1603 | xorl %esi, %edx | ||
1604 | andl $0xfcfcfcfc, %eax | ||
1605 | andl $0xcfcfcfcf, %edx | ||
1606 | movb %al, %bl | ||
1607 | movb %ah, %cl | ||
1608 | rorl $4, %edx | ||
1609 | movl des_SPtrans(%ebx),%ebp | ||
1610 | movb %dl, %bl | ||
1611 | xorl %ebp, %edi | ||
1612 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1613 | xorl %ebp, %edi | ||
1614 | movb %dh, %cl | ||
1615 | shrl $16, %eax | ||
1616 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1617 | xorl %ebp, %edi | ||
1618 | movb %ah, %bl | ||
1619 | shrl $16, %edx | ||
1620 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1621 | xorl %ebp, %edi | ||
1622 | movl 24(%esp), %ebp | ||
1623 | movb %dh, %cl | ||
1624 | andl $0xff, %eax | ||
1625 | andl $0xff, %edx | ||
1626 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1627 | xorl %ebx, %edi | ||
1628 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1629 | xorl %ebx, %edi | ||
1630 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1631 | xorl %ebx, %edi | ||
1632 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1633 | xorl %ebx, %edi | ||
1634 | |||
1635 | /* Round 7 */ | ||
1636 | movl 56(%ebp), %eax | ||
1637 | xorl %ebx, %ebx | ||
1638 | movl 60(%ebp), %edx | ||
1639 | xorl %edi, %eax | ||
1640 | xorl %edi, %edx | ||
1641 | andl $0xfcfcfcfc, %eax | ||
1642 | andl $0xcfcfcfcf, %edx | ||
1643 | movb %al, %bl | ||
1644 | movb %ah, %cl | ||
1645 | rorl $4, %edx | ||
1646 | movl des_SPtrans(%ebx),%ebp | ||
1647 | movb %dl, %bl | ||
1648 | xorl %ebp, %esi | ||
1649 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1650 | xorl %ebp, %esi | ||
1651 | movb %dh, %cl | ||
1652 | shrl $16, %eax | ||
1653 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1654 | xorl %ebp, %esi | ||
1655 | movb %ah, %bl | ||
1656 | shrl $16, %edx | ||
1657 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1658 | xorl %ebp, %esi | ||
1659 | movl 24(%esp), %ebp | ||
1660 | movb %dh, %cl | ||
1661 | andl $0xff, %eax | ||
1662 | andl $0xff, %edx | ||
1663 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1664 | xorl %ebx, %esi | ||
1665 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1666 | xorl %ebx, %esi | ||
1667 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1668 | xorl %ebx, %esi | ||
1669 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1670 | xorl %ebx, %esi | ||
1671 | |||
1672 | /* Round 8 */ | ||
1673 | movl 64(%ebp), %eax | ||
1674 | xorl %ebx, %ebx | ||
1675 | movl 68(%ebp), %edx | ||
1676 | xorl %esi, %eax | ||
1677 | xorl %esi, %edx | ||
1678 | andl $0xfcfcfcfc, %eax | ||
1679 | andl $0xcfcfcfcf, %edx | ||
1680 | movb %al, %bl | ||
1681 | movb %ah, %cl | ||
1682 | rorl $4, %edx | ||
1683 | movl des_SPtrans(%ebx),%ebp | ||
1684 | movb %dl, %bl | ||
1685 | xorl %ebp, %edi | ||
1686 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1687 | xorl %ebp, %edi | ||
1688 | movb %dh, %cl | ||
1689 | shrl $16, %eax | ||
1690 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1691 | xorl %ebp, %edi | ||
1692 | movb %ah, %bl | ||
1693 | shrl $16, %edx | ||
1694 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1695 | xorl %ebp, %edi | ||
1696 | movl 24(%esp), %ebp | ||
1697 | movb %dh, %cl | ||
1698 | andl $0xff, %eax | ||
1699 | andl $0xff, %edx | ||
1700 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1701 | xorl %ebx, %edi | ||
1702 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1703 | xorl %ebx, %edi | ||
1704 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1705 | xorl %ebx, %edi | ||
1706 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1707 | xorl %ebx, %edi | ||
1708 | |||
1709 | /* Round 9 */ | ||
1710 | movl 72(%ebp), %eax | ||
1711 | xorl %ebx, %ebx | ||
1712 | movl 76(%ebp), %edx | ||
1713 | xorl %edi, %eax | ||
1714 | xorl %edi, %edx | ||
1715 | andl $0xfcfcfcfc, %eax | ||
1716 | andl $0xcfcfcfcf, %edx | ||
1717 | movb %al, %bl | ||
1718 | movb %ah, %cl | ||
1719 | rorl $4, %edx | ||
1720 | movl des_SPtrans(%ebx),%ebp | ||
1721 | movb %dl, %bl | ||
1722 | xorl %ebp, %esi | ||
1723 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1724 | xorl %ebp, %esi | ||
1725 | movb %dh, %cl | ||
1726 | shrl $16, %eax | ||
1727 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1728 | xorl %ebp, %esi | ||
1729 | movb %ah, %bl | ||
1730 | shrl $16, %edx | ||
1731 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1732 | xorl %ebp, %esi | ||
1733 | movl 24(%esp), %ebp | ||
1734 | movb %dh, %cl | ||
1735 | andl $0xff, %eax | ||
1736 | andl $0xff, %edx | ||
1737 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1738 | xorl %ebx, %esi | ||
1739 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1740 | xorl %ebx, %esi | ||
1741 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1742 | xorl %ebx, %esi | ||
1743 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1744 | xorl %ebx, %esi | ||
1745 | |||
1746 | /* Round 10 */ | ||
1747 | movl 80(%ebp), %eax | ||
1748 | xorl %ebx, %ebx | ||
1749 | movl 84(%ebp), %edx | ||
1750 | xorl %esi, %eax | ||
1751 | xorl %esi, %edx | ||
1752 | andl $0xfcfcfcfc, %eax | ||
1753 | andl $0xcfcfcfcf, %edx | ||
1754 | movb %al, %bl | ||
1755 | movb %ah, %cl | ||
1756 | rorl $4, %edx | ||
1757 | movl des_SPtrans(%ebx),%ebp | ||
1758 | movb %dl, %bl | ||
1759 | xorl %ebp, %edi | ||
1760 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1761 | xorl %ebp, %edi | ||
1762 | movb %dh, %cl | ||
1763 | shrl $16, %eax | ||
1764 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1765 | xorl %ebp, %edi | ||
1766 | movb %ah, %bl | ||
1767 | shrl $16, %edx | ||
1768 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1769 | xorl %ebp, %edi | ||
1770 | movl 24(%esp), %ebp | ||
1771 | movb %dh, %cl | ||
1772 | andl $0xff, %eax | ||
1773 | andl $0xff, %edx | ||
1774 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1775 | xorl %ebx, %edi | ||
1776 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1777 | xorl %ebx, %edi | ||
1778 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1779 | xorl %ebx, %edi | ||
1780 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1781 | xorl %ebx, %edi | ||
1782 | |||
1783 | /* Round 11 */ | ||
1784 | movl 88(%ebp), %eax | ||
1785 | xorl %ebx, %ebx | ||
1786 | movl 92(%ebp), %edx | ||
1787 | xorl %edi, %eax | ||
1788 | xorl %edi, %edx | ||
1789 | andl $0xfcfcfcfc, %eax | ||
1790 | andl $0xcfcfcfcf, %edx | ||
1791 | movb %al, %bl | ||
1792 | movb %ah, %cl | ||
1793 | rorl $4, %edx | ||
1794 | movl des_SPtrans(%ebx),%ebp | ||
1795 | movb %dl, %bl | ||
1796 | xorl %ebp, %esi | ||
1797 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1798 | xorl %ebp, %esi | ||
1799 | movb %dh, %cl | ||
1800 | shrl $16, %eax | ||
1801 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1802 | xorl %ebp, %esi | ||
1803 | movb %ah, %bl | ||
1804 | shrl $16, %edx | ||
1805 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1806 | xorl %ebp, %esi | ||
1807 | movl 24(%esp), %ebp | ||
1808 | movb %dh, %cl | ||
1809 | andl $0xff, %eax | ||
1810 | andl $0xff, %edx | ||
1811 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1812 | xorl %ebx, %esi | ||
1813 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1814 | xorl %ebx, %esi | ||
1815 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1816 | xorl %ebx, %esi | ||
1817 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1818 | xorl %ebx, %esi | ||
1819 | |||
1820 | /* Round 12 */ | ||
1821 | movl 96(%ebp), %eax | ||
1822 | xorl %ebx, %ebx | ||
1823 | movl 100(%ebp), %edx | ||
1824 | xorl %esi, %eax | ||
1825 | xorl %esi, %edx | ||
1826 | andl $0xfcfcfcfc, %eax | ||
1827 | andl $0xcfcfcfcf, %edx | ||
1828 | movb %al, %bl | ||
1829 | movb %ah, %cl | ||
1830 | rorl $4, %edx | ||
1831 | movl des_SPtrans(%ebx),%ebp | ||
1832 | movb %dl, %bl | ||
1833 | xorl %ebp, %edi | ||
1834 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1835 | xorl %ebp, %edi | ||
1836 | movb %dh, %cl | ||
1837 | shrl $16, %eax | ||
1838 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1839 | xorl %ebp, %edi | ||
1840 | movb %ah, %bl | ||
1841 | shrl $16, %edx | ||
1842 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1843 | xorl %ebp, %edi | ||
1844 | movl 24(%esp), %ebp | ||
1845 | movb %dh, %cl | ||
1846 | andl $0xff, %eax | ||
1847 | andl $0xff, %edx | ||
1848 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1849 | xorl %ebx, %edi | ||
1850 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1851 | xorl %ebx, %edi | ||
1852 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1853 | xorl %ebx, %edi | ||
1854 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1855 | xorl %ebx, %edi | ||
1856 | |||
1857 | /* Round 13 */ | ||
1858 | movl 104(%ebp), %eax | ||
1859 | xorl %ebx, %ebx | ||
1860 | movl 108(%ebp), %edx | ||
1861 | xorl %edi, %eax | ||
1862 | xorl %edi, %edx | ||
1863 | andl $0xfcfcfcfc, %eax | ||
1864 | andl $0xcfcfcfcf, %edx | ||
1865 | movb %al, %bl | ||
1866 | movb %ah, %cl | ||
1867 | rorl $4, %edx | ||
1868 | movl des_SPtrans(%ebx),%ebp | ||
1869 | movb %dl, %bl | ||
1870 | xorl %ebp, %esi | ||
1871 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1872 | xorl %ebp, %esi | ||
1873 | movb %dh, %cl | ||
1874 | shrl $16, %eax | ||
1875 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1876 | xorl %ebp, %esi | ||
1877 | movb %ah, %bl | ||
1878 | shrl $16, %edx | ||
1879 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1880 | xorl %ebp, %esi | ||
1881 | movl 24(%esp), %ebp | ||
1882 | movb %dh, %cl | ||
1883 | andl $0xff, %eax | ||
1884 | andl $0xff, %edx | ||
1885 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1886 | xorl %ebx, %esi | ||
1887 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1888 | xorl %ebx, %esi | ||
1889 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1890 | xorl %ebx, %esi | ||
1891 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1892 | xorl %ebx, %esi | ||
1893 | |||
1894 | /* Round 14 */ | ||
1895 | movl 112(%ebp), %eax | ||
1896 | xorl %ebx, %ebx | ||
1897 | movl 116(%ebp), %edx | ||
1898 | xorl %esi, %eax | ||
1899 | xorl %esi, %edx | ||
1900 | andl $0xfcfcfcfc, %eax | ||
1901 | andl $0xcfcfcfcf, %edx | ||
1902 | movb %al, %bl | ||
1903 | movb %ah, %cl | ||
1904 | rorl $4, %edx | ||
1905 | movl des_SPtrans(%ebx),%ebp | ||
1906 | movb %dl, %bl | ||
1907 | xorl %ebp, %edi | ||
1908 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1909 | xorl %ebp, %edi | ||
1910 | movb %dh, %cl | ||
1911 | shrl $16, %eax | ||
1912 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1913 | xorl %ebp, %edi | ||
1914 | movb %ah, %bl | ||
1915 | shrl $16, %edx | ||
1916 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1917 | xorl %ebp, %edi | ||
1918 | movl 24(%esp), %ebp | ||
1919 | movb %dh, %cl | ||
1920 | andl $0xff, %eax | ||
1921 | andl $0xff, %edx | ||
1922 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1923 | xorl %ebx, %edi | ||
1924 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1925 | xorl %ebx, %edi | ||
1926 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1927 | xorl %ebx, %edi | ||
1928 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1929 | xorl %ebx, %edi | ||
1930 | |||
1931 | /* Round 15 */ | ||
1932 | movl 120(%ebp), %eax | ||
1933 | xorl %ebx, %ebx | ||
1934 | movl 124(%ebp), %edx | ||
1935 | xorl %edi, %eax | ||
1936 | xorl %edi, %edx | ||
1937 | andl $0xfcfcfcfc, %eax | ||
1938 | andl $0xcfcfcfcf, %edx | ||
1939 | movb %al, %bl | ||
1940 | movb %ah, %cl | ||
1941 | rorl $4, %edx | ||
1942 | movl des_SPtrans(%ebx),%ebp | ||
1943 | movb %dl, %bl | ||
1944 | xorl %ebp, %esi | ||
1945 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1946 | xorl %ebp, %esi | ||
1947 | movb %dh, %cl | ||
1948 | shrl $16, %eax | ||
1949 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1950 | xorl %ebp, %esi | ||
1951 | movb %ah, %bl | ||
1952 | shrl $16, %edx | ||
1953 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1954 | xorl %ebp, %esi | ||
1955 | movl 24(%esp), %ebp | ||
1956 | movb %dh, %cl | ||
1957 | andl $0xff, %eax | ||
1958 | andl $0xff, %edx | ||
1959 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1960 | xorl %ebx, %esi | ||
1961 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
1962 | xorl %ebx, %esi | ||
1963 | movl 0x400+des_SPtrans(%eax),%ebx | ||
1964 | xorl %ebx, %esi | ||
1965 | movl 0x500+des_SPtrans(%edx),%ebx | ||
1966 | xorl %ebx, %esi | ||
1967 | jmp .L003end | ||
1968 | .L002start_decrypt: | ||
1969 | |||
1970 | /* Round 15 */ | ||
1971 | movl 120(%ebp), %eax | ||
1972 | xorl %ebx, %ebx | ||
1973 | movl 124(%ebp), %edx | ||
1974 | xorl %esi, %eax | ||
1975 | xorl %esi, %edx | ||
1976 | andl $0xfcfcfcfc, %eax | ||
1977 | andl $0xcfcfcfcf, %edx | ||
1978 | movb %al, %bl | ||
1979 | movb %ah, %cl | ||
1980 | rorl $4, %edx | ||
1981 | movl des_SPtrans(%ebx),%ebp | ||
1982 | movb %dl, %bl | ||
1983 | xorl %ebp, %edi | ||
1984 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
1985 | xorl %ebp, %edi | ||
1986 | movb %dh, %cl | ||
1987 | shrl $16, %eax | ||
1988 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
1989 | xorl %ebp, %edi | ||
1990 | movb %ah, %bl | ||
1991 | shrl $16, %edx | ||
1992 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
1993 | xorl %ebp, %edi | ||
1994 | movl 24(%esp), %ebp | ||
1995 | movb %dh, %cl | ||
1996 | andl $0xff, %eax | ||
1997 | andl $0xff, %edx | ||
1998 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
1999 | xorl %ebx, %edi | ||
2000 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2001 | xorl %ebx, %edi | ||
2002 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2003 | xorl %ebx, %edi | ||
2004 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2005 | xorl %ebx, %edi | ||
2006 | |||
2007 | /* Round 14 */ | ||
2008 | movl 112(%ebp), %eax | ||
2009 | xorl %ebx, %ebx | ||
2010 | movl 116(%ebp), %edx | ||
2011 | xorl %edi, %eax | ||
2012 | xorl %edi, %edx | ||
2013 | andl $0xfcfcfcfc, %eax | ||
2014 | andl $0xcfcfcfcf, %edx | ||
2015 | movb %al, %bl | ||
2016 | movb %ah, %cl | ||
2017 | rorl $4, %edx | ||
2018 | movl des_SPtrans(%ebx),%ebp | ||
2019 | movb %dl, %bl | ||
2020 | xorl %ebp, %esi | ||
2021 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2022 | xorl %ebp, %esi | ||
2023 | movb %dh, %cl | ||
2024 | shrl $16, %eax | ||
2025 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2026 | xorl %ebp, %esi | ||
2027 | movb %ah, %bl | ||
2028 | shrl $16, %edx | ||
2029 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2030 | xorl %ebp, %esi | ||
2031 | movl 24(%esp), %ebp | ||
2032 | movb %dh, %cl | ||
2033 | andl $0xff, %eax | ||
2034 | andl $0xff, %edx | ||
2035 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2036 | xorl %ebx, %esi | ||
2037 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2038 | xorl %ebx, %esi | ||
2039 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2040 | xorl %ebx, %esi | ||
2041 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2042 | xorl %ebx, %esi | ||
2043 | |||
2044 | /* Round 13 */ | ||
2045 | movl 104(%ebp), %eax | ||
2046 | xorl %ebx, %ebx | ||
2047 | movl 108(%ebp), %edx | ||
2048 | xorl %esi, %eax | ||
2049 | xorl %esi, %edx | ||
2050 | andl $0xfcfcfcfc, %eax | ||
2051 | andl $0xcfcfcfcf, %edx | ||
2052 | movb %al, %bl | ||
2053 | movb %ah, %cl | ||
2054 | rorl $4, %edx | ||
2055 | movl des_SPtrans(%ebx),%ebp | ||
2056 | movb %dl, %bl | ||
2057 | xorl %ebp, %edi | ||
2058 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2059 | xorl %ebp, %edi | ||
2060 | movb %dh, %cl | ||
2061 | shrl $16, %eax | ||
2062 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2063 | xorl %ebp, %edi | ||
2064 | movb %ah, %bl | ||
2065 | shrl $16, %edx | ||
2066 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2067 | xorl %ebp, %edi | ||
2068 | movl 24(%esp), %ebp | ||
2069 | movb %dh, %cl | ||
2070 | andl $0xff, %eax | ||
2071 | andl $0xff, %edx | ||
2072 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2073 | xorl %ebx, %edi | ||
2074 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2075 | xorl %ebx, %edi | ||
2076 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2077 | xorl %ebx, %edi | ||
2078 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2079 | xorl %ebx, %edi | ||
2080 | |||
2081 | /* Round 12 */ | ||
2082 | movl 96(%ebp), %eax | ||
2083 | xorl %ebx, %ebx | ||
2084 | movl 100(%ebp), %edx | ||
2085 | xorl %edi, %eax | ||
2086 | xorl %edi, %edx | ||
2087 | andl $0xfcfcfcfc, %eax | ||
2088 | andl $0xcfcfcfcf, %edx | ||
2089 | movb %al, %bl | ||
2090 | movb %ah, %cl | ||
2091 | rorl $4, %edx | ||
2092 | movl des_SPtrans(%ebx),%ebp | ||
2093 | movb %dl, %bl | ||
2094 | xorl %ebp, %esi | ||
2095 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2096 | xorl %ebp, %esi | ||
2097 | movb %dh, %cl | ||
2098 | shrl $16, %eax | ||
2099 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2100 | xorl %ebp, %esi | ||
2101 | movb %ah, %bl | ||
2102 | shrl $16, %edx | ||
2103 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2104 | xorl %ebp, %esi | ||
2105 | movl 24(%esp), %ebp | ||
2106 | movb %dh, %cl | ||
2107 | andl $0xff, %eax | ||
2108 | andl $0xff, %edx | ||
2109 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2110 | xorl %ebx, %esi | ||
2111 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2112 | xorl %ebx, %esi | ||
2113 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2114 | xorl %ebx, %esi | ||
2115 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2116 | xorl %ebx, %esi | ||
2117 | |||
2118 | /* Round 11 */ | ||
2119 | movl 88(%ebp), %eax | ||
2120 | xorl %ebx, %ebx | ||
2121 | movl 92(%ebp), %edx | ||
2122 | xorl %esi, %eax | ||
2123 | xorl %esi, %edx | ||
2124 | andl $0xfcfcfcfc, %eax | ||
2125 | andl $0xcfcfcfcf, %edx | ||
2126 | movb %al, %bl | ||
2127 | movb %ah, %cl | ||
2128 | rorl $4, %edx | ||
2129 | movl des_SPtrans(%ebx),%ebp | ||
2130 | movb %dl, %bl | ||
2131 | xorl %ebp, %edi | ||
2132 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2133 | xorl %ebp, %edi | ||
2134 | movb %dh, %cl | ||
2135 | shrl $16, %eax | ||
2136 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2137 | xorl %ebp, %edi | ||
2138 | movb %ah, %bl | ||
2139 | shrl $16, %edx | ||
2140 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2141 | xorl %ebp, %edi | ||
2142 | movl 24(%esp), %ebp | ||
2143 | movb %dh, %cl | ||
2144 | andl $0xff, %eax | ||
2145 | andl $0xff, %edx | ||
2146 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2147 | xorl %ebx, %edi | ||
2148 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2149 | xorl %ebx, %edi | ||
2150 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2151 | xorl %ebx, %edi | ||
2152 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2153 | xorl %ebx, %edi | ||
2154 | |||
2155 | /* Round 10 */ | ||
2156 | movl 80(%ebp), %eax | ||
2157 | xorl %ebx, %ebx | ||
2158 | movl 84(%ebp), %edx | ||
2159 | xorl %edi, %eax | ||
2160 | xorl %edi, %edx | ||
2161 | andl $0xfcfcfcfc, %eax | ||
2162 | andl $0xcfcfcfcf, %edx | ||
2163 | movb %al, %bl | ||
2164 | movb %ah, %cl | ||
2165 | rorl $4, %edx | ||
2166 | movl des_SPtrans(%ebx),%ebp | ||
2167 | movb %dl, %bl | ||
2168 | xorl %ebp, %esi | ||
2169 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2170 | xorl %ebp, %esi | ||
2171 | movb %dh, %cl | ||
2172 | shrl $16, %eax | ||
2173 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2174 | xorl %ebp, %esi | ||
2175 | movb %ah, %bl | ||
2176 | shrl $16, %edx | ||
2177 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2178 | xorl %ebp, %esi | ||
2179 | movl 24(%esp), %ebp | ||
2180 | movb %dh, %cl | ||
2181 | andl $0xff, %eax | ||
2182 | andl $0xff, %edx | ||
2183 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2184 | xorl %ebx, %esi | ||
2185 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2186 | xorl %ebx, %esi | ||
2187 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2188 | xorl %ebx, %esi | ||
2189 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2190 | xorl %ebx, %esi | ||
2191 | |||
2192 | /* Round 9 */ | ||
2193 | movl 72(%ebp), %eax | ||
2194 | xorl %ebx, %ebx | ||
2195 | movl 76(%ebp), %edx | ||
2196 | xorl %esi, %eax | ||
2197 | xorl %esi, %edx | ||
2198 | andl $0xfcfcfcfc, %eax | ||
2199 | andl $0xcfcfcfcf, %edx | ||
2200 | movb %al, %bl | ||
2201 | movb %ah, %cl | ||
2202 | rorl $4, %edx | ||
2203 | movl des_SPtrans(%ebx),%ebp | ||
2204 | movb %dl, %bl | ||
2205 | xorl %ebp, %edi | ||
2206 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2207 | xorl %ebp, %edi | ||
2208 | movb %dh, %cl | ||
2209 | shrl $16, %eax | ||
2210 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2211 | xorl %ebp, %edi | ||
2212 | movb %ah, %bl | ||
2213 | shrl $16, %edx | ||
2214 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2215 | xorl %ebp, %edi | ||
2216 | movl 24(%esp), %ebp | ||
2217 | movb %dh, %cl | ||
2218 | andl $0xff, %eax | ||
2219 | andl $0xff, %edx | ||
2220 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2221 | xorl %ebx, %edi | ||
2222 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2223 | xorl %ebx, %edi | ||
2224 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2225 | xorl %ebx, %edi | ||
2226 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2227 | xorl %ebx, %edi | ||
2228 | |||
2229 | /* Round 8 */ | ||
2230 | movl 64(%ebp), %eax | ||
2231 | xorl %ebx, %ebx | ||
2232 | movl 68(%ebp), %edx | ||
2233 | xorl %edi, %eax | ||
2234 | xorl %edi, %edx | ||
2235 | andl $0xfcfcfcfc, %eax | ||
2236 | andl $0xcfcfcfcf, %edx | ||
2237 | movb %al, %bl | ||
2238 | movb %ah, %cl | ||
2239 | rorl $4, %edx | ||
2240 | movl des_SPtrans(%ebx),%ebp | ||
2241 | movb %dl, %bl | ||
2242 | xorl %ebp, %esi | ||
2243 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2244 | xorl %ebp, %esi | ||
2245 | movb %dh, %cl | ||
2246 | shrl $16, %eax | ||
2247 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2248 | xorl %ebp, %esi | ||
2249 | movb %ah, %bl | ||
2250 | shrl $16, %edx | ||
2251 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2252 | xorl %ebp, %esi | ||
2253 | movl 24(%esp), %ebp | ||
2254 | movb %dh, %cl | ||
2255 | andl $0xff, %eax | ||
2256 | andl $0xff, %edx | ||
2257 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2258 | xorl %ebx, %esi | ||
2259 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2260 | xorl %ebx, %esi | ||
2261 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2262 | xorl %ebx, %esi | ||
2263 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2264 | xorl %ebx, %esi | ||
2265 | |||
2266 | /* Round 7 */ | ||
2267 | movl 56(%ebp), %eax | ||
2268 | xorl %ebx, %ebx | ||
2269 | movl 60(%ebp), %edx | ||
2270 | xorl %esi, %eax | ||
2271 | xorl %esi, %edx | ||
2272 | andl $0xfcfcfcfc, %eax | ||
2273 | andl $0xcfcfcfcf, %edx | ||
2274 | movb %al, %bl | ||
2275 | movb %ah, %cl | ||
2276 | rorl $4, %edx | ||
2277 | movl des_SPtrans(%ebx),%ebp | ||
2278 | movb %dl, %bl | ||
2279 | xorl %ebp, %edi | ||
2280 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2281 | xorl %ebp, %edi | ||
2282 | movb %dh, %cl | ||
2283 | shrl $16, %eax | ||
2284 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2285 | xorl %ebp, %edi | ||
2286 | movb %ah, %bl | ||
2287 | shrl $16, %edx | ||
2288 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2289 | xorl %ebp, %edi | ||
2290 | movl 24(%esp), %ebp | ||
2291 | movb %dh, %cl | ||
2292 | andl $0xff, %eax | ||
2293 | andl $0xff, %edx | ||
2294 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2295 | xorl %ebx, %edi | ||
2296 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2297 | xorl %ebx, %edi | ||
2298 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2299 | xorl %ebx, %edi | ||
2300 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2301 | xorl %ebx, %edi | ||
2302 | |||
2303 | /* Round 6 */ | ||
2304 | movl 48(%ebp), %eax | ||
2305 | xorl %ebx, %ebx | ||
2306 | movl 52(%ebp), %edx | ||
2307 | xorl %edi, %eax | ||
2308 | xorl %edi, %edx | ||
2309 | andl $0xfcfcfcfc, %eax | ||
2310 | andl $0xcfcfcfcf, %edx | ||
2311 | movb %al, %bl | ||
2312 | movb %ah, %cl | ||
2313 | rorl $4, %edx | ||
2314 | movl des_SPtrans(%ebx),%ebp | ||
2315 | movb %dl, %bl | ||
2316 | xorl %ebp, %esi | ||
2317 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2318 | xorl %ebp, %esi | ||
2319 | movb %dh, %cl | ||
2320 | shrl $16, %eax | ||
2321 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2322 | xorl %ebp, %esi | ||
2323 | movb %ah, %bl | ||
2324 | shrl $16, %edx | ||
2325 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2326 | xorl %ebp, %esi | ||
2327 | movl 24(%esp), %ebp | ||
2328 | movb %dh, %cl | ||
2329 | andl $0xff, %eax | ||
2330 | andl $0xff, %edx | ||
2331 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2332 | xorl %ebx, %esi | ||
2333 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2334 | xorl %ebx, %esi | ||
2335 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2336 | xorl %ebx, %esi | ||
2337 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2338 | xorl %ebx, %esi | ||
2339 | |||
2340 | /* Round 5 */ | ||
2341 | movl 40(%ebp), %eax | ||
2342 | xorl %ebx, %ebx | ||
2343 | movl 44(%ebp), %edx | ||
2344 | xorl %esi, %eax | ||
2345 | xorl %esi, %edx | ||
2346 | andl $0xfcfcfcfc, %eax | ||
2347 | andl $0xcfcfcfcf, %edx | ||
2348 | movb %al, %bl | ||
2349 | movb %ah, %cl | ||
2350 | rorl $4, %edx | ||
2351 | movl des_SPtrans(%ebx),%ebp | ||
2352 | movb %dl, %bl | ||
2353 | xorl %ebp, %edi | ||
2354 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2355 | xorl %ebp, %edi | ||
2356 | movb %dh, %cl | ||
2357 | shrl $16, %eax | ||
2358 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2359 | xorl %ebp, %edi | ||
2360 | movb %ah, %bl | ||
2361 | shrl $16, %edx | ||
2362 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2363 | xorl %ebp, %edi | ||
2364 | movl 24(%esp), %ebp | ||
2365 | movb %dh, %cl | ||
2366 | andl $0xff, %eax | ||
2367 | andl $0xff, %edx | ||
2368 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2369 | xorl %ebx, %edi | ||
2370 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2371 | xorl %ebx, %edi | ||
2372 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2373 | xorl %ebx, %edi | ||
2374 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2375 | xorl %ebx, %edi | ||
2376 | |||
2377 | /* Round 4 */ | ||
2378 | movl 32(%ebp), %eax | ||
2379 | xorl %ebx, %ebx | ||
2380 | movl 36(%ebp), %edx | ||
2381 | xorl %edi, %eax | ||
2382 | xorl %edi, %edx | ||
2383 | andl $0xfcfcfcfc, %eax | ||
2384 | andl $0xcfcfcfcf, %edx | ||
2385 | movb %al, %bl | ||
2386 | movb %ah, %cl | ||
2387 | rorl $4, %edx | ||
2388 | movl des_SPtrans(%ebx),%ebp | ||
2389 | movb %dl, %bl | ||
2390 | xorl %ebp, %esi | ||
2391 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2392 | xorl %ebp, %esi | ||
2393 | movb %dh, %cl | ||
2394 | shrl $16, %eax | ||
2395 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2396 | xorl %ebp, %esi | ||
2397 | movb %ah, %bl | ||
2398 | shrl $16, %edx | ||
2399 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2400 | xorl %ebp, %esi | ||
2401 | movl 24(%esp), %ebp | ||
2402 | movb %dh, %cl | ||
2403 | andl $0xff, %eax | ||
2404 | andl $0xff, %edx | ||
2405 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2406 | xorl %ebx, %esi | ||
2407 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2408 | xorl %ebx, %esi | ||
2409 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2410 | xorl %ebx, %esi | ||
2411 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2412 | xorl %ebx, %esi | ||
2413 | |||
2414 | /* Round 3 */ | ||
2415 | movl 24(%ebp), %eax | ||
2416 | xorl %ebx, %ebx | ||
2417 | movl 28(%ebp), %edx | ||
2418 | xorl %esi, %eax | ||
2419 | xorl %esi, %edx | ||
2420 | andl $0xfcfcfcfc, %eax | ||
2421 | andl $0xcfcfcfcf, %edx | ||
2422 | movb %al, %bl | ||
2423 | movb %ah, %cl | ||
2424 | rorl $4, %edx | ||
2425 | movl des_SPtrans(%ebx),%ebp | ||
2426 | movb %dl, %bl | ||
2427 | xorl %ebp, %edi | ||
2428 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2429 | xorl %ebp, %edi | ||
2430 | movb %dh, %cl | ||
2431 | shrl $16, %eax | ||
2432 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2433 | xorl %ebp, %edi | ||
2434 | movb %ah, %bl | ||
2435 | shrl $16, %edx | ||
2436 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2437 | xorl %ebp, %edi | ||
2438 | movl 24(%esp), %ebp | ||
2439 | movb %dh, %cl | ||
2440 | andl $0xff, %eax | ||
2441 | andl $0xff, %edx | ||
2442 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2443 | xorl %ebx, %edi | ||
2444 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2445 | xorl %ebx, %edi | ||
2446 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2447 | xorl %ebx, %edi | ||
2448 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2449 | xorl %ebx, %edi | ||
2450 | |||
2451 | /* Round 2 */ | ||
2452 | movl 16(%ebp), %eax | ||
2453 | xorl %ebx, %ebx | ||
2454 | movl 20(%ebp), %edx | ||
2455 | xorl %edi, %eax | ||
2456 | xorl %edi, %edx | ||
2457 | andl $0xfcfcfcfc, %eax | ||
2458 | andl $0xcfcfcfcf, %edx | ||
2459 | movb %al, %bl | ||
2460 | movb %ah, %cl | ||
2461 | rorl $4, %edx | ||
2462 | movl des_SPtrans(%ebx),%ebp | ||
2463 | movb %dl, %bl | ||
2464 | xorl %ebp, %esi | ||
2465 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2466 | xorl %ebp, %esi | ||
2467 | movb %dh, %cl | ||
2468 | shrl $16, %eax | ||
2469 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2470 | xorl %ebp, %esi | ||
2471 | movb %ah, %bl | ||
2472 | shrl $16, %edx | ||
2473 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2474 | xorl %ebp, %esi | ||
2475 | movl 24(%esp), %ebp | ||
2476 | movb %dh, %cl | ||
2477 | andl $0xff, %eax | ||
2478 | andl $0xff, %edx | ||
2479 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2480 | xorl %ebx, %esi | ||
2481 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2482 | xorl %ebx, %esi | ||
2483 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2484 | xorl %ebx, %esi | ||
2485 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2486 | xorl %ebx, %esi | ||
2487 | |||
2488 | /* Round 1 */ | ||
2489 | movl 8(%ebp), %eax | ||
2490 | xorl %ebx, %ebx | ||
2491 | movl 12(%ebp), %edx | ||
2492 | xorl %esi, %eax | ||
2493 | xorl %esi, %edx | ||
2494 | andl $0xfcfcfcfc, %eax | ||
2495 | andl $0xcfcfcfcf, %edx | ||
2496 | movb %al, %bl | ||
2497 | movb %ah, %cl | ||
2498 | rorl $4, %edx | ||
2499 | movl des_SPtrans(%ebx),%ebp | ||
2500 | movb %dl, %bl | ||
2501 | xorl %ebp, %edi | ||
2502 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2503 | xorl %ebp, %edi | ||
2504 | movb %dh, %cl | ||
2505 | shrl $16, %eax | ||
2506 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2507 | xorl %ebp, %edi | ||
2508 | movb %ah, %bl | ||
2509 | shrl $16, %edx | ||
2510 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2511 | xorl %ebp, %edi | ||
2512 | movl 24(%esp), %ebp | ||
2513 | movb %dh, %cl | ||
2514 | andl $0xff, %eax | ||
2515 | andl $0xff, %edx | ||
2516 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2517 | xorl %ebx, %edi | ||
2518 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2519 | xorl %ebx, %edi | ||
2520 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2521 | xorl %ebx, %edi | ||
2522 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2523 | xorl %ebx, %edi | ||
2524 | |||
2525 | /* Round 0 */ | ||
2526 | movl (%ebp), %eax | ||
2527 | xorl %ebx, %ebx | ||
2528 | movl 4(%ebp), %edx | ||
2529 | xorl %edi, %eax | ||
2530 | xorl %edi, %edx | ||
2531 | andl $0xfcfcfcfc, %eax | ||
2532 | andl $0xcfcfcfcf, %edx | ||
2533 | movb %al, %bl | ||
2534 | movb %ah, %cl | ||
2535 | rorl $4, %edx | ||
2536 | movl des_SPtrans(%ebx),%ebp | ||
2537 | movb %dl, %bl | ||
2538 | xorl %ebp, %esi | ||
2539 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
2540 | xorl %ebp, %esi | ||
2541 | movb %dh, %cl | ||
2542 | shrl $16, %eax | ||
2543 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
2544 | xorl %ebp, %esi | ||
2545 | movb %ah, %bl | ||
2546 | shrl $16, %edx | ||
2547 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
2548 | xorl %ebp, %esi | ||
2549 | movl 24(%esp), %ebp | ||
2550 | movb %dh, %cl | ||
2551 | andl $0xff, %eax | ||
2552 | andl $0xff, %edx | ||
2553 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
2554 | xorl %ebx, %esi | ||
2555 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
2556 | xorl %ebx, %esi | ||
2557 | movl 0x400+des_SPtrans(%eax),%ebx | ||
2558 | xorl %ebx, %esi | ||
2559 | movl 0x500+des_SPtrans(%edx),%ebx | ||
2560 | xorl %ebx, %esi | ||
2561 | .L003end: | ||
2562 | |||
2563 | /* Fixup */ | ||
2564 | rorl $3, %edi | ||
2565 | movl 20(%esp), %eax | ||
2566 | rorl $3, %esi | ||
2567 | movl %edi, (%eax) | ||
2568 | movl %esi, 4(%eax) | ||
2569 | popl %ebp | ||
2570 | popl %ebx | ||
2571 | popl %edi | ||
2572 | popl %esi | ||
2573 | ret | ||
2574 | .des_encrypt2_end: | ||
2575 | SIZE(des_encrypt2,.des_encrypt2_end-des_encrypt2) | ||
2576 | .ident "desasm.pl" | ||
2577 | .text | ||
2578 | .align ALIGN | ||
2579 | .globl des_encrypt3 | ||
2580 | TYPE(des_encrypt3,@function) | ||
2581 | des_encrypt3: | ||
2582 | pushl %ebx | ||
2583 | movl 8(%esp), %ebx | ||
2584 | pushl %ebp | ||
2585 | pushl %esi | ||
2586 | pushl %edi | ||
2587 | |||
2588 | /* Load the data words */ | ||
2589 | movl (%ebx), %edi | ||
2590 | movl 4(%ebx), %esi | ||
2591 | subl $12, %esp | ||
2592 | |||
2593 | /* IP */ | ||
2594 | roll $4, %edi | ||
2595 | movl %edi, %edx | ||
2596 | xorl %esi, %edi | ||
2597 | andl $0xf0f0f0f0, %edi | ||
2598 | xorl %edi, %edx | ||
2599 | xorl %edi, %esi | ||
2600 | |||
2601 | roll $20, %esi | ||
2602 | movl %esi, %edi | ||
2603 | xorl %edx, %esi | ||
2604 | andl $0xfff0000f, %esi | ||
2605 | xorl %esi, %edi | ||
2606 | xorl %esi, %edx | ||
2607 | |||
2608 | roll $14, %edi | ||
2609 | movl %edi, %esi | ||
2610 | xorl %edx, %edi | ||
2611 | andl $0x33333333, %edi | ||
2612 | xorl %edi, %esi | ||
2613 | xorl %edi, %edx | ||
2614 | |||
2615 | roll $22, %edx | ||
2616 | movl %edx, %edi | ||
2617 | xorl %esi, %edx | ||
2618 | andl $0x03fc03fc, %edx | ||
2619 | xorl %edx, %edi | ||
2620 | xorl %edx, %esi | ||
2621 | |||
2622 | roll $9, %edi | ||
2623 | movl %edi, %edx | ||
2624 | xorl %esi, %edi | ||
2625 | andl $0xaaaaaaaa, %edi | ||
2626 | xorl %edi, %edx | ||
2627 | xorl %edi, %esi | ||
2628 | |||
2629 | rorl $3, %edx | ||
2630 | rorl $2, %esi | ||
2631 | movl %esi, 4(%ebx) | ||
2632 | movl 36(%esp), %eax | ||
2633 | movl %edx, (%ebx) | ||
2634 | movl 40(%esp), %edi | ||
2635 | movl 44(%esp), %esi | ||
2636 | movl $1, 8(%esp) | ||
2637 | movl %eax, 4(%esp) | ||
2638 | movl %ebx, (%esp) | ||
2639 | call des_encrypt2 | ||
2640 | movl $0, 8(%esp) | ||
2641 | movl %edi, 4(%esp) | ||
2642 | movl %ebx, (%esp) | ||
2643 | call des_encrypt2 | ||
2644 | movl $1, 8(%esp) | ||
2645 | movl %esi, 4(%esp) | ||
2646 | movl %ebx, (%esp) | ||
2647 | call des_encrypt2 | ||
2648 | addl $12, %esp | ||
2649 | movl (%ebx), %edi | ||
2650 | movl 4(%ebx), %esi | ||
2651 | |||
2652 | /* FP */ | ||
2653 | roll $2, %esi | ||
2654 | roll $3, %edi | ||
2655 | movl %edi, %eax | ||
2656 | xorl %esi, %edi | ||
2657 | andl $0xaaaaaaaa, %edi | ||
2658 | xorl %edi, %eax | ||
2659 | xorl %edi, %esi | ||
2660 | |||
2661 | roll $23, %eax | ||
2662 | movl %eax, %edi | ||
2663 | xorl %esi, %eax | ||
2664 | andl $0x03fc03fc, %eax | ||
2665 | xorl %eax, %edi | ||
2666 | xorl %eax, %esi | ||
2667 | |||
2668 | roll $10, %edi | ||
2669 | movl %edi, %eax | ||
2670 | xorl %esi, %edi | ||
2671 | andl $0x33333333, %edi | ||
2672 | xorl %edi, %eax | ||
2673 | xorl %edi, %esi | ||
2674 | |||
2675 | roll $18, %esi | ||
2676 | movl %esi, %edi | ||
2677 | xorl %eax, %esi | ||
2678 | andl $0xfff0000f, %esi | ||
2679 | xorl %esi, %edi | ||
2680 | xorl %esi, %eax | ||
2681 | |||
2682 | roll $12, %edi | ||
2683 | movl %edi, %esi | ||
2684 | xorl %eax, %edi | ||
2685 | andl $0xf0f0f0f0, %edi | ||
2686 | xorl %edi, %esi | ||
2687 | xorl %edi, %eax | ||
2688 | |||
2689 | rorl $4, %eax | ||
2690 | movl %eax, (%ebx) | ||
2691 | movl %esi, 4(%ebx) | ||
2692 | popl %edi | ||
2693 | popl %esi | ||
2694 | popl %ebp | ||
2695 | popl %ebx | ||
2696 | ret | ||
2697 | .des_encrypt3_end: | ||
2698 | SIZE(des_encrypt3,.des_encrypt3_end-des_encrypt3) | ||
2699 | .ident "desasm.pl" | ||
2700 | .text | ||
2701 | .align ALIGN | ||
2702 | .globl des_decrypt3 | ||
2703 | TYPE(des_decrypt3,@function) | ||
2704 | des_decrypt3: | ||
2705 | pushl %ebx | ||
2706 | movl 8(%esp), %ebx | ||
2707 | pushl %ebp | ||
2708 | pushl %esi | ||
2709 | pushl %edi | ||
2710 | |||
2711 | /* Load the data words */ | ||
2712 | movl (%ebx), %edi | ||
2713 | movl 4(%ebx), %esi | ||
2714 | subl $12, %esp | ||
2715 | |||
2716 | /* IP */ | ||
2717 | roll $4, %edi | ||
2718 | movl %edi, %edx | ||
2719 | xorl %esi, %edi | ||
2720 | andl $0xf0f0f0f0, %edi | ||
2721 | xorl %edi, %edx | ||
2722 | xorl %edi, %esi | ||
2723 | |||
2724 | roll $20, %esi | ||
2725 | movl %esi, %edi | ||
2726 | xorl %edx, %esi | ||
2727 | andl $0xfff0000f, %esi | ||
2728 | xorl %esi, %edi | ||
2729 | xorl %esi, %edx | ||
2730 | |||
2731 | roll $14, %edi | ||
2732 | movl %edi, %esi | ||
2733 | xorl %edx, %edi | ||
2734 | andl $0x33333333, %edi | ||
2735 | xorl %edi, %esi | ||
2736 | xorl %edi, %edx | ||
2737 | |||
2738 | roll $22, %edx | ||
2739 | movl %edx, %edi | ||
2740 | xorl %esi, %edx | ||
2741 | andl $0x03fc03fc, %edx | ||
2742 | xorl %edx, %edi | ||
2743 | xorl %edx, %esi | ||
2744 | |||
2745 | roll $9, %edi | ||
2746 | movl %edi, %edx | ||
2747 | xorl %esi, %edi | ||
2748 | andl $0xaaaaaaaa, %edi | ||
2749 | xorl %edi, %edx | ||
2750 | xorl %edi, %esi | ||
2751 | |||
2752 | rorl $3, %edx | ||
2753 | rorl $2, %esi | ||
2754 | movl %esi, 4(%ebx) | ||
2755 | movl 36(%esp), %esi | ||
2756 | movl %edx, (%ebx) | ||
2757 | movl 40(%esp), %edi | ||
2758 | movl 44(%esp), %eax | ||
2759 | movl $0, 8(%esp) | ||
2760 | movl %eax, 4(%esp) | ||
2761 | movl %ebx, (%esp) | ||
2762 | call des_encrypt2 | ||
2763 | movl $1, 8(%esp) | ||
2764 | movl %edi, 4(%esp) | ||
2765 | movl %ebx, (%esp) | ||
2766 | call des_encrypt2 | ||
2767 | movl $0, 8(%esp) | ||
2768 | movl %esi, 4(%esp) | ||
2769 | movl %ebx, (%esp) | ||
2770 | call des_encrypt2 | ||
2771 | addl $12, %esp | ||
2772 | movl (%ebx), %edi | ||
2773 | movl 4(%ebx), %esi | ||
2774 | |||
2775 | /* FP */ | ||
2776 | roll $2, %esi | ||
2777 | roll $3, %edi | ||
2778 | movl %edi, %eax | ||
2779 | xorl %esi, %edi | ||
2780 | andl $0xaaaaaaaa, %edi | ||
2781 | xorl %edi, %eax | ||
2782 | xorl %edi, %esi | ||
2783 | |||
2784 | roll $23, %eax | ||
2785 | movl %eax, %edi | ||
2786 | xorl %esi, %eax | ||
2787 | andl $0x03fc03fc, %eax | ||
2788 | xorl %eax, %edi | ||
2789 | xorl %eax, %esi | ||
2790 | |||
2791 | roll $10, %edi | ||
2792 | movl %edi, %eax | ||
2793 | xorl %esi, %edi | ||
2794 | andl $0x33333333, %edi | ||
2795 | xorl %edi, %eax | ||
2796 | xorl %edi, %esi | ||
2797 | |||
2798 | roll $18, %esi | ||
2799 | movl %esi, %edi | ||
2800 | xorl %eax, %esi | ||
2801 | andl $0xfff0000f, %esi | ||
2802 | xorl %esi, %edi | ||
2803 | xorl %esi, %eax | ||
2804 | |||
2805 | roll $12, %edi | ||
2806 | movl %edi, %esi | ||
2807 | xorl %eax, %edi | ||
2808 | andl $0xf0f0f0f0, %edi | ||
2809 | xorl %edi, %esi | ||
2810 | xorl %edi, %eax | ||
2811 | |||
2812 | rorl $4, %eax | ||
2813 | movl %eax, (%ebx) | ||
2814 | movl %esi, 4(%ebx) | ||
2815 | popl %edi | ||
2816 | popl %esi | ||
2817 | popl %ebp | ||
2818 | popl %ebx | ||
2819 | ret | ||
2820 | .des_decrypt3_end: | ||
2821 | SIZE(des_decrypt3,.des_decrypt3_end-des_decrypt3) | ||
2822 | .ident "desasm.pl" | ||
2823 | .text | ||
2824 | .align ALIGN | ||
2825 | .globl des_ncbc_encrypt | ||
2826 | TYPE(des_ncbc_encrypt,@function) | ||
2827 | des_ncbc_encrypt: | ||
2828 | |||
2829 | pushl %ebp | ||
2830 | pushl %ebx | ||
2831 | pushl %esi | ||
2832 | pushl %edi | ||
2833 | movl 28(%esp), %ebp | ||
2834 | /* getting iv ptr from parameter 4 */ | ||
2835 | movl 36(%esp), %ebx | ||
2836 | movl (%ebx), %esi | ||
2837 | movl 4(%ebx), %edi | ||
2838 | pushl %edi | ||
2839 | pushl %esi | ||
2840 | pushl %edi | ||
2841 | pushl %esi | ||
2842 | movl %esp, %ebx | ||
2843 | movl 36(%esp), %esi | ||
2844 | movl 40(%esp), %edi | ||
2845 | /* getting encrypt flag from parameter 5 */ | ||
2846 | movl 56(%esp), %ecx | ||
2847 | /* get and push parameter 5 */ | ||
2848 | pushl %ecx | ||
2849 | /* get and push parameter 3 */ | ||
2850 | movl 52(%esp), %eax | ||
2851 | pushl %eax | ||
2852 | pushl %ebx | ||
2853 | cmpl $0, %ecx | ||
2854 | jz .L004decrypt | ||
2855 | andl $4294967288, %ebp | ||
2856 | movl 12(%esp), %eax | ||
2857 | movl 16(%esp), %ebx | ||
2858 | jz .L005encrypt_finish | ||
2859 | .L006encrypt_loop: | ||
2860 | movl (%esi), %ecx | ||
2861 | movl 4(%esi), %edx | ||
2862 | xorl %ecx, %eax | ||
2863 | xorl %edx, %ebx | ||
2864 | movl %eax, 12(%esp) | ||
2865 | movl %ebx, 16(%esp) | ||
2866 | call des_encrypt | ||
2867 | movl 12(%esp), %eax | ||
2868 | movl 16(%esp), %ebx | ||
2869 | movl %eax, (%edi) | ||
2870 | movl %ebx, 4(%edi) | ||
2871 | addl $8, %esi | ||
2872 | addl $8, %edi | ||
2873 | subl $8, %ebp | ||
2874 | jnz .L006encrypt_loop | ||
2875 | .L005encrypt_finish: | ||
2876 | movl 56(%esp), %ebp | ||
2877 | andl $7, %ebp | ||
2878 | jz .L007finish | ||
2879 | xorl %ecx, %ecx | ||
2880 | xorl %edx, %edx | ||
2881 | movl .L008cbc_enc_jmp_table(,%ebp,4),%ebp | ||
2882 | jmp *%ebp | ||
2883 | .L009ej7: | ||
2884 | movb 6(%esi), %dh | ||
2885 | sall $8, %edx | ||
2886 | .L010ej6: | ||
2887 | movb 5(%esi), %dh | ||
2888 | .L011ej5: | ||
2889 | movb 4(%esi), %dl | ||
2890 | .L012ej4: | ||
2891 | movl (%esi), %ecx | ||
2892 | jmp .L013ejend | ||
2893 | .L014ej3: | ||
2894 | movb 2(%esi), %ch | ||
2895 | sall $8, %ecx | ||
2896 | .L015ej2: | ||
2897 | movb 1(%esi), %ch | ||
2898 | .L016ej1: | ||
2899 | movb (%esi), %cl | ||
2900 | .L013ejend: | ||
2901 | xorl %ecx, %eax | ||
2902 | xorl %edx, %ebx | ||
2903 | movl %eax, 12(%esp) | ||
2904 | movl %ebx, 16(%esp) | ||
2905 | call des_encrypt | ||
2906 | movl 12(%esp), %eax | ||
2907 | movl 16(%esp), %ebx | ||
2908 | movl %eax, (%edi) | ||
2909 | movl %ebx, 4(%edi) | ||
2910 | jmp .L007finish | ||
2911 | .align ALIGN | ||
2912 | .L004decrypt: | ||
2913 | andl $4294967288, %ebp | ||
2914 | movl 20(%esp), %eax | ||
2915 | movl 24(%esp), %ebx | ||
2916 | jz .L017decrypt_finish | ||
2917 | .L018decrypt_loop: | ||
2918 | movl (%esi), %eax | ||
2919 | movl 4(%esi), %ebx | ||
2920 | movl %eax, 12(%esp) | ||
2921 | movl %ebx, 16(%esp) | ||
2922 | call des_encrypt | ||
2923 | movl 12(%esp), %eax | ||
2924 | movl 16(%esp), %ebx | ||
2925 | movl 20(%esp), %ecx | ||
2926 | movl 24(%esp), %edx | ||
2927 | xorl %eax, %ecx | ||
2928 | xorl %ebx, %edx | ||
2929 | movl (%esi), %eax | ||
2930 | movl 4(%esi), %ebx | ||
2931 | movl %ecx, (%edi) | ||
2932 | movl %edx, 4(%edi) | ||
2933 | movl %eax, 20(%esp) | ||
2934 | movl %ebx, 24(%esp) | ||
2935 | addl $8, %esi | ||
2936 | addl $8, %edi | ||
2937 | subl $8, %ebp | ||
2938 | jnz .L018decrypt_loop | ||
2939 | .L017decrypt_finish: | ||
2940 | movl 56(%esp), %ebp | ||
2941 | andl $7, %ebp | ||
2942 | jz .L007finish | ||
2943 | movl (%esi), %eax | ||
2944 | movl 4(%esi), %ebx | ||
2945 | movl %eax, 12(%esp) | ||
2946 | movl %ebx, 16(%esp) | ||
2947 | call des_encrypt | ||
2948 | movl 12(%esp), %eax | ||
2949 | movl 16(%esp), %ebx | ||
2950 | movl 20(%esp), %ecx | ||
2951 | movl 24(%esp), %edx | ||
2952 | xorl %eax, %ecx | ||
2953 | xorl %ebx, %edx | ||
2954 | movl (%esi), %eax | ||
2955 | movl 4(%esi), %ebx | ||
2956 | .L019dj7: | ||
2957 | rorl $16, %edx | ||
2958 | movb %dl, 6(%edi) | ||
2959 | shrl $16, %edx | ||
2960 | .L020dj6: | ||
2961 | movb %dh, 5(%edi) | ||
2962 | .L021dj5: | ||
2963 | movb %dl, 4(%edi) | ||
2964 | .L022dj4: | ||
2965 | movl %ecx, (%edi) | ||
2966 | jmp .L023djend | ||
2967 | .L024dj3: | ||
2968 | rorl $16, %ecx | ||
2969 | movb %cl, 2(%edi) | ||
2970 | sall $16, %ecx | ||
2971 | .L025dj2: | ||
2972 | movb %ch, 1(%esi) | ||
2973 | .L026dj1: | ||
2974 | movb %cl, (%esi) | ||
2975 | .L023djend: | ||
2976 | jmp .L007finish | ||
2977 | .align ALIGN | ||
2978 | .L007finish: | ||
2979 | movl 64(%esp), %ecx | ||
2980 | addl $28, %esp | ||
2981 | movl %eax, (%ecx) | ||
2982 | movl %ebx, 4(%ecx) | ||
2983 | popl %edi | ||
2984 | popl %esi | ||
2985 | popl %ebx | ||
2986 | popl %ebp | ||
2987 | ret | ||
2988 | .align ALIGN | ||
2989 | .L008cbc_enc_jmp_table: | ||
2990 | .long 0 | ||
2991 | .long .L016ej1 | ||
2992 | .long .L015ej2 | ||
2993 | .long .L014ej3 | ||
2994 | .long .L012ej4 | ||
2995 | .long .L011ej5 | ||
2996 | .long .L010ej6 | ||
2997 | .long .L009ej7 | ||
2998 | .align ALIGN | ||
2999 | .L027cbc_dec_jmp_table: | ||
3000 | .long 0 | ||
3001 | .long .L026dj1 | ||
3002 | .long .L025dj2 | ||
3003 | .long .L024dj3 | ||
3004 | .long .L022dj4 | ||
3005 | .long .L021dj5 | ||
3006 | .long .L020dj6 | ||
3007 | .long .L019dj7 | ||
3008 | .des_ncbc_encrypt_end: | ||
3009 | SIZE(des_ncbc_encrypt,.des_ncbc_encrypt_end-des_ncbc_encrypt) | ||
3010 | .ident "desasm.pl" | ||
3011 | .text | ||
3012 | .align ALIGN | ||
3013 | .globl des_ede3_cbc_encrypt | ||
3014 | TYPE(des_ede3_cbc_encrypt,@function) | ||
3015 | des_ede3_cbc_encrypt: | ||
3016 | |||
3017 | pushl %ebp | ||
3018 | pushl %ebx | ||
3019 | pushl %esi | ||
3020 | pushl %edi | ||
3021 | movl 28(%esp), %ebp | ||
3022 | /* getting iv ptr from parameter 6 */ | ||
3023 | movl 44(%esp), %ebx | ||
3024 | movl (%ebx), %esi | ||
3025 | movl 4(%ebx), %edi | ||
3026 | pushl %edi | ||
3027 | pushl %esi | ||
3028 | pushl %edi | ||
3029 | pushl %esi | ||
3030 | movl %esp, %ebx | ||
3031 | movl 36(%esp), %esi | ||
3032 | movl 40(%esp), %edi | ||
3033 | /* getting encrypt flag from parameter 7 */ | ||
3034 | movl 64(%esp), %ecx | ||
3035 | /* get and push parameter 5 */ | ||
3036 | movl 56(%esp), %eax | ||
3037 | pushl %eax | ||
3038 | /* get and push parameter 4 */ | ||
3039 | movl 56(%esp), %eax | ||
3040 | pushl %eax | ||
3041 | /* get and push parameter 3 */ | ||
3042 | movl 56(%esp), %eax | ||
3043 | pushl %eax | ||
3044 | pushl %ebx | ||
3045 | cmpl $0, %ecx | ||
3046 | jz .L028decrypt | ||
3047 | andl $4294967288, %ebp | ||
3048 | movl 16(%esp), %eax | ||
3049 | movl 20(%esp), %ebx | ||
3050 | jz .L029encrypt_finish | ||
3051 | .L030encrypt_loop: | ||
3052 | movl (%esi), %ecx | ||
3053 | movl 4(%esi), %edx | ||
3054 | xorl %ecx, %eax | ||
3055 | xorl %edx, %ebx | ||
3056 | movl %eax, 16(%esp) | ||
3057 | movl %ebx, 20(%esp) | ||
3058 | call des_encrypt3 | ||
3059 | movl 16(%esp), %eax | ||
3060 | movl 20(%esp), %ebx | ||
3061 | movl %eax, (%edi) | ||
3062 | movl %ebx, 4(%edi) | ||
3063 | addl $8, %esi | ||
3064 | addl $8, %edi | ||
3065 | subl $8, %ebp | ||
3066 | jnz .L030encrypt_loop | ||
3067 | .L029encrypt_finish: | ||
3068 | movl 60(%esp), %ebp | ||
3069 | andl $7, %ebp | ||
3070 | jz .L031finish | ||
3071 | xorl %ecx, %ecx | ||
3072 | xorl %edx, %edx | ||
3073 | movl .L032cbc_enc_jmp_table(,%ebp,4),%ebp | ||
3074 | jmp *%ebp | ||
3075 | .L033ej7: | ||
3076 | movb 6(%esi), %dh | ||
3077 | sall $8, %edx | ||
3078 | .L034ej6: | ||
3079 | movb 5(%esi), %dh | ||
3080 | .L035ej5: | ||
3081 | movb 4(%esi), %dl | ||
3082 | .L036ej4: | ||
3083 | movl (%esi), %ecx | ||
3084 | jmp .L037ejend | ||
3085 | .L038ej3: | ||
3086 | movb 2(%esi), %ch | ||
3087 | sall $8, %ecx | ||
3088 | .L039ej2: | ||
3089 | movb 1(%esi), %ch | ||
3090 | .L040ej1: | ||
3091 | movb (%esi), %cl | ||
3092 | .L037ejend: | ||
3093 | xorl %ecx, %eax | ||
3094 | xorl %edx, %ebx | ||
3095 | movl %eax, 16(%esp) | ||
3096 | movl %ebx, 20(%esp) | ||
3097 | call des_encrypt3 | ||
3098 | movl 16(%esp), %eax | ||
3099 | movl 20(%esp), %ebx | ||
3100 | movl %eax, (%edi) | ||
3101 | movl %ebx, 4(%edi) | ||
3102 | jmp .L031finish | ||
3103 | .align ALIGN | ||
3104 | .L028decrypt: | ||
3105 | andl $4294967288, %ebp | ||
3106 | movl 24(%esp), %eax | ||
3107 | movl 28(%esp), %ebx | ||
3108 | jz .L041decrypt_finish | ||
3109 | .L042decrypt_loop: | ||
3110 | movl (%esi), %eax | ||
3111 | movl 4(%esi), %ebx | ||
3112 | movl %eax, 16(%esp) | ||
3113 | movl %ebx, 20(%esp) | ||
3114 | call des_decrypt3 | ||
3115 | movl 16(%esp), %eax | ||
3116 | movl 20(%esp), %ebx | ||
3117 | movl 24(%esp), %ecx | ||
3118 | movl 28(%esp), %edx | ||
3119 | xorl %eax, %ecx | ||
3120 | xorl %ebx, %edx | ||
3121 | movl (%esi), %eax | ||
3122 | movl 4(%esi), %ebx | ||
3123 | movl %ecx, (%edi) | ||
3124 | movl %edx, 4(%edi) | ||
3125 | movl %eax, 24(%esp) | ||
3126 | movl %ebx, 28(%esp) | ||
3127 | addl $8, %esi | ||
3128 | addl $8, %edi | ||
3129 | subl $8, %ebp | ||
3130 | jnz .L042decrypt_loop | ||
3131 | .L041decrypt_finish: | ||
3132 | movl 60(%esp), %ebp | ||
3133 | andl $7, %ebp | ||
3134 | jz .L031finish | ||
3135 | movl (%esi), %eax | ||
3136 | movl 4(%esi), %ebx | ||
3137 | movl %eax, 16(%esp) | ||
3138 | movl %ebx, 20(%esp) | ||
3139 | call des_decrypt3 | ||
3140 | movl 16(%esp), %eax | ||
3141 | movl 20(%esp), %ebx | ||
3142 | movl 24(%esp), %ecx | ||
3143 | movl 28(%esp), %edx | ||
3144 | xorl %eax, %ecx | ||
3145 | xorl %ebx, %edx | ||
3146 | movl (%esi), %eax | ||
3147 | movl 4(%esi), %ebx | ||
3148 | .L043dj7: | ||
3149 | rorl $16, %edx | ||
3150 | movb %dl, 6(%edi) | ||
3151 | shrl $16, %edx | ||
3152 | .L044dj6: | ||
3153 | movb %dh, 5(%edi) | ||
3154 | .L045dj5: | ||
3155 | movb %dl, 4(%edi) | ||
3156 | .L046dj4: | ||
3157 | movl %ecx, (%edi) | ||
3158 | jmp .L047djend | ||
3159 | .L048dj3: | ||
3160 | rorl $16, %ecx | ||
3161 | movb %cl, 2(%edi) | ||
3162 | sall $16, %ecx | ||
3163 | .L049dj2: | ||
3164 | movb %ch, 1(%esi) | ||
3165 | .L050dj1: | ||
3166 | movb %cl, (%esi) | ||
3167 | .L047djend: | ||
3168 | jmp .L031finish | ||
3169 | .align ALIGN | ||
3170 | .L031finish: | ||
3171 | movl 76(%esp), %ecx | ||
3172 | addl $32, %esp | ||
3173 | movl %eax, (%ecx) | ||
3174 | movl %ebx, 4(%ecx) | ||
3175 | popl %edi | ||
3176 | popl %esi | ||
3177 | popl %ebx | ||
3178 | popl %ebp | ||
3179 | ret | ||
3180 | .align ALIGN | ||
3181 | .L032cbc_enc_jmp_table: | ||
3182 | .long 0 | ||
3183 | .long .L040ej1 | ||
3184 | .long .L039ej2 | ||
3185 | .long .L038ej3 | ||
3186 | .long .L036ej4 | ||
3187 | .long .L035ej5 | ||
3188 | .long .L034ej6 | ||
3189 | .long .L033ej7 | ||
3190 | .align ALIGN | ||
3191 | .L051cbc_dec_jmp_table: | ||
3192 | .long 0 | ||
3193 | .long .L050dj1 | ||
3194 | .long .L049dj2 | ||
3195 | .long .L048dj3 | ||
3196 | .long .L046dj4 | ||
3197 | .long .L045dj5 | ||
3198 | .long .L044dj6 | ||
3199 | .long .L043dj7 | ||
3200 | .des_ede3_cbc_encrypt_end: | ||
3201 | SIZE(des_ede3_cbc_encrypt,.des_ede3_cbc_encrypt_end-des_ede3_cbc_encrypt) | ||
3202 | .ident "desasm.pl" | ||
diff --git a/src/lib/libcrypto/des/asm/y-win32.asm b/src/lib/libcrypto/des/asm/y-win32.asm new file mode 100644 index 0000000000..af5c102422 --- /dev/null +++ b/src/lib/libcrypto/des/asm/y-win32.asm | |||
@@ -0,0 +1,929 @@ | |||
1 | ; Don't even think of reading this code | ||
2 | ; It was automatically generated by crypt586.pl | ||
3 | ; Which is a perl program used to generate the x86 assember for | ||
4 | ; any of elf, a.out, BSDI,Win32, or Solaris | ||
5 | ; eric <eay@cryptsoft.com> | ||
6 | ; | ||
7 | TITLE crypt586.asm | ||
8 | .386 | ||
9 | .model FLAT | ||
10 | _TEXT SEGMENT | ||
11 | PUBLIC _fcrypt_body | ||
12 | EXTRN _des_SPtrans:DWORD | ||
13 | _fcrypt_body PROC NEAR | ||
14 | push ebp | ||
15 | push ebx | ||
16 | push esi | ||
17 | push edi | ||
18 | ; | ||
19 | ; Load the 2 words | ||
20 | xor edi, edi | ||
21 | xor esi, esi | ||
22 | mov ebp, DWORD PTR 24[esp] | ||
23 | push 25 | ||
24 | L000start: | ||
25 | ; | ||
26 | ; Round 0 | ||
27 | mov eax, DWORD PTR 32[esp] | ||
28 | mov edx, esi | ||
29 | shr edx, 16 | ||
30 | mov ecx, DWORD PTR 36[esp] | ||
31 | xor edx, esi | ||
32 | and eax, edx | ||
33 | and edx, ecx | ||
34 | mov ebx, eax | ||
35 | shl ebx, 16 | ||
36 | mov ecx, edx | ||
37 | shl ecx, 16 | ||
38 | xor eax, ebx | ||
39 | xor edx, ecx | ||
40 | mov ebx, DWORD PTR [ebp] | ||
41 | xor eax, ebx | ||
42 | mov ecx, DWORD PTR 4[ebp] | ||
43 | xor eax, esi | ||
44 | xor edx, esi | ||
45 | xor edx, ecx | ||
46 | and eax, 0fcfcfcfch | ||
47 | xor ebx, ebx | ||
48 | and edx, 0cfcfcfcfh | ||
49 | xor ecx, ecx | ||
50 | mov bl, al | ||
51 | mov cl, ah | ||
52 | ror edx, 4 | ||
53 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
54 | mov bl, dl | ||
55 | xor edi, ebp | ||
56 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
57 | xor edi, ebp | ||
58 | mov cl, dh | ||
59 | shr eax, 16 | ||
60 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
61 | xor edi, ebp | ||
62 | mov bl, ah | ||
63 | shr edx, 16 | ||
64 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
65 | xor edi, ebp | ||
66 | mov ebp, DWORD PTR 28[esp] | ||
67 | mov cl, dh | ||
68 | and eax, 0ffh | ||
69 | and edx, 0ffh | ||
70 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
71 | xor edi, ebx | ||
72 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
73 | xor edi, ebx | ||
74 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
75 | xor edi, ebx | ||
76 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
77 | xor edi, ebx | ||
78 | ; | ||
79 | ; Round 1 | ||
80 | mov eax, DWORD PTR 32[esp] | ||
81 | mov edx, edi | ||
82 | shr edx, 16 | ||
83 | mov ecx, DWORD PTR 36[esp] | ||
84 | xor edx, edi | ||
85 | and eax, edx | ||
86 | and edx, ecx | ||
87 | mov ebx, eax | ||
88 | shl ebx, 16 | ||
89 | mov ecx, edx | ||
90 | shl ecx, 16 | ||
91 | xor eax, ebx | ||
92 | xor edx, ecx | ||
93 | mov ebx, DWORD PTR 8[ebp] | ||
94 | xor eax, ebx | ||
95 | mov ecx, DWORD PTR 12[ebp] | ||
96 | xor eax, edi | ||
97 | xor edx, edi | ||
98 | xor edx, ecx | ||
99 | and eax, 0fcfcfcfch | ||
100 | xor ebx, ebx | ||
101 | and edx, 0cfcfcfcfh | ||
102 | xor ecx, ecx | ||
103 | mov bl, al | ||
104 | mov cl, ah | ||
105 | ror edx, 4 | ||
106 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
107 | mov bl, dl | ||
108 | xor esi, ebp | ||
109 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
110 | xor esi, ebp | ||
111 | mov cl, dh | ||
112 | shr eax, 16 | ||
113 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
114 | xor esi, ebp | ||
115 | mov bl, ah | ||
116 | shr edx, 16 | ||
117 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
118 | xor esi, ebp | ||
119 | mov ebp, DWORD PTR 28[esp] | ||
120 | mov cl, dh | ||
121 | and eax, 0ffh | ||
122 | and edx, 0ffh | ||
123 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
124 | xor esi, ebx | ||
125 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
126 | xor esi, ebx | ||
127 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
128 | xor esi, ebx | ||
129 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
130 | xor esi, ebx | ||
131 | ; | ||
132 | ; Round 2 | ||
133 | mov eax, DWORD PTR 32[esp] | ||
134 | mov edx, esi | ||
135 | shr edx, 16 | ||
136 | mov ecx, DWORD PTR 36[esp] | ||
137 | xor edx, esi | ||
138 | and eax, edx | ||
139 | and edx, ecx | ||
140 | mov ebx, eax | ||
141 | shl ebx, 16 | ||
142 | mov ecx, edx | ||
143 | shl ecx, 16 | ||
144 | xor eax, ebx | ||
145 | xor edx, ecx | ||
146 | mov ebx, DWORD PTR 16[ebp] | ||
147 | xor eax, ebx | ||
148 | mov ecx, DWORD PTR 20[ebp] | ||
149 | xor eax, esi | ||
150 | xor edx, esi | ||
151 | xor edx, ecx | ||
152 | and eax, 0fcfcfcfch | ||
153 | xor ebx, ebx | ||
154 | and edx, 0cfcfcfcfh | ||
155 | xor ecx, ecx | ||
156 | mov bl, al | ||
157 | mov cl, ah | ||
158 | ror edx, 4 | ||
159 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
160 | mov bl, dl | ||
161 | xor edi, ebp | ||
162 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
163 | xor edi, ebp | ||
164 | mov cl, dh | ||
165 | shr eax, 16 | ||
166 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
167 | xor edi, ebp | ||
168 | mov bl, ah | ||
169 | shr edx, 16 | ||
170 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
171 | xor edi, ebp | ||
172 | mov ebp, DWORD PTR 28[esp] | ||
173 | mov cl, dh | ||
174 | and eax, 0ffh | ||
175 | and edx, 0ffh | ||
176 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
177 | xor edi, ebx | ||
178 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
179 | xor edi, ebx | ||
180 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
181 | xor edi, ebx | ||
182 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
183 | xor edi, ebx | ||
184 | ; | ||
185 | ; Round 3 | ||
186 | mov eax, DWORD PTR 32[esp] | ||
187 | mov edx, edi | ||
188 | shr edx, 16 | ||
189 | mov ecx, DWORD PTR 36[esp] | ||
190 | xor edx, edi | ||
191 | and eax, edx | ||
192 | and edx, ecx | ||
193 | mov ebx, eax | ||
194 | shl ebx, 16 | ||
195 | mov ecx, edx | ||
196 | shl ecx, 16 | ||
197 | xor eax, ebx | ||
198 | xor edx, ecx | ||
199 | mov ebx, DWORD PTR 24[ebp] | ||
200 | xor eax, ebx | ||
201 | mov ecx, DWORD PTR 28[ebp] | ||
202 | xor eax, edi | ||
203 | xor edx, edi | ||
204 | xor edx, ecx | ||
205 | and eax, 0fcfcfcfch | ||
206 | xor ebx, ebx | ||
207 | and edx, 0cfcfcfcfh | ||
208 | xor ecx, ecx | ||
209 | mov bl, al | ||
210 | mov cl, ah | ||
211 | ror edx, 4 | ||
212 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
213 | mov bl, dl | ||
214 | xor esi, ebp | ||
215 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
216 | xor esi, ebp | ||
217 | mov cl, dh | ||
218 | shr eax, 16 | ||
219 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
220 | xor esi, ebp | ||
221 | mov bl, ah | ||
222 | shr edx, 16 | ||
223 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
224 | xor esi, ebp | ||
225 | mov ebp, DWORD PTR 28[esp] | ||
226 | mov cl, dh | ||
227 | and eax, 0ffh | ||
228 | and edx, 0ffh | ||
229 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
230 | xor esi, ebx | ||
231 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
232 | xor esi, ebx | ||
233 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
234 | xor esi, ebx | ||
235 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
236 | xor esi, ebx | ||
237 | ; | ||
238 | ; Round 4 | ||
239 | mov eax, DWORD PTR 32[esp] | ||
240 | mov edx, esi | ||
241 | shr edx, 16 | ||
242 | mov ecx, DWORD PTR 36[esp] | ||
243 | xor edx, esi | ||
244 | and eax, edx | ||
245 | and edx, ecx | ||
246 | mov ebx, eax | ||
247 | shl ebx, 16 | ||
248 | mov ecx, edx | ||
249 | shl ecx, 16 | ||
250 | xor eax, ebx | ||
251 | xor edx, ecx | ||
252 | mov ebx, DWORD PTR 32[ebp] | ||
253 | xor eax, ebx | ||
254 | mov ecx, DWORD PTR 36[ebp] | ||
255 | xor eax, esi | ||
256 | xor edx, esi | ||
257 | xor edx, ecx | ||
258 | and eax, 0fcfcfcfch | ||
259 | xor ebx, ebx | ||
260 | and edx, 0cfcfcfcfh | ||
261 | xor ecx, ecx | ||
262 | mov bl, al | ||
263 | mov cl, ah | ||
264 | ror edx, 4 | ||
265 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
266 | mov bl, dl | ||
267 | xor edi, ebp | ||
268 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
269 | xor edi, ebp | ||
270 | mov cl, dh | ||
271 | shr eax, 16 | ||
272 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
273 | xor edi, ebp | ||
274 | mov bl, ah | ||
275 | shr edx, 16 | ||
276 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
277 | xor edi, ebp | ||
278 | mov ebp, DWORD PTR 28[esp] | ||
279 | mov cl, dh | ||
280 | and eax, 0ffh | ||
281 | and edx, 0ffh | ||
282 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
283 | xor edi, ebx | ||
284 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
285 | xor edi, ebx | ||
286 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
287 | xor edi, ebx | ||
288 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
289 | xor edi, ebx | ||
290 | ; | ||
291 | ; Round 5 | ||
292 | mov eax, DWORD PTR 32[esp] | ||
293 | mov edx, edi | ||
294 | shr edx, 16 | ||
295 | mov ecx, DWORD PTR 36[esp] | ||
296 | xor edx, edi | ||
297 | and eax, edx | ||
298 | and edx, ecx | ||
299 | mov ebx, eax | ||
300 | shl ebx, 16 | ||
301 | mov ecx, edx | ||
302 | shl ecx, 16 | ||
303 | xor eax, ebx | ||
304 | xor edx, ecx | ||
305 | mov ebx, DWORD PTR 40[ebp] | ||
306 | xor eax, ebx | ||
307 | mov ecx, DWORD PTR 44[ebp] | ||
308 | xor eax, edi | ||
309 | xor edx, edi | ||
310 | xor edx, ecx | ||
311 | and eax, 0fcfcfcfch | ||
312 | xor ebx, ebx | ||
313 | and edx, 0cfcfcfcfh | ||
314 | xor ecx, ecx | ||
315 | mov bl, al | ||
316 | mov cl, ah | ||
317 | ror edx, 4 | ||
318 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
319 | mov bl, dl | ||
320 | xor esi, ebp | ||
321 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
322 | xor esi, ebp | ||
323 | mov cl, dh | ||
324 | shr eax, 16 | ||
325 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
326 | xor esi, ebp | ||
327 | mov bl, ah | ||
328 | shr edx, 16 | ||
329 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
330 | xor esi, ebp | ||
331 | mov ebp, DWORD PTR 28[esp] | ||
332 | mov cl, dh | ||
333 | and eax, 0ffh | ||
334 | and edx, 0ffh | ||
335 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
336 | xor esi, ebx | ||
337 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
338 | xor esi, ebx | ||
339 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
340 | xor esi, ebx | ||
341 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
342 | xor esi, ebx | ||
343 | ; | ||
344 | ; Round 6 | ||
345 | mov eax, DWORD PTR 32[esp] | ||
346 | mov edx, esi | ||
347 | shr edx, 16 | ||
348 | mov ecx, DWORD PTR 36[esp] | ||
349 | xor edx, esi | ||
350 | and eax, edx | ||
351 | and edx, ecx | ||
352 | mov ebx, eax | ||
353 | shl ebx, 16 | ||
354 | mov ecx, edx | ||
355 | shl ecx, 16 | ||
356 | xor eax, ebx | ||
357 | xor edx, ecx | ||
358 | mov ebx, DWORD PTR 48[ebp] | ||
359 | xor eax, ebx | ||
360 | mov ecx, DWORD PTR 52[ebp] | ||
361 | xor eax, esi | ||
362 | xor edx, esi | ||
363 | xor edx, ecx | ||
364 | and eax, 0fcfcfcfch | ||
365 | xor ebx, ebx | ||
366 | and edx, 0cfcfcfcfh | ||
367 | xor ecx, ecx | ||
368 | mov bl, al | ||
369 | mov cl, ah | ||
370 | ror edx, 4 | ||
371 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
372 | mov bl, dl | ||
373 | xor edi, ebp | ||
374 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
375 | xor edi, ebp | ||
376 | mov cl, dh | ||
377 | shr eax, 16 | ||
378 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
379 | xor edi, ebp | ||
380 | mov bl, ah | ||
381 | shr edx, 16 | ||
382 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
383 | xor edi, ebp | ||
384 | mov ebp, DWORD PTR 28[esp] | ||
385 | mov cl, dh | ||
386 | and eax, 0ffh | ||
387 | and edx, 0ffh | ||
388 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
389 | xor edi, ebx | ||
390 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
391 | xor edi, ebx | ||
392 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
393 | xor edi, ebx | ||
394 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
395 | xor edi, ebx | ||
396 | ; | ||
397 | ; Round 7 | ||
398 | mov eax, DWORD PTR 32[esp] | ||
399 | mov edx, edi | ||
400 | shr edx, 16 | ||
401 | mov ecx, DWORD PTR 36[esp] | ||
402 | xor edx, edi | ||
403 | and eax, edx | ||
404 | and edx, ecx | ||
405 | mov ebx, eax | ||
406 | shl ebx, 16 | ||
407 | mov ecx, edx | ||
408 | shl ecx, 16 | ||
409 | xor eax, ebx | ||
410 | xor edx, ecx | ||
411 | mov ebx, DWORD PTR 56[ebp] | ||
412 | xor eax, ebx | ||
413 | mov ecx, DWORD PTR 60[ebp] | ||
414 | xor eax, edi | ||
415 | xor edx, edi | ||
416 | xor edx, ecx | ||
417 | and eax, 0fcfcfcfch | ||
418 | xor ebx, ebx | ||
419 | and edx, 0cfcfcfcfh | ||
420 | xor ecx, ecx | ||
421 | mov bl, al | ||
422 | mov cl, ah | ||
423 | ror edx, 4 | ||
424 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
425 | mov bl, dl | ||
426 | xor esi, ebp | ||
427 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
428 | xor esi, ebp | ||
429 | mov cl, dh | ||
430 | shr eax, 16 | ||
431 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
432 | xor esi, ebp | ||
433 | mov bl, ah | ||
434 | shr edx, 16 | ||
435 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
436 | xor esi, ebp | ||
437 | mov ebp, DWORD PTR 28[esp] | ||
438 | mov cl, dh | ||
439 | and eax, 0ffh | ||
440 | and edx, 0ffh | ||
441 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
442 | xor esi, ebx | ||
443 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
444 | xor esi, ebx | ||
445 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
446 | xor esi, ebx | ||
447 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
448 | xor esi, ebx | ||
449 | ; | ||
450 | ; Round 8 | ||
451 | mov eax, DWORD PTR 32[esp] | ||
452 | mov edx, esi | ||
453 | shr edx, 16 | ||
454 | mov ecx, DWORD PTR 36[esp] | ||
455 | xor edx, esi | ||
456 | and eax, edx | ||
457 | and edx, ecx | ||
458 | mov ebx, eax | ||
459 | shl ebx, 16 | ||
460 | mov ecx, edx | ||
461 | shl ecx, 16 | ||
462 | xor eax, ebx | ||
463 | xor edx, ecx | ||
464 | mov ebx, DWORD PTR 64[ebp] | ||
465 | xor eax, ebx | ||
466 | mov ecx, DWORD PTR 68[ebp] | ||
467 | xor eax, esi | ||
468 | xor edx, esi | ||
469 | xor edx, ecx | ||
470 | and eax, 0fcfcfcfch | ||
471 | xor ebx, ebx | ||
472 | and edx, 0cfcfcfcfh | ||
473 | xor ecx, ecx | ||
474 | mov bl, al | ||
475 | mov cl, ah | ||
476 | ror edx, 4 | ||
477 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
478 | mov bl, dl | ||
479 | xor edi, ebp | ||
480 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
481 | xor edi, ebp | ||
482 | mov cl, dh | ||
483 | shr eax, 16 | ||
484 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
485 | xor edi, ebp | ||
486 | mov bl, ah | ||
487 | shr edx, 16 | ||
488 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
489 | xor edi, ebp | ||
490 | mov ebp, DWORD PTR 28[esp] | ||
491 | mov cl, dh | ||
492 | and eax, 0ffh | ||
493 | and edx, 0ffh | ||
494 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
495 | xor edi, ebx | ||
496 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
497 | xor edi, ebx | ||
498 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
499 | xor edi, ebx | ||
500 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
501 | xor edi, ebx | ||
502 | ; | ||
503 | ; Round 9 | ||
504 | mov eax, DWORD PTR 32[esp] | ||
505 | mov edx, edi | ||
506 | shr edx, 16 | ||
507 | mov ecx, DWORD PTR 36[esp] | ||
508 | xor edx, edi | ||
509 | and eax, edx | ||
510 | and edx, ecx | ||
511 | mov ebx, eax | ||
512 | shl ebx, 16 | ||
513 | mov ecx, edx | ||
514 | shl ecx, 16 | ||
515 | xor eax, ebx | ||
516 | xor edx, ecx | ||
517 | mov ebx, DWORD PTR 72[ebp] | ||
518 | xor eax, ebx | ||
519 | mov ecx, DWORD PTR 76[ebp] | ||
520 | xor eax, edi | ||
521 | xor edx, edi | ||
522 | xor edx, ecx | ||
523 | and eax, 0fcfcfcfch | ||
524 | xor ebx, ebx | ||
525 | and edx, 0cfcfcfcfh | ||
526 | xor ecx, ecx | ||
527 | mov bl, al | ||
528 | mov cl, ah | ||
529 | ror edx, 4 | ||
530 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
531 | mov bl, dl | ||
532 | xor esi, ebp | ||
533 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
534 | xor esi, ebp | ||
535 | mov cl, dh | ||
536 | shr eax, 16 | ||
537 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
538 | xor esi, ebp | ||
539 | mov bl, ah | ||
540 | shr edx, 16 | ||
541 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
542 | xor esi, ebp | ||
543 | mov ebp, DWORD PTR 28[esp] | ||
544 | mov cl, dh | ||
545 | and eax, 0ffh | ||
546 | and edx, 0ffh | ||
547 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
548 | xor esi, ebx | ||
549 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
550 | xor esi, ebx | ||
551 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
552 | xor esi, ebx | ||
553 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
554 | xor esi, ebx | ||
555 | ; | ||
556 | ; Round 10 | ||
557 | mov eax, DWORD PTR 32[esp] | ||
558 | mov edx, esi | ||
559 | shr edx, 16 | ||
560 | mov ecx, DWORD PTR 36[esp] | ||
561 | xor edx, esi | ||
562 | and eax, edx | ||
563 | and edx, ecx | ||
564 | mov ebx, eax | ||
565 | shl ebx, 16 | ||
566 | mov ecx, edx | ||
567 | shl ecx, 16 | ||
568 | xor eax, ebx | ||
569 | xor edx, ecx | ||
570 | mov ebx, DWORD PTR 80[ebp] | ||
571 | xor eax, ebx | ||
572 | mov ecx, DWORD PTR 84[ebp] | ||
573 | xor eax, esi | ||
574 | xor edx, esi | ||
575 | xor edx, ecx | ||
576 | and eax, 0fcfcfcfch | ||
577 | xor ebx, ebx | ||
578 | and edx, 0cfcfcfcfh | ||
579 | xor ecx, ecx | ||
580 | mov bl, al | ||
581 | mov cl, ah | ||
582 | ror edx, 4 | ||
583 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
584 | mov bl, dl | ||
585 | xor edi, ebp | ||
586 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
587 | xor edi, ebp | ||
588 | mov cl, dh | ||
589 | shr eax, 16 | ||
590 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
591 | xor edi, ebp | ||
592 | mov bl, ah | ||
593 | shr edx, 16 | ||
594 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
595 | xor edi, ebp | ||
596 | mov ebp, DWORD PTR 28[esp] | ||
597 | mov cl, dh | ||
598 | and eax, 0ffh | ||
599 | and edx, 0ffh | ||
600 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
601 | xor edi, ebx | ||
602 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
603 | xor edi, ebx | ||
604 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
605 | xor edi, ebx | ||
606 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
607 | xor edi, ebx | ||
608 | ; | ||
609 | ; Round 11 | ||
610 | mov eax, DWORD PTR 32[esp] | ||
611 | mov edx, edi | ||
612 | shr edx, 16 | ||
613 | mov ecx, DWORD PTR 36[esp] | ||
614 | xor edx, edi | ||
615 | and eax, edx | ||
616 | and edx, ecx | ||
617 | mov ebx, eax | ||
618 | shl ebx, 16 | ||
619 | mov ecx, edx | ||
620 | shl ecx, 16 | ||
621 | xor eax, ebx | ||
622 | xor edx, ecx | ||
623 | mov ebx, DWORD PTR 88[ebp] | ||
624 | xor eax, ebx | ||
625 | mov ecx, DWORD PTR 92[ebp] | ||
626 | xor eax, edi | ||
627 | xor edx, edi | ||
628 | xor edx, ecx | ||
629 | and eax, 0fcfcfcfch | ||
630 | xor ebx, ebx | ||
631 | and edx, 0cfcfcfcfh | ||
632 | xor ecx, ecx | ||
633 | mov bl, al | ||
634 | mov cl, ah | ||
635 | ror edx, 4 | ||
636 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
637 | mov bl, dl | ||
638 | xor esi, ebp | ||
639 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
640 | xor esi, ebp | ||
641 | mov cl, dh | ||
642 | shr eax, 16 | ||
643 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
644 | xor esi, ebp | ||
645 | mov bl, ah | ||
646 | shr edx, 16 | ||
647 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
648 | xor esi, ebp | ||
649 | mov ebp, DWORD PTR 28[esp] | ||
650 | mov cl, dh | ||
651 | and eax, 0ffh | ||
652 | and edx, 0ffh | ||
653 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
654 | xor esi, ebx | ||
655 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
656 | xor esi, ebx | ||
657 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
658 | xor esi, ebx | ||
659 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
660 | xor esi, ebx | ||
661 | ; | ||
662 | ; Round 12 | ||
663 | mov eax, DWORD PTR 32[esp] | ||
664 | mov edx, esi | ||
665 | shr edx, 16 | ||
666 | mov ecx, DWORD PTR 36[esp] | ||
667 | xor edx, esi | ||
668 | and eax, edx | ||
669 | and edx, ecx | ||
670 | mov ebx, eax | ||
671 | shl ebx, 16 | ||
672 | mov ecx, edx | ||
673 | shl ecx, 16 | ||
674 | xor eax, ebx | ||
675 | xor edx, ecx | ||
676 | mov ebx, DWORD PTR 96[ebp] | ||
677 | xor eax, ebx | ||
678 | mov ecx, DWORD PTR 100[ebp] | ||
679 | xor eax, esi | ||
680 | xor edx, esi | ||
681 | xor edx, ecx | ||
682 | and eax, 0fcfcfcfch | ||
683 | xor ebx, ebx | ||
684 | and edx, 0cfcfcfcfh | ||
685 | xor ecx, ecx | ||
686 | mov bl, al | ||
687 | mov cl, ah | ||
688 | ror edx, 4 | ||
689 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
690 | mov bl, dl | ||
691 | xor edi, ebp | ||
692 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
693 | xor edi, ebp | ||
694 | mov cl, dh | ||
695 | shr eax, 16 | ||
696 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
697 | xor edi, ebp | ||
698 | mov bl, ah | ||
699 | shr edx, 16 | ||
700 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
701 | xor edi, ebp | ||
702 | mov ebp, DWORD PTR 28[esp] | ||
703 | mov cl, dh | ||
704 | and eax, 0ffh | ||
705 | and edx, 0ffh | ||
706 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
707 | xor edi, ebx | ||
708 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
709 | xor edi, ebx | ||
710 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
711 | xor edi, ebx | ||
712 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
713 | xor edi, ebx | ||
714 | ; | ||
715 | ; Round 13 | ||
716 | mov eax, DWORD PTR 32[esp] | ||
717 | mov edx, edi | ||
718 | shr edx, 16 | ||
719 | mov ecx, DWORD PTR 36[esp] | ||
720 | xor edx, edi | ||
721 | and eax, edx | ||
722 | and edx, ecx | ||
723 | mov ebx, eax | ||
724 | shl ebx, 16 | ||
725 | mov ecx, edx | ||
726 | shl ecx, 16 | ||
727 | xor eax, ebx | ||
728 | xor edx, ecx | ||
729 | mov ebx, DWORD PTR 104[ebp] | ||
730 | xor eax, ebx | ||
731 | mov ecx, DWORD PTR 108[ebp] | ||
732 | xor eax, edi | ||
733 | xor edx, edi | ||
734 | xor edx, ecx | ||
735 | and eax, 0fcfcfcfch | ||
736 | xor ebx, ebx | ||
737 | and edx, 0cfcfcfcfh | ||
738 | xor ecx, ecx | ||
739 | mov bl, al | ||
740 | mov cl, ah | ||
741 | ror edx, 4 | ||
742 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
743 | mov bl, dl | ||
744 | xor esi, ebp | ||
745 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
746 | xor esi, ebp | ||
747 | mov cl, dh | ||
748 | shr eax, 16 | ||
749 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
750 | xor esi, ebp | ||
751 | mov bl, ah | ||
752 | shr edx, 16 | ||
753 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
754 | xor esi, ebp | ||
755 | mov ebp, DWORD PTR 28[esp] | ||
756 | mov cl, dh | ||
757 | and eax, 0ffh | ||
758 | and edx, 0ffh | ||
759 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
760 | xor esi, ebx | ||
761 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
762 | xor esi, ebx | ||
763 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
764 | xor esi, ebx | ||
765 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
766 | xor esi, ebx | ||
767 | ; | ||
768 | ; Round 14 | ||
769 | mov eax, DWORD PTR 32[esp] | ||
770 | mov edx, esi | ||
771 | shr edx, 16 | ||
772 | mov ecx, DWORD PTR 36[esp] | ||
773 | xor edx, esi | ||
774 | and eax, edx | ||
775 | and edx, ecx | ||
776 | mov ebx, eax | ||
777 | shl ebx, 16 | ||
778 | mov ecx, edx | ||
779 | shl ecx, 16 | ||
780 | xor eax, ebx | ||
781 | xor edx, ecx | ||
782 | mov ebx, DWORD PTR 112[ebp] | ||
783 | xor eax, ebx | ||
784 | mov ecx, DWORD PTR 116[ebp] | ||
785 | xor eax, esi | ||
786 | xor edx, esi | ||
787 | xor edx, ecx | ||
788 | and eax, 0fcfcfcfch | ||
789 | xor ebx, ebx | ||
790 | and edx, 0cfcfcfcfh | ||
791 | xor ecx, ecx | ||
792 | mov bl, al | ||
793 | mov cl, ah | ||
794 | ror edx, 4 | ||
795 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
796 | mov bl, dl | ||
797 | xor edi, ebp | ||
798 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
799 | xor edi, ebp | ||
800 | mov cl, dh | ||
801 | shr eax, 16 | ||
802 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
803 | xor edi, ebp | ||
804 | mov bl, ah | ||
805 | shr edx, 16 | ||
806 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
807 | xor edi, ebp | ||
808 | mov ebp, DWORD PTR 28[esp] | ||
809 | mov cl, dh | ||
810 | and eax, 0ffh | ||
811 | and edx, 0ffh | ||
812 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
813 | xor edi, ebx | ||
814 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
815 | xor edi, ebx | ||
816 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
817 | xor edi, ebx | ||
818 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
819 | xor edi, ebx | ||
820 | ; | ||
821 | ; Round 15 | ||
822 | mov eax, DWORD PTR 32[esp] | ||
823 | mov edx, edi | ||
824 | shr edx, 16 | ||
825 | mov ecx, DWORD PTR 36[esp] | ||
826 | xor edx, edi | ||
827 | and eax, edx | ||
828 | and edx, ecx | ||
829 | mov ebx, eax | ||
830 | shl ebx, 16 | ||
831 | mov ecx, edx | ||
832 | shl ecx, 16 | ||
833 | xor eax, ebx | ||
834 | xor edx, ecx | ||
835 | mov ebx, DWORD PTR 120[ebp] | ||
836 | xor eax, ebx | ||
837 | mov ecx, DWORD PTR 124[ebp] | ||
838 | xor eax, edi | ||
839 | xor edx, edi | ||
840 | xor edx, ecx | ||
841 | and eax, 0fcfcfcfch | ||
842 | xor ebx, ebx | ||
843 | and edx, 0cfcfcfcfh | ||
844 | xor ecx, ecx | ||
845 | mov bl, al | ||
846 | mov cl, ah | ||
847 | ror edx, 4 | ||
848 | mov ebp, DWORD PTR _des_SPtrans[ebx] | ||
849 | mov bl, dl | ||
850 | xor esi, ebp | ||
851 | mov ebp, DWORD PTR _des_SPtrans[0200h+ecx] | ||
852 | xor esi, ebp | ||
853 | mov cl, dh | ||
854 | shr eax, 16 | ||
855 | mov ebp, DWORD PTR _des_SPtrans[0100h+ebx] | ||
856 | xor esi, ebp | ||
857 | mov bl, ah | ||
858 | shr edx, 16 | ||
859 | mov ebp, DWORD PTR _des_SPtrans[0300h+ecx] | ||
860 | xor esi, ebp | ||
861 | mov ebp, DWORD PTR 28[esp] | ||
862 | mov cl, dh | ||
863 | and eax, 0ffh | ||
864 | and edx, 0ffh | ||
865 | mov ebx, DWORD PTR _des_SPtrans[0600h+ebx] | ||
866 | xor esi, ebx | ||
867 | mov ebx, DWORD PTR _des_SPtrans[0700h+ecx] | ||
868 | xor esi, ebx | ||
869 | mov ebx, DWORD PTR _des_SPtrans[0400h+eax] | ||
870 | xor esi, ebx | ||
871 | mov ebx, DWORD PTR _des_SPtrans[0500h+edx] | ||
872 | xor esi, ebx | ||
873 | mov ebx, DWORD PTR [esp] | ||
874 | mov eax, edi | ||
875 | dec ebx | ||
876 | mov edi, esi | ||
877 | mov esi, eax | ||
878 | mov DWORD PTR [esp],ebx | ||
879 | jnz L000start | ||
880 | ; | ||
881 | ; FP | ||
882 | mov edx, DWORD PTR 24[esp] | ||
883 | ror edi, 1 | ||
884 | mov eax, esi | ||
885 | xor esi, edi | ||
886 | and esi, 0aaaaaaaah | ||
887 | xor eax, esi | ||
888 | xor edi, esi | ||
889 | ; | ||
890 | rol eax, 23 | ||
891 | mov esi, eax | ||
892 | xor eax, edi | ||
893 | and eax, 003fc03fch | ||
894 | xor esi, eax | ||
895 | xor edi, eax | ||
896 | ; | ||
897 | rol esi, 10 | ||
898 | mov eax, esi | ||
899 | xor esi, edi | ||
900 | and esi, 033333333h | ||
901 | xor eax, esi | ||
902 | xor edi, esi | ||
903 | ; | ||
904 | rol edi, 18 | ||
905 | mov esi, edi | ||
906 | xor edi, eax | ||
907 | and edi, 0fff0000fh | ||
908 | xor esi, edi | ||
909 | xor eax, edi | ||
910 | ; | ||
911 | rol esi, 12 | ||
912 | mov edi, esi | ||
913 | xor esi, eax | ||
914 | and esi, 0f0f0f0f0h | ||
915 | xor edi, esi | ||
916 | xor eax, esi | ||
917 | ; | ||
918 | ror eax, 4 | ||
919 | mov DWORD PTR [edx],eax | ||
920 | mov DWORD PTR 4[edx],edi | ||
921 | pop ecx | ||
922 | pop edi | ||
923 | pop esi | ||
924 | pop ebx | ||
925 | pop ebp | ||
926 | ret | ||
927 | _fcrypt_body ENDP | ||
928 | _TEXT ENDS | ||
929 | END | ||
diff --git a/src/lib/libcrypto/des/asm/yx86unix.cpp b/src/lib/libcrypto/des/asm/yx86unix.cpp new file mode 100644 index 0000000000..8719e38607 --- /dev/null +++ b/src/lib/libcrypto/des/asm/yx86unix.cpp | |||
@@ -0,0 +1,976 @@ | |||
1 | /* Run the C pre-processor over this file with one of the following defined | ||
2 | * ELF - elf object files, | ||
3 | * OUT - a.out object files, | ||
4 | * BSDI - BSDI style a.out object files | ||
5 | * SOL - Solaris style elf | ||
6 | */ | ||
7 | |||
8 | #define TYPE(a,b) .type a,b | ||
9 | #define SIZE(a,b) .size a,b | ||
10 | |||
11 | #if defined(OUT) || defined(BSDI) | ||
12 | #define des_SPtrans _des_SPtrans | ||
13 | #define fcrypt_body _fcrypt_body | ||
14 | |||
15 | #endif | ||
16 | |||
17 | #ifdef OUT | ||
18 | #define OK 1 | ||
19 | #define ALIGN 4 | ||
20 | #endif | ||
21 | |||
22 | #ifdef BSDI | ||
23 | #define OK 1 | ||
24 | #define ALIGN 4 | ||
25 | #undef SIZE | ||
26 | #undef TYPE | ||
27 | #define SIZE(a,b) | ||
28 | #define TYPE(a,b) | ||
29 | #endif | ||
30 | |||
31 | #if defined(ELF) || defined(SOL) | ||
32 | #define OK 1 | ||
33 | #define ALIGN 16 | ||
34 | #endif | ||
35 | |||
36 | #ifndef OK | ||
37 | You need to define one of | ||
38 | ELF - elf systems - linux-elf, NetBSD and DG-UX | ||
39 | OUT - a.out systems - linux-a.out and FreeBSD | ||
40 | SOL - solaris systems, which are elf with strange comment lines | ||
41 | BSDI - a.out with a very primative version of as. | ||
42 | #endif | ||
43 | |||
44 | /* Let the Assembler begin :-) */ | ||
45 | /* Don't even think of reading this code */ | ||
46 | /* It was automatically generated by crypt586.pl */ | ||
47 | /* Which is a perl program used to generate the x86 assember for */ | ||
48 | /* any of elf, a.out, BSDI,Win32, or Solaris */ | ||
49 | /* eric <eay@cryptsoft.com> */ | ||
50 | |||
51 | .file "crypt586.s" | ||
52 | .version "01.01" | ||
53 | gcc2_compiled.: | ||
54 | .text | ||
55 | .align ALIGN | ||
56 | .globl fcrypt_body | ||
57 | TYPE(fcrypt_body,@function) | ||
58 | fcrypt_body: | ||
59 | pushl %ebp | ||
60 | pushl %ebx | ||
61 | pushl %esi | ||
62 | pushl %edi | ||
63 | |||
64 | |||
65 | /* Load the 2 words */ | ||
66 | xorl %edi, %edi | ||
67 | xorl %esi, %esi | ||
68 | movl 24(%esp), %ebp | ||
69 | pushl $25 | ||
70 | .L000start: | ||
71 | |||
72 | /* Round 0 */ | ||
73 | movl 32(%esp), %eax | ||
74 | movl %esi, %edx | ||
75 | shrl $16, %edx | ||
76 | movl 36(%esp), %ecx | ||
77 | xorl %esi, %edx | ||
78 | andl %edx, %eax | ||
79 | andl %ecx, %edx | ||
80 | movl %eax, %ebx | ||
81 | sall $16, %ebx | ||
82 | movl %edx, %ecx | ||
83 | sall $16, %ecx | ||
84 | xorl %ebx, %eax | ||
85 | xorl %ecx, %edx | ||
86 | movl (%ebp), %ebx | ||
87 | xorl %ebx, %eax | ||
88 | movl 4(%ebp), %ecx | ||
89 | xorl %esi, %eax | ||
90 | xorl %esi, %edx | ||
91 | xorl %ecx, %edx | ||
92 | andl $0xfcfcfcfc, %eax | ||
93 | xorl %ebx, %ebx | ||
94 | andl $0xcfcfcfcf, %edx | ||
95 | xorl %ecx, %ecx | ||
96 | movb %al, %bl | ||
97 | movb %ah, %cl | ||
98 | rorl $4, %edx | ||
99 | movl des_SPtrans(%ebx),%ebp | ||
100 | movb %dl, %bl | ||
101 | xorl %ebp, %edi | ||
102 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
103 | xorl %ebp, %edi | ||
104 | movb %dh, %cl | ||
105 | shrl $16, %eax | ||
106 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
107 | xorl %ebp, %edi | ||
108 | movb %ah, %bl | ||
109 | shrl $16, %edx | ||
110 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
111 | xorl %ebp, %edi | ||
112 | movl 28(%esp), %ebp | ||
113 | movb %dh, %cl | ||
114 | andl $0xff, %eax | ||
115 | andl $0xff, %edx | ||
116 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
117 | xorl %ebx, %edi | ||
118 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
119 | xorl %ebx, %edi | ||
120 | movl 0x400+des_SPtrans(%eax),%ebx | ||
121 | xorl %ebx, %edi | ||
122 | movl 0x500+des_SPtrans(%edx),%ebx | ||
123 | xorl %ebx, %edi | ||
124 | |||
125 | /* Round 1 */ | ||
126 | movl 32(%esp), %eax | ||
127 | movl %edi, %edx | ||
128 | shrl $16, %edx | ||
129 | movl 36(%esp), %ecx | ||
130 | xorl %edi, %edx | ||
131 | andl %edx, %eax | ||
132 | andl %ecx, %edx | ||
133 | movl %eax, %ebx | ||
134 | sall $16, %ebx | ||
135 | movl %edx, %ecx | ||
136 | sall $16, %ecx | ||
137 | xorl %ebx, %eax | ||
138 | xorl %ecx, %edx | ||
139 | movl 8(%ebp), %ebx | ||
140 | xorl %ebx, %eax | ||
141 | movl 12(%ebp), %ecx | ||
142 | xorl %edi, %eax | ||
143 | xorl %edi, %edx | ||
144 | xorl %ecx, %edx | ||
145 | andl $0xfcfcfcfc, %eax | ||
146 | xorl %ebx, %ebx | ||
147 | andl $0xcfcfcfcf, %edx | ||
148 | xorl %ecx, %ecx | ||
149 | movb %al, %bl | ||
150 | movb %ah, %cl | ||
151 | rorl $4, %edx | ||
152 | movl des_SPtrans(%ebx),%ebp | ||
153 | movb %dl, %bl | ||
154 | xorl %ebp, %esi | ||
155 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
156 | xorl %ebp, %esi | ||
157 | movb %dh, %cl | ||
158 | shrl $16, %eax | ||
159 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
160 | xorl %ebp, %esi | ||
161 | movb %ah, %bl | ||
162 | shrl $16, %edx | ||
163 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
164 | xorl %ebp, %esi | ||
165 | movl 28(%esp), %ebp | ||
166 | movb %dh, %cl | ||
167 | andl $0xff, %eax | ||
168 | andl $0xff, %edx | ||
169 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
170 | xorl %ebx, %esi | ||
171 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
172 | xorl %ebx, %esi | ||
173 | movl 0x400+des_SPtrans(%eax),%ebx | ||
174 | xorl %ebx, %esi | ||
175 | movl 0x500+des_SPtrans(%edx),%ebx | ||
176 | xorl %ebx, %esi | ||
177 | |||
178 | /* Round 2 */ | ||
179 | movl 32(%esp), %eax | ||
180 | movl %esi, %edx | ||
181 | shrl $16, %edx | ||
182 | movl 36(%esp), %ecx | ||
183 | xorl %esi, %edx | ||
184 | andl %edx, %eax | ||
185 | andl %ecx, %edx | ||
186 | movl %eax, %ebx | ||
187 | sall $16, %ebx | ||
188 | movl %edx, %ecx | ||
189 | sall $16, %ecx | ||
190 | xorl %ebx, %eax | ||
191 | xorl %ecx, %edx | ||
192 | movl 16(%ebp), %ebx | ||
193 | xorl %ebx, %eax | ||
194 | movl 20(%ebp), %ecx | ||
195 | xorl %esi, %eax | ||
196 | xorl %esi, %edx | ||
197 | xorl %ecx, %edx | ||
198 | andl $0xfcfcfcfc, %eax | ||
199 | xorl %ebx, %ebx | ||
200 | andl $0xcfcfcfcf, %edx | ||
201 | xorl %ecx, %ecx | ||
202 | movb %al, %bl | ||
203 | movb %ah, %cl | ||
204 | rorl $4, %edx | ||
205 | movl des_SPtrans(%ebx),%ebp | ||
206 | movb %dl, %bl | ||
207 | xorl %ebp, %edi | ||
208 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
209 | xorl %ebp, %edi | ||
210 | movb %dh, %cl | ||
211 | shrl $16, %eax | ||
212 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
213 | xorl %ebp, %edi | ||
214 | movb %ah, %bl | ||
215 | shrl $16, %edx | ||
216 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
217 | xorl %ebp, %edi | ||
218 | movl 28(%esp), %ebp | ||
219 | movb %dh, %cl | ||
220 | andl $0xff, %eax | ||
221 | andl $0xff, %edx | ||
222 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
223 | xorl %ebx, %edi | ||
224 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
225 | xorl %ebx, %edi | ||
226 | movl 0x400+des_SPtrans(%eax),%ebx | ||
227 | xorl %ebx, %edi | ||
228 | movl 0x500+des_SPtrans(%edx),%ebx | ||
229 | xorl %ebx, %edi | ||
230 | |||
231 | /* Round 3 */ | ||
232 | movl 32(%esp), %eax | ||
233 | movl %edi, %edx | ||
234 | shrl $16, %edx | ||
235 | movl 36(%esp), %ecx | ||
236 | xorl %edi, %edx | ||
237 | andl %edx, %eax | ||
238 | andl %ecx, %edx | ||
239 | movl %eax, %ebx | ||
240 | sall $16, %ebx | ||
241 | movl %edx, %ecx | ||
242 | sall $16, %ecx | ||
243 | xorl %ebx, %eax | ||
244 | xorl %ecx, %edx | ||
245 | movl 24(%ebp), %ebx | ||
246 | xorl %ebx, %eax | ||
247 | movl 28(%ebp), %ecx | ||
248 | xorl %edi, %eax | ||
249 | xorl %edi, %edx | ||
250 | xorl %ecx, %edx | ||
251 | andl $0xfcfcfcfc, %eax | ||
252 | xorl %ebx, %ebx | ||
253 | andl $0xcfcfcfcf, %edx | ||
254 | xorl %ecx, %ecx | ||
255 | movb %al, %bl | ||
256 | movb %ah, %cl | ||
257 | rorl $4, %edx | ||
258 | movl des_SPtrans(%ebx),%ebp | ||
259 | movb %dl, %bl | ||
260 | xorl %ebp, %esi | ||
261 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
262 | xorl %ebp, %esi | ||
263 | movb %dh, %cl | ||
264 | shrl $16, %eax | ||
265 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
266 | xorl %ebp, %esi | ||
267 | movb %ah, %bl | ||
268 | shrl $16, %edx | ||
269 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
270 | xorl %ebp, %esi | ||
271 | movl 28(%esp), %ebp | ||
272 | movb %dh, %cl | ||
273 | andl $0xff, %eax | ||
274 | andl $0xff, %edx | ||
275 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
276 | xorl %ebx, %esi | ||
277 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
278 | xorl %ebx, %esi | ||
279 | movl 0x400+des_SPtrans(%eax),%ebx | ||
280 | xorl %ebx, %esi | ||
281 | movl 0x500+des_SPtrans(%edx),%ebx | ||
282 | xorl %ebx, %esi | ||
283 | |||
284 | /* Round 4 */ | ||
285 | movl 32(%esp), %eax | ||
286 | movl %esi, %edx | ||
287 | shrl $16, %edx | ||
288 | movl 36(%esp), %ecx | ||
289 | xorl %esi, %edx | ||
290 | andl %edx, %eax | ||
291 | andl %ecx, %edx | ||
292 | movl %eax, %ebx | ||
293 | sall $16, %ebx | ||
294 | movl %edx, %ecx | ||
295 | sall $16, %ecx | ||
296 | xorl %ebx, %eax | ||
297 | xorl %ecx, %edx | ||
298 | movl 32(%ebp), %ebx | ||
299 | xorl %ebx, %eax | ||
300 | movl 36(%ebp), %ecx | ||
301 | xorl %esi, %eax | ||
302 | xorl %esi, %edx | ||
303 | xorl %ecx, %edx | ||
304 | andl $0xfcfcfcfc, %eax | ||
305 | xorl %ebx, %ebx | ||
306 | andl $0xcfcfcfcf, %edx | ||
307 | xorl %ecx, %ecx | ||
308 | movb %al, %bl | ||
309 | movb %ah, %cl | ||
310 | rorl $4, %edx | ||
311 | movl des_SPtrans(%ebx),%ebp | ||
312 | movb %dl, %bl | ||
313 | xorl %ebp, %edi | ||
314 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
315 | xorl %ebp, %edi | ||
316 | movb %dh, %cl | ||
317 | shrl $16, %eax | ||
318 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
319 | xorl %ebp, %edi | ||
320 | movb %ah, %bl | ||
321 | shrl $16, %edx | ||
322 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
323 | xorl %ebp, %edi | ||
324 | movl 28(%esp), %ebp | ||
325 | movb %dh, %cl | ||
326 | andl $0xff, %eax | ||
327 | andl $0xff, %edx | ||
328 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
329 | xorl %ebx, %edi | ||
330 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
331 | xorl %ebx, %edi | ||
332 | movl 0x400+des_SPtrans(%eax),%ebx | ||
333 | xorl %ebx, %edi | ||
334 | movl 0x500+des_SPtrans(%edx),%ebx | ||
335 | xorl %ebx, %edi | ||
336 | |||
337 | /* Round 5 */ | ||
338 | movl 32(%esp), %eax | ||
339 | movl %edi, %edx | ||
340 | shrl $16, %edx | ||
341 | movl 36(%esp), %ecx | ||
342 | xorl %edi, %edx | ||
343 | andl %edx, %eax | ||
344 | andl %ecx, %edx | ||
345 | movl %eax, %ebx | ||
346 | sall $16, %ebx | ||
347 | movl %edx, %ecx | ||
348 | sall $16, %ecx | ||
349 | xorl %ebx, %eax | ||
350 | xorl %ecx, %edx | ||
351 | movl 40(%ebp), %ebx | ||
352 | xorl %ebx, %eax | ||
353 | movl 44(%ebp), %ecx | ||
354 | xorl %edi, %eax | ||
355 | xorl %edi, %edx | ||
356 | xorl %ecx, %edx | ||
357 | andl $0xfcfcfcfc, %eax | ||
358 | xorl %ebx, %ebx | ||
359 | andl $0xcfcfcfcf, %edx | ||
360 | xorl %ecx, %ecx | ||
361 | movb %al, %bl | ||
362 | movb %ah, %cl | ||
363 | rorl $4, %edx | ||
364 | movl des_SPtrans(%ebx),%ebp | ||
365 | movb %dl, %bl | ||
366 | xorl %ebp, %esi | ||
367 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
368 | xorl %ebp, %esi | ||
369 | movb %dh, %cl | ||
370 | shrl $16, %eax | ||
371 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
372 | xorl %ebp, %esi | ||
373 | movb %ah, %bl | ||
374 | shrl $16, %edx | ||
375 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
376 | xorl %ebp, %esi | ||
377 | movl 28(%esp), %ebp | ||
378 | movb %dh, %cl | ||
379 | andl $0xff, %eax | ||
380 | andl $0xff, %edx | ||
381 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
382 | xorl %ebx, %esi | ||
383 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
384 | xorl %ebx, %esi | ||
385 | movl 0x400+des_SPtrans(%eax),%ebx | ||
386 | xorl %ebx, %esi | ||
387 | movl 0x500+des_SPtrans(%edx),%ebx | ||
388 | xorl %ebx, %esi | ||
389 | |||
390 | /* Round 6 */ | ||
391 | movl 32(%esp), %eax | ||
392 | movl %esi, %edx | ||
393 | shrl $16, %edx | ||
394 | movl 36(%esp), %ecx | ||
395 | xorl %esi, %edx | ||
396 | andl %edx, %eax | ||
397 | andl %ecx, %edx | ||
398 | movl %eax, %ebx | ||
399 | sall $16, %ebx | ||
400 | movl %edx, %ecx | ||
401 | sall $16, %ecx | ||
402 | xorl %ebx, %eax | ||
403 | xorl %ecx, %edx | ||
404 | movl 48(%ebp), %ebx | ||
405 | xorl %ebx, %eax | ||
406 | movl 52(%ebp), %ecx | ||
407 | xorl %esi, %eax | ||
408 | xorl %esi, %edx | ||
409 | xorl %ecx, %edx | ||
410 | andl $0xfcfcfcfc, %eax | ||
411 | xorl %ebx, %ebx | ||
412 | andl $0xcfcfcfcf, %edx | ||
413 | xorl %ecx, %ecx | ||
414 | movb %al, %bl | ||
415 | movb %ah, %cl | ||
416 | rorl $4, %edx | ||
417 | movl des_SPtrans(%ebx),%ebp | ||
418 | movb %dl, %bl | ||
419 | xorl %ebp, %edi | ||
420 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
421 | xorl %ebp, %edi | ||
422 | movb %dh, %cl | ||
423 | shrl $16, %eax | ||
424 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
425 | xorl %ebp, %edi | ||
426 | movb %ah, %bl | ||
427 | shrl $16, %edx | ||
428 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
429 | xorl %ebp, %edi | ||
430 | movl 28(%esp), %ebp | ||
431 | movb %dh, %cl | ||
432 | andl $0xff, %eax | ||
433 | andl $0xff, %edx | ||
434 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
435 | xorl %ebx, %edi | ||
436 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
437 | xorl %ebx, %edi | ||
438 | movl 0x400+des_SPtrans(%eax),%ebx | ||
439 | xorl %ebx, %edi | ||
440 | movl 0x500+des_SPtrans(%edx),%ebx | ||
441 | xorl %ebx, %edi | ||
442 | |||
443 | /* Round 7 */ | ||
444 | movl 32(%esp), %eax | ||
445 | movl %edi, %edx | ||
446 | shrl $16, %edx | ||
447 | movl 36(%esp), %ecx | ||
448 | xorl %edi, %edx | ||
449 | andl %edx, %eax | ||
450 | andl %ecx, %edx | ||
451 | movl %eax, %ebx | ||
452 | sall $16, %ebx | ||
453 | movl %edx, %ecx | ||
454 | sall $16, %ecx | ||
455 | xorl %ebx, %eax | ||
456 | xorl %ecx, %edx | ||
457 | movl 56(%ebp), %ebx | ||
458 | xorl %ebx, %eax | ||
459 | movl 60(%ebp), %ecx | ||
460 | xorl %edi, %eax | ||
461 | xorl %edi, %edx | ||
462 | xorl %ecx, %edx | ||
463 | andl $0xfcfcfcfc, %eax | ||
464 | xorl %ebx, %ebx | ||
465 | andl $0xcfcfcfcf, %edx | ||
466 | xorl %ecx, %ecx | ||
467 | movb %al, %bl | ||
468 | movb %ah, %cl | ||
469 | rorl $4, %edx | ||
470 | movl des_SPtrans(%ebx),%ebp | ||
471 | movb %dl, %bl | ||
472 | xorl %ebp, %esi | ||
473 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
474 | xorl %ebp, %esi | ||
475 | movb %dh, %cl | ||
476 | shrl $16, %eax | ||
477 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
478 | xorl %ebp, %esi | ||
479 | movb %ah, %bl | ||
480 | shrl $16, %edx | ||
481 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
482 | xorl %ebp, %esi | ||
483 | movl 28(%esp), %ebp | ||
484 | movb %dh, %cl | ||
485 | andl $0xff, %eax | ||
486 | andl $0xff, %edx | ||
487 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
488 | xorl %ebx, %esi | ||
489 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
490 | xorl %ebx, %esi | ||
491 | movl 0x400+des_SPtrans(%eax),%ebx | ||
492 | xorl %ebx, %esi | ||
493 | movl 0x500+des_SPtrans(%edx),%ebx | ||
494 | xorl %ebx, %esi | ||
495 | |||
496 | /* Round 8 */ | ||
497 | movl 32(%esp), %eax | ||
498 | movl %esi, %edx | ||
499 | shrl $16, %edx | ||
500 | movl 36(%esp), %ecx | ||
501 | xorl %esi, %edx | ||
502 | andl %edx, %eax | ||
503 | andl %ecx, %edx | ||
504 | movl %eax, %ebx | ||
505 | sall $16, %ebx | ||
506 | movl %edx, %ecx | ||
507 | sall $16, %ecx | ||
508 | xorl %ebx, %eax | ||
509 | xorl %ecx, %edx | ||
510 | movl 64(%ebp), %ebx | ||
511 | xorl %ebx, %eax | ||
512 | movl 68(%ebp), %ecx | ||
513 | xorl %esi, %eax | ||
514 | xorl %esi, %edx | ||
515 | xorl %ecx, %edx | ||
516 | andl $0xfcfcfcfc, %eax | ||
517 | xorl %ebx, %ebx | ||
518 | andl $0xcfcfcfcf, %edx | ||
519 | xorl %ecx, %ecx | ||
520 | movb %al, %bl | ||
521 | movb %ah, %cl | ||
522 | rorl $4, %edx | ||
523 | movl des_SPtrans(%ebx),%ebp | ||
524 | movb %dl, %bl | ||
525 | xorl %ebp, %edi | ||
526 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
527 | xorl %ebp, %edi | ||
528 | movb %dh, %cl | ||
529 | shrl $16, %eax | ||
530 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
531 | xorl %ebp, %edi | ||
532 | movb %ah, %bl | ||
533 | shrl $16, %edx | ||
534 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
535 | xorl %ebp, %edi | ||
536 | movl 28(%esp), %ebp | ||
537 | movb %dh, %cl | ||
538 | andl $0xff, %eax | ||
539 | andl $0xff, %edx | ||
540 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
541 | xorl %ebx, %edi | ||
542 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
543 | xorl %ebx, %edi | ||
544 | movl 0x400+des_SPtrans(%eax),%ebx | ||
545 | xorl %ebx, %edi | ||
546 | movl 0x500+des_SPtrans(%edx),%ebx | ||
547 | xorl %ebx, %edi | ||
548 | |||
549 | /* Round 9 */ | ||
550 | movl 32(%esp), %eax | ||
551 | movl %edi, %edx | ||
552 | shrl $16, %edx | ||
553 | movl 36(%esp), %ecx | ||
554 | xorl %edi, %edx | ||
555 | andl %edx, %eax | ||
556 | andl %ecx, %edx | ||
557 | movl %eax, %ebx | ||
558 | sall $16, %ebx | ||
559 | movl %edx, %ecx | ||
560 | sall $16, %ecx | ||
561 | xorl %ebx, %eax | ||
562 | xorl %ecx, %edx | ||
563 | movl 72(%ebp), %ebx | ||
564 | xorl %ebx, %eax | ||
565 | movl 76(%ebp), %ecx | ||
566 | xorl %edi, %eax | ||
567 | xorl %edi, %edx | ||
568 | xorl %ecx, %edx | ||
569 | andl $0xfcfcfcfc, %eax | ||
570 | xorl %ebx, %ebx | ||
571 | andl $0xcfcfcfcf, %edx | ||
572 | xorl %ecx, %ecx | ||
573 | movb %al, %bl | ||
574 | movb %ah, %cl | ||
575 | rorl $4, %edx | ||
576 | movl des_SPtrans(%ebx),%ebp | ||
577 | movb %dl, %bl | ||
578 | xorl %ebp, %esi | ||
579 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
580 | xorl %ebp, %esi | ||
581 | movb %dh, %cl | ||
582 | shrl $16, %eax | ||
583 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
584 | xorl %ebp, %esi | ||
585 | movb %ah, %bl | ||
586 | shrl $16, %edx | ||
587 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
588 | xorl %ebp, %esi | ||
589 | movl 28(%esp), %ebp | ||
590 | movb %dh, %cl | ||
591 | andl $0xff, %eax | ||
592 | andl $0xff, %edx | ||
593 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
594 | xorl %ebx, %esi | ||
595 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
596 | xorl %ebx, %esi | ||
597 | movl 0x400+des_SPtrans(%eax),%ebx | ||
598 | xorl %ebx, %esi | ||
599 | movl 0x500+des_SPtrans(%edx),%ebx | ||
600 | xorl %ebx, %esi | ||
601 | |||
602 | /* Round 10 */ | ||
603 | movl 32(%esp), %eax | ||
604 | movl %esi, %edx | ||
605 | shrl $16, %edx | ||
606 | movl 36(%esp), %ecx | ||
607 | xorl %esi, %edx | ||
608 | andl %edx, %eax | ||
609 | andl %ecx, %edx | ||
610 | movl %eax, %ebx | ||
611 | sall $16, %ebx | ||
612 | movl %edx, %ecx | ||
613 | sall $16, %ecx | ||
614 | xorl %ebx, %eax | ||
615 | xorl %ecx, %edx | ||
616 | movl 80(%ebp), %ebx | ||
617 | xorl %ebx, %eax | ||
618 | movl 84(%ebp), %ecx | ||
619 | xorl %esi, %eax | ||
620 | xorl %esi, %edx | ||
621 | xorl %ecx, %edx | ||
622 | andl $0xfcfcfcfc, %eax | ||
623 | xorl %ebx, %ebx | ||
624 | andl $0xcfcfcfcf, %edx | ||
625 | xorl %ecx, %ecx | ||
626 | movb %al, %bl | ||
627 | movb %ah, %cl | ||
628 | rorl $4, %edx | ||
629 | movl des_SPtrans(%ebx),%ebp | ||
630 | movb %dl, %bl | ||
631 | xorl %ebp, %edi | ||
632 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
633 | xorl %ebp, %edi | ||
634 | movb %dh, %cl | ||
635 | shrl $16, %eax | ||
636 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
637 | xorl %ebp, %edi | ||
638 | movb %ah, %bl | ||
639 | shrl $16, %edx | ||
640 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
641 | xorl %ebp, %edi | ||
642 | movl 28(%esp), %ebp | ||
643 | movb %dh, %cl | ||
644 | andl $0xff, %eax | ||
645 | andl $0xff, %edx | ||
646 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
647 | xorl %ebx, %edi | ||
648 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
649 | xorl %ebx, %edi | ||
650 | movl 0x400+des_SPtrans(%eax),%ebx | ||
651 | xorl %ebx, %edi | ||
652 | movl 0x500+des_SPtrans(%edx),%ebx | ||
653 | xorl %ebx, %edi | ||
654 | |||
655 | /* Round 11 */ | ||
656 | movl 32(%esp), %eax | ||
657 | movl %edi, %edx | ||
658 | shrl $16, %edx | ||
659 | movl 36(%esp), %ecx | ||
660 | xorl %edi, %edx | ||
661 | andl %edx, %eax | ||
662 | andl %ecx, %edx | ||
663 | movl %eax, %ebx | ||
664 | sall $16, %ebx | ||
665 | movl %edx, %ecx | ||
666 | sall $16, %ecx | ||
667 | xorl %ebx, %eax | ||
668 | xorl %ecx, %edx | ||
669 | movl 88(%ebp), %ebx | ||
670 | xorl %ebx, %eax | ||
671 | movl 92(%ebp), %ecx | ||
672 | xorl %edi, %eax | ||
673 | xorl %edi, %edx | ||
674 | xorl %ecx, %edx | ||
675 | andl $0xfcfcfcfc, %eax | ||
676 | xorl %ebx, %ebx | ||
677 | andl $0xcfcfcfcf, %edx | ||
678 | xorl %ecx, %ecx | ||
679 | movb %al, %bl | ||
680 | movb %ah, %cl | ||
681 | rorl $4, %edx | ||
682 | movl des_SPtrans(%ebx),%ebp | ||
683 | movb %dl, %bl | ||
684 | xorl %ebp, %esi | ||
685 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
686 | xorl %ebp, %esi | ||
687 | movb %dh, %cl | ||
688 | shrl $16, %eax | ||
689 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
690 | xorl %ebp, %esi | ||
691 | movb %ah, %bl | ||
692 | shrl $16, %edx | ||
693 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
694 | xorl %ebp, %esi | ||
695 | movl 28(%esp), %ebp | ||
696 | movb %dh, %cl | ||
697 | andl $0xff, %eax | ||
698 | andl $0xff, %edx | ||
699 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
700 | xorl %ebx, %esi | ||
701 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
702 | xorl %ebx, %esi | ||
703 | movl 0x400+des_SPtrans(%eax),%ebx | ||
704 | xorl %ebx, %esi | ||
705 | movl 0x500+des_SPtrans(%edx),%ebx | ||
706 | xorl %ebx, %esi | ||
707 | |||
708 | /* Round 12 */ | ||
709 | movl 32(%esp), %eax | ||
710 | movl %esi, %edx | ||
711 | shrl $16, %edx | ||
712 | movl 36(%esp), %ecx | ||
713 | xorl %esi, %edx | ||
714 | andl %edx, %eax | ||
715 | andl %ecx, %edx | ||
716 | movl %eax, %ebx | ||
717 | sall $16, %ebx | ||
718 | movl %edx, %ecx | ||
719 | sall $16, %ecx | ||
720 | xorl %ebx, %eax | ||
721 | xorl %ecx, %edx | ||
722 | movl 96(%ebp), %ebx | ||
723 | xorl %ebx, %eax | ||
724 | movl 100(%ebp), %ecx | ||
725 | xorl %esi, %eax | ||
726 | xorl %esi, %edx | ||
727 | xorl %ecx, %edx | ||
728 | andl $0xfcfcfcfc, %eax | ||
729 | xorl %ebx, %ebx | ||
730 | andl $0xcfcfcfcf, %edx | ||
731 | xorl %ecx, %ecx | ||
732 | movb %al, %bl | ||
733 | movb %ah, %cl | ||
734 | rorl $4, %edx | ||
735 | movl des_SPtrans(%ebx),%ebp | ||
736 | movb %dl, %bl | ||
737 | xorl %ebp, %edi | ||
738 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
739 | xorl %ebp, %edi | ||
740 | movb %dh, %cl | ||
741 | shrl $16, %eax | ||
742 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
743 | xorl %ebp, %edi | ||
744 | movb %ah, %bl | ||
745 | shrl $16, %edx | ||
746 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
747 | xorl %ebp, %edi | ||
748 | movl 28(%esp), %ebp | ||
749 | movb %dh, %cl | ||
750 | andl $0xff, %eax | ||
751 | andl $0xff, %edx | ||
752 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
753 | xorl %ebx, %edi | ||
754 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
755 | xorl %ebx, %edi | ||
756 | movl 0x400+des_SPtrans(%eax),%ebx | ||
757 | xorl %ebx, %edi | ||
758 | movl 0x500+des_SPtrans(%edx),%ebx | ||
759 | xorl %ebx, %edi | ||
760 | |||
761 | /* Round 13 */ | ||
762 | movl 32(%esp), %eax | ||
763 | movl %edi, %edx | ||
764 | shrl $16, %edx | ||
765 | movl 36(%esp), %ecx | ||
766 | xorl %edi, %edx | ||
767 | andl %edx, %eax | ||
768 | andl %ecx, %edx | ||
769 | movl %eax, %ebx | ||
770 | sall $16, %ebx | ||
771 | movl %edx, %ecx | ||
772 | sall $16, %ecx | ||
773 | xorl %ebx, %eax | ||
774 | xorl %ecx, %edx | ||
775 | movl 104(%ebp), %ebx | ||
776 | xorl %ebx, %eax | ||
777 | movl 108(%ebp), %ecx | ||
778 | xorl %edi, %eax | ||
779 | xorl %edi, %edx | ||
780 | xorl %ecx, %edx | ||
781 | andl $0xfcfcfcfc, %eax | ||
782 | xorl %ebx, %ebx | ||
783 | andl $0xcfcfcfcf, %edx | ||
784 | xorl %ecx, %ecx | ||
785 | movb %al, %bl | ||
786 | movb %ah, %cl | ||
787 | rorl $4, %edx | ||
788 | movl des_SPtrans(%ebx),%ebp | ||
789 | movb %dl, %bl | ||
790 | xorl %ebp, %esi | ||
791 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
792 | xorl %ebp, %esi | ||
793 | movb %dh, %cl | ||
794 | shrl $16, %eax | ||
795 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
796 | xorl %ebp, %esi | ||
797 | movb %ah, %bl | ||
798 | shrl $16, %edx | ||
799 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
800 | xorl %ebp, %esi | ||
801 | movl 28(%esp), %ebp | ||
802 | movb %dh, %cl | ||
803 | andl $0xff, %eax | ||
804 | andl $0xff, %edx | ||
805 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
806 | xorl %ebx, %esi | ||
807 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
808 | xorl %ebx, %esi | ||
809 | movl 0x400+des_SPtrans(%eax),%ebx | ||
810 | xorl %ebx, %esi | ||
811 | movl 0x500+des_SPtrans(%edx),%ebx | ||
812 | xorl %ebx, %esi | ||
813 | |||
814 | /* Round 14 */ | ||
815 | movl 32(%esp), %eax | ||
816 | movl %esi, %edx | ||
817 | shrl $16, %edx | ||
818 | movl 36(%esp), %ecx | ||
819 | xorl %esi, %edx | ||
820 | andl %edx, %eax | ||
821 | andl %ecx, %edx | ||
822 | movl %eax, %ebx | ||
823 | sall $16, %ebx | ||
824 | movl %edx, %ecx | ||
825 | sall $16, %ecx | ||
826 | xorl %ebx, %eax | ||
827 | xorl %ecx, %edx | ||
828 | movl 112(%ebp), %ebx | ||
829 | xorl %ebx, %eax | ||
830 | movl 116(%ebp), %ecx | ||
831 | xorl %esi, %eax | ||
832 | xorl %esi, %edx | ||
833 | xorl %ecx, %edx | ||
834 | andl $0xfcfcfcfc, %eax | ||
835 | xorl %ebx, %ebx | ||
836 | andl $0xcfcfcfcf, %edx | ||
837 | xorl %ecx, %ecx | ||
838 | movb %al, %bl | ||
839 | movb %ah, %cl | ||
840 | rorl $4, %edx | ||
841 | movl des_SPtrans(%ebx),%ebp | ||
842 | movb %dl, %bl | ||
843 | xorl %ebp, %edi | ||
844 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
845 | xorl %ebp, %edi | ||
846 | movb %dh, %cl | ||
847 | shrl $16, %eax | ||
848 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
849 | xorl %ebp, %edi | ||
850 | movb %ah, %bl | ||
851 | shrl $16, %edx | ||
852 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
853 | xorl %ebp, %edi | ||
854 | movl 28(%esp), %ebp | ||
855 | movb %dh, %cl | ||
856 | andl $0xff, %eax | ||
857 | andl $0xff, %edx | ||
858 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
859 | xorl %ebx, %edi | ||
860 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
861 | xorl %ebx, %edi | ||
862 | movl 0x400+des_SPtrans(%eax),%ebx | ||
863 | xorl %ebx, %edi | ||
864 | movl 0x500+des_SPtrans(%edx),%ebx | ||
865 | xorl %ebx, %edi | ||
866 | |||
867 | /* Round 15 */ | ||
868 | movl 32(%esp), %eax | ||
869 | movl %edi, %edx | ||
870 | shrl $16, %edx | ||
871 | movl 36(%esp), %ecx | ||
872 | xorl %edi, %edx | ||
873 | andl %edx, %eax | ||
874 | andl %ecx, %edx | ||
875 | movl %eax, %ebx | ||
876 | sall $16, %ebx | ||
877 | movl %edx, %ecx | ||
878 | sall $16, %ecx | ||
879 | xorl %ebx, %eax | ||
880 | xorl %ecx, %edx | ||
881 | movl 120(%ebp), %ebx | ||
882 | xorl %ebx, %eax | ||
883 | movl 124(%ebp), %ecx | ||
884 | xorl %edi, %eax | ||
885 | xorl %edi, %edx | ||
886 | xorl %ecx, %edx | ||
887 | andl $0xfcfcfcfc, %eax | ||
888 | xorl %ebx, %ebx | ||
889 | andl $0xcfcfcfcf, %edx | ||
890 | xorl %ecx, %ecx | ||
891 | movb %al, %bl | ||
892 | movb %ah, %cl | ||
893 | rorl $4, %edx | ||
894 | movl des_SPtrans(%ebx),%ebp | ||
895 | movb %dl, %bl | ||
896 | xorl %ebp, %esi | ||
897 | movl 0x200+des_SPtrans(%ecx),%ebp | ||
898 | xorl %ebp, %esi | ||
899 | movb %dh, %cl | ||
900 | shrl $16, %eax | ||
901 | movl 0x100+des_SPtrans(%ebx),%ebp | ||
902 | xorl %ebp, %esi | ||
903 | movb %ah, %bl | ||
904 | shrl $16, %edx | ||
905 | movl 0x300+des_SPtrans(%ecx),%ebp | ||
906 | xorl %ebp, %esi | ||
907 | movl 28(%esp), %ebp | ||
908 | movb %dh, %cl | ||
909 | andl $0xff, %eax | ||
910 | andl $0xff, %edx | ||
911 | movl 0x600+des_SPtrans(%ebx),%ebx | ||
912 | xorl %ebx, %esi | ||
913 | movl 0x700+des_SPtrans(%ecx),%ebx | ||
914 | xorl %ebx, %esi | ||
915 | movl 0x400+des_SPtrans(%eax),%ebx | ||
916 | xorl %ebx, %esi | ||
917 | movl 0x500+des_SPtrans(%edx),%ebx | ||
918 | xorl %ebx, %esi | ||
919 | movl (%esp), %ebx | ||
920 | movl %edi, %eax | ||
921 | decl %ebx | ||
922 | movl %esi, %edi | ||
923 | movl %eax, %esi | ||
924 | movl %ebx, (%esp) | ||
925 | jnz .L000start | ||
926 | |||
927 | /* FP */ | ||
928 | movl 24(%esp), %edx | ||
929 | .byte 209 | ||
930 | .byte 207 /* rorl $1 %edi */ | ||
931 | movl %esi, %eax | ||
932 | xorl %edi, %esi | ||
933 | andl $0xaaaaaaaa, %esi | ||
934 | xorl %esi, %eax | ||
935 | xorl %esi, %edi | ||
936 | |||
937 | roll $23, %eax | ||
938 | movl %eax, %esi | ||
939 | xorl %edi, %eax | ||
940 | andl $0x03fc03fc, %eax | ||
941 | xorl %eax, %esi | ||
942 | xorl %eax, %edi | ||
943 | |||
944 | roll $10, %esi | ||
945 | movl %esi, %eax | ||
946 | xorl %edi, %esi | ||
947 | andl $0x33333333, %esi | ||
948 | xorl %esi, %eax | ||
949 | xorl %esi, %edi | ||
950 | |||
951 | roll $18, %edi | ||
952 | movl %edi, %esi | ||
953 | xorl %eax, %edi | ||
954 | andl $0xfff0000f, %edi | ||
955 | xorl %edi, %esi | ||
956 | xorl %edi, %eax | ||
957 | |||
958 | roll $12, %esi | ||
959 | movl %esi, %edi | ||
960 | xorl %eax, %esi | ||
961 | andl $0xf0f0f0f0, %esi | ||
962 | xorl %esi, %edi | ||
963 | xorl %esi, %eax | ||
964 | |||
965 | rorl $4, %eax | ||
966 | movl %eax, (%edx) | ||
967 | movl %edi, 4(%edx) | ||
968 | popl %ecx | ||
969 | popl %edi | ||
970 | popl %esi | ||
971 | popl %ebx | ||
972 | popl %ebp | ||
973 | ret | ||
974 | .fcrypt_body_end: | ||
975 | SIZE(fcrypt_body,.fcrypt_body_end-fcrypt_body) | ||
976 | .ident "fcrypt_body" | ||
diff --git a/src/lib/libcrypto/des/des.man b/src/lib/libcrypto/des/des.man new file mode 100644 index 0000000000..7e06a1851a --- /dev/null +++ b/src/lib/libcrypto/des/des.man | |||
@@ -0,0 +1,186 @@ | |||
1 | .TH DES 1 | ||
2 | .SH NAME | ||
3 | des - encrypt or decrypt data using Data Encryption Standard | ||
4 | .SH SYNOPSIS | ||
5 | .B des | ||
6 | ( | ||
7 | .B \-e | ||
8 | | | ||
9 | .B \-E | ||
10 | ) | ( | ||
11 | .B \-d | ||
12 | | | ||
13 | .B \-D | ||
14 | ) | ( | ||
15 | .B \-\fR[\fPcC\fR][\fPckname\fR]\fP | ||
16 | ) | | ||
17 | [ | ||
18 | .B \-b3hfs | ||
19 | ] [ | ||
20 | .B \-k | ||
21 | .I key | ||
22 | ] | ||
23 | ] [ | ||
24 | .B \-u\fR[\fIuuname\fR] | ||
25 | [ | ||
26 | .I input-file | ||
27 | [ | ||
28 | .I output-file | ||
29 | ] ] | ||
30 | .SH DESCRIPTION | ||
31 | .B des | ||
32 | encrypts and decrypts data using the | ||
33 | Data Encryption Standard algorithm. | ||
34 | One of | ||
35 | .B \-e, \-E | ||
36 | (for encrypt) or | ||
37 | .B \-d, \-D | ||
38 | (for decrypt) must be specified. | ||
39 | It is also possible to use | ||
40 | .B \-c | ||
41 | or | ||
42 | .B \-C | ||
43 | in conjunction or instead of the a encrypt/decrypt option to generate | ||
44 | a 16 character hexadecimal checksum, generated via the | ||
45 | .I des_cbc_cksum. | ||
46 | .LP | ||
47 | Two standard encryption modes are supported by the | ||
48 | .B des | ||
49 | program, Cipher Block Chaining (the default) and Electronic Code Book | ||
50 | (specified with | ||
51 | .B \-b | ||
52 | ). | ||
53 | .LP | ||
54 | The key used for the DES | ||
55 | algorithm is obtained by prompting the user unless the | ||
56 | .B `\-k | ||
57 | .I key' | ||
58 | option is given. | ||
59 | If the key is an argument to the | ||
60 | .B des | ||
61 | command, it is potentially visible to users executing | ||
62 | .BR ps (1) | ||
63 | or a derivative. To minimise this possibility, | ||
64 | .B des | ||
65 | takes care to destroy the key argument immediately upon entry. | ||
66 | If your shell keeps a history file be careful to make sure it is not | ||
67 | world readable. | ||
68 | .LP | ||
69 | Since this program attempts to maintain compatability with sunOS's | ||
70 | des(1) command, there are 2 different methods used to convert the user | ||
71 | supplied key to a des key. | ||
72 | Whenever and one or more of | ||
73 | .B \-E, \-D, \-C | ||
74 | or | ||
75 | .B \-3 | ||
76 | options are used, the key conversion procedure will not be compatible | ||
77 | with the sunOS des(1) version but will use all the user supplied | ||
78 | character to generate the des key. | ||
79 | .B des | ||
80 | command reads from standard input unless | ||
81 | .I input-file | ||
82 | is specified and writes to standard output unless | ||
83 | .I output-file | ||
84 | is given. | ||
85 | .SH OPTIONS | ||
86 | .TP | ||
87 | .B \-b | ||
88 | Select ECB | ||
89 | (eight bytes at a time) encryption mode. | ||
90 | .TP | ||
91 | .B \-3 | ||
92 | Encrypt using triple encryption. | ||
93 | By default triple cbc encryption is used but if the | ||
94 | .B \-b | ||
95 | option is used then triple ecb encryption is performed. | ||
96 | If the key is less than 8 characters long, the flag has no effect. | ||
97 | .TP | ||
98 | .B \-e | ||
99 | Encrypt data using an 8 byte key in a manner compatible with sunOS | ||
100 | des(1). | ||
101 | .TP | ||
102 | .B \-E | ||
103 | Encrypt data using a key of nearly unlimited length (1024 bytes). | ||
104 | This will product a more secure encryption. | ||
105 | .TP | ||
106 | .B \-d | ||
107 | Decrypt data that was encrypted with the \-e option. | ||
108 | .TP | ||
109 | .B \-D | ||
110 | Decrypt data that was encrypted with the \-E option. | ||
111 | .TP | ||
112 | .B \-c | ||
113 | Generate a 16 character hexadecimal cbc checksum and output this to | ||
114 | stderr. | ||
115 | If a filename was specified after the | ||
116 | .B \-c | ||
117 | option, the checksum is output to that file. | ||
118 | The checksum is generated using a key generated in a sunOS compatible | ||
119 | manner. | ||
120 | .TP | ||
121 | .B \-C | ||
122 | A cbc checksum is generated in the same manner as described for the | ||
123 | .B \-c | ||
124 | option but the DES key is generated in the same manner as used for the | ||
125 | .B \-E | ||
126 | and | ||
127 | .B \-D | ||
128 | options | ||
129 | .TP | ||
130 | .B \-f | ||
131 | Does nothing - allowed for compatibility with sunOS des(1) command. | ||
132 | .TP | ||
133 | .B \-s | ||
134 | Does nothing - allowed for compatibility with sunOS des(1) command. | ||
135 | .TP | ||
136 | .B "\-k \fIkey\fP" | ||
137 | Use the encryption | ||
138 | .I key | ||
139 | specified. | ||
140 | .TP | ||
141 | .B "\-h" | ||
142 | The | ||
143 | .I key | ||
144 | is assumed to be a 16 character hexadecimal number. | ||
145 | If the | ||
146 | .B "\-3" | ||
147 | option is used the key is assumed to be a 32 character hexadecimal | ||
148 | number. | ||
149 | .TP | ||
150 | .B \-u | ||
151 | This flag is used to read and write uuencoded files. If decrypting, | ||
152 | the input file is assumed to contain uuencoded, DES encrypted data. | ||
153 | If encrypting, the characters following the -u are used as the name of | ||
154 | the uuencoded file to embed in the begin line of the uuencoded | ||
155 | output. If there is no name specified after the -u, the name text.des | ||
156 | will be embedded in the header. | ||
157 | .SH SEE ALSO | ||
158 | .B ps (1) | ||
159 | .B des_crypt(3) | ||
160 | .SH BUGS | ||
161 | .LP | ||
162 | The problem with using the | ||
163 | .B -e | ||
164 | option is the short key length. | ||
165 | It would be better to use a real 56-bit key rather than an | ||
166 | ASCII-based 56-bit pattern. Knowing that the key was derived from ASCII | ||
167 | radically reduces the time necessary for a brute-force cryptographic attack. | ||
168 | My attempt to remove this problem is to add an alternative text-key to | ||
169 | DES-key function. This alternative function (accessed via | ||
170 | .B -E, -D, -S | ||
171 | and | ||
172 | .B -3 | ||
173 | ) | ||
174 | uses DES to help generate the key. | ||
175 | .LP | ||
176 | Be carefully when using the -u option. Doing des -ud <filename> will | ||
177 | not decrypt filename (the -u option will gobble the d option). | ||
178 | .LP | ||
179 | The VMS operating system operates in a world where files are always a | ||
180 | multiple of 512 bytes. This causes problems when encrypted data is | ||
181 | send from unix to VMS since a 88 byte file will suddenly be padded | ||
182 | with 424 null bytes. To get around this problem, use the -u option | ||
183 | to uuencode the data before it is send to the VMS system. | ||
184 | .SH AUTHOR | ||
185 | .LP | ||
186 | Eric Young (eay@cryptsoft.com) | ||
diff --git a/src/lib/libcrypto/des/des.org b/src/lib/libcrypto/des/des.org new file mode 100644 index 0000000000..a4cf5c8770 --- /dev/null +++ b/src/lib/libcrypto/des/des.org | |||
@@ -0,0 +1,301 @@ | |||
1 | /* crypto/des/des.org */ | ||
2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
60 | * | ||
61 | * Always modify des.org since des.h is automatically generated from | ||
62 | * it during SSLeay configuration. | ||
63 | * | ||
64 | * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
65 | */ | ||
66 | |||
67 | #ifndef HEADER_DES_H | ||
68 | #define HEADER_DES_H | ||
69 | |||
70 | #ifdef __cplusplus | ||
71 | extern "C" { | ||
72 | #endif | ||
73 | |||
74 | #include <stdio.h> | ||
75 | |||
76 | /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a | ||
77 | * %20 speed up (longs are 8 bytes, int's are 4). */ | ||
78 | #ifndef DES_LONG | ||
79 | #define DES_LONG unsigned long | ||
80 | #endif | ||
81 | |||
82 | typedef unsigned char des_cblock[8]; | ||
83 | typedef struct des_ks_struct | ||
84 | { | ||
85 | union { | ||
86 | des_cblock _; | ||
87 | /* make sure things are correct size on machines with | ||
88 | * 8 byte longs */ | ||
89 | DES_LONG pad[2]; | ||
90 | } ks; | ||
91 | #undef _ | ||
92 | #define _ ks._ | ||
93 | } des_key_schedule[16]; | ||
94 | |||
95 | #define DES_KEY_SZ (sizeof(des_cblock)) | ||
96 | #define DES_SCHEDULE_SZ (sizeof(des_key_schedule)) | ||
97 | |||
98 | #define DES_ENCRYPT 1 | ||
99 | #define DES_DECRYPT 0 | ||
100 | |||
101 | #define DES_CBC_MODE 0 | ||
102 | #define DES_PCBC_MODE 1 | ||
103 | |||
104 | #define des_ecb2_encrypt(i,o,k1,k2,e) \ | ||
105 | des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) | ||
106 | |||
107 | #define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ | ||
108 | des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) | ||
109 | |||
110 | #define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ | ||
111 | des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) | ||
112 | |||
113 | #define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ | ||
114 | des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) | ||
115 | |||
116 | #define C_Block des_cblock | ||
117 | #define Key_schedule des_key_schedule | ||
118 | #ifdef KERBEROS | ||
119 | #define ENCRYPT DES_ENCRYPT | ||
120 | #define DECRYPT DES_DECRYPT | ||
121 | #endif | ||
122 | #define KEY_SZ DES_KEY_SZ | ||
123 | #define string_to_key des_string_to_key | ||
124 | #define read_pw_string des_read_pw_string | ||
125 | #define random_key des_random_key | ||
126 | #define pcbc_encrypt des_pcbc_encrypt | ||
127 | #define set_key des_set_key | ||
128 | #define key_sched des_key_sched | ||
129 | #define ecb_encrypt des_ecb_encrypt | ||
130 | #define cbc_encrypt des_cbc_encrypt | ||
131 | #define ncbc_encrypt des_ncbc_encrypt | ||
132 | #define xcbc_encrypt des_xcbc_encrypt | ||
133 | #define cbc_cksum des_cbc_cksum | ||
134 | #define quad_cksum des_quad_cksum | ||
135 | |||
136 | /* For compatibility with the MIT lib - eay 20/05/92 */ | ||
137 | typedef des_key_schedule bit_64; | ||
138 | #define des_fixup_key_parity des_set_odd_parity | ||
139 | #define des_check_key_parity check_parity | ||
140 | |||
141 | extern int des_check_key; /* defaults to false */ | ||
142 | extern int des_rw_mode; /* defaults to DES_PCBC_MODE */ | ||
143 | |||
144 | /* The next line is used to disable full ANSI prototypes, if your | ||
145 | * compiler has problems with the prototypes, make sure this line always | ||
146 | * evaluates to true :-) */ | ||
147 | #if defined(MSDOS) || defined(__STDC__) | ||
148 | #undef NOPROTO | ||
149 | #endif | ||
150 | #ifndef NOPROTO | ||
151 | char *des_options(void); | ||
152 | void des_ecb3_encrypt(des_cblock *input,des_cblock *output, | ||
153 | des_key_schedule ks1,des_key_schedule ks2, | ||
154 | des_key_schedule ks3, int enc); | ||
155 | DES_LONG des_cbc_cksum(des_cblock *input,des_cblock *output, | ||
156 | long length,des_key_schedule schedule,des_cblock *ivec); | ||
157 | void des_cbc_encrypt(des_cblock *input,des_cblock *output,long length, | ||
158 | des_key_schedule schedule,des_cblock *ivec,int enc); | ||
159 | void des_ncbc_encrypt(des_cblock *input,des_cblock *output,long length, | ||
160 | des_key_schedule schedule,des_cblock *ivec,int enc); | ||
161 | void des_xcbc_encrypt(des_cblock *input,des_cblock *output,long length, | ||
162 | des_key_schedule schedule,des_cblock *ivec, | ||
163 | des_cblock *inw,des_cblock *outw,int enc); | ||
164 | void des_cfb_encrypt(unsigned char *in,unsigned char *out,int numbits, | ||
165 | long length,des_key_schedule schedule,des_cblock *ivec,int enc); | ||
166 | void des_ecb_encrypt(des_cblock *input,des_cblock *output, | ||
167 | des_key_schedule ks,int enc); | ||
168 | void des_encrypt(DES_LONG *data,des_key_schedule ks, int enc); | ||
169 | void des_encrypt2(DES_LONG *data,des_key_schedule ks, int enc); | ||
170 | void des_encrypt3(DES_LONG *data, des_key_schedule ks1, | ||
171 | des_key_schedule ks2, des_key_schedule ks3); | ||
172 | void des_decrypt3(DES_LONG *data, des_key_schedule ks1, | ||
173 | des_key_schedule ks2, des_key_schedule ks3); | ||
174 | void des_ede3_cbc_encrypt(des_cblock *input, des_cblock *output, | ||
175 | long length, des_key_schedule ks1, des_key_schedule ks2, | ||
176 | des_key_schedule ks3, des_cblock *ivec, int enc); | ||
177 | void des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out, | ||
178 | long length, des_key_schedule ks1, des_key_schedule ks2, | ||
179 | des_key_schedule ks3, des_cblock *ivec, int *num, int enc); | ||
180 | void des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out, | ||
181 | long length, des_key_schedule ks1, des_key_schedule ks2, | ||
182 | des_key_schedule ks3, des_cblock *ivec, int *num); | ||
183 | |||
184 | void des_xwhite_in2out(des_cblock (*des_key), des_cblock (*in_white), | ||
185 | des_cblock (*out_white)); | ||
186 | |||
187 | int des_enc_read(int fd,char *buf,int len,des_key_schedule sched, | ||
188 | des_cblock *iv); | ||
189 | int des_enc_write(int fd,char *buf,int len,des_key_schedule sched, | ||
190 | des_cblock *iv); | ||
191 | char *des_fcrypt(const char *buf,const char *salt, char *ret); | ||
192 | #ifdef PERL5 | ||
193 | char *des_crypt(const char *buf,const char *salt); | ||
194 | #else | ||
195 | /* some stupid compilers complain because I have declared char instead | ||
196 | * of const char */ | ||
197 | #ifdef HEADER_DES_LOCL_H | ||
198 | char *crypt(const char *buf,const char *salt); | ||
199 | #else | ||
200 | char *crypt(); | ||
201 | #endif | ||
202 | #endif | ||
203 | void des_ofb_encrypt(unsigned char *in,unsigned char *out, | ||
204 | int numbits,long length,des_key_schedule schedule,des_cblock *ivec); | ||
205 | void des_pcbc_encrypt(des_cblock *input,des_cblock *output,long length, | ||
206 | des_key_schedule schedule,des_cblock *ivec,int enc); | ||
207 | DES_LONG des_quad_cksum(des_cblock *input,des_cblock *output, | ||
208 | long length,int out_count,des_cblock *seed); | ||
209 | void des_random_seed(des_cblock key); | ||
210 | void des_random_key(des_cblock ret); | ||
211 | int des_read_password(des_cblock *key,char *prompt,int verify); | ||
212 | int des_read_2passwords(des_cblock *key1,des_cblock *key2, | ||
213 | char *prompt,int verify); | ||
214 | int des_read_pw_string(char *buf,int length,char *prompt,int verify); | ||
215 | void des_set_odd_parity(des_cblock *key); | ||
216 | int des_is_weak_key(des_cblock *key); | ||
217 | int des_set_key(des_cblock *key,des_key_schedule schedule); | ||
218 | int des_key_sched(des_cblock *key,des_key_schedule schedule); | ||
219 | void des_string_to_key(char *str,des_cblock *key); | ||
220 | void des_string_to_2keys(char *str,des_cblock *key1,des_cblock *key2); | ||
221 | void des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, | ||
222 | des_key_schedule schedule, des_cblock *ivec, int *num, int enc); | ||
223 | void des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, | ||
224 | des_key_schedule schedule, des_cblock *ivec, int *num); | ||
225 | int des_read_pw(char *buf, char *buff, int size, char *prompt, int verify); | ||
226 | |||
227 | /* Extra functions from Mark Murray <mark@grondar.za> */ | ||
228 | void des_cblock_print_file(des_cblock *cb, FILE *fp); | ||
229 | /* The following functions are not in the normal unix build or the | ||
230 | * SSLeay build. When using the SSLeay build, use RAND_seed() | ||
231 | * and RAND_bytes() instead. */ | ||
232 | int des_new_random_key(des_cblock *key); | ||
233 | void des_init_random_number_generator(des_cblock *key); | ||
234 | void des_set_random_generator_seed(des_cblock *key); | ||
235 | void des_set_sequence_number(des_cblock new_sequence_number); | ||
236 | void des_generate_random_block(des_cblock *block); | ||
237 | |||
238 | #else | ||
239 | |||
240 | char *des_options(); | ||
241 | void des_ecb3_encrypt(); | ||
242 | DES_LONG des_cbc_cksum(); | ||
243 | void des_cbc_encrypt(); | ||
244 | void des_ncbc_encrypt(); | ||
245 | void des_xcbc_encrypt(); | ||
246 | void des_cfb_encrypt(); | ||
247 | void des_ede3_cfb64_encrypt(); | ||
248 | void des_ede3_ofb64_encrypt(); | ||
249 | void des_ecb_encrypt(); | ||
250 | void des_encrypt(); | ||
251 | void des_encrypt2(); | ||
252 | void des_encrypt3(); | ||
253 | void des_decrypt3(); | ||
254 | void des_ede3_cbc_encrypt(); | ||
255 | int des_enc_read(); | ||
256 | int des_enc_write(); | ||
257 | char *des_fcrypt(); | ||
258 | #ifdef PERL5 | ||
259 | char *des_crypt(); | ||
260 | #else | ||
261 | char *crypt(); | ||
262 | #endif | ||
263 | void des_ofb_encrypt(); | ||
264 | void des_pcbc_encrypt(); | ||
265 | DES_LONG des_quad_cksum(); | ||
266 | void des_random_seed(); | ||
267 | void des_random_key(); | ||
268 | int des_read_password(); | ||
269 | int des_read_2passwords(); | ||
270 | int des_read_pw_string(); | ||
271 | void des_set_odd_parity(); | ||
272 | int des_is_weak_key(); | ||
273 | int des_set_key(); | ||
274 | int des_key_sched(); | ||
275 | void des_string_to_key(); | ||
276 | void des_string_to_2keys(); | ||
277 | void des_cfb64_encrypt(); | ||
278 | void des_ofb64_encrypt(); | ||
279 | int des_read_pw(); | ||
280 | void des_xwhite_in2out(); | ||
281 | |||
282 | /* Extra functions from Mark Murray <mark@grondar.za> */ | ||
283 | void des_cblock_print_file(); | ||
284 | /* The following functions are not in the normal unix build or the | ||
285 | * SSLeay build. When using the SSLeay build, use RAND_seed() | ||
286 | * and RAND_bytes() instead. */ | ||
287 | #ifdef FreeBSD | ||
288 | int des_new_random_key(); | ||
289 | void des_init_random_number_generator(); | ||
290 | void des_set_random_generator_seed(); | ||
291 | void des_set_sequence_number(); | ||
292 | void des_generate_random_block(); | ||
293 | #endif | ||
294 | |||
295 | #endif | ||
296 | |||
297 | #ifdef __cplusplus | ||
298 | } | ||
299 | #endif | ||
300 | |||
301 | #endif | ||
diff --git a/src/lib/libcrypto/des/des.pl b/src/lib/libcrypto/des/des.pl new file mode 100644 index 0000000000..935eacb504 --- /dev/null +++ b/src/lib/libcrypto/des/des.pl | |||
@@ -0,0 +1,552 @@ | |||
1 | #!/usr/bin/perl | ||
2 | # des.pl - eric young 22/11/1991 eay@cryptsoft.com | ||
3 | # | ||
4 | # Copyright (C) 1993 Eric Young | ||
5 | # | ||
6 | # 11 April 1996 - patched to circumvent Perl 5 (through 5.002) problem | ||
7 | # with sign-extension on right shift operations. | ||
8 | # Ed Kubaitis - ejk@uiuc.edu | ||
9 | # | ||
10 | # eay - 92/08/31 - I think I have fixed all problems for 64bit | ||
11 | # versions of perl but I could be wrong since I have not tested it yet :-). | ||
12 | # | ||
13 | # This is an implementation of DES in perl. | ||
14 | # The two routines (des_set_key and des_ecb_encrypt) | ||
15 | # take 8 byte objects as arguments. | ||
16 | # | ||
17 | # des_set_key takes an 8 byte string as a key and returns a key schedule | ||
18 | # for use in calls to des_ecb_encrypt. | ||
19 | # des_ecb_encrypt takes three arguments, the first is a key schedule | ||
20 | # (make sure to pass it by reference with the *), the second is 1 | ||
21 | # to encrypt, 0 to decrypt. The third argument is an 8 byte object | ||
22 | # to encrypt. The function returns an 8 byte object that has been | ||
23 | # DES encrypted. | ||
24 | # | ||
25 | # example: | ||
26 | # require 'des.pl' | ||
27 | # | ||
28 | # $key =pack("C8",0x12,0x23,0x45,0x67,0x89,0xab,0xcd,0xef); | ||
29 | # @ks= &des_set_key($key); | ||
30 | # | ||
31 | # $outbytes= &des_ecb_encrypt(*ks,1,$data); | ||
32 | # @enc =unpack("C8",$outbytes); | ||
33 | # | ||
34 | |||
35 | package des; | ||
36 | |||
37 | eval("use integer;") if (int($]) > 4); | ||
38 | |||
39 | # The following 8 arrays are used in des_set_key | ||
40 | @skb0=( | ||
41 | # for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 | ||
42 | 0x00000000,0x00000010,0x20000000,0x20000010, | ||
43 | 0x00010000,0x00010010,0x20010000,0x20010010, | ||
44 | 0x00000800,0x00000810,0x20000800,0x20000810, | ||
45 | 0x00010800,0x00010810,0x20010800,0x20010810, | ||
46 | 0x00000020,0x00000030,0x20000020,0x20000030, | ||
47 | 0x00010020,0x00010030,0x20010020,0x20010030, | ||
48 | 0x00000820,0x00000830,0x20000820,0x20000830, | ||
49 | 0x00010820,0x00010830,0x20010820,0x20010830, | ||
50 | 0x00080000,0x00080010,0x20080000,0x20080010, | ||
51 | 0x00090000,0x00090010,0x20090000,0x20090010, | ||
52 | 0x00080800,0x00080810,0x20080800,0x20080810, | ||
53 | 0x00090800,0x00090810,0x20090800,0x20090810, | ||
54 | 0x00080020,0x00080030,0x20080020,0x20080030, | ||
55 | 0x00090020,0x00090030,0x20090020,0x20090030, | ||
56 | 0x00080820,0x00080830,0x20080820,0x20080830, | ||
57 | 0x00090820,0x00090830,0x20090820,0x20090830, | ||
58 | ); | ||
59 | @skb1=( | ||
60 | # for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 | ||
61 | 0x00000000,0x02000000,0x00002000,0x02002000, | ||
62 | 0x00200000,0x02200000,0x00202000,0x02202000, | ||
63 | 0x00000004,0x02000004,0x00002004,0x02002004, | ||
64 | 0x00200004,0x02200004,0x00202004,0x02202004, | ||
65 | 0x00000400,0x02000400,0x00002400,0x02002400, | ||
66 | 0x00200400,0x02200400,0x00202400,0x02202400, | ||
67 | 0x00000404,0x02000404,0x00002404,0x02002404, | ||
68 | 0x00200404,0x02200404,0x00202404,0x02202404, | ||
69 | 0x10000000,0x12000000,0x10002000,0x12002000, | ||
70 | 0x10200000,0x12200000,0x10202000,0x12202000, | ||
71 | 0x10000004,0x12000004,0x10002004,0x12002004, | ||
72 | 0x10200004,0x12200004,0x10202004,0x12202004, | ||
73 | 0x10000400,0x12000400,0x10002400,0x12002400, | ||
74 | 0x10200400,0x12200400,0x10202400,0x12202400, | ||
75 | 0x10000404,0x12000404,0x10002404,0x12002404, | ||
76 | 0x10200404,0x12200404,0x10202404,0x12202404, | ||
77 | ); | ||
78 | @skb2=( | ||
79 | # for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 | ||
80 | 0x00000000,0x00000001,0x00040000,0x00040001, | ||
81 | 0x01000000,0x01000001,0x01040000,0x01040001, | ||
82 | 0x00000002,0x00000003,0x00040002,0x00040003, | ||
83 | 0x01000002,0x01000003,0x01040002,0x01040003, | ||
84 | 0x00000200,0x00000201,0x00040200,0x00040201, | ||
85 | 0x01000200,0x01000201,0x01040200,0x01040201, | ||
86 | 0x00000202,0x00000203,0x00040202,0x00040203, | ||
87 | 0x01000202,0x01000203,0x01040202,0x01040203, | ||
88 | 0x08000000,0x08000001,0x08040000,0x08040001, | ||
89 | 0x09000000,0x09000001,0x09040000,0x09040001, | ||
90 | 0x08000002,0x08000003,0x08040002,0x08040003, | ||
91 | 0x09000002,0x09000003,0x09040002,0x09040003, | ||
92 | 0x08000200,0x08000201,0x08040200,0x08040201, | ||
93 | 0x09000200,0x09000201,0x09040200,0x09040201, | ||
94 | 0x08000202,0x08000203,0x08040202,0x08040203, | ||
95 | 0x09000202,0x09000203,0x09040202,0x09040203, | ||
96 | ); | ||
97 | @skb3=( | ||
98 | # for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 | ||
99 | 0x00000000,0x00100000,0x00000100,0x00100100, | ||
100 | 0x00000008,0x00100008,0x00000108,0x00100108, | ||
101 | 0x00001000,0x00101000,0x00001100,0x00101100, | ||
102 | 0x00001008,0x00101008,0x00001108,0x00101108, | ||
103 | 0x04000000,0x04100000,0x04000100,0x04100100, | ||
104 | 0x04000008,0x04100008,0x04000108,0x04100108, | ||
105 | 0x04001000,0x04101000,0x04001100,0x04101100, | ||
106 | 0x04001008,0x04101008,0x04001108,0x04101108, | ||
107 | 0x00020000,0x00120000,0x00020100,0x00120100, | ||
108 | 0x00020008,0x00120008,0x00020108,0x00120108, | ||
109 | 0x00021000,0x00121000,0x00021100,0x00121100, | ||
110 | 0x00021008,0x00121008,0x00021108,0x00121108, | ||
111 | 0x04020000,0x04120000,0x04020100,0x04120100, | ||
112 | 0x04020008,0x04120008,0x04020108,0x04120108, | ||
113 | 0x04021000,0x04121000,0x04021100,0x04121100, | ||
114 | 0x04021008,0x04121008,0x04021108,0x04121108, | ||
115 | ); | ||
116 | @skb4=( | ||
117 | # for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 | ||
118 | 0x00000000,0x10000000,0x00010000,0x10010000, | ||
119 | 0x00000004,0x10000004,0x00010004,0x10010004, | ||
120 | 0x20000000,0x30000000,0x20010000,0x30010000, | ||
121 | 0x20000004,0x30000004,0x20010004,0x30010004, | ||
122 | 0x00100000,0x10100000,0x00110000,0x10110000, | ||
123 | 0x00100004,0x10100004,0x00110004,0x10110004, | ||
124 | 0x20100000,0x30100000,0x20110000,0x30110000, | ||
125 | 0x20100004,0x30100004,0x20110004,0x30110004, | ||
126 | 0x00001000,0x10001000,0x00011000,0x10011000, | ||
127 | 0x00001004,0x10001004,0x00011004,0x10011004, | ||
128 | 0x20001000,0x30001000,0x20011000,0x30011000, | ||
129 | 0x20001004,0x30001004,0x20011004,0x30011004, | ||
130 | 0x00101000,0x10101000,0x00111000,0x10111000, | ||
131 | 0x00101004,0x10101004,0x00111004,0x10111004, | ||
132 | 0x20101000,0x30101000,0x20111000,0x30111000, | ||
133 | 0x20101004,0x30101004,0x20111004,0x30111004, | ||
134 | ); | ||
135 | @skb5=( | ||
136 | # for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 | ||
137 | 0x00000000,0x08000000,0x00000008,0x08000008, | ||
138 | 0x00000400,0x08000400,0x00000408,0x08000408, | ||
139 | 0x00020000,0x08020000,0x00020008,0x08020008, | ||
140 | 0x00020400,0x08020400,0x00020408,0x08020408, | ||
141 | 0x00000001,0x08000001,0x00000009,0x08000009, | ||
142 | 0x00000401,0x08000401,0x00000409,0x08000409, | ||
143 | 0x00020001,0x08020001,0x00020009,0x08020009, | ||
144 | 0x00020401,0x08020401,0x00020409,0x08020409, | ||
145 | 0x02000000,0x0A000000,0x02000008,0x0A000008, | ||
146 | 0x02000400,0x0A000400,0x02000408,0x0A000408, | ||
147 | 0x02020000,0x0A020000,0x02020008,0x0A020008, | ||
148 | 0x02020400,0x0A020400,0x02020408,0x0A020408, | ||
149 | 0x02000001,0x0A000001,0x02000009,0x0A000009, | ||
150 | 0x02000401,0x0A000401,0x02000409,0x0A000409, | ||
151 | 0x02020001,0x0A020001,0x02020009,0x0A020009, | ||
152 | 0x02020401,0x0A020401,0x02020409,0x0A020409, | ||
153 | ); | ||
154 | @skb6=( | ||
155 | # for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 | ||
156 | 0x00000000,0x00000100,0x00080000,0x00080100, | ||
157 | 0x01000000,0x01000100,0x01080000,0x01080100, | ||
158 | 0x00000010,0x00000110,0x00080010,0x00080110, | ||
159 | 0x01000010,0x01000110,0x01080010,0x01080110, | ||
160 | 0x00200000,0x00200100,0x00280000,0x00280100, | ||
161 | 0x01200000,0x01200100,0x01280000,0x01280100, | ||
162 | 0x00200010,0x00200110,0x00280010,0x00280110, | ||
163 | 0x01200010,0x01200110,0x01280010,0x01280110, | ||
164 | 0x00000200,0x00000300,0x00080200,0x00080300, | ||
165 | 0x01000200,0x01000300,0x01080200,0x01080300, | ||
166 | 0x00000210,0x00000310,0x00080210,0x00080310, | ||
167 | 0x01000210,0x01000310,0x01080210,0x01080310, | ||
168 | 0x00200200,0x00200300,0x00280200,0x00280300, | ||
169 | 0x01200200,0x01200300,0x01280200,0x01280300, | ||
170 | 0x00200210,0x00200310,0x00280210,0x00280310, | ||
171 | 0x01200210,0x01200310,0x01280210,0x01280310, | ||
172 | ); | ||
173 | @skb7=( | ||
174 | # for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 | ||
175 | 0x00000000,0x04000000,0x00040000,0x04040000, | ||
176 | 0x00000002,0x04000002,0x00040002,0x04040002, | ||
177 | 0x00002000,0x04002000,0x00042000,0x04042000, | ||
178 | 0x00002002,0x04002002,0x00042002,0x04042002, | ||
179 | 0x00000020,0x04000020,0x00040020,0x04040020, | ||
180 | 0x00000022,0x04000022,0x00040022,0x04040022, | ||
181 | 0x00002020,0x04002020,0x00042020,0x04042020, | ||
182 | 0x00002022,0x04002022,0x00042022,0x04042022, | ||
183 | 0x00000800,0x04000800,0x00040800,0x04040800, | ||
184 | 0x00000802,0x04000802,0x00040802,0x04040802, | ||
185 | 0x00002800,0x04002800,0x00042800,0x04042800, | ||
186 | 0x00002802,0x04002802,0x00042802,0x04042802, | ||
187 | 0x00000820,0x04000820,0x00040820,0x04040820, | ||
188 | 0x00000822,0x04000822,0x00040822,0x04040822, | ||
189 | 0x00002820,0x04002820,0x00042820,0x04042820, | ||
190 | 0x00002822,0x04002822,0x00042822,0x04042822, | ||
191 | ); | ||
192 | |||
193 | @shifts2=(0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0); | ||
194 | |||
195 | # used in ecb_encrypt | ||
196 | @SP0=( | ||
197 | 0x00410100, 0x00010000, 0x40400000, 0x40410100, | ||
198 | 0x00400000, 0x40010100, 0x40010000, 0x40400000, | ||
199 | 0x40010100, 0x00410100, 0x00410000, 0x40000100, | ||
200 | 0x40400100, 0x00400000, 0x00000000, 0x40010000, | ||
201 | 0x00010000, 0x40000000, 0x00400100, 0x00010100, | ||
202 | 0x40410100, 0x00410000, 0x40000100, 0x00400100, | ||
203 | 0x40000000, 0x00000100, 0x00010100, 0x40410000, | ||
204 | 0x00000100, 0x40400100, 0x40410000, 0x00000000, | ||
205 | 0x00000000, 0x40410100, 0x00400100, 0x40010000, | ||
206 | 0x00410100, 0x00010000, 0x40000100, 0x00400100, | ||
207 | 0x40410000, 0x00000100, 0x00010100, 0x40400000, | ||
208 | 0x40010100, 0x40000000, 0x40400000, 0x00410000, | ||
209 | 0x40410100, 0x00010100, 0x00410000, 0x40400100, | ||
210 | 0x00400000, 0x40000100, 0x40010000, 0x00000000, | ||
211 | 0x00010000, 0x00400000, 0x40400100, 0x00410100, | ||
212 | 0x40000000, 0x40410000, 0x00000100, 0x40010100, | ||
213 | ); | ||
214 | @SP1=( | ||
215 | 0x08021002, 0x00000000, 0x00021000, 0x08020000, | ||
216 | 0x08000002, 0x00001002, 0x08001000, 0x00021000, | ||
217 | 0x00001000, 0x08020002, 0x00000002, 0x08001000, | ||
218 | 0x00020002, 0x08021000, 0x08020000, 0x00000002, | ||
219 | 0x00020000, 0x08001002, 0x08020002, 0x00001000, | ||
220 | 0x00021002, 0x08000000, 0x00000000, 0x00020002, | ||
221 | 0x08001002, 0x00021002, 0x08021000, 0x08000002, | ||
222 | 0x08000000, 0x00020000, 0x00001002, 0x08021002, | ||
223 | 0x00020002, 0x08021000, 0x08001000, 0x00021002, | ||
224 | 0x08021002, 0x00020002, 0x08000002, 0x00000000, | ||
225 | 0x08000000, 0x00001002, 0x00020000, 0x08020002, | ||
226 | 0x00001000, 0x08000000, 0x00021002, 0x08001002, | ||
227 | 0x08021000, 0x00001000, 0x00000000, 0x08000002, | ||
228 | 0x00000002, 0x08021002, 0x00021000, 0x08020000, | ||
229 | 0x08020002, 0x00020000, 0x00001002, 0x08001000, | ||
230 | 0x08001002, 0x00000002, 0x08020000, 0x00021000, | ||
231 | ); | ||
232 | @SP2=( | ||
233 | 0x20800000, 0x00808020, 0x00000020, 0x20800020, | ||
234 | 0x20008000, 0x00800000, 0x20800020, 0x00008020, | ||
235 | 0x00800020, 0x00008000, 0x00808000, 0x20000000, | ||
236 | 0x20808020, 0x20000020, 0x20000000, 0x20808000, | ||
237 | 0x00000000, 0x20008000, 0x00808020, 0x00000020, | ||
238 | 0x20000020, 0x20808020, 0x00008000, 0x20800000, | ||
239 | 0x20808000, 0x00800020, 0x20008020, 0x00808000, | ||
240 | 0x00008020, 0x00000000, 0x00800000, 0x20008020, | ||
241 | 0x00808020, 0x00000020, 0x20000000, 0x00008000, | ||
242 | 0x20000020, 0x20008000, 0x00808000, 0x20800020, | ||
243 | 0x00000000, 0x00808020, 0x00008020, 0x20808000, | ||
244 | 0x20008000, 0x00800000, 0x20808020, 0x20000000, | ||
245 | 0x20008020, 0x20800000, 0x00800000, 0x20808020, | ||
246 | 0x00008000, 0x00800020, 0x20800020, 0x00008020, | ||
247 | 0x00800020, 0x00000000, 0x20808000, 0x20000020, | ||
248 | 0x20800000, 0x20008020, 0x00000020, 0x00808000, | ||
249 | ); | ||
250 | @SP3=( | ||
251 | 0x00080201, 0x02000200, 0x00000001, 0x02080201, | ||
252 | 0x00000000, 0x02080000, 0x02000201, 0x00080001, | ||
253 | 0x02080200, 0x02000001, 0x02000000, 0x00000201, | ||
254 | 0x02000001, 0x00080201, 0x00080000, 0x02000000, | ||
255 | 0x02080001, 0x00080200, 0x00000200, 0x00000001, | ||
256 | 0x00080200, 0x02000201, 0x02080000, 0x00000200, | ||
257 | 0x00000201, 0x00000000, 0x00080001, 0x02080200, | ||
258 | 0x02000200, 0x02080001, 0x02080201, 0x00080000, | ||
259 | 0x02080001, 0x00000201, 0x00080000, 0x02000001, | ||
260 | 0x00080200, 0x02000200, 0x00000001, 0x02080000, | ||
261 | 0x02000201, 0x00000000, 0x00000200, 0x00080001, | ||
262 | 0x00000000, 0x02080001, 0x02080200, 0x00000200, | ||
263 | 0x02000000, 0x02080201, 0x00080201, 0x00080000, | ||
264 | 0x02080201, 0x00000001, 0x02000200, 0x00080201, | ||
265 | 0x00080001, 0x00080200, 0x02080000, 0x02000201, | ||
266 | 0x00000201, 0x02000000, 0x02000001, 0x02080200, | ||
267 | ); | ||
268 | @SP4=( | ||
269 | 0x01000000, 0x00002000, 0x00000080, 0x01002084, | ||
270 | 0x01002004, 0x01000080, 0x00002084, 0x01002000, | ||
271 | 0x00002000, 0x00000004, 0x01000004, 0x00002080, | ||
272 | 0x01000084, 0x01002004, 0x01002080, 0x00000000, | ||
273 | 0x00002080, 0x01000000, 0x00002004, 0x00000084, | ||
274 | 0x01000080, 0x00002084, 0x00000000, 0x01000004, | ||
275 | 0x00000004, 0x01000084, 0x01002084, 0x00002004, | ||
276 | 0x01002000, 0x00000080, 0x00000084, 0x01002080, | ||
277 | 0x01002080, 0x01000084, 0x00002004, 0x01002000, | ||
278 | 0x00002000, 0x00000004, 0x01000004, 0x01000080, | ||
279 | 0x01000000, 0x00002080, 0x01002084, 0x00000000, | ||
280 | 0x00002084, 0x01000000, 0x00000080, 0x00002004, | ||
281 | 0x01000084, 0x00000080, 0x00000000, 0x01002084, | ||
282 | 0x01002004, 0x01002080, 0x00000084, 0x00002000, | ||
283 | 0x00002080, 0x01002004, 0x01000080, 0x00000084, | ||
284 | 0x00000004, 0x00002084, 0x01002000, 0x01000004, | ||
285 | ); | ||
286 | @SP5=( | ||
287 | 0x10000008, 0x00040008, 0x00000000, 0x10040400, | ||
288 | 0x00040008, 0x00000400, 0x10000408, 0x00040000, | ||
289 | 0x00000408, 0x10040408, 0x00040400, 0x10000000, | ||
290 | 0x10000400, 0x10000008, 0x10040000, 0x00040408, | ||
291 | 0x00040000, 0x10000408, 0x10040008, 0x00000000, | ||
292 | 0x00000400, 0x00000008, 0x10040400, 0x10040008, | ||
293 | 0x10040408, 0x10040000, 0x10000000, 0x00000408, | ||
294 | 0x00000008, 0x00040400, 0x00040408, 0x10000400, | ||
295 | 0x00000408, 0x10000000, 0x10000400, 0x00040408, | ||
296 | 0x10040400, 0x00040008, 0x00000000, 0x10000400, | ||
297 | 0x10000000, 0x00000400, 0x10040008, 0x00040000, | ||
298 | 0x00040008, 0x10040408, 0x00040400, 0x00000008, | ||
299 | 0x10040408, 0x00040400, 0x00040000, 0x10000408, | ||
300 | 0x10000008, 0x10040000, 0x00040408, 0x00000000, | ||
301 | 0x00000400, 0x10000008, 0x10000408, 0x10040400, | ||
302 | 0x10040000, 0x00000408, 0x00000008, 0x10040008, | ||
303 | ); | ||
304 | @SP6=( | ||
305 | 0x00000800, 0x00000040, 0x00200040, 0x80200000, | ||
306 | 0x80200840, 0x80000800, 0x00000840, 0x00000000, | ||
307 | 0x00200000, 0x80200040, 0x80000040, 0x00200800, | ||
308 | 0x80000000, 0x00200840, 0x00200800, 0x80000040, | ||
309 | 0x80200040, 0x00000800, 0x80000800, 0x80200840, | ||
310 | 0x00000000, 0x00200040, 0x80200000, 0x00000840, | ||
311 | 0x80200800, 0x80000840, 0x00200840, 0x80000000, | ||
312 | 0x80000840, 0x80200800, 0x00000040, 0x00200000, | ||
313 | 0x80000840, 0x00200800, 0x80200800, 0x80000040, | ||
314 | 0x00000800, 0x00000040, 0x00200000, 0x80200800, | ||
315 | 0x80200040, 0x80000840, 0x00000840, 0x00000000, | ||
316 | 0x00000040, 0x80200000, 0x80000000, 0x00200040, | ||
317 | 0x00000000, 0x80200040, 0x00200040, 0x00000840, | ||
318 | 0x80000040, 0x00000800, 0x80200840, 0x00200000, | ||
319 | 0x00200840, 0x80000000, 0x80000800, 0x80200840, | ||
320 | 0x80200000, 0x00200840, 0x00200800, 0x80000800, | ||
321 | ); | ||
322 | @SP7=( | ||
323 | 0x04100010, 0x04104000, 0x00004010, 0x00000000, | ||
324 | 0x04004000, 0x00100010, 0x04100000, 0x04104010, | ||
325 | 0x00000010, 0x04000000, 0x00104000, 0x00004010, | ||
326 | 0x00104010, 0x04004010, 0x04000010, 0x04100000, | ||
327 | 0x00004000, 0x00104010, 0x00100010, 0x04004000, | ||
328 | 0x04104010, 0x04000010, 0x00000000, 0x00104000, | ||
329 | 0x04000000, 0x00100000, 0x04004010, 0x04100010, | ||
330 | 0x00100000, 0x00004000, 0x04104000, 0x00000010, | ||
331 | 0x00100000, 0x00004000, 0x04000010, 0x04104010, | ||
332 | 0x00004010, 0x04000000, 0x00000000, 0x00104000, | ||
333 | 0x04100010, 0x04004010, 0x04004000, 0x00100010, | ||
334 | 0x04104000, 0x00000010, 0x00100010, 0x04004000, | ||
335 | 0x04104010, 0x00100000, 0x04100000, 0x04000010, | ||
336 | 0x00104000, 0x00004010, 0x04004010, 0x04100000, | ||
337 | 0x00000010, 0x04104000, 0x00104010, 0x00000000, | ||
338 | 0x04000000, 0x04100010, 0x00004000, 0x00104010, | ||
339 | ); | ||
340 | |||
341 | sub main'des_set_key | ||
342 | { | ||
343 | local($param)=@_; | ||
344 | local(@key); | ||
345 | local($c,$d,$i,$s,$t); | ||
346 | local(@ks)=(); | ||
347 | |||
348 | # Get the bytes in the order we want. | ||
349 | @key=unpack("C8",$param); | ||
350 | |||
351 | $c= ($key[0] )| | ||
352 | ($key[1]<< 8)| | ||
353 | ($key[2]<<16)| | ||
354 | ($key[3]<<24); | ||
355 | $d= ($key[4] )| | ||
356 | ($key[5]<< 8)| | ||
357 | ($key[6]<<16)| | ||
358 | ($key[7]<<24); | ||
359 | |||
360 | &doPC1(*c,*d); | ||
361 | |||
362 | for $i (@shifts2) | ||
363 | { | ||
364 | if ($i) | ||
365 | { | ||
366 | $c=($c>>2)|($c<<26); | ||
367 | $d=($d>>2)|($d<<26); | ||
368 | } | ||
369 | else | ||
370 | { | ||
371 | $c=($c>>1)|($c<<27); | ||
372 | $d=($d>>1)|($d<<27); | ||
373 | } | ||
374 | $c&=0x0fffffff; | ||
375 | $d&=0x0fffffff; | ||
376 | $s= $skb0[ ($c )&0x3f ]| | ||
377 | $skb1[(($c>> 6)&0x03)|(($c>> 7)&0x3c)]| | ||
378 | $skb2[(($c>>13)&0x0f)|(($c>>14)&0x30)]| | ||
379 | $skb3[(($c>>20)&0x01)|(($c>>21)&0x06) | | ||
380 | (($c>>22)&0x38)]; | ||
381 | $t= $skb4[ ($d )&0x3f ]| | ||
382 | $skb5[(($d>> 7)&0x03)|(($d>> 8)&0x3c)]| | ||
383 | $skb6[ ($d>>15)&0x3f ]| | ||
384 | $skb7[(($d>>21)&0x0f)|(($d>>22)&0x30)]; | ||
385 | push(@ks,(($t<<16)|($s&0x0000ffff))&0xffffffff); | ||
386 | $s= (($s>>16)&0x0000ffff)|($t&0xffff0000) ; | ||
387 | push(@ks,(($s<<4)|(($s>>28)&0xf))&0xffffffff); | ||
388 | } | ||
389 | @ks; | ||
390 | } | ||
391 | |||
392 | sub doPC1 | ||
393 | { | ||
394 | local(*a,*b)=@_; | ||
395 | local($t); | ||
396 | |||
397 | $t=(($b>>4)^$a)&0x0f0f0f0f; | ||
398 | $b^=($t<<4); $a^=$t; | ||
399 | # do $a first | ||
400 | $t=(($a<<18)^$a)&0xcccc0000; | ||
401 | $a=$a^$t^(($t>>18)&0x00003fff); | ||
402 | $t=(($a<<17)^$a)&0xaaaa0000; | ||
403 | $a=$a^$t^(($t>>17)&0x00007fff); | ||
404 | $t=(($a<< 8)^$a)&0x00ff0000; | ||
405 | $a=$a^$t^(($t>> 8)&0x00ffffff); | ||
406 | $t=(($a<<17)^$a)&0xaaaa0000; | ||
407 | $a=$a^$t^(($t>>17)&0x00007fff); | ||
408 | |||
409 | # now do $b | ||
410 | $t=(($b<<24)^$b)&0xff000000; | ||
411 | $b=$b^$t^(($t>>24)&0x000000ff); | ||
412 | $t=(($b<< 8)^$b)&0x00ff0000; | ||
413 | $b=$b^$t^(($t>> 8)&0x00ffffff); | ||
414 | $t=(($b<<14)^$b)&0x33330000; | ||
415 | $b=$b^$t^(($t>>14)&0x0003ffff); | ||
416 | $b=(($b&0x00aa00aa)<<7)|(($b&0x55005500)>>7)|($b&0xaa55aa55); | ||
417 | $b=(($b>>8)&0x00ffffff)|((($a&0xf0000000)>>4)&0x0fffffff); | ||
418 | $a&=0x0fffffff; | ||
419 | } | ||
420 | |||
421 | sub doIP | ||
422 | { | ||
423 | local(*a,*b)=@_; | ||
424 | local($t); | ||
425 | |||
426 | $t=(($b>> 4)^$a)&0x0f0f0f0f; | ||
427 | $b^=($t<< 4); $a^=$t; | ||
428 | $t=(($a>>16)^$b)&0x0000ffff; | ||
429 | $a^=($t<<16); $b^=$t; | ||
430 | $t=(($b>> 2)^$a)&0x33333333; | ||
431 | $b^=($t<< 2); $a^=$t; | ||
432 | $t=(($a>> 8)^$b)&0x00ff00ff; | ||
433 | $a^=($t<< 8); $b^=$t; | ||
434 | $t=(($b>> 1)^$a)&0x55555555; | ||
435 | $b^=($t<< 1); $a^=$t; | ||
436 | $t=$a; | ||
437 | $a=$b&0xffffffff; | ||
438 | $b=$t&0xffffffff; | ||
439 | } | ||
440 | |||
441 | sub doFP | ||
442 | { | ||
443 | local(*a,*b)=@_; | ||
444 | local($t); | ||
445 | |||
446 | $t=(($b>> 1)^$a)&0x55555555; | ||
447 | $b^=($t<< 1); $a^=$t; | ||
448 | $t=(($a>> 8)^$b)&0x00ff00ff; | ||
449 | $a^=($t<< 8); $b^=$t; | ||
450 | $t=(($b>> 2)^$a)&0x33333333; | ||
451 | $b^=($t<< 2); $a^=$t; | ||
452 | $t=(($a>>16)^$b)&0x0000ffff; | ||
453 | $a^=($t<<16); $b^=$t; | ||
454 | $t=(($b>> 4)^$a)&0x0f0f0f0f; | ||
455 | $b^=($t<< 4); $a^=$t; | ||
456 | $a&=0xffffffff; | ||
457 | $b&=0xffffffff; | ||
458 | } | ||
459 | |||
460 | sub main'des_ecb_encrypt | ||
461 | { | ||
462 | local(*ks,$encrypt,$in)=@_; | ||
463 | local($l,$r,$i,$t,$u,@input); | ||
464 | |||
465 | @input=unpack("C8",$in); | ||
466 | # Get the bytes in the order we want. | ||
467 | $l= ($input[0] )| | ||
468 | ($input[1]<< 8)| | ||
469 | ($input[2]<<16)| | ||
470 | ($input[3]<<24); | ||
471 | $r= ($input[4] )| | ||
472 | ($input[5]<< 8)| | ||
473 | ($input[6]<<16)| | ||
474 | ($input[7]<<24); | ||
475 | |||
476 | $l&=0xffffffff; | ||
477 | $r&=0xffffffff; | ||
478 | &doIP(*l,*r); | ||
479 | if ($encrypt) | ||
480 | { | ||
481 | for ($i=0; $i<32; $i+=4) | ||
482 | { | ||
483 | $t=((($r&0x7fffffff)<<1)|(($r>>31)&0x00000001)); | ||
484 | $u=$t^$ks[$i ]; | ||
485 | $t=$t^$ks[$i+1]; | ||
486 | $t2=(($t&0x0000000f)<<28); | ||
487 | |||
488 | $t=((($t>>4)&0x0fffffff)|(($t&0x0000000f)<<28)); | ||
489 | $l^= $SP1[ $t &0x3f]| | ||
490 | $SP3[($t>> 8)&0x3f]| | ||
491 | $SP5[($t>>16)&0x3f]| | ||
492 | $SP7[($t>>24)&0x3f]| | ||
493 | $SP0[ $u &0x3f]| | ||
494 | $SP2[($u>> 8)&0x3f]| | ||
495 | $SP4[($u>>16)&0x3f]| | ||
496 | $SP6[($u>>24)&0x3f]; | ||
497 | |||
498 | $t=(($l<<1)|(($l>>31)&0x1))&0xffffffff; | ||
499 | $u=$t^$ks[$i+2]; | ||
500 | $t=$t^$ks[$i+3]; | ||
501 | $t=((($t>>4)&0x0fffffff)|($t<<28))&0xffffffff; | ||
502 | $r^= $SP1[ $t &0x3f]| | ||
503 | $SP3[($t>> 8)&0x3f]| | ||
504 | $SP5[($t>>16)&0x3f]| | ||
505 | $SP7[($t>>24)&0x3f]| | ||
506 | $SP0[ $u &0x3f]| | ||
507 | $SP2[($u>> 8)&0x3f]| | ||
508 | $SP4[($u>>16)&0x3f]| | ||
509 | $SP6[($u>>24)&0x3f]; | ||
510 | } | ||
511 | } | ||
512 | else | ||
513 | { | ||
514 | for ($i=30; $i>0; $i-=4) | ||
515 | { | ||
516 | $t=(($r<<1)|(($r>>31)&0x1))&0xffffffff; | ||
517 | $u=$t^$ks[$i ]; | ||
518 | $t=$t^$ks[$i+1]; | ||
519 | $t=((($t>>4)&0x0fffffff)|($t<<28))&0xffffffff; | ||
520 | $l^= $SP1[ $t &0x3f]| | ||
521 | $SP3[($t>> 8)&0x3f]| | ||
522 | $SP5[($t>>16)&0x3f]| | ||
523 | $SP7[($t>>24)&0x3f]| | ||
524 | $SP0[ $u &0x3f]| | ||
525 | $SP2[($u>> 8)&0x3f]| | ||
526 | $SP4[($u>>16)&0x3f]| | ||
527 | $SP6[($u>>24)&0x3f]; | ||
528 | |||
529 | $t=(($l<<1)|(($l>>31)&0x1))&0xffffffff; | ||
530 | $u=$t^$ks[$i-2]; | ||
531 | $t=$t^$ks[$i-1]; | ||
532 | $t=((($t>>4)&0x0fffffff)|($t<<28))&0xffffffff; | ||
533 | $r^= $SP1[ $t &0x3f]| | ||
534 | $SP3[($t>> 8)&0x3f]| | ||
535 | $SP5[($t>>16)&0x3f]| | ||
536 | $SP7[($t>>24)&0x3f]| | ||
537 | $SP0[ $u &0x3f]| | ||
538 | $SP2[($u>> 8)&0x3f]| | ||
539 | $SP4[($u>>16)&0x3f]| | ||
540 | $SP6[($u>>24)&0x3f]; | ||
541 | } | ||
542 | } | ||
543 | &doFP(*l,*r); | ||
544 | pack("C8",$l&0xff, | ||
545 | ($l>> 8)&0x00ffffff, | ||
546 | ($l>>16)&0x0000ffff, | ||
547 | ($l>>24)&0x000000ff, | ||
548 | $r&0xff, | ||
549 | ($r>> 8)&0x00ffffff, | ||
550 | ($r>>16)&0x0000ffff, | ||
551 | ($r>>24)&0x000000ff); | ||
552 | } | ||
diff --git a/src/lib/libcrypto/des/des_crypt.man b/src/lib/libcrypto/des/des_crypt.man new file mode 100644 index 0000000000..0ecc416877 --- /dev/null +++ b/src/lib/libcrypto/des/des_crypt.man | |||
@@ -0,0 +1,508 @@ | |||
1 | .TH DES_CRYPT 3 | ||
2 | .SH NAME | ||
3 | des_read_password, des_read_2password, | ||
4 | des_string_to_key, des_string_to_2key, des_read_pw_string, | ||
5 | des_random_key, des_set_key, | ||
6 | des_key_sched, des_ecb_encrypt, des_ecb3_encrypt, des_cbc_encrypt, | ||
7 | des_3cbc_encrypt, | ||
8 | des_pcbc_encrypt, des_cfb_encrypt, des_ofb_encrypt, | ||
9 | des_cbc_cksum, des_quad_cksum, | ||
10 | des_enc_read, des_enc_write, des_set_odd_parity, | ||
11 | des_is_weak_key, crypt \- (non USA) DES encryption | ||
12 | .SH SYNOPSIS | ||
13 | .nf | ||
14 | .nj | ||
15 | .ft B | ||
16 | #include <des.h> | ||
17 | .PP | ||
18 | .B int des_read_password(key,prompt,verify) | ||
19 | des_cblock *key; | ||
20 | char *prompt; | ||
21 | int verify; | ||
22 | .PP | ||
23 | .B int des_read_2password(key1,key2,prompt,verify) | ||
24 | des_cblock *key1,*key2; | ||
25 | char *prompt; | ||
26 | int verify; | ||
27 | .PP | ||
28 | .B int des_string_to_key(str,key) | ||
29 | char *str; | ||
30 | des_cblock *key; | ||
31 | .PP | ||
32 | .B int des_string_to_2keys(str,key1,key2) | ||
33 | char *str; | ||
34 | des_cblock *key1,*key2; | ||
35 | .PP | ||
36 | .B int des_read_pw_string(buf,length,prompt,verify) | ||
37 | char *buf; | ||
38 | int length; | ||
39 | char *prompt; | ||
40 | int verify; | ||
41 | .PP | ||
42 | .B int des_random_key(key) | ||
43 | des_cblock *key; | ||
44 | .PP | ||
45 | .B int des_set_key(key,schedule) | ||
46 | des_cblock *key; | ||
47 | des_key_schedule schedule; | ||
48 | .PP | ||
49 | .B int des_key_sched(key,schedule) | ||
50 | des_cblock *key; | ||
51 | des_key_schedule schedule; | ||
52 | .PP | ||
53 | .B int des_ecb_encrypt(input,output,schedule,encrypt) | ||
54 | des_cblock *input; | ||
55 | des_cblock *output; | ||
56 | des_key_schedule schedule; | ||
57 | int encrypt; | ||
58 | .PP | ||
59 | .B int des_ecb3_encrypt(input,output,ks1,ks2,encrypt) | ||
60 | des_cblock *input; | ||
61 | des_cblock *output; | ||
62 | des_key_schedule ks1,ks2; | ||
63 | int encrypt; | ||
64 | .PP | ||
65 | .B int des_cbc_encrypt(input,output,length,schedule,ivec,encrypt) | ||
66 | des_cblock *input; | ||
67 | des_cblock *output; | ||
68 | long length; | ||
69 | des_key_schedule schedule; | ||
70 | des_cblock *ivec; | ||
71 | int encrypt; | ||
72 | .PP | ||
73 | .B int des_3cbc_encrypt(input,output,length,sk1,sk2,ivec1,ivec2,encrypt) | ||
74 | des_cblock *input; | ||
75 | des_cblock *output; | ||
76 | long length; | ||
77 | des_key_schedule sk1; | ||
78 | des_key_schedule sk2; | ||
79 | des_cblock *ivec1; | ||
80 | des_cblock *ivec2; | ||
81 | int encrypt; | ||
82 | .PP | ||
83 | .B int des_pcbc_encrypt(input,output,length,schedule,ivec,encrypt) | ||
84 | des_cblock *input; | ||
85 | des_cblock *output; | ||
86 | long length; | ||
87 | des_key_schedule schedule; | ||
88 | des_cblock *ivec; | ||
89 | int encrypt; | ||
90 | .PP | ||
91 | .B int des_cfb_encrypt(input,output,numbits,length,schedule,ivec,encrypt) | ||
92 | unsigned char *input; | ||
93 | unsigned char *output; | ||
94 | int numbits; | ||
95 | long length; | ||
96 | des_key_schedule schedule; | ||
97 | des_cblock *ivec; | ||
98 | int encrypt; | ||
99 | .PP | ||
100 | .B int des_ofb_encrypt(input,output,numbits,length,schedule,ivec) | ||
101 | unsigned char *input,*output; | ||
102 | int numbits; | ||
103 | long length; | ||
104 | des_key_schedule schedule; | ||
105 | des_cblock *ivec; | ||
106 | .PP | ||
107 | .B unsigned long des_cbc_cksum(input,output,length,schedule,ivec) | ||
108 | des_cblock *input; | ||
109 | des_cblock *output; | ||
110 | long length; | ||
111 | des_key_schedule schedule; | ||
112 | des_cblock *ivec; | ||
113 | .PP | ||
114 | .B unsigned long des_quad_cksum(input,output,length,out_count,seed) | ||
115 | des_cblock *input; | ||
116 | des_cblock *output; | ||
117 | long length; | ||
118 | int out_count; | ||
119 | des_cblock *seed; | ||
120 | .PP | ||
121 | .B int des_check_key; | ||
122 | .PP | ||
123 | .B int des_enc_read(fd,buf,len,sched,iv) | ||
124 | int fd; | ||
125 | char *buf; | ||
126 | int len; | ||
127 | des_key_schedule sched; | ||
128 | des_cblock *iv; | ||
129 | .PP | ||
130 | .B int des_enc_write(fd,buf,len,sched,iv) | ||
131 | int fd; | ||
132 | char *buf; | ||
133 | int len; | ||
134 | des_key_schedule sched; | ||
135 | des_cblock *iv; | ||
136 | .PP | ||
137 | .B extern int des_rw_mode; | ||
138 | .PP | ||
139 | .B void des_set_odd_parity(key) | ||
140 | des_cblock *key; | ||
141 | .PP | ||
142 | .B int des_is_weak_key(key) | ||
143 | des_cblock *key; | ||
144 | .PP | ||
145 | .B char *crypt(passwd,salt) | ||
146 | char *passwd; | ||
147 | char *salt; | ||
148 | .PP | ||
149 | .fi | ||
150 | .SH DESCRIPTION | ||
151 | This library contains a fast implementation of the DES encryption | ||
152 | algorithm. | ||
153 | .PP | ||
154 | There are two phases to the use of DES encryption. | ||
155 | The first is the generation of a | ||
156 | .I des_key_schedule | ||
157 | from a key, | ||
158 | the second is the actual encryption. | ||
159 | A des key is of type | ||
160 | .I des_cblock. | ||
161 | This type is made from 8 characters with odd parity. | ||
162 | The least significant bit in the character is the parity bit. | ||
163 | The key schedule is an expanded form of the key; it is used to speed the | ||
164 | encryption process. | ||
165 | .PP | ||
166 | .I des_read_password | ||
167 | writes the string specified by prompt to the standard output, | ||
168 | turns off echo and reads an input string from standard input | ||
169 | until terminated with a newline. | ||
170 | If verify is non-zero, it prompts and reads the input again and verifies | ||
171 | that both entered passwords are the same. | ||
172 | The entered string is converted into a des key by using the | ||
173 | .I des_string_to_key | ||
174 | routine. | ||
175 | The new key is placed in the | ||
176 | .I des_cblock | ||
177 | that was passed (by reference) to the routine. | ||
178 | If there were no errors, | ||
179 | .I des_read_password | ||
180 | returns 0, | ||
181 | -1 is returned if there was a terminal error and 1 is returned for | ||
182 | any other error. | ||
183 | .PP | ||
184 | .I des_read_2password | ||
185 | operates in the same way as | ||
186 | .I des_read_password | ||
187 | except that it generates 2 keys by using the | ||
188 | .I des_string_to_2key | ||
189 | function. | ||
190 | .PP | ||
191 | .I des_read_pw_string | ||
192 | is called by | ||
193 | .I des_read_password | ||
194 | to read and verify a string from a terminal device. | ||
195 | The string is returned in | ||
196 | .I buf. | ||
197 | The size of | ||
198 | .I buf | ||
199 | is passed to the routine via the | ||
200 | .I length | ||
201 | parameter. | ||
202 | .PP | ||
203 | .I des_string_to_key | ||
204 | converts a string into a valid des key. | ||
205 | .PP | ||
206 | .I des_string_to_2key | ||
207 | converts a string into 2 valid des keys. | ||
208 | This routine is best suited for used to generate keys for use with | ||
209 | .I des_ecb3_encrypt. | ||
210 | .PP | ||
211 | .I des_random_key | ||
212 | returns a random key that is made of a combination of process id, | ||
213 | time and an increasing counter. | ||
214 | .PP | ||
215 | Before a des key can be used it is converted into a | ||
216 | .I des_key_schedule | ||
217 | via the | ||
218 | .I des_set_key | ||
219 | routine. | ||
220 | If the | ||
221 | .I des_check_key | ||
222 | flag is non-zero, | ||
223 | .I des_set_key | ||
224 | will check that the key passed is of odd parity and is not a week or | ||
225 | semi-weak key. | ||
226 | If the parity is wrong, | ||
227 | then -1 is returned. | ||
228 | If the key is a weak key, | ||
229 | then -2 is returned. | ||
230 | If an error is returned, | ||
231 | the key schedule is not generated. | ||
232 | .PP | ||
233 | .I des_key_sched | ||
234 | is another name for the | ||
235 | .I des_set_key | ||
236 | function. | ||
237 | .PP | ||
238 | The following routines mostly operate on an input and output stream of | ||
239 | .I des_cblock's. | ||
240 | .PP | ||
241 | .I des_ecb_encrypt | ||
242 | is the basic DES encryption routine that encrypts or decrypts a single 8-byte | ||
243 | .I des_cblock | ||
244 | in | ||
245 | .I electronic code book | ||
246 | mode. | ||
247 | It always transforms the input data, pointed to by | ||
248 | .I input, | ||
249 | into the output data, | ||
250 | pointed to by the | ||
251 | .I output | ||
252 | argument. | ||
253 | If the | ||
254 | .I encrypt | ||
255 | argument is non-zero (DES_ENCRYPT), | ||
256 | the | ||
257 | .I input | ||
258 | (cleartext) is encrypted in to the | ||
259 | .I output | ||
260 | (ciphertext) using the key_schedule specified by the | ||
261 | .I schedule | ||
262 | argument, | ||
263 | previously set via | ||
264 | .I des_set_key. | ||
265 | If | ||
266 | .I encrypt | ||
267 | is zero (DES_DECRYPT), | ||
268 | the | ||
269 | .I input | ||
270 | (now ciphertext) | ||
271 | is decrypted into the | ||
272 | .I output | ||
273 | (now cleartext). | ||
274 | Input and output may overlap. | ||
275 | No meaningful value is returned. | ||
276 | .PP | ||
277 | .I des_ecb3_encrypt | ||
278 | encrypts/decrypts the | ||
279 | .I input | ||
280 | block by using triple ecb DES encryption. | ||
281 | This involves encrypting the input with | ||
282 | .I ks1, | ||
283 | decryption with the key schedule | ||
284 | .I ks2, | ||
285 | and then encryption with the first again. | ||
286 | This routine greatly reduces the chances of brute force breaking of | ||
287 | DES and has the advantage of if | ||
288 | .I ks1 | ||
289 | and | ||
290 | .I ks2 | ||
291 | are the same, it is equivalent to just encryption using ecb mode and | ||
292 | .I ks1 | ||
293 | as the key. | ||
294 | .PP | ||
295 | .I des_cbc_encrypt | ||
296 | encrypts/decrypts using the | ||
297 | .I cipher-block-chaining | ||
298 | mode of DES. | ||
299 | If the | ||
300 | .I encrypt | ||
301 | argument is non-zero, | ||
302 | the routine cipher-block-chain encrypts the cleartext data pointed to by the | ||
303 | .I input | ||
304 | argument into the ciphertext pointed to by the | ||
305 | .I output | ||
306 | argument, | ||
307 | using the key schedule provided by the | ||
308 | .I schedule | ||
309 | argument, | ||
310 | and initialisation vector provided by the | ||
311 | .I ivec | ||
312 | argument. | ||
313 | If the | ||
314 | .I length | ||
315 | argument is not an integral multiple of eight bytes, | ||
316 | the last block is copied to a temporary area and zero filled. | ||
317 | The output is always | ||
318 | an integral multiple of eight bytes. | ||
319 | To make multiple cbc encrypt calls on a large amount of data appear to | ||
320 | be one | ||
321 | .I des_cbc_encrypt | ||
322 | call, the | ||
323 | .I ivec | ||
324 | of subsequent calls should be the last 8 bytes of the output. | ||
325 | .PP | ||
326 | .I des_3cbc_encrypt | ||
327 | encrypts/decrypts the | ||
328 | .I input | ||
329 | block by using triple cbc DES encryption. | ||
330 | This involves encrypting the input with key schedule | ||
331 | .I ks1, | ||
332 | decryption with the key schedule | ||
333 | .I ks2, | ||
334 | and then encryption with the first again. | ||
335 | 2 initialisation vectors are required, | ||
336 | .I ivec1 | ||
337 | and | ||
338 | .I ivec2. | ||
339 | Unlike | ||
340 | .I des_cbc_encrypt, | ||
341 | these initialisation vectors are modified by the subroutine. | ||
342 | This routine greatly reduces the chances of brute force breaking of | ||
343 | DES and has the advantage of if | ||
344 | .I ks1 | ||
345 | and | ||
346 | .I ks2 | ||
347 | are the same, it is equivalent to just encryption using cbc mode and | ||
348 | .I ks1 | ||
349 | as the key. | ||
350 | .PP | ||
351 | .I des_pcbc_encrypt | ||
352 | encrypt/decrypts using a modified block chaining mode. | ||
353 | It provides better error propagation characteristics than cbc | ||
354 | encryption. | ||
355 | .PP | ||
356 | .I des_cfb_encrypt | ||
357 | encrypt/decrypts using cipher feedback mode. This method takes an | ||
358 | array of characters as input and outputs and array of characters. It | ||
359 | does not require any padding to 8 character groups. Note: the ivec | ||
360 | variable is changed and the new changed value needs to be passed to | ||
361 | the next call to this function. Since this function runs a complete | ||
362 | DES ecb encryption per numbits, this function is only suggested for | ||
363 | use when sending small numbers of characters. | ||
364 | .PP | ||
365 | .I des_ofb_encrypt | ||
366 | encrypt using output feedback mode. This method takes an | ||
367 | array of characters as input and outputs and array of characters. It | ||
368 | does not require any padding to 8 character groups. Note: the ivec | ||
369 | variable is changed and the new changed value needs to be passed to | ||
370 | the next call to this function. Since this function runs a complete | ||
371 | DES ecb encryption per numbits, this function is only suggested for | ||
372 | use when sending small numbers of characters. | ||
373 | .PP | ||
374 | .I des_cbc_cksum | ||
375 | produces an 8 byte checksum based on the input stream (via cbc encryption). | ||
376 | The last 4 bytes of the checksum is returned and the complete 8 bytes is | ||
377 | placed in | ||
378 | .I output. | ||
379 | .PP | ||
380 | .I des_quad_cksum | ||
381 | returns a 4 byte checksum from the input bytes. | ||
382 | The algorithm can be iterated over the input, | ||
383 | depending on | ||
384 | .I out_count, | ||
385 | 1, 2, 3 or 4 times. | ||
386 | If | ||
387 | .I output | ||
388 | is non-NULL, | ||
389 | the 8 bytes generated by each pass are written into | ||
390 | .I output. | ||
391 | .PP | ||
392 | .I des_enc_write | ||
393 | is used to write | ||
394 | .I len | ||
395 | bytes | ||
396 | to file descriptor | ||
397 | .I fd | ||
398 | from buffer | ||
399 | .I buf. | ||
400 | The data is encrypted via | ||
401 | .I pcbc_encrypt | ||
402 | (default) using | ||
403 | .I sched | ||
404 | for the key and | ||
405 | .I iv | ||
406 | as a starting vector. | ||
407 | The actual data send down | ||
408 | .I fd | ||
409 | consists of 4 bytes (in network byte order) containing the length of the | ||
410 | following encrypted data. The encrypted data then follows, padded with random | ||
411 | data out to a multiple of 8 bytes. | ||
412 | .PP | ||
413 | .I des_enc_read | ||
414 | is used to read | ||
415 | .I len | ||
416 | bytes | ||
417 | from file descriptor | ||
418 | .I fd | ||
419 | into buffer | ||
420 | .I buf. | ||
421 | The data being read from | ||
422 | .I fd | ||
423 | is assumed to have come from | ||
424 | .I des_enc_write | ||
425 | and is decrypted using | ||
426 | .I sched | ||
427 | for the key schedule and | ||
428 | .I iv | ||
429 | for the initial vector. | ||
430 | The | ||
431 | .I des_enc_read/des_enc_write | ||
432 | pair can be used to read/write to files, pipes and sockets. | ||
433 | I have used them in implementing a version of rlogin in which all | ||
434 | data is encrypted. | ||
435 | .PP | ||
436 | .I des_rw_mode | ||
437 | is used to specify the encryption mode to use with | ||
438 | .I des_enc_read | ||
439 | and | ||
440 | .I des_end_write. | ||
441 | If set to | ||
442 | .I DES_PCBC_MODE | ||
443 | (the default), des_pcbc_encrypt is used. | ||
444 | If set to | ||
445 | .I DES_CBC_MODE | ||
446 | des_cbc_encrypt is used. | ||
447 | These two routines and the variable are not part of the normal MIT library. | ||
448 | .PP | ||
449 | .I des_set_odd_parity | ||
450 | sets the parity of the passed | ||
451 | .I key | ||
452 | to odd. This routine is not part of the standard MIT library. | ||
453 | .PP | ||
454 | .I des_is_weak_key | ||
455 | returns 1 is the passed key is a weak key (pick again :-), | ||
456 | 0 if it is ok. | ||
457 | This routine is not part of the standard MIT library. | ||
458 | .PP | ||
459 | .I crypt | ||
460 | is a replacement for the normal system crypt. | ||
461 | It is much faster than the system crypt. | ||
462 | .PP | ||
463 | .SH FILES | ||
464 | /usr/include/des.h | ||
465 | .br | ||
466 | /usr/lib/libdes.a | ||
467 | .PP | ||
468 | The encryption routines have been tested on 16bit, 32bit and 64bit | ||
469 | machines of various endian and even works under VMS. | ||
470 | .PP | ||
471 | .SH BUGS | ||
472 | .PP | ||
473 | If you think this manual is sparse, | ||
474 | read the des_crypt(3) manual from the MIT kerberos (or bones outside | ||
475 | of the USA) distribution. | ||
476 | .PP | ||
477 | .I des_cfb_encrypt | ||
478 | and | ||
479 | .I des_ofb_encrypt | ||
480 | operates on input of 8 bits. What this means is that if you set | ||
481 | numbits to 12, and length to 2, the first 12 bits will come from the 1st | ||
482 | input byte and the low half of the second input byte. The second 12 | ||
483 | bits will have the low 8 bits taken from the 3rd input byte and the | ||
484 | top 4 bits taken from the 4th input byte. The same holds for output. | ||
485 | This function has been implemented this way because most people will | ||
486 | be using a multiple of 8 and because once you get into pulling bytes input | ||
487 | bytes apart things get ugly! | ||
488 | .PP | ||
489 | .I des_read_pw_string | ||
490 | is the most machine/OS dependent function and normally generates the | ||
491 | most problems when porting this code. | ||
492 | .PP | ||
493 | .I des_string_to_key | ||
494 | is probably different from the MIT version since there are lots | ||
495 | of fun ways to implement one-way encryption of a text string. | ||
496 | .PP | ||
497 | The routines are optimised for 32 bit machines and so are not efficient | ||
498 | on IBM PCs. | ||
499 | .PP | ||
500 | NOTE: extensive work has been done on this library since this document | ||
501 | was origionally written. Please try to read des.doc from the libdes | ||
502 | distribution since it is far more upto date and documents more of the | ||
503 | functions. Libdes is now also being shipped as part of SSLeay, a | ||
504 | general cryptographic library that amonst other things implements | ||
505 | netscapes SSL protocoll. The most recent version can be found in | ||
506 | SSLeay distributions. | ||
507 | .SH AUTHOR | ||
508 | Eric Young (eay@cryptsoft.com) | ||
diff --git a/src/lib/libcrypto/des/des_locl.org b/src/lib/libcrypto/des/des_locl.org new file mode 100644 index 0000000000..e2e503cbed --- /dev/null +++ b/src/lib/libcrypto/des/des_locl.org | |||
@@ -0,0 +1,516 @@ | |||
1 | /* crypto/des/des_locl.org */ | ||
2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
60 | * | ||
61 | * Always modify des_locl.org since des_locl.h is automatically generated from | ||
62 | * it during SSLeay configuration. | ||
63 | * | ||
64 | * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
65 | */ | ||
66 | |||
67 | #ifndef HEADER_DES_LOCL_H | ||
68 | #define HEADER_DES_LOCL_H | ||
69 | |||
70 | #if defined(WIN32) || defined(WIN16) | ||
71 | #ifndef MSDOS | ||
72 | #define MSDOS | ||
73 | #endif | ||
74 | #endif | ||
75 | |||
76 | #include <stdio.h> | ||
77 | #include <stdlib.h> | ||
78 | #ifndef MSDOS | ||
79 | #include <unistd.h> | ||
80 | #endif | ||
81 | #include "des.h" | ||
82 | |||
83 | #ifndef DES_DEFAULT_OPTIONS | ||
84 | /* the following is tweaked from a config script, that is why it is a | ||
85 | * protected undef/define */ | ||
86 | #ifndef DES_PTR | ||
87 | #undef DES_PTR | ||
88 | #endif | ||
89 | |||
90 | /* This helps C compiler generate the correct code for multiple functional | ||
91 | * units. It reduces register dependancies at the expense of 2 more | ||
92 | * registers */ | ||
93 | #ifndef DES_RISC1 | ||
94 | #undef DES_RISC1 | ||
95 | #endif | ||
96 | |||
97 | #ifndef DES_RISC2 | ||
98 | #undef DES_RISC2 | ||
99 | #endif | ||
100 | |||
101 | #if defined(DES_RISC1) && defined(DES_RISC2) | ||
102 | YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! | ||
103 | #endif | ||
104 | |||
105 | /* Unroll the inner loop, this sometimes helps, sometimes hinders. | ||
106 | * Very mucy CPU dependant */ | ||
107 | #ifndef DES_UNROLL | ||
108 | #undef DES_UNROLL | ||
109 | #endif | ||
110 | |||
111 | /* These default values were supplied by | ||
112 | * Peter Gutman <pgut001@cs.auckland.ac.nz> | ||
113 | * They are only used if nothing else has been defined */ | ||
114 | #if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) | ||
115 | /* Special defines which change the way the code is built depending on the | ||
116 | CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find | ||
117 | even newer MIPS CPU's, but at the moment one size fits all for | ||
118 | optimization options. Older Sparc's work better with only UNROLL, but | ||
119 | there's no way to tell at compile time what it is you're running on */ | ||
120 | |||
121 | #if defined( sun ) /* Newer Sparc's */ | ||
122 | #define DES_PTR | ||
123 | #define DES_RISC1 | ||
124 | #define DES_UNROLL | ||
125 | #elif defined( __ultrix ) /* Older MIPS */ | ||
126 | #define DES_PTR | ||
127 | #define DES_RISC2 | ||
128 | #define DES_UNROLL | ||
129 | #elif defined( __osf1__ ) /* Alpha */ | ||
130 | #define DES_PTR | ||
131 | #define DES_RISC2 | ||
132 | #elif defined ( _AIX ) /* RS6000 */ | ||
133 | /* Unknown */ | ||
134 | #elif defined( __hpux ) /* HP-PA */ | ||
135 | /* Unknown */ | ||
136 | #elif defined( __aux ) /* 68K */ | ||
137 | /* Unknown */ | ||
138 | #elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ | ||
139 | #define DES_UNROLL | ||
140 | #elif defined( __sgi ) /* Newer MIPS */ | ||
141 | #define DES_PTR | ||
142 | #define DES_RISC2 | ||
143 | #define DES_UNROLL | ||
144 | #elif defined( i386 ) /* x86 boxes, should be gcc */ | ||
145 | #define DES_PTR | ||
146 | #define DES_RISC1 | ||
147 | #define DES_UNROLL | ||
148 | #endif /* Systems-specific speed defines */ | ||
149 | #endif | ||
150 | |||
151 | #endif /* DES_DEFAULT_OPTIONS */ | ||
152 | |||
153 | #ifdef MSDOS /* Visual C++ 2.1 (Windows NT/95) */ | ||
154 | #include <stdlib.h> | ||
155 | #include <errno.h> | ||
156 | #include <time.h> | ||
157 | #include <io.h> | ||
158 | #ifndef RAND | ||
159 | #define RAND | ||
160 | #endif | ||
161 | #undef NOPROTO | ||
162 | #endif | ||
163 | |||
164 | #if defined(__STDC__) || defined(VMS) || defined(M_XENIX) || defined(MSDOS) | ||
165 | #include <string.h> | ||
166 | #endif | ||
167 | |||
168 | #ifndef RAND | ||
169 | #define RAND | ||
170 | #endif | ||
171 | |||
172 | #ifdef linux | ||
173 | #undef RAND | ||
174 | #endif | ||
175 | |||
176 | #ifdef MSDOS | ||
177 | #define getpid() 2 | ||
178 | #define RAND | ||
179 | #undef NOPROTO | ||
180 | #endif | ||
181 | |||
182 | #if defined(NOCONST) | ||
183 | #define const | ||
184 | #endif | ||
185 | |||
186 | #ifdef __STDC__ | ||
187 | #undef NOPROTO | ||
188 | #endif | ||
189 | |||
190 | #ifdef RAND | ||
191 | #define srandom(s) srand(s) | ||
192 | #define random rand | ||
193 | #endif | ||
194 | |||
195 | #define ITERATIONS 16 | ||
196 | #define HALF_ITERATIONS 8 | ||
197 | |||
198 | /* used in des_read and des_write */ | ||
199 | #define MAXWRITE (1024*16) | ||
200 | #define BSIZE (MAXWRITE+4) | ||
201 | |||
202 | #define c2l(c,l) (l =((DES_LONG)(*((c)++))) , \ | ||
203 | l|=((DES_LONG)(*((c)++)))<< 8L, \ | ||
204 | l|=((DES_LONG)(*((c)++)))<<16L, \ | ||
205 | l|=((DES_LONG)(*((c)++)))<<24L) | ||
206 | |||
207 | /* NOTE - c is not incremented as per c2l */ | ||
208 | #define c2ln(c,l1,l2,n) { \ | ||
209 | c+=n; \ | ||
210 | l1=l2=0; \ | ||
211 | switch (n) { \ | ||
212 | case 8: l2 =((DES_LONG)(*(--(c))))<<24L; \ | ||
213 | case 7: l2|=((DES_LONG)(*(--(c))))<<16L; \ | ||
214 | case 6: l2|=((DES_LONG)(*(--(c))))<< 8L; \ | ||
215 | case 5: l2|=((DES_LONG)(*(--(c)))); \ | ||
216 | case 4: l1 =((DES_LONG)(*(--(c))))<<24L; \ | ||
217 | case 3: l1|=((DES_LONG)(*(--(c))))<<16L; \ | ||
218 | case 2: l1|=((DES_LONG)(*(--(c))))<< 8L; \ | ||
219 | case 1: l1|=((DES_LONG)(*(--(c)))); \ | ||
220 | } \ | ||
221 | } | ||
222 | |||
223 | #define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ | ||
224 | *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ | ||
225 | *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ | ||
226 | *((c)++)=(unsigned char)(((l)>>24L)&0xff)) | ||
227 | |||
228 | /* replacements for htonl and ntohl since I have no idea what to do | ||
229 | * when faced with machines with 8 byte longs. */ | ||
230 | #define HDRSIZE 4 | ||
231 | |||
232 | #define n2l(c,l) (l =((DES_LONG)(*((c)++)))<<24L, \ | ||
233 | l|=((DES_LONG)(*((c)++)))<<16L, \ | ||
234 | l|=((DES_LONG)(*((c)++)))<< 8L, \ | ||
235 | l|=((DES_LONG)(*((c)++)))) | ||
236 | |||
237 | #define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ | ||
238 | *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ | ||
239 | *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ | ||
240 | *((c)++)=(unsigned char)(((l) )&0xff)) | ||
241 | |||
242 | /* NOTE - c is not incremented as per l2c */ | ||
243 | #define l2cn(l1,l2,c,n) { \ | ||
244 | c+=n; \ | ||
245 | switch (n) { \ | ||
246 | case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ | ||
247 | case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ | ||
248 | case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ | ||
249 | case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ | ||
250 | case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ | ||
251 | case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ | ||
252 | case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ | ||
253 | case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ | ||
254 | } \ | ||
255 | } | ||
256 | |||
257 | #if defined(WIN32) | ||
258 | #define ROTATE(a,n) (_lrotr(a,n)) | ||
259 | #else | ||
260 | #define ROTATE(a,n) (((a)>>(n))+((a)<<(32-(n)))) | ||
261 | #endif | ||
262 | |||
263 | /* Don't worry about the LOAD_DATA() stuff, that is used by | ||
264 | * fcrypt() to add it's little bit to the front */ | ||
265 | |||
266 | #ifdef DES_FCRYPT | ||
267 | |||
268 | #define LOAD_DATA_tmp(R,S,u,t,E0,E1) \ | ||
269 | { DES_LONG tmp; LOAD_DATA(R,S,u,t,E0,E1,tmp); } | ||
270 | |||
271 | #define LOAD_DATA(R,S,u,t,E0,E1,tmp) \ | ||
272 | t=R^(R>>16L); \ | ||
273 | u=t&E0; t&=E1; \ | ||
274 | tmp=(u<<16); u^=R^s[S ]; u^=tmp; \ | ||
275 | tmp=(t<<16); t^=R^s[S+1]; t^=tmp | ||
276 | #else | ||
277 | #define LOAD_DATA_tmp(a,b,c,d,e,f) LOAD_DATA(a,b,c,d,e,f,g) | ||
278 | #define LOAD_DATA(R,S,u,t,E0,E1,tmp) \ | ||
279 | u=R^s[S ]; \ | ||
280 | t=R^s[S+1] | ||
281 | #endif | ||
282 | |||
283 | /* The changes to this macro may help or hinder, depending on the | ||
284 | * compiler and the achitecture. gcc2 always seems to do well :-). | ||
285 | * Inspired by Dana How <how@isl.stanford.edu> | ||
286 | * DO NOT use the alternative version on machines with 8 byte longs. | ||
287 | * It does not seem to work on the Alpha, even when DES_LONG is 4 | ||
288 | * bytes, probably an issue of accessing non-word aligned objects :-( */ | ||
289 | #ifdef DES_PTR | ||
290 | |||
291 | /* It recently occured to me that 0^0^0^0^0^0^0 == 0, so there | ||
292 | * is no reason to not xor all the sub items together. This potentially | ||
293 | * saves a register since things can be xored directly into L */ | ||
294 | |||
295 | #if defined(DES_RISC1) || defined(DES_RISC2) | ||
296 | #ifdef DES_RISC1 | ||
297 | #define D_ENCRYPT(LL,R,S) { \ | ||
298 | unsigned int u1,u2,u3; \ | ||
299 | LOAD_DATA(R,S,u,t,E0,E1,u1); \ | ||
300 | u2=(int)u>>8L; \ | ||
301 | u1=(int)u&0xfc; \ | ||
302 | u2&=0xfc; \ | ||
303 | t=ROTATE(t,4); \ | ||
304 | u>>=16L; \ | ||
305 | LL^= *(DES_LONG *)((unsigned char *)des_SP +u1); \ | ||
306 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x200+u2); \ | ||
307 | u3=(int)(u>>8L); \ | ||
308 | u1=(int)u&0xfc; \ | ||
309 | u3&=0xfc; \ | ||
310 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x400+u1); \ | ||
311 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x600+u3); \ | ||
312 | u2=(int)t>>8L; \ | ||
313 | u1=(int)t&0xfc; \ | ||
314 | u2&=0xfc; \ | ||
315 | t>>=16L; \ | ||
316 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x100+u1); \ | ||
317 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x300+u2); \ | ||
318 | u3=(int)t>>8L; \ | ||
319 | u1=(int)t&0xfc; \ | ||
320 | u3&=0xfc; \ | ||
321 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x500+u1); \ | ||
322 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x700+u3); } | ||
323 | #endif | ||
324 | #ifdef DES_RISC2 | ||
325 | #define D_ENCRYPT(LL,R,S) { \ | ||
326 | unsigned int u1,u2,s1,s2; \ | ||
327 | LOAD_DATA(R,S,u,t,E0,E1,u1); \ | ||
328 | u2=(int)u>>8L; \ | ||
329 | u1=(int)u&0xfc; \ | ||
330 | u2&=0xfc; \ | ||
331 | t=ROTATE(t,4); \ | ||
332 | LL^= *(DES_LONG *)((unsigned char *)des_SP +u1); \ | ||
333 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x200+u2); \ | ||
334 | s1=(int)(u>>16L); \ | ||
335 | s2=(int)(u>>24L); \ | ||
336 | s1&=0xfc; \ | ||
337 | s2&=0xfc; \ | ||
338 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x400+s1); \ | ||
339 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x600+s2); \ | ||
340 | u2=(int)t>>8L; \ | ||
341 | u1=(int)t&0xfc; \ | ||
342 | u2&=0xfc; \ | ||
343 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x100+u1); \ | ||
344 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x300+u2); \ | ||
345 | s1=(int)(t>>16L); \ | ||
346 | s2=(int)(t>>24L); \ | ||
347 | s1&=0xfc; \ | ||
348 | s2&=0xfc; \ | ||
349 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x500+s1); \ | ||
350 | LL^= *(DES_LONG *)((unsigned char *)des_SP+0x700+s2); } | ||
351 | #endif | ||
352 | #else | ||
353 | #define D_ENCRYPT(LL,R,S) { \ | ||
354 | LOAD_DATA_tmp(R,S,u,t,E0,E1); \ | ||
355 | t=ROTATE(t,4); \ | ||
356 | LL^= \ | ||
357 | *(DES_LONG *)((unsigned char *)des_SP +((u )&0xfc))^ \ | ||
358 | *(DES_LONG *)((unsigned char *)des_SP+0x200+((u>> 8L)&0xfc))^ \ | ||
359 | *(DES_LONG *)((unsigned char *)des_SP+0x400+((u>>16L)&0xfc))^ \ | ||
360 | *(DES_LONG *)((unsigned char *)des_SP+0x600+((u>>24L)&0xfc))^ \ | ||
361 | *(DES_LONG *)((unsigned char *)des_SP+0x100+((t )&0xfc))^ \ | ||
362 | *(DES_LONG *)((unsigned char *)des_SP+0x300+((t>> 8L)&0xfc))^ \ | ||
363 | *(DES_LONG *)((unsigned char *)des_SP+0x500+((t>>16L)&0xfc))^ \ | ||
364 | *(DES_LONG *)((unsigned char *)des_SP+0x700+((t>>24L)&0xfc)); } | ||
365 | #endif | ||
366 | |||
367 | #else /* original version */ | ||
368 | |||
369 | #if defined(DES_RISC1) || defined(DES_RISC2) | ||
370 | #ifdef DES_RISC1 | ||
371 | #define D_ENCRYPT(LL,R,S) {\ | ||
372 | unsigned int u1,u2,u3; \ | ||
373 | LOAD_DATA(R,S,u,t,E0,E1,u1); \ | ||
374 | u>>=2L; \ | ||
375 | t=ROTATE(t,6); \ | ||
376 | u2=(int)u>>8L; \ | ||
377 | u1=(int)u&0x3f; \ | ||
378 | u2&=0x3f; \ | ||
379 | u>>=16L; \ | ||
380 | LL^=des_SPtrans[0][u1]; \ | ||
381 | LL^=des_SPtrans[2][u2]; \ | ||
382 | u3=(int)u>>8L; \ | ||
383 | u1=(int)u&0x3f; \ | ||
384 | u3&=0x3f; \ | ||
385 | LL^=des_SPtrans[4][u1]; \ | ||
386 | LL^=des_SPtrans[6][u3]; \ | ||
387 | u2=(int)t>>8L; \ | ||
388 | u1=(int)t&0x3f; \ | ||
389 | u2&=0x3f; \ | ||
390 | t>>=16L; \ | ||
391 | LL^=des_SPtrans[1][u1]; \ | ||
392 | LL^=des_SPtrans[3][u2]; \ | ||
393 | u3=(int)t>>8L; \ | ||
394 | u1=(int)t&0x3f; \ | ||
395 | u3&=0x3f; \ | ||
396 | LL^=des_SPtrans[5][u1]; \ | ||
397 | LL^=des_SPtrans[7][u3]; } | ||
398 | #endif | ||
399 | #ifdef DES_RISC2 | ||
400 | #define D_ENCRYPT(LL,R,S) {\ | ||
401 | unsigned int u1,u2,s1,s2; \ | ||
402 | LOAD_DATA(R,S,u,t,E0,E1,u1); \ | ||
403 | u>>=2L; \ | ||
404 | t=ROTATE(t,6); \ | ||
405 | u2=(int)u>>8L; \ | ||
406 | u1=(int)u&0x3f; \ | ||
407 | u2&=0x3f; \ | ||
408 | LL^=des_SPtrans[0][u1]; \ | ||
409 | LL^=des_SPtrans[2][u2]; \ | ||
410 | s1=(int)u>>16L; \ | ||
411 | s2=(int)u>>24L; \ | ||
412 | s1&=0x3f; \ | ||
413 | s2&=0x3f; \ | ||
414 | LL^=des_SPtrans[4][s1]; \ | ||
415 | LL^=des_SPtrans[6][s2]; \ | ||
416 | u2=(int)t>>8L; \ | ||
417 | u1=(int)t&0x3f; \ | ||
418 | u2&=0x3f; \ | ||
419 | LL^=des_SPtrans[1][u1]; \ | ||
420 | LL^=des_SPtrans[3][u2]; \ | ||
421 | s1=(int)t>>16; \ | ||
422 | s2=(int)t>>24L; \ | ||
423 | s1&=0x3f; \ | ||
424 | s2&=0x3f; \ | ||
425 | LL^=des_SPtrans[5][s1]; \ | ||
426 | LL^=des_SPtrans[7][s2]; } | ||
427 | #endif | ||
428 | |||
429 | #else | ||
430 | |||
431 | #define D_ENCRYPT(LL,R,S) {\ | ||
432 | LOAD_DATA_tmp(R,S,u,t,E0,E1); \ | ||
433 | t=ROTATE(t,4); \ | ||
434 | LL^=\ | ||
435 | des_SPtrans[0][(u>> 2L)&0x3f]^ \ | ||
436 | des_SPtrans[2][(u>>10L)&0x3f]^ \ | ||
437 | des_SPtrans[4][(u>>18L)&0x3f]^ \ | ||
438 | des_SPtrans[6][(u>>26L)&0x3f]^ \ | ||
439 | des_SPtrans[1][(t>> 2L)&0x3f]^ \ | ||
440 | des_SPtrans[3][(t>>10L)&0x3f]^ \ | ||
441 | des_SPtrans[5][(t>>18L)&0x3f]^ \ | ||
442 | des_SPtrans[7][(t>>26L)&0x3f]; } | ||
443 | #endif | ||
444 | #endif | ||
445 | |||
446 | /* IP and FP | ||
447 | * The problem is more of a geometric problem that random bit fiddling. | ||
448 | 0 1 2 3 4 5 6 7 62 54 46 38 30 22 14 6 | ||
449 | 8 9 10 11 12 13 14 15 60 52 44 36 28 20 12 4 | ||
450 | 16 17 18 19 20 21 22 23 58 50 42 34 26 18 10 2 | ||
451 | 24 25 26 27 28 29 30 31 to 56 48 40 32 24 16 8 0 | ||
452 | |||
453 | 32 33 34 35 36 37 38 39 63 55 47 39 31 23 15 7 | ||
454 | 40 41 42 43 44 45 46 47 61 53 45 37 29 21 13 5 | ||
455 | 48 49 50 51 52 53 54 55 59 51 43 35 27 19 11 3 | ||
456 | 56 57 58 59 60 61 62 63 57 49 41 33 25 17 9 1 | ||
457 | |||
458 | The output has been subject to swaps of the form | ||
459 | 0 1 -> 3 1 but the odd and even bits have been put into | ||
460 | 2 3 2 0 | ||
461 | different words. The main trick is to remember that | ||
462 | t=((l>>size)^r)&(mask); | ||
463 | r^=t; | ||
464 | l^=(t<<size); | ||
465 | can be used to swap and move bits between words. | ||
466 | |||
467 | So l = 0 1 2 3 r = 16 17 18 19 | ||
468 | 4 5 6 7 20 21 22 23 | ||
469 | 8 9 10 11 24 25 26 27 | ||
470 | 12 13 14 15 28 29 30 31 | ||
471 | becomes (for size == 2 and mask == 0x3333) | ||
472 | t = 2^16 3^17 -- -- l = 0 1 16 17 r = 2 3 18 19 | ||
473 | 6^20 7^21 -- -- 4 5 20 21 6 7 22 23 | ||
474 | 10^24 11^25 -- -- 8 9 24 25 10 11 24 25 | ||
475 | 14^28 15^29 -- -- 12 13 28 29 14 15 28 29 | ||
476 | |||
477 | Thanks for hints from Richard Outerbridge - he told me IP&FP | ||
478 | could be done in 15 xor, 10 shifts and 5 ands. | ||
479 | When I finally started to think of the problem in 2D | ||
480 | I first got ~42 operations without xors. When I remembered | ||
481 | how to use xors :-) I got it to its final state. | ||
482 | */ | ||
483 | #define PERM_OP(a,b,t,n,m) ((t)=((((a)>>(n))^(b))&(m)),\ | ||
484 | (b)^=(t),\ | ||
485 | (a)^=((t)<<(n))) | ||
486 | |||
487 | #define IP(l,r) \ | ||
488 | { \ | ||
489 | register DES_LONG tt; \ | ||
490 | PERM_OP(r,l,tt, 4,0x0f0f0f0fL); \ | ||
491 | PERM_OP(l,r,tt,16,0x0000ffffL); \ | ||
492 | PERM_OP(r,l,tt, 2,0x33333333L); \ | ||
493 | PERM_OP(l,r,tt, 8,0x00ff00ffL); \ | ||
494 | PERM_OP(r,l,tt, 1,0x55555555L); \ | ||
495 | } | ||
496 | |||
497 | #define FP(l,r) \ | ||
498 | { \ | ||
499 | register DES_LONG tt; \ | ||
500 | PERM_OP(l,r,tt, 1,0x55555555L); \ | ||
501 | PERM_OP(r,l,tt, 8,0x00ff00ffL); \ | ||
502 | PERM_OP(l,r,tt, 2,0x33333333L); \ | ||
503 | PERM_OP(r,l,tt,16,0x0000ffffL); \ | ||
504 | PERM_OP(l,r,tt, 4,0x0f0f0f0fL); \ | ||
505 | } | ||
506 | |||
507 | extern const DES_LONG des_SPtrans[8][64]; | ||
508 | |||
509 | #ifndef NOPROTO | ||
510 | void fcrypt_body(DES_LONG *out,des_key_schedule ks, | ||
511 | DES_LONG Eswap0, DES_LONG Eswap1); | ||
512 | #else | ||
513 | void fcrypt_body(); | ||
514 | #endif | ||
515 | |||
516 | #endif | ||
diff --git a/src/lib/libcrypto/des/doIP b/src/lib/libcrypto/des/doIP new file mode 100644 index 0000000000..18cf231303 --- /dev/null +++ b/src/lib/libcrypto/des/doIP | |||
@@ -0,0 +1,46 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | |||
3 | @l=( | ||
4 | 0, 1, 2, 3, 4, 5, 6, 7, | ||
5 | 8, 9,10,11,12,13,14,15, | ||
6 | 16,17,18,19,20,21,22,23, | ||
7 | 24,25,26,27,28,29,30,31 | ||
8 | ); | ||
9 | @r=( | ||
10 | 32,33,34,35,36,37,38,39, | ||
11 | 40,41,42,43,44,45,46,47, | ||
12 | 48,49,50,51,52,53,54,55, | ||
13 | 56,57,58,59,60,61,62,63 | ||
14 | ); | ||
15 | |||
16 | require 'shifts.pl'; | ||
17 | |||
18 | sub PERM_OP | ||
19 | { | ||
20 | local(*a,*b,*t,$n,$m)=@_; | ||
21 | |||
22 | @z=&shift(*a,-$n); | ||
23 | @z=&xor(*b,*z); | ||
24 | @z=&and(*z,$m); | ||
25 | @b=&xor(*b,*z); | ||
26 | @z=&shift(*z,$n); | ||
27 | @a=&xor(*a,*z); | ||
28 | } | ||
29 | |||
30 | |||
31 | @L=@l; | ||
32 | @R=@r; | ||
33 | &PERM_OP(*R,*L,*T,4,0x0f0f0f0f); | ||
34 | &PERM_OP(*L,*R,*T,16,0x0000ffff); | ||
35 | &PERM_OP(*R,*L,*T,2,0x33333333); | ||
36 | &PERM_OP(*L,*R,*T,8,0x00ff00ff); | ||
37 | &PERM_OP(*R,*L,*T,1,0x55555555); | ||
38 | &printit(@L); | ||
39 | &printit(@R); | ||
40 | &PERM_OP(*R,*L,*T,1,0x55555555); | ||
41 | &PERM_OP(*L,*R,*T,8,0x00ff00ff); | ||
42 | &PERM_OP(*R,*L,*T,2,0x33333333); | ||
43 | &PERM_OP(*L,*R,*T,16,0x0000ffff); | ||
44 | &PERM_OP(*R,*L,*T,4,0x0f0f0f0f); | ||
45 | &printit(@L); | ||
46 | &printit(@R); | ||
diff --git a/src/lib/libcrypto/des/doPC1 b/src/lib/libcrypto/des/doPC1 new file mode 100644 index 0000000000..096afd8c46 --- /dev/null +++ b/src/lib/libcrypto/des/doPC1 | |||
@@ -0,0 +1,110 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | |||
3 | @l=( | ||
4 | 0, 1, 2, 3, 4, 5, 6, 7, | ||
5 | 8, 9,10,11,12,13,14,15, | ||
6 | 16,17,18,19,20,21,22,23, | ||
7 | 24,25,26,27,28,29,30,31 | ||
8 | ); | ||
9 | @r=( | ||
10 | 32,33,34,35,36,37,38,39, | ||
11 | 40,41,42,43,44,45,46,47, | ||
12 | 48,49,50,51,52,53,54,55, | ||
13 | 56,57,58,59,60,61,62,63 | ||
14 | ); | ||
15 | |||
16 | require 'shifts.pl'; | ||
17 | |||
18 | sub PERM_OP | ||
19 | { | ||
20 | local(*a,*b,*t,$n,$m)=@_; | ||
21 | |||
22 | @z=&shift(*a,-$n); | ||
23 | @z=&xor(*b,*z); | ||
24 | @z=&and(*z,$m); | ||
25 | @b=&xor(*b,*z); | ||
26 | @z=&shift(*z,$n); | ||
27 | @a=&xor(*a,*z); | ||
28 | } | ||
29 | |||
30 | sub HPERM_OP2 | ||
31 | { | ||
32 | local(*a,*t,$n,$m)=@_; | ||
33 | local(@x,@y,$i); | ||
34 | |||
35 | @z=&shift(*a,16-$n); | ||
36 | @z=&xor(*a,*z); | ||
37 | @z=&and(*z,$m); | ||
38 | @a=&xor(*a,*z); | ||
39 | @z=&shift(*z,$n-16); | ||
40 | @a=&xor(*a,*z); | ||
41 | } | ||
42 | |||
43 | sub HPERM_OP | ||
44 | { | ||
45 | local(*a,*t,$n,$m)=@_; | ||
46 | local(@x,@y,$i); | ||
47 | |||
48 | for ($i=0; $i<16; $i++) | ||
49 | { | ||
50 | $x[$i]=$a[$i]; | ||
51 | $y[$i]=$a[16+$i]; | ||
52 | } | ||
53 | @z=&shift(*x,-$n); | ||
54 | @z=&xor(*y,*z); | ||
55 | @z=&and(*z,$m); | ||
56 | @y=&xor(*y,*z); | ||
57 | @z=&shift(*z,$n); | ||
58 | @x=&xor(*x,*z); | ||
59 | for ($i=0; $i<16; $i++) | ||
60 | { | ||
61 | $a[$i]=$x[$i]; | ||
62 | $a[16+$i]=$y[$i]; | ||
63 | } | ||
64 | } | ||
65 | |||
66 | @L=@l; | ||
67 | @R=@r; | ||
68 | |||
69 | print "---\n"; &printit(@R); | ||
70 | &PERM_OP(*R,*L,*T,4,0x0f0f0f0f); | ||
71 | print "---\n"; &printit(@R); | ||
72 | &HPERM_OP2(*L,*T,-2,0xcccc0000); | ||
73 | &HPERM_OP2(*R,*T,-2,0xcccc0000); | ||
74 | print "---\n"; &printit(@R); | ||
75 | &PERM_OP(*R,*L,*T,1,0x55555555); | ||
76 | print "---\n"; &printit(@R); | ||
77 | &PERM_OP(*L,*R,*T,8,0x00ff00ff); | ||
78 | print "---\n"; &printit(@R); | ||
79 | &PERM_OP(*R,*L,*T,1,0x55555555); | ||
80 | print "---\n"; &printit(@R); | ||
81 | # &printit(@L); | ||
82 | &printit(@R); | ||
83 | print <<"EOF"; | ||
84 | ============================== | ||
85 | 63 55 47 39 31 23 15 7 | ||
86 | 62 54 46 38 30 22 14 6 | ||
87 | 61 53 45 37 29 21 13 5 | ||
88 | 60 52 44 36 -- -- -- -- | ||
89 | |||
90 | 57 49 41 33 25 17 9 1 | ||
91 | 58 50 42 34 26 18 10 2 | ||
92 | 59 51 43 35 27 19 11 3 | ||
93 | 28 20 12 4 -- -- -- -- | ||
94 | EOF | ||
95 | exit(1); | ||
96 | @A=&and(*R,0x000000ff); | ||
97 | @A=&shift(*A,16); | ||
98 | @B=&and(*R,0x0000ff00); | ||
99 | @C=&and(*R,0x00ff0000); | ||
100 | @C=&shift(*C,-16); | ||
101 | @D=&and(*L,0xf0000000); | ||
102 | @D=&shift(*D,-4); | ||
103 | @A=&or(*A,*B); | ||
104 | @B=&or(*D,*C); | ||
105 | @R=&or(*A,*B); | ||
106 | @L=&and(*L,0x0fffffff); | ||
107 | |||
108 | &printit(@L); | ||
109 | &printit(@R); | ||
110 | |||
diff --git a/src/lib/libcrypto/des/doPC2 b/src/lib/libcrypto/des/doPC2 new file mode 100644 index 0000000000..fa5cf74cf7 --- /dev/null +++ b/src/lib/libcrypto/des/doPC2 | |||
@@ -0,0 +1,94 @@ | |||
1 | #!/usr/local/bin/perl | ||
2 | |||
3 | @PC2_C=(14,17,11,24, 1, 5, | ||
4 | 3,28,15, 6,21,10, | ||
5 | 23,19,12, 4,26, 8, | ||
6 | 16, 7,27,20,13, 2, | ||
7 | ); | ||
8 | |||
9 | @PC2_D=(41,52,31,37,47,55, | ||
10 | 30,40,51,45,33,48, | ||
11 | 44,49,39,56,34,53, | ||
12 | 46,42,50,36,29,32, | ||
13 | ); | ||
14 | |||
15 | $i=0; | ||
16 | foreach (@PC2_C) { | ||
17 | $_--; | ||
18 | # printf "%2d,",$_; | ||
19 | $C{$_}=$i; | ||
20 | ++$i; | ||
21 | # print "\n" if ((($i) % 8) == 0); | ||
22 | } | ||
23 | $i=0; | ||
24 | #print "\n"; | ||
25 | foreach (@PC2_D) { | ||
26 | $_-=28; | ||
27 | $_--; | ||
28 | # printf "%2d,",$_; | ||
29 | $D{$_}=$i; | ||
30 | $i++; | ||
31 | # print "\n" if ((($i) % 8) == 0); | ||
32 | } | ||
33 | |||
34 | #print "\n"; | ||
35 | foreach $i (0 .. 27) | ||
36 | { | ||
37 | $_=$C{$i}; | ||
38 | # printf "%2d,",$_; | ||
39 | $i++; | ||
40 | # print "\n" if ((($i) % 8) == 0); | ||
41 | } | ||
42 | #print "\n"; | ||
43 | |||
44 | #print "\n"; | ||
45 | foreach $i (0 .. 27) | ||
46 | { | ||
47 | $_=$D{$i}; | ||
48 | # printf "%2d,",$_; | ||
49 | $i++; | ||
50 | # print "\n" if ((($i) % 8) == 0); | ||
51 | } | ||
52 | #print "\n"; | ||
53 | |||
54 | print "static ulong skb[8][64]={\n"; | ||
55 | &doit("C",*C, 0, 1, 2, 3, 4, 5); | ||
56 | &doit("C",*C, 6, 7, 9,10,11,12); | ||
57 | &doit("C",*C,13,14,15,16,18,19); | ||
58 | &doit("C",*C,20,22,23,25,26,27); | ||
59 | |||
60 | &doit("D",*D, 0, 1, 2, 3, 4, 5); | ||
61 | &doit("D",*D, 7, 8,10,11,12,13); | ||
62 | &doit("D",*D,15,16,17,18,19,20); | ||
63 | &doit("D",*D,21,22,23,24,26,27); | ||
64 | print "};\n"; | ||
65 | |||
66 | sub doit | ||
67 | { | ||
68 | local($l,*A,@b)=@_; | ||
69 | local(@out); | ||
70 | |||
71 | printf("/* for $l bits (numbered as per FIPS 46) %d %d %d %d %d %d */\n", | ||
72 | $b[0]+1, $b[1]+1, $b[2]+1, $b[3]+1, $b[4]+1, $b[5]+1); | ||
73 | for ($i=0; $i<64; $i++) | ||
74 | { | ||
75 | $out[$i]=0; | ||
76 | $j=1; | ||
77 | #print "\n"; | ||
78 | for ($k=0; $k<6; $k++) | ||
79 | { | ||
80 | $l=$A{$b[$k]}; | ||
81 | #print"$l - "; | ||
82 | if ((1<<$k) & $i) | ||
83 | { | ||
84 | $ll=int($l/6)*8+($l%6); | ||
85 | $out[$i]|=1<<($ll); | ||
86 | } | ||
87 | } | ||
88 | $pp=$out[$i]; | ||
89 | $pp=($pp&0xff0000ff)| (($pp&0x00ff0000)>>8)| | ||
90 | (($pp&0x0000ff00)<<8); | ||
91 | printf("0x%08X,",$pp); | ||
92 | print "\n" if (($i+1) % 4 == 0); | ||
93 | } | ||
94 | } | ||
diff --git a/src/lib/libcrypto/des/ede_enc.c b/src/lib/libcrypto/des/ede_enc.c new file mode 100644 index 0000000000..9f75dd1037 --- /dev/null +++ b/src/lib/libcrypto/des/ede_enc.c | |||
@@ -0,0 +1,190 @@ | |||
1 | /* crypto/des/ede_enc.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include "des_locl.h" | ||
60 | |||
61 | void des_ede3_cbc_encrypt(input, output, length, ks1, ks2, ks3, ivec, enc) | ||
62 | des_cblock (*input); | ||
63 | des_cblock (*output); | ||
64 | long length; | ||
65 | des_key_schedule ks1; | ||
66 | des_key_schedule ks2; | ||
67 | des_key_schedule ks3; | ||
68 | des_cblock (*ivec); | ||
69 | int enc; | ||
70 | { | ||
71 | register DES_LONG tin0,tin1; | ||
72 | register DES_LONG tout0,tout1,xor0,xor1; | ||
73 | register unsigned char *in,*out; | ||
74 | register long l=length; | ||
75 | DES_LONG tin[2]; | ||
76 | unsigned char *iv; | ||
77 | |||
78 | in=(unsigned char *)input; | ||
79 | out=(unsigned char *)output; | ||
80 | iv=(unsigned char *)ivec; | ||
81 | |||
82 | if (enc) | ||
83 | { | ||
84 | c2l(iv,tout0); | ||
85 | c2l(iv,tout1); | ||
86 | for (l-=8; l>=0; l-=8) | ||
87 | { | ||
88 | c2l(in,tin0); | ||
89 | c2l(in,tin1); | ||
90 | tin0^=tout0; | ||
91 | tin1^=tout1; | ||
92 | |||
93 | tin[0]=tin0; | ||
94 | tin[1]=tin1; | ||
95 | des_encrypt3((DES_LONG *)tin,ks1,ks2,ks3); | ||
96 | tout0=tin[0]; | ||
97 | tout1=tin[1]; | ||
98 | |||
99 | l2c(tout0,out); | ||
100 | l2c(tout1,out); | ||
101 | } | ||
102 | if (l != -8) | ||
103 | { | ||
104 | c2ln(in,tin0,tin1,l+8); | ||
105 | tin0^=tout0; | ||
106 | tin1^=tout1; | ||
107 | |||
108 | tin[0]=tin0; | ||
109 | tin[1]=tin1; | ||
110 | des_encrypt3((DES_LONG *)tin,ks1,ks2,ks3); | ||
111 | tout0=tin[0]; | ||
112 | tout1=tin[1]; | ||
113 | |||
114 | l2c(tout0,out); | ||
115 | l2c(tout1,out); | ||
116 | } | ||
117 | iv=(unsigned char *)ivec; | ||
118 | l2c(tout0,iv); | ||
119 | l2c(tout1,iv); | ||
120 | } | ||
121 | else | ||
122 | { | ||
123 | register DES_LONG t0,t1; | ||
124 | |||
125 | c2l(iv,xor0); | ||
126 | c2l(iv,xor1); | ||
127 | for (l-=8; l>=0; l-=8) | ||
128 | { | ||
129 | c2l(in,tin0); | ||
130 | c2l(in,tin1); | ||
131 | |||
132 | t0=tin0; | ||
133 | t1=tin1; | ||
134 | |||
135 | tin[0]=tin0; | ||
136 | tin[1]=tin1; | ||
137 | des_decrypt3((DES_LONG *)tin,ks1,ks2,ks3); | ||
138 | tout0=tin[0]; | ||
139 | tout1=tin[1]; | ||
140 | |||
141 | tout0^=xor0; | ||
142 | tout1^=xor1; | ||
143 | l2c(tout0,out); | ||
144 | l2c(tout1,out); | ||
145 | xor0=t0; | ||
146 | xor1=t1; | ||
147 | } | ||
148 | if (l != -8) | ||
149 | { | ||
150 | c2l(in,tin0); | ||
151 | c2l(in,tin1); | ||
152 | |||
153 | t0=tin0; | ||
154 | t1=tin1; | ||
155 | |||
156 | tin[0]=tin0; | ||
157 | tin[1]=tin1; | ||
158 | des_decrypt3((DES_LONG *)tin,ks1,ks2,ks3); | ||
159 | tout0=tin[0]; | ||
160 | tout1=tin[1]; | ||
161 | |||
162 | tout0^=xor0; | ||
163 | tout1^=xor1; | ||
164 | l2cn(tout0,tout1,out,l+8); | ||
165 | xor0=t0; | ||
166 | xor1=t1; | ||
167 | } | ||
168 | |||
169 | iv=(unsigned char *)ivec; | ||
170 | l2c(xor0,iv); | ||
171 | l2c(xor1,iv); | ||
172 | } | ||
173 | tin0=tin1=tout0=tout1=xor0=xor1=0; | ||
174 | tin[0]=tin[1]=0; | ||
175 | } | ||
176 | |||
177 | #ifdef undef /* MACRO */ | ||
178 | void des_ede2_cbc_encrypt(input, output, length, ks1, ks2, ivec, enc) | ||
179 | des_cblock (*input); | ||
180 | des_cblock (*output); | ||
181 | long length; | ||
182 | des_key_schedule ks1; | ||
183 | des_key_schedule ks2; | ||
184 | des_cblock (*ivec); | ||
185 | int enc; | ||
186 | { | ||
187 | des_ede3_cbc_encrypt(input,output,length,ks1,ks2,ks1,ivec,enc); | ||
188 | } | ||
189 | #endif | ||
190 | |||
diff --git a/src/lib/libcrypto/des/podd.h b/src/lib/libcrypto/des/podd.h new file mode 100644 index 0000000000..1b2bfe0843 --- /dev/null +++ b/src/lib/libcrypto/des/podd.h | |||
@@ -0,0 +1,75 @@ | |||
1 | /* crypto/des/podd.h */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | static const unsigned char odd_parity[256]={ | ||
60 | 1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14, | ||
61 | 16, 16, 19, 19, 21, 21, 22, 22, 25, 25, 26, 26, 28, 28, 31, 31, | ||
62 | 32, 32, 35, 35, 37, 37, 38, 38, 41, 41, 42, 42, 44, 44, 47, 47, | ||
63 | 49, 49, 50, 50, 52, 52, 55, 55, 56, 56, 59, 59, 61, 61, 62, 62, | ||
64 | 64, 64, 67, 67, 69, 69, 70, 70, 73, 73, 74, 74, 76, 76, 79, 79, | ||
65 | 81, 81, 82, 82, 84, 84, 87, 87, 88, 88, 91, 91, 93, 93, 94, 94, | ||
66 | 97, 97, 98, 98,100,100,103,103,104,104,107,107,109,109,110,110, | ||
67 | 112,112,115,115,117,117,118,118,121,121,122,122,124,124,127,127, | ||
68 | 128,128,131,131,133,133,134,134,137,137,138,138,140,140,143,143, | ||
69 | 145,145,146,146,148,148,151,151,152,152,155,155,157,157,158,158, | ||
70 | 161,161,162,162,164,164,167,167,168,168,171,171,173,173,174,174, | ||
71 | 176,176,179,179,181,181,182,182,185,185,186,186,188,188,191,191, | ||
72 | 193,193,194,194,196,196,199,199,200,200,203,203,205,205,206,206, | ||
73 | 208,208,211,211,213,213,214,214,217,217,218,218,220,220,223,223, | ||
74 | 224,224,227,227,229,229,230,230,233,233,234,234,236,236,239,239, | ||
75 | 241,241,242,242,244,244,247,247,248,248,251,251,253,253,254,254}; | ||
diff --git a/src/lib/libcrypto/des/ranlib.sh b/src/lib/libcrypto/des/ranlib.sh new file mode 100644 index 0000000000..543f712c6b --- /dev/null +++ b/src/lib/libcrypto/des/ranlib.sh | |||
@@ -0,0 +1,23 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | cwd=`pwd` | ||
4 | cd /tmp | ||
5 | |||
6 | if [ -s /bin/ranlib ] ; then | ||
7 | RL=/bin/ranlib | ||
8 | else if [ -s /usr/bin/ranlib ] ; then | ||
9 | RL=/usr/bin/ranlib | ||
10 | fi | ||
11 | fi | ||
12 | |||
13 | if [ "x$RL" != "x" ] | ||
14 | then | ||
15 | case "$1" in | ||
16 | /*) | ||
17 | $RL "$1" | ||
18 | ;; | ||
19 | *) | ||
20 | $RL "$cwd/$1" | ||
21 | ;; | ||
22 | esac | ||
23 | fi | ||
diff --git a/src/lib/libcrypto/des/shifts.pl b/src/lib/libcrypto/des/shifts.pl new file mode 100644 index 0000000000..d8a240c1ba --- /dev/null +++ b/src/lib/libcrypto/des/shifts.pl | |||
@@ -0,0 +1,198 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | sub lab_shift | ||
4 | { | ||
5 | local(*a,$n)=@_; | ||
6 | local(@r,$i,$j,$k,$d,@z); | ||
7 | |||
8 | @r=&shift(*a,$n); | ||
9 | foreach $i (0 .. 31) | ||
10 | { | ||
11 | @z=split(/\^/,$r[$i]); | ||
12 | for ($j=0; $j <= $#z; $j++) | ||
13 | { | ||
14 | ($d)=($z[$j] =~ /^(..)/); | ||
15 | ($k)=($z[$j] =~ /\[(.*)\]$/); | ||
16 | $k.=",$n" if ($k ne ""); | ||
17 | $k="$n" if ($k eq ""); | ||
18 | $d="$d[$k]"; | ||
19 | $z[$j]=$d; | ||
20 | } | ||
21 | $r[$i]=join('^',@z); | ||
22 | } | ||
23 | return(@r); | ||
24 | } | ||
25 | |||
26 | sub shift | ||
27 | { | ||
28 | local(*a,$n)=@_; | ||
29 | local(@f); | ||
30 | |||
31 | if ($n > 0) | ||
32 | { | ||
33 | @f=&shiftl(*a,$n); | ||
34 | } | ||
35 | else | ||
36 | { | ||
37 | @f=&shiftr(*a,-$n); | ||
38 | } | ||
39 | return(@f); | ||
40 | } | ||
41 | |||
42 | sub rotate | ||
43 | { | ||
44 | local(*a,$n)=@_; | ||
45 | local(@f); | ||
46 | |||
47 | if ($n > 0) | ||
48 | { @f=&rotatel(*a,$n); } | ||
49 | else | ||
50 | { @f=&rotater(*a,-$n); } | ||
51 | return(@f); | ||
52 | } | ||
53 | |||
54 | sub rotater | ||
55 | { | ||
56 | local(*a,$n)=@_; | ||
57 | local(@f,@g); | ||
58 | |||
59 | @f=&shiftr(*a,$n); | ||
60 | @g=&shiftl(*a,32-$n); | ||
61 | $#f=31; | ||
62 | $#g=31; | ||
63 | return(&or(*f,*g)); | ||
64 | } | ||
65 | |||
66 | sub rotatel | ||
67 | { | ||
68 | local(*a,$n)=@_; | ||
69 | local(@f,@g); | ||
70 | |||
71 | @f=&shiftl(*a,$n); | ||
72 | @g=&shiftr(*a,32-$n); | ||
73 | $#f=31; | ||
74 | $#g=31; | ||
75 | return(&or(*f,*g)); | ||
76 | } | ||
77 | |||
78 | sub shiftr | ||
79 | { | ||
80 | local(*a,$n)=@_; | ||
81 | local(@r,$i); | ||
82 | |||
83 | $#r=31; | ||
84 | foreach $i (0 .. 31) | ||
85 | { | ||
86 | if (($i+$n) > 31) | ||
87 | { | ||
88 | $r[$i]="--"; | ||
89 | } | ||
90 | else | ||
91 | { | ||
92 | $r[$i]=$a[$i+$n]; | ||
93 | } | ||
94 | } | ||
95 | return(@r); | ||
96 | } | ||
97 | |||
98 | sub shiftl | ||
99 | { | ||
100 | local(*a,$n)=@_; | ||
101 | local(@r,$i); | ||
102 | |||
103 | $#r=31; | ||
104 | foreach $i (0 .. 31) | ||
105 | { | ||
106 | if ($i < $n) | ||
107 | { | ||
108 | $r[$i]="--"; | ||
109 | } | ||
110 | else | ||
111 | { | ||
112 | $r[$i]=$a[$i-$n]; | ||
113 | } | ||
114 | } | ||
115 | return(@r); | ||
116 | } | ||
117 | |||
118 | sub printit | ||
119 | { | ||
120 | local(@a)=@_; | ||
121 | local($i); | ||
122 | |||
123 | foreach $i (0 .. 31) | ||
124 | { | ||
125 | printf "%2s ",$a[$i]; | ||
126 | print "\n" if (($i%8) == 7); | ||
127 | } | ||
128 | print "\n"; | ||
129 | } | ||
130 | |||
131 | sub xor | ||
132 | { | ||
133 | local(*a,*b)=@_; | ||
134 | local(@r,$i); | ||
135 | |||
136 | $#r=31; | ||
137 | foreach $i (0 .. 31) | ||
138 | { | ||
139 | $r[$i]=&compress($a[$i].'^'.$b[$i]); | ||
140 | # $r[$i]=$a[$i]."^".$b[$i]; | ||
141 | } | ||
142 | return(@r); | ||
143 | } | ||
144 | |||
145 | sub and | ||
146 | { | ||
147 | local(*a,$m)=@_; | ||
148 | local(@r,$i); | ||
149 | |||
150 | $#r=31; | ||
151 | foreach $i (0 .. 31) | ||
152 | { | ||
153 | $r[$i]=(($m & (1<<$i))?($a[$i]):('--')); | ||
154 | } | ||
155 | return(@r); | ||
156 | } | ||
157 | |||
158 | sub or | ||
159 | { | ||
160 | local(*a,*b)=@_; | ||
161 | local(@r,$i); | ||
162 | |||
163 | $#r=31; | ||
164 | foreach $i (0 .. 31) | ||
165 | { | ||
166 | $r[$i]='--' if (($a[$i] eq '--') && ($b[$i] eq '--')); | ||
167 | $r[$i]=$a[$i] if (($a[$i] ne '--') && ($b[$i] eq '--')); | ||
168 | $r[$i]=$b[$i] if (($a[$i] eq '--') && ($b[$i] ne '--')); | ||
169 | $r[$i]='++' if (($a[$i] ne '--') && ($b[$i] ne '--')); | ||
170 | } | ||
171 | return(@r); | ||
172 | } | ||
173 | |||
174 | sub compress | ||
175 | { | ||
176 | local($s)=@_; | ||
177 | local($_,$i,@a,%a,$r); | ||
178 | |||
179 | $s =~ s/\^\^/\^/g; | ||
180 | $s =~ s/^\^//; | ||
181 | $s =~ s/\^$//; | ||
182 | @a=split(/\^/,$s); | ||
183 | |||
184 | while ($#a >= 0) | ||
185 | { | ||
186 | $_=shift(@a); | ||
187 | next unless /\d/; | ||
188 | $a{$_}++; | ||
189 | } | ||
190 | foreach $i (sort keys %a) | ||
191 | { | ||
192 | next if ($a{$i}%2 == 0); | ||
193 | $r.="$i^"; | ||
194 | } | ||
195 | chop($r); | ||
196 | return($r); | ||
197 | } | ||
198 | 1; | ||
diff --git a/src/lib/libcrypto/des/sk.h b/src/lib/libcrypto/des/sk.h new file mode 100644 index 0000000000..f2ade88c7c --- /dev/null +++ b/src/lib/libcrypto/des/sk.h | |||
@@ -0,0 +1,204 @@ | |||
1 | /* crypto/des/sk.h */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | static const DES_LONG des_skb[8][64]={ | ||
60 | { | ||
61 | /* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ | ||
62 | 0x00000000L,0x00000010L,0x20000000L,0x20000010L, | ||
63 | 0x00010000L,0x00010010L,0x20010000L,0x20010010L, | ||
64 | 0x00000800L,0x00000810L,0x20000800L,0x20000810L, | ||
65 | 0x00010800L,0x00010810L,0x20010800L,0x20010810L, | ||
66 | 0x00000020L,0x00000030L,0x20000020L,0x20000030L, | ||
67 | 0x00010020L,0x00010030L,0x20010020L,0x20010030L, | ||
68 | 0x00000820L,0x00000830L,0x20000820L,0x20000830L, | ||
69 | 0x00010820L,0x00010830L,0x20010820L,0x20010830L, | ||
70 | 0x00080000L,0x00080010L,0x20080000L,0x20080010L, | ||
71 | 0x00090000L,0x00090010L,0x20090000L,0x20090010L, | ||
72 | 0x00080800L,0x00080810L,0x20080800L,0x20080810L, | ||
73 | 0x00090800L,0x00090810L,0x20090800L,0x20090810L, | ||
74 | 0x00080020L,0x00080030L,0x20080020L,0x20080030L, | ||
75 | 0x00090020L,0x00090030L,0x20090020L,0x20090030L, | ||
76 | 0x00080820L,0x00080830L,0x20080820L,0x20080830L, | ||
77 | 0x00090820L,0x00090830L,0x20090820L,0x20090830L, | ||
78 | },{ | ||
79 | /* for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 */ | ||
80 | 0x00000000L,0x02000000L,0x00002000L,0x02002000L, | ||
81 | 0x00200000L,0x02200000L,0x00202000L,0x02202000L, | ||
82 | 0x00000004L,0x02000004L,0x00002004L,0x02002004L, | ||
83 | 0x00200004L,0x02200004L,0x00202004L,0x02202004L, | ||
84 | 0x00000400L,0x02000400L,0x00002400L,0x02002400L, | ||
85 | 0x00200400L,0x02200400L,0x00202400L,0x02202400L, | ||
86 | 0x00000404L,0x02000404L,0x00002404L,0x02002404L, | ||
87 | 0x00200404L,0x02200404L,0x00202404L,0x02202404L, | ||
88 | 0x10000000L,0x12000000L,0x10002000L,0x12002000L, | ||
89 | 0x10200000L,0x12200000L,0x10202000L,0x12202000L, | ||
90 | 0x10000004L,0x12000004L,0x10002004L,0x12002004L, | ||
91 | 0x10200004L,0x12200004L,0x10202004L,0x12202004L, | ||
92 | 0x10000400L,0x12000400L,0x10002400L,0x12002400L, | ||
93 | 0x10200400L,0x12200400L,0x10202400L,0x12202400L, | ||
94 | 0x10000404L,0x12000404L,0x10002404L,0x12002404L, | ||
95 | 0x10200404L,0x12200404L,0x10202404L,0x12202404L, | ||
96 | },{ | ||
97 | /* for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 */ | ||
98 | 0x00000000L,0x00000001L,0x00040000L,0x00040001L, | ||
99 | 0x01000000L,0x01000001L,0x01040000L,0x01040001L, | ||
100 | 0x00000002L,0x00000003L,0x00040002L,0x00040003L, | ||
101 | 0x01000002L,0x01000003L,0x01040002L,0x01040003L, | ||
102 | 0x00000200L,0x00000201L,0x00040200L,0x00040201L, | ||
103 | 0x01000200L,0x01000201L,0x01040200L,0x01040201L, | ||
104 | 0x00000202L,0x00000203L,0x00040202L,0x00040203L, | ||
105 | 0x01000202L,0x01000203L,0x01040202L,0x01040203L, | ||
106 | 0x08000000L,0x08000001L,0x08040000L,0x08040001L, | ||
107 | 0x09000000L,0x09000001L,0x09040000L,0x09040001L, | ||
108 | 0x08000002L,0x08000003L,0x08040002L,0x08040003L, | ||
109 | 0x09000002L,0x09000003L,0x09040002L,0x09040003L, | ||
110 | 0x08000200L,0x08000201L,0x08040200L,0x08040201L, | ||
111 | 0x09000200L,0x09000201L,0x09040200L,0x09040201L, | ||
112 | 0x08000202L,0x08000203L,0x08040202L,0x08040203L, | ||
113 | 0x09000202L,0x09000203L,0x09040202L,0x09040203L, | ||
114 | },{ | ||
115 | /* for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 */ | ||
116 | 0x00000000L,0x00100000L,0x00000100L,0x00100100L, | ||
117 | 0x00000008L,0x00100008L,0x00000108L,0x00100108L, | ||
118 | 0x00001000L,0x00101000L,0x00001100L,0x00101100L, | ||
119 | 0x00001008L,0x00101008L,0x00001108L,0x00101108L, | ||
120 | 0x04000000L,0x04100000L,0x04000100L,0x04100100L, | ||
121 | 0x04000008L,0x04100008L,0x04000108L,0x04100108L, | ||
122 | 0x04001000L,0x04101000L,0x04001100L,0x04101100L, | ||
123 | 0x04001008L,0x04101008L,0x04001108L,0x04101108L, | ||
124 | 0x00020000L,0x00120000L,0x00020100L,0x00120100L, | ||
125 | 0x00020008L,0x00120008L,0x00020108L,0x00120108L, | ||
126 | 0x00021000L,0x00121000L,0x00021100L,0x00121100L, | ||
127 | 0x00021008L,0x00121008L,0x00021108L,0x00121108L, | ||
128 | 0x04020000L,0x04120000L,0x04020100L,0x04120100L, | ||
129 | 0x04020008L,0x04120008L,0x04020108L,0x04120108L, | ||
130 | 0x04021000L,0x04121000L,0x04021100L,0x04121100L, | ||
131 | 0x04021008L,0x04121008L,0x04021108L,0x04121108L, | ||
132 | },{ | ||
133 | /* for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ | ||
134 | 0x00000000L,0x10000000L,0x00010000L,0x10010000L, | ||
135 | 0x00000004L,0x10000004L,0x00010004L,0x10010004L, | ||
136 | 0x20000000L,0x30000000L,0x20010000L,0x30010000L, | ||
137 | 0x20000004L,0x30000004L,0x20010004L,0x30010004L, | ||
138 | 0x00100000L,0x10100000L,0x00110000L,0x10110000L, | ||
139 | 0x00100004L,0x10100004L,0x00110004L,0x10110004L, | ||
140 | 0x20100000L,0x30100000L,0x20110000L,0x30110000L, | ||
141 | 0x20100004L,0x30100004L,0x20110004L,0x30110004L, | ||
142 | 0x00001000L,0x10001000L,0x00011000L,0x10011000L, | ||
143 | 0x00001004L,0x10001004L,0x00011004L,0x10011004L, | ||
144 | 0x20001000L,0x30001000L,0x20011000L,0x30011000L, | ||
145 | 0x20001004L,0x30001004L,0x20011004L,0x30011004L, | ||
146 | 0x00101000L,0x10101000L,0x00111000L,0x10111000L, | ||
147 | 0x00101004L,0x10101004L,0x00111004L,0x10111004L, | ||
148 | 0x20101000L,0x30101000L,0x20111000L,0x30111000L, | ||
149 | 0x20101004L,0x30101004L,0x20111004L,0x30111004L, | ||
150 | },{ | ||
151 | /* for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 */ | ||
152 | 0x00000000L,0x08000000L,0x00000008L,0x08000008L, | ||
153 | 0x00000400L,0x08000400L,0x00000408L,0x08000408L, | ||
154 | 0x00020000L,0x08020000L,0x00020008L,0x08020008L, | ||
155 | 0x00020400L,0x08020400L,0x00020408L,0x08020408L, | ||
156 | 0x00000001L,0x08000001L,0x00000009L,0x08000009L, | ||
157 | 0x00000401L,0x08000401L,0x00000409L,0x08000409L, | ||
158 | 0x00020001L,0x08020001L,0x00020009L,0x08020009L, | ||
159 | 0x00020401L,0x08020401L,0x00020409L,0x08020409L, | ||
160 | 0x02000000L,0x0A000000L,0x02000008L,0x0A000008L, | ||
161 | 0x02000400L,0x0A000400L,0x02000408L,0x0A000408L, | ||
162 | 0x02020000L,0x0A020000L,0x02020008L,0x0A020008L, | ||
163 | 0x02020400L,0x0A020400L,0x02020408L,0x0A020408L, | ||
164 | 0x02000001L,0x0A000001L,0x02000009L,0x0A000009L, | ||
165 | 0x02000401L,0x0A000401L,0x02000409L,0x0A000409L, | ||
166 | 0x02020001L,0x0A020001L,0x02020009L,0x0A020009L, | ||
167 | 0x02020401L,0x0A020401L,0x02020409L,0x0A020409L, | ||
168 | },{ | ||
169 | /* for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 */ | ||
170 | 0x00000000L,0x00000100L,0x00080000L,0x00080100L, | ||
171 | 0x01000000L,0x01000100L,0x01080000L,0x01080100L, | ||
172 | 0x00000010L,0x00000110L,0x00080010L,0x00080110L, | ||
173 | 0x01000010L,0x01000110L,0x01080010L,0x01080110L, | ||
174 | 0x00200000L,0x00200100L,0x00280000L,0x00280100L, | ||
175 | 0x01200000L,0x01200100L,0x01280000L,0x01280100L, | ||
176 | 0x00200010L,0x00200110L,0x00280010L,0x00280110L, | ||
177 | 0x01200010L,0x01200110L,0x01280010L,0x01280110L, | ||
178 | 0x00000200L,0x00000300L,0x00080200L,0x00080300L, | ||
179 | 0x01000200L,0x01000300L,0x01080200L,0x01080300L, | ||
180 | 0x00000210L,0x00000310L,0x00080210L,0x00080310L, | ||
181 | 0x01000210L,0x01000310L,0x01080210L,0x01080310L, | ||
182 | 0x00200200L,0x00200300L,0x00280200L,0x00280300L, | ||
183 | 0x01200200L,0x01200300L,0x01280200L,0x01280300L, | ||
184 | 0x00200210L,0x00200310L,0x00280210L,0x00280310L, | ||
185 | 0x01200210L,0x01200310L,0x01280210L,0x01280310L, | ||
186 | },{ | ||
187 | /* for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 */ | ||
188 | 0x00000000L,0x04000000L,0x00040000L,0x04040000L, | ||
189 | 0x00000002L,0x04000002L,0x00040002L,0x04040002L, | ||
190 | 0x00002000L,0x04002000L,0x00042000L,0x04042000L, | ||
191 | 0x00002002L,0x04002002L,0x00042002L,0x04042002L, | ||
192 | 0x00000020L,0x04000020L,0x00040020L,0x04040020L, | ||
193 | 0x00000022L,0x04000022L,0x00040022L,0x04040022L, | ||
194 | 0x00002020L,0x04002020L,0x00042020L,0x04042020L, | ||
195 | 0x00002022L,0x04002022L,0x00042022L,0x04042022L, | ||
196 | 0x00000800L,0x04000800L,0x00040800L,0x04040800L, | ||
197 | 0x00000802L,0x04000802L,0x00040802L,0x04040802L, | ||
198 | 0x00002800L,0x04002800L,0x00042800L,0x04042800L, | ||
199 | 0x00002802L,0x04002802L,0x00042802L,0x04042802L, | ||
200 | 0x00000820L,0x04000820L,0x00040820L,0x04040820L, | ||
201 | 0x00000822L,0x04000822L,0x00040822L,0x04040822L, | ||
202 | 0x00002820L,0x04002820L,0x00042820L,0x04042820L, | ||
203 | 0x00002822L,0x04002822L,0x00042822L,0x04042822L, | ||
204 | }}; | ||
diff --git a/src/lib/libcrypto/des/supp.c b/src/lib/libcrypto/des/supp.c new file mode 100644 index 0000000000..f8e5833f69 --- /dev/null +++ b/src/lib/libcrypto/des/supp.c | |||
@@ -0,0 +1,109 @@ | |||
1 | /* crypto/des/supp.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | /* | ||
60 | * Copyright (c) 1995 | ||
61 | * Mark Murray. All rights reserved. | ||
62 | * | ||
63 | * Redistribution and use in source and binary forms, with or without | ||
64 | * modification, are permitted provided that the following conditions | ||
65 | * are met: | ||
66 | * 1. Redistributions of source code must retain the above copyright | ||
67 | * notice, this list of conditions and the following disclaimer. | ||
68 | * 2. Redistributions in binary form must reproduce the above copyright | ||
69 | * notice, this list of conditions and the following disclaimer in the | ||
70 | * documentation and/or other materials provided with the distribution. | ||
71 | * 3. All advertising materials mentioning features or use of this software | ||
72 | * must display the following acknowledgement: | ||
73 | * This product includes software developed by Mark Murray | ||
74 | * 4. Neither the name of the author nor the names of any co-contributors | ||
75 | * may be used to endorse or promote products derived from this software | ||
76 | * without specific prior written permission. | ||
77 | * | ||
78 | * THIS SOFTWARE IS PROVIDED BY MARK MURRAY AND CONTRIBUTORS ``AS IS'' AND | ||
79 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
80 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
81 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
82 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
83 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
84 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
85 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
86 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
87 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
88 | * SUCH DAMAGE. | ||
89 | * | ||
90 | * $Id: supp.c,v 1.1.1.1 1998/10/05 20:12:45 ryker Exp $ | ||
91 | */ | ||
92 | |||
93 | #include <stdio.h> | ||
94 | #include "des_locl.h" | ||
95 | |||
96 | void des_cblock_print_file(cb, fp) | ||
97 | des_cblock *cb; | ||
98 | FILE *fp; | ||
99 | { | ||
100 | int i; | ||
101 | unsigned int *p = (unsigned int *)cb; | ||
102 | |||
103 | fprintf(fp, " 0x { "); | ||
104 | for (i = 0; i < 8; i++) { | ||
105 | fprintf(fp, "%x", p[i]); | ||
106 | if (i != 7) fprintf(fp, ", "); | ||
107 | } | ||
108 | fprintf(fp, " }"); | ||
109 | } | ||
diff --git a/src/lib/libcrypto/des/testdes.pl b/src/lib/libcrypto/des/testdes.pl new file mode 100644 index 0000000000..67fbd47f36 --- /dev/null +++ b/src/lib/libcrypto/des/testdes.pl | |||
@@ -0,0 +1,167 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | # des.pl tesing code | ||
4 | |||
5 | require 'des.pl'; | ||
6 | |||
7 | $num_tests=34; | ||
8 | @key_data=( | ||
9 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
10 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, | ||
11 | 0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
12 | 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, | ||
13 | 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, | ||
14 | 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, | ||
15 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
16 | 0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10, | ||
17 | 0x7C,0xA1,0x10,0x45,0x4A,0x1A,0x6E,0x57, | ||
18 | 0x01,0x31,0xD9,0x61,0x9D,0xC1,0x37,0x6E, | ||
19 | 0x07,0xA1,0x13,0x3E,0x4A,0x0B,0x26,0x86, | ||
20 | 0x38,0x49,0x67,0x4C,0x26,0x02,0x31,0x9E, | ||
21 | 0x04,0xB9,0x15,0xBA,0x43,0xFE,0xB5,0xB6, | ||
22 | 0x01,0x13,0xB9,0x70,0xFD,0x34,0xF2,0xCE, | ||
23 | 0x01,0x70,0xF1,0x75,0x46,0x8F,0xB5,0xE6, | ||
24 | 0x43,0x29,0x7F,0xAD,0x38,0xE3,0x73,0xFE, | ||
25 | 0x07,0xA7,0x13,0x70,0x45,0xDA,0x2A,0x16, | ||
26 | 0x04,0x68,0x91,0x04,0xC2,0xFD,0x3B,0x2F, | ||
27 | 0x37,0xD0,0x6B,0xB5,0x16,0xCB,0x75,0x46, | ||
28 | 0x1F,0x08,0x26,0x0D,0x1A,0xC2,0x46,0x5E, | ||
29 | 0x58,0x40,0x23,0x64,0x1A,0xBA,0x61,0x76, | ||
30 | 0x02,0x58,0x16,0x16,0x46,0x29,0xB0,0x07, | ||
31 | 0x49,0x79,0x3E,0xBC,0x79,0xB3,0x25,0x8F, | ||
32 | 0x4F,0xB0,0x5E,0x15,0x15,0xAB,0x73,0xA7, | ||
33 | 0x49,0xE9,0x5D,0x6D,0x4C,0xA2,0x29,0xBF, | ||
34 | 0x01,0x83,0x10,0xDC,0x40,0x9B,0x26,0xD6, | ||
35 | 0x1C,0x58,0x7F,0x1C,0x13,0x92,0x4F,0xEF, | ||
36 | 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, | ||
37 | 0x1F,0x1F,0x1F,0x1F,0x0E,0x0E,0x0E,0x0E, | ||
38 | 0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1,0xFE, | ||
39 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
40 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, | ||
41 | 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, | ||
42 | 0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10, | ||
43 | ); | ||
44 | |||
45 | @plain_data=( | ||
46 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
47 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, | ||
48 | 0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x01, | ||
49 | 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, | ||
50 | 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, | ||
51 | 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, | ||
52 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
53 | 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, | ||
54 | 0x01,0xA1,0xD6,0xD0,0x39,0x77,0x67,0x42, | ||
55 | 0x5C,0xD5,0x4C,0xA8,0x3D,0xEF,0x57,0xDA, | ||
56 | 0x02,0x48,0xD4,0x38,0x06,0xF6,0x71,0x72, | ||
57 | 0x51,0x45,0x4B,0x58,0x2D,0xDF,0x44,0x0A, | ||
58 | 0x42,0xFD,0x44,0x30,0x59,0x57,0x7F,0xA2, | ||
59 | 0x05,0x9B,0x5E,0x08,0x51,0xCF,0x14,0x3A, | ||
60 | 0x07,0x56,0xD8,0xE0,0x77,0x47,0x61,0xD2, | ||
61 | 0x76,0x25,0x14,0xB8,0x29,0xBF,0x48,0x6A, | ||
62 | 0x3B,0xDD,0x11,0x90,0x49,0x37,0x28,0x02, | ||
63 | 0x26,0x95,0x5F,0x68,0x35,0xAF,0x60,0x9A, | ||
64 | 0x16,0x4D,0x5E,0x40,0x4F,0x27,0x52,0x32, | ||
65 | 0x6B,0x05,0x6E,0x18,0x75,0x9F,0x5C,0xCA, | ||
66 | 0x00,0x4B,0xD6,0xEF,0x09,0x17,0x60,0x62, | ||
67 | 0x48,0x0D,0x39,0x00,0x6E,0xE7,0x62,0xF2, | ||
68 | 0x43,0x75,0x40,0xC8,0x69,0x8F,0x3C,0xFA, | ||
69 | 0x07,0x2D,0x43,0xA0,0x77,0x07,0x52,0x92, | ||
70 | 0x02,0xFE,0x55,0x77,0x81,0x17,0xF1,0x2A, | ||
71 | 0x1D,0x9D,0x5C,0x50,0x18,0xF7,0x28,0xC2, | ||
72 | 0x30,0x55,0x32,0x28,0x6D,0x6F,0x29,0x5A, | ||
73 | 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, | ||
74 | 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, | ||
75 | 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, | ||
76 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, | ||
77 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
78 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
79 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF); | ||
80 | |||
81 | @cipher_data=( | ||
82 | 0x8C,0xA6,0x4D,0xE9,0xC1,0xB1,0x23,0xA7, | ||
83 | 0x73,0x59,0xB2,0x16,0x3E,0x4E,0xDC,0x58, | ||
84 | 0x95,0x8E,0x6E,0x62,0x7A,0x05,0x55,0x7B, | ||
85 | 0xF4,0x03,0x79,0xAB,0x9E,0x0E,0xC5,0x33, | ||
86 | 0x17,0x66,0x8D,0xFC,0x72,0x92,0x53,0x2D, | ||
87 | 0x8A,0x5A,0xE1,0xF8,0x1A,0xB8,0xF2,0xDD, | ||
88 | 0x8C,0xA6,0x4D,0xE9,0xC1,0xB1,0x23,0xA7, | ||
89 | 0xED,0x39,0xD9,0x50,0xFA,0x74,0xBC,0xC4, | ||
90 | 0x69,0x0F,0x5B,0x0D,0x9A,0x26,0x93,0x9B, | ||
91 | 0x7A,0x38,0x9D,0x10,0x35,0x4B,0xD2,0x71, | ||
92 | 0x86,0x8E,0xBB,0x51,0xCA,0xB4,0x59,0x9A, | ||
93 | 0x71,0x78,0x87,0x6E,0x01,0xF1,0x9B,0x2A, | ||
94 | 0xAF,0x37,0xFB,0x42,0x1F,0x8C,0x40,0x95, | ||
95 | 0x86,0xA5,0x60,0xF1,0x0E,0xC6,0xD8,0x5B, | ||
96 | 0x0C,0xD3,0xDA,0x02,0x00,0x21,0xDC,0x09, | ||
97 | 0xEA,0x67,0x6B,0x2C,0xB7,0xDB,0x2B,0x7A, | ||
98 | 0xDF,0xD6,0x4A,0x81,0x5C,0xAF,0x1A,0x0F, | ||
99 | 0x5C,0x51,0x3C,0x9C,0x48,0x86,0xC0,0x88, | ||
100 | 0x0A,0x2A,0xEE,0xAE,0x3F,0xF4,0xAB,0x77, | ||
101 | 0xEF,0x1B,0xF0,0x3E,0x5D,0xFA,0x57,0x5A, | ||
102 | 0x88,0xBF,0x0D,0xB6,0xD7,0x0D,0xEE,0x56, | ||
103 | 0xA1,0xF9,0x91,0x55,0x41,0x02,0x0B,0x56, | ||
104 | 0x6F,0xBF,0x1C,0xAF,0xCF,0xFD,0x05,0x56, | ||
105 | 0x2F,0x22,0xE4,0x9B,0xAB,0x7C,0xA1,0xAC, | ||
106 | 0x5A,0x6B,0x61,0x2C,0xC2,0x6C,0xCE,0x4A, | ||
107 | 0x5F,0x4C,0x03,0x8E,0xD1,0x2B,0x2E,0x41, | ||
108 | 0x63,0xFA,0xC0,0xD0,0x34,0xD9,0xF7,0x93, | ||
109 | 0x61,0x7B,0x3A,0x0C,0xE8,0xF0,0x71,0x00, | ||
110 | 0xDB,0x95,0x86,0x05,0xF8,0xC8,0xC6,0x06, | ||
111 | 0xED,0xBF,0xD1,0xC6,0x6C,0x29,0xCC,0xC7, | ||
112 | 0x35,0x55,0x50,0xB2,0x15,0x0E,0x24,0x51, | ||
113 | 0xCA,0xAA,0xAF,0x4D,0xEA,0xF1,0xDB,0xAE, | ||
114 | 0xD5,0xD4,0x4F,0xF7,0x20,0x68,0x3D,0x0D, | ||
115 | 0x2A,0x2B,0xB0,0x08,0xDF,0x97,0xC2,0xF2); | ||
116 | |||
117 | print "Doing ecb tests\n"; | ||
118 | for ($i=0; $i<$num_tests; $i++) | ||
119 | { | ||
120 | printf "Doing test $i\n"; | ||
121 | $key =pack("C8",splice(@key_data ,0,8)); | ||
122 | $data=pack("C8",splice(@plain_data ,0,8)); | ||
123 | $res =pack("C8",splice(@cipher_data,0,8)); | ||
124 | |||
125 | @ks= &des_set_key($key); | ||
126 | $out1= &des_ecb_encrypt(*ks,1,$data); | ||
127 | $out2= &des_ecb_encrypt(*ks,0,$out1); | ||
128 | $out3= &des_ecb_encrypt(*ks,0,$res); | ||
129 | &eprint("encryption failure",$res,$out1) | ||
130 | if ($out1 ne $res); | ||
131 | &eprint("encryption/decryption failure",$data,$out2) | ||
132 | if ($out2 ne $data); | ||
133 | &eprint("decryption failure",$data,$out3) | ||
134 | if ($data ne $out3); | ||
135 | } | ||
136 | print "Done\n"; | ||
137 | |||
138 | print "doing speed test over 30 seconds\n"; | ||
139 | $SIG{'ALRM'}='done'; | ||
140 | sub done {$done=1;} | ||
141 | $done=0; | ||
142 | |||
143 | $count=0; | ||
144 | $d=pack("C8",0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef); | ||
145 | @ks= &des_set_key($d); | ||
146 | alarm(30); | ||
147 | $start=(times)[0]; | ||
148 | while (!$done) | ||
149 | { | ||
150 | $count++; | ||
151 | $d=&des_ecb_encrypt(*ks,1,$d); | ||
152 | } | ||
153 | $end=(times)[0]; | ||
154 | $t=$end-$start; | ||
155 | printf "$count DESs in %.2f seconds is %.2f DESs/sec or %.2f bytes/sec\n", | ||
156 | 1.0*$t,1.0*$count/$t,$count*8.0/$t; | ||
157 | |||
158 | sub eprint | ||
159 | { | ||
160 | local($s,$c,$e)=@_; | ||
161 | local(@k); | ||
162 | |||
163 | @k=unpack("C8",$c); | ||
164 | printf "%02x%02x%02x%02x %02x%02x%02x%02x - ",unpack("C8",$c); | ||
165 | printf "%02x%02x%02x%02x %02x%02x%02x%02x :",unpack("C8",$e); | ||
166 | print " $s\n"; | ||
167 | } | ||
diff --git a/src/lib/libcrypto/des/vms.com b/src/lib/libcrypto/des/vms.com new file mode 100644 index 0000000000..62ca1fbda4 --- /dev/null +++ b/src/lib/libcrypto/des/vms.com | |||
@@ -0,0 +1,90 @@ | |||
1 | $! --- VMS.com --- | ||
2 | $! | ||
3 | $ GoSub defines | ||
4 | $ GoSub linker_options | ||
5 | $ If (P1 .nes. "") | ||
6 | $ Then | ||
7 | $ GoSub 'P1' | ||
8 | $ Else | ||
9 | $ GoSub lib | ||
10 | $ GoSub destest | ||
11 | $ GoSub rpw | ||
12 | $ GoSub speed | ||
13 | $ GoSub des | ||
14 | $ EndIF | ||
15 | $! | ||
16 | $ Exit | ||
17 | $! | ||
18 | $!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
19 | $! | ||
20 | $DEFINES: | ||
21 | $ OPT_FILE := "VAX_LINKER_OPTIONS.OPT" | ||
22 | $! | ||
23 | $ CC_OPTS := "/NODebug/OPTimize/NOWarn" | ||
24 | $! | ||
25 | $ LINK_OPTS := "/NODebug/NOTraceback/Contiguous" | ||
26 | $! | ||
27 | $ OBJS = "cbc_cksm.obj,cbc_enc.obj,ecb_enc.obj,pcbc_enc.obj," + - | ||
28 | "qud_cksm.obj,rand_key.obj,read_pwd.obj,set_key.obj," + - | ||
29 | "str2key.obj,enc_read.obj,enc_writ.obj,fcrypt.obj," + - | ||
30 | "cfb_enc.obj,ecb3_enc.obj,ofb_enc.obj" | ||
31 | |||
32 | |||
33 | $! | ||
34 | $ LIBDES = "cbc_cksm.c,cbc_enc.c,ecb_enc.c,enc_read.c," + - | ||
35 | "enc_writ.c,pcbc_enc.c,qud_cksm.c,rand_key.c," + - | ||
36 | "read_pwd.c,set_key.c,str2key.c,fcrypt.c," + - | ||
37 | "cfb_enc.c,ecb3_enc.c,ofb_enc.c" | ||
38 | $ Return | ||
39 | $! | ||
40 | $!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
41 | $! | ||
42 | $LINKER_OPTIONS: | ||
43 | $ If (f$search(OPT_FILE) .eqs. "") | ||
44 | $ Then | ||
45 | $ Create 'OPT_FILE' | ||
46 | $DECK | ||
47 | ! Default system options file to link against the sharable C runtime library | ||
48 | ! | ||
49 | Sys$Share:VAXcRTL.exe/Share | ||
50 | $EOD | ||
51 | $ EndIF | ||
52 | $ Return | ||
53 | $! | ||
54 | $!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
55 | $! | ||
56 | $LIB: | ||
57 | $ CC 'CC_OPTS' 'LIBDES' | ||
58 | $ If (f$search("LIBDES.OLB") .nes. "") | ||
59 | $ Then Library /Object /Replace libdes 'OBJS' | ||
60 | $ Else Library /Create /Object libdes 'OBJS' | ||
61 | $ EndIF | ||
62 | $ Return | ||
63 | $! | ||
64 | $!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
65 | $! | ||
66 | $DESTEST: | ||
67 | $ CC 'CC_OPTS' destest | ||
68 | $ Link 'link_opts' /Exec=destest destest.obj,libdes/LIBRARY,'opt_file'/Option | ||
69 | $ Return | ||
70 | $! | ||
71 | $!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
72 | $! | ||
73 | $RPW: | ||
74 | $ CC 'CC_OPTS' rpw | ||
75 | $ Link 'link_opts' /Exec=rpw rpw.obj,libdes/LIBRARY,'opt_file'/Option | ||
76 | $ Return | ||
77 | $! | ||
78 | $!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
79 | $! | ||
80 | $SPEED: | ||
81 | $ CC 'CC_OPTS' speed | ||
82 | $ Link 'link_opts' /Exec=speed speed.obj,libdes/LIBRARY,'opt_file'/Option | ||
83 | $ Return | ||
84 | $! | ||
85 | $!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
86 | $! | ||
87 | $DES: | ||
88 | $ CC 'CC_OPTS' des | ||
89 | $ Link 'link_opts' /Exec=des des.obj,libdes/LIBRARY,'opt_file'/Option | ||
90 | $ Return | ||