diff options
Diffstat (limited to 'src/lib/libcrypto/des')
31 files changed, 488 insertions, 7009 deletions
diff --git a/src/lib/libcrypto/des/DES.pod b/src/lib/libcrypto/des/DES.pod index 8a739e7ca0..e69de29bb2 100644 --- a/src/lib/libcrypto/des/DES.pod +++ b/src/lib/libcrypto/des/DES.pod | |||
@@ -1,16 +0,0 @@ | |||
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 index 0cbc44f51d..e69de29bb2 100644 --- a/src/lib/libcrypto/des/MODES.DES +++ b/src/lib/libcrypto/des/MODES.DES | |||
@@ -1,84 +0,0 @@ | |||
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 index b54a24387c..e69de29bb2 100644 --- a/src/lib/libcrypto/des/Makefile.PL +++ b/src/lib/libcrypto/des/Makefile.PL | |||
@@ -1,14 +0,0 @@ | |||
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 index c09f6969da..e69de29bb2 100644 --- a/src/lib/libcrypto/des/Makefile.lit +++ b/src/lib/libcrypto/des/Makefile.lit | |||
@@ -1,250 +0,0 @@ | |||
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.ssl b/src/lib/libcrypto/des/Makefile.ssl index 41976655e9..3eb0738b7b 100644 --- a/src/lib/libcrypto/des/Makefile.ssl +++ b/src/lib/libcrypto/des/Makefile.ssl | |||
@@ -32,21 +32,21 @@ LIBSRC= cbc_cksm.c cbc_enc.c cfb64enc.c cfb_enc.c \ | |||
32 | fcrypt.c ofb64enc.c ofb_enc.c pcbc_enc.c \ | 32 | fcrypt.c ofb64enc.c ofb_enc.c pcbc_enc.c \ |
33 | qud_cksm.c rand_key.c read_pwd.c rpc_enc.c set_key.c \ | 33 | qud_cksm.c rand_key.c read_pwd.c rpc_enc.c set_key.c \ |
34 | des_enc.c fcrypt_b.c read2pwd.c \ | 34 | des_enc.c fcrypt_b.c read2pwd.c \ |
35 | fcrypt.c xcbc_enc.c \ | 35 | xcbc_enc.c \ |
36 | str2key.c cfb64ede.c ofb64ede.c supp.c ede_cbcm_enc.c | 36 | str2key.c cfb64ede.c ofb64ede.c ede_cbcm_enc.c |
37 | 37 | ||
38 | LIBOBJ= set_key.o ecb_enc.o cbc_enc.o \ | 38 | LIBOBJ= set_key.o ecb_enc.o cbc_enc.o \ |
39 | ecb3_enc.o cfb64enc.o cfb64ede.o cfb_enc.o ofb64ede.o \ | 39 | ecb3_enc.o cfb64enc.o cfb64ede.o cfb_enc.o ofb64ede.o \ |
40 | enc_read.o enc_writ.o ofb64enc.o \ | 40 | enc_read.o enc_writ.o ofb64enc.o \ |
41 | ofb_enc.o str2key.o pcbc_enc.o qud_cksm.o rand_key.o \ | 41 | ofb_enc.o str2key.o pcbc_enc.o qud_cksm.o rand_key.o \ |
42 | ${DES_ENC} read2pwd.o \ | 42 | ${DES_ENC} read2pwd.o \ |
43 | fcrypt.o xcbc_enc.o read_pwd.o rpc_enc.o cbc_cksm.o supp.o \ | 43 | fcrypt.o xcbc_enc.o read_pwd.o rpc_enc.o cbc_cksm.o \ |
44 | ede_cbcm_enc.o | 44 | ede_cbcm_enc.o |
45 | 45 | ||
46 | SRC= $(LIBSRC) | 46 | SRC= $(LIBSRC) |
47 | 47 | ||
48 | EXHEADER= des.h | 48 | EXHEADER= des.h |
49 | HEADER= des_locl.h rpc_des.h podd.h sk.h spr.h des_ver.h $(EXHEADER) | 49 | HEADER= des_locl.h rpc_des.h spr.h des_ver.h $(EXHEADER) |
50 | 50 | ||
51 | ALL= $(GENERAL) $(SRC) $(HEADER) | 51 | ALL= $(GENERAL) $(SRC) $(HEADER) |
52 | 52 | ||
@@ -65,10 +65,10 @@ des: des.o cbc3_enc.o lib | |||
65 | 65 | ||
66 | # elf | 66 | # elf |
67 | asm/dx86-elf.o: asm/dx86unix.cpp | 67 | asm/dx86-elf.o: asm/dx86unix.cpp |
68 | $(CPP) -DELF asm/dx86unix.cpp | as -o asm/dx86-elf.o | 68 | $(CPP) -DELF -x c asm/dx86unix.cpp | as -o asm/dx86-elf.o |
69 | 69 | ||
70 | asm/yx86-elf.o: asm/yx86unix.cpp | 70 | asm/yx86-elf.o: asm/yx86unix.cpp |
71 | $(CPP) -DELF asm/yx86unix.cpp | as -o asm/yx86-elf.o | 71 | $(CPP) -DELF -x c asm/yx86unix.cpp | as -o asm/yx86-elf.o |
72 | 72 | ||
73 | # solaris | 73 | # solaris |
74 | asm/dx86-sol.o: asm/dx86unix.cpp | 74 | asm/dx86-sol.o: asm/dx86unix.cpp |
@@ -95,10 +95,10 @@ asm/dx86bsdi.o: asm/dx86unix.cpp | |||
95 | asm/yx86bsdi.o: asm/yx86unix.cpp | 95 | asm/yx86bsdi.o: asm/yx86unix.cpp |
96 | $(CPP) -DBSDI asm/yx86unix.cpp | sed 's/ :/:/' | as -o asm/yx86bsdi.o | 96 | $(CPP) -DBSDI asm/yx86unix.cpp | sed 's/ :/:/' | as -o asm/yx86bsdi.o |
97 | 97 | ||
98 | asm/dx86unix.cpp: asm/des-586.pl | 98 | asm/dx86unix.cpp: asm/des-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl |
99 | (cd asm; $(PERL) des-586.pl cpp >dx86unix.cpp) | 99 | (cd asm; $(PERL) des-586.pl cpp >dx86unix.cpp) |
100 | 100 | ||
101 | asm/yx86unix.cpp: asm/crypt586.pl | 101 | asm/yx86unix.cpp: asm/crypt586.pl ../perlasm/x86asm.pl |
102 | (cd asm; $(PERL) crypt586.pl cpp >yx86unix.cpp) | 102 | (cd asm; $(PERL) crypt586.pl cpp >yx86unix.cpp) |
103 | 103 | ||
104 | files: | 104 | files: |
@@ -172,10 +172,8 @@ enc_writ.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h | |||
172 | enc_writ.o: ../../include/openssl/opensslv.h ../../include/openssl/rand.h | 172 | enc_writ.o: ../../include/openssl/opensslv.h ../../include/openssl/rand.h |
173 | enc_writ.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 173 | enc_writ.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
174 | enc_writ.o: ../cryptlib.h des_locl.h | 174 | enc_writ.o: ../cryptlib.h des_locl.h |
175 | fcrypt.o: ../../include/openssl/des.h ../../include/openssl/des.h | 175 | fcrypt.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h |
176 | fcrypt.o: ../../include/openssl/e_os2.h ../../include/openssl/e_os2.h | 176 | fcrypt.o: ../../include/openssl/opensslconf.h des_locl.h |
177 | fcrypt.o: ../../include/openssl/opensslconf.h | ||
178 | fcrypt.o: ../../include/openssl/opensslconf.h des_locl.h des_locl.h | ||
179 | fcrypt_b.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 177 | fcrypt_b.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h |
180 | fcrypt_b.o: ../../include/openssl/opensslconf.h des_locl.h | 178 | fcrypt_b.o: ../../include/openssl/opensslconf.h des_locl.h |
181 | ofb64ede.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 179 | ofb64ede.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h |
@@ -201,10 +199,8 @@ read_pwd.o: ../../include/openssl/stack.h ../cryptlib.h des_locl.h | |||
201 | rpc_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 199 | rpc_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h |
202 | rpc_enc.o: ../../include/openssl/opensslconf.h des_locl.h des_ver.h rpc_des.h | 200 | rpc_enc.o: ../../include/openssl/opensslconf.h des_locl.h des_ver.h rpc_des.h |
203 | set_key.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 201 | set_key.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h |
204 | set_key.o: ../../include/openssl/opensslconf.h des_locl.h podd.h sk.h | 202 | set_key.o: ../../include/openssl/opensslconf.h des_locl.h |
205 | str2key.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 203 | str2key.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h |
206 | str2key.o: ../../include/openssl/opensslconf.h des_locl.h | 204 | str2key.o: ../../include/openssl/opensslconf.h des_locl.h |
207 | supp.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | ||
208 | supp.o: ../../include/openssl/opensslconf.h des_locl.h | ||
209 | xcbc_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 205 | xcbc_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h |
210 | xcbc_enc.o: ../../include/openssl/opensslconf.h des_locl.h | 206 | xcbc_enc.o: ../../include/openssl/opensslconf.h des_locl.h |
diff --git a/src/lib/libcrypto/des/Makefile.uni b/src/lib/libcrypto/des/Makefile.uni index ec19d75b81..e69de29bb2 100644 --- a/src/lib/libcrypto/des/Makefile.uni +++ b/src/lib/libcrypto/des/Makefile.uni | |||
@@ -1,251 +0,0 @@ | |||
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 | RANLIB=ranlib | ||
55 | |||
56 | # Assember version of des_encrypt*(). | ||
57 | DES_ENC=des_enc.o fcrypt_b.o # normal C version | ||
58 | #DES_ENC=asm/dx86-elf.o asm/yx86-elf.o # elf format x86 | ||
59 | #DES_ENC=asm/dx86-out.o asm/yx86-out.o # a.out format x86 | ||
60 | #DES_ENC=asm/dx86-sol.o asm/yx86-sol.o # solaris format x86 | ||
61 | #DES_ENC=asm/dx86bsdi.o asm/yx86basi.o # bsdi format x86 | ||
62 | |||
63 | LIBDIR=/usr/local/lib | ||
64 | BINDIR=/usr/local/bin | ||
65 | INCDIR=/usr/local/include | ||
66 | MANDIR=/usr/local/man | ||
67 | MAN1=1 | ||
68 | MAN3=3 | ||
69 | SHELL=/bin/sh | ||
70 | OBJ_LIT=cbc_enc.o ecb_enc.o $(DES_ENC) fcrypt.o set_key.o | ||
71 | OBJ_FULL=cbc_cksm.o $(OBJ_LIT) pcbc_enc.o \ | ||
72 | xcbc_enc.o qud_cksm.o cbc3_enc.o \ | ||
73 | cfb64ede.o cfb64enc.o cfb_enc.o ecb3_enc.o \ | ||
74 | enc_read.o enc_writ.o ofb64ede.o ofb64enc.o ofb_enc.o \ | ||
75 | rand_key.o read_pwd.o read2pwd.o rpc_enc.o str2key.o supp.o | ||
76 | |||
77 | GENERAL_LIT=COPYRIGHT INSTALL README VERSION Makefile des_crypt.man \ | ||
78 | des.doc options.txt asm | ||
79 | GENERAL_FULL=$(GENERAL_LIT) FILES Imakefile times vms.com KERBEROS MODES.DES \ | ||
80 | des.man DES.pm DES.pod DES.xs Makefile.PL dess.cpp des3s.cpp \ | ||
81 | Makefile.uni typemap t Makefile.ssl makefile.bc Makefile.lit \ | ||
82 | des.org des_locl.org | ||
83 | TESTING_LIT= destest speed des_opts | ||
84 | TESTING_FULL= rpw des $(TESTING_LIT) | ||
85 | TESTING_SRC_LIT=destest.c speed.c des_opts.c | ||
86 | TESTING_SRC_FULL=rpw.c des.c $(TESTING_SRC_LIT) | ||
87 | HEADERS_LIT=des_ver.h des.h des_locl.h podd.h sk.h spr.h | ||
88 | HEADERS_FULL= $(HEADERS_LIT) rpc_des.h | ||
89 | LIBDES_LIT=cbc_enc.c ecb_enc.c fcrypt.c set_key.c des_enc.c fcrypt_b.c | ||
90 | LIBDES_FULL= cbc_cksm.c pcbc_enc.c qud_cksm.c cbc3_enc.c \ | ||
91 | cfb64ede.c cfb64enc.c cfb_enc.c ecb3_enc.c \ | ||
92 | enc_read.c enc_writ.c ofb64ede.c ofb64enc.c ofb_enc.c \ | ||
93 | rand_key.c rpc_enc.c str2key.c supp.c \ | ||
94 | xcbc_enc.c $(LIBDES_LIT) read_pwd.c read2pwd.c | ||
95 | |||
96 | PERL= des.pl testdes.pl doIP doPC1 doPC2 PC1 PC2 shifts.pl | ||
97 | |||
98 | OBJ= $(OBJ_FULL) | ||
99 | GENERAL=$(GENERAL_FULL) | ||
100 | TESTING=$(TESTING_FULL) | ||
101 | TESTING_SRC=$(TESTING_SRC_FULL) | ||
102 | HEADERS=$(HEADERS_FULL) | ||
103 | LIBDES= $(LIBDES_FULL) | ||
104 | |||
105 | ALL= $(GENERAL) $(TESTING_SRC) $(LIBDES) $(PERL) $(HEADERS) | ||
106 | |||
107 | DLIB= libdes.a | ||
108 | |||
109 | all: $(DLIB) $(TESTING) | ||
110 | |||
111 | cc: | ||
112 | $(MAKE) CC=cc CFLAGS="-O $(OPTS) $(CFLAG)" all | ||
113 | |||
114 | gcc: | ||
115 | $(MAKE) CC=gcc CFLAGS="-O3 -fomit-frame-pointer $(OPTS) $(CFLAG)" all | ||
116 | |||
117 | x86-elf: | ||
118 | $(MAKE) DES_ENC='asm/dx86-elf.o asm/yx86-elf.o' CC=$(CC) CFLAGS="-DELF $(OPTS) $(CFLAG)" all | ||
119 | |||
120 | x86-out: | ||
121 | $(MAKE) DES_ENC='asm/dx86-out.o asm/yx86-out.o' CC=$(CC) CFLAGS="-DOUT $(OPTS) $(CFLAG)" all | ||
122 | |||
123 | x86-solaris: | ||
124 | $(MAKE) DES_ENC='asm/dx86-sol.o asm/yx86-sol.o' CC=$(CC) CFLAGS="-DSOL $(OPTS) $(CFLAG)" all | ||
125 | |||
126 | x86-bsdi: | ||
127 | $(MAKE) DES_ENC='asm/dx86bsdi.o asm/yx86bsdi.o' CC=$(CC) CFLAGS="-DBSDI $(OPTS) $(CFLAG)" all | ||
128 | |||
129 | # elf | ||
130 | asm/dx86-elf.o: asm/dx86unix.cpp | ||
131 | $(CPP) -DELF asm/dx86unix.cpp | $(AS) -o asm/dx86-elf.o | ||
132 | |||
133 | asm/yx86-elf.o: asm/yx86unix.cpp | ||
134 | $(CPP) -DELF asm/yx86unix.cpp | $(AS) -o asm/yx86-elf.o | ||
135 | |||
136 | # solaris | ||
137 | asm/dx86-sol.o: asm/dx86unix.cpp | ||
138 | $(CC) -E -DSOL asm/dx86unix.cpp | sed 's/^#.*//' > asm/dx86-sol.s | ||
139 | as -o asm/dx86-sol.o asm/dx86-sol.s | ||
140 | rm -f asm/dx86-sol.s | ||
141 | |||
142 | asm/yx86-sol.o: asm/yx86unix.cpp | ||
143 | $(CC) -E -DSOL asm/yx86unix.cpp | sed 's/^#.*//' > asm/yx86-sol.s | ||
144 | as -o asm/yx86-sol.o asm/yx86-sol.s | ||
145 | rm -f asm/yx86-sol.s | ||
146 | |||
147 | # a.out | ||
148 | asm/dx86-out.o: asm/dx86unix.cpp | ||
149 | $(CPP) -DOUT asm/dx86unix.cpp | $(AS) -o asm/dx86-out.o | ||
150 | |||
151 | asm/yx86-out.o: asm/yx86unix.cpp | ||
152 | $(CPP) -DOUT asm/yx86unix.cpp | $(AS) -o asm/yx86-out.o | ||
153 | |||
154 | # bsdi | ||
155 | asm/dx86bsdi.o: asm/dx86unix.cpp | ||
156 | $(CPP) -DBSDI asm/dx86unix.cpp | $(AS) -o asm/dx86bsdi.o | ||
157 | |||
158 | asm/yx86bsdi.o: asm/yx86unix.cpp | ||
159 | $(CPP) -DBSDI asm/yx86unix.cpp | $(AS) -o asm/yx86bsdi.o | ||
160 | |||
161 | asm/dx86unix.cpp: | ||
162 | (cd asm; perl des-586.pl cpp >dx86unix.cpp) | ||
163 | |||
164 | asm/yx86unix.cpp: | ||
165 | (cd asm; perl crypt586.pl cpp >yx86unix.cpp) | ||
166 | |||
167 | test: all | ||
168 | ./destest | ||
169 | |||
170 | $(DLIB): $(OBJ) | ||
171 | /bin/rm -f $(DLIB) | ||
172 | ar cr $(DLIB) $(OBJ) | ||
173 | $(RANLIB) $(DLIB) | ||
174 | |||
175 | des_opts: des_opts.o $(DLIB) | ||
176 | $(CC) $(CFLAGS) -o des_opts des_opts.o $(DLIB) | ||
177 | |||
178 | destest: destest.o $(DLIB) | ||
179 | $(CC) $(CFLAGS) -o destest destest.o $(DLIB) | ||
180 | |||
181 | rpw: rpw.o $(DLIB) | ||
182 | $(CC) $(CFLAGS) -o rpw rpw.o $(DLIB) | ||
183 | |||
184 | speed: speed.o $(DLIB) | ||
185 | $(CC) $(CFLAGS) -o speed speed.o $(DLIB) | ||
186 | |||
187 | des: des.o $(DLIB) | ||
188 | $(CC) $(CFLAGS) -o des des.o $(DLIB) | ||
189 | |||
190 | tags: | ||
191 | ctags $(TESTING_SRC) $(LIBDES) | ||
192 | |||
193 | tar_lit: | ||
194 | /bin/mv Makefile Makefile.tmp | ||
195 | /bin/cp Makefile.lit Makefile | ||
196 | for i in $(HEADERS_LIT) $(LIBDES_LIT) $(GENERAL_LIT) $(TESTING_SRC_LIT) ;\ | ||
197 | do \ | ||
198 | n="$$n des/$$i"; \ | ||
199 | done; \ | ||
200 | ( cd .. ; tar chf - $$n )| gzip > libdes-l.tgz | ||
201 | /bin/rm -f Makefile | ||
202 | /bin/mv Makefile.tmp Makefile | ||
203 | |||
204 | tar: | ||
205 | mv Makefile Makefile.tmp | ||
206 | /bin/cp Makefile.uni Makefile | ||
207 | for i in $(ALL) ;\ | ||
208 | do \ | ||
209 | n="$$n des/$$i"; \ | ||
210 | done; \ | ||
211 | ( cd .. ; tar chf - $$n )| gzip > libdes.tgz | ||
212 | /bin/rm -f Makefile | ||
213 | /bin/mv Makefile.tmp Makefile | ||
214 | |||
215 | shar: | ||
216 | shar $(ALL) >libdes.shar | ||
217 | |||
218 | depend: | ||
219 | makedepend $(LIBDES) $(TESTING_SRC) | ||
220 | |||
221 | clean: | ||
222 | /bin/rm -f *.o tags core $(TESTING) $(DLIB) .nfs* *.old *.bak asm/*.o | ||
223 | |||
224 | dclean: | ||
225 | sed -e '/^# DO NOT DELETE THIS LINE/ q' Makefile >Makefile.new | ||
226 | mv -f Makefile.new Makefile | ||
227 | |||
228 | # Eric is probably going to choke when he next looks at this --tjh | ||
229 | install: des | ||
230 | if test $(INSTALLTOP); then \ | ||
231 | echo SSL style install; \ | ||
232 | cp $(DLIB) $(INSTALLTOP)/lib; \ | ||
233 | $(RANLIB) $(DLIB); \ | ||
234 | chmod 644 $(INSTALLTOP)/lib/$(DLIB); \ | ||
235 | cp des.h $(INSTALLTOP)/include; \ | ||
236 | chmod 644 $(INSTALLTOP)/include/des.h; \ | ||
237 | else \ | ||
238 | echo Standalone install; \ | ||
239 | cp $(DLIB) $(LIBDIR)/$(DLIB); \ | ||
240 | $(RANLIB) $(DLIB); \ | ||
241 | chmod 644 $(LIBDIR)/$(DLIB); \ | ||
242 | cp des $(BINDIR)/des; \ | ||
243 | chmod 711 $(BINDIR)/des; \ | ||
244 | cp des_crypt.man $(MANDIR)/man$(MAN3)/des_crypt.$(MAN3); \ | ||
245 | chmod 644 $(MANDIR)/man$(MAN3)/des_crypt.$(MAN3); \ | ||
246 | cp des.man $(MANDIR)/man$(MAN1)/des.$(MAN1); \ | ||
247 | chmod 644 $(MANDIR)/man$(MAN1)/des.$(MAN1); \ | ||
248 | cp des.h $(INCDIR)/des.h; \ | ||
249 | chmod 644 $(INCDIR)/des.h; \ | ||
250 | fi | ||
251 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
diff --git a/src/lib/libcrypto/des/PC1 b/src/lib/libcrypto/des/PC1 index efb8348b72..e69de29bb2 100644 --- a/src/lib/libcrypto/des/PC1 +++ b/src/lib/libcrypto/des/PC1 | |||
@@ -1,28 +0,0 @@ | |||
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 index 2d560270ec..e69de29bb2 100644 --- a/src/lib/libcrypto/des/PC2 +++ b/src/lib/libcrypto/des/PC2 | |||
@@ -1,57 +0,0 @@ | |||
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 index 9e3dc9cd87..e69de29bb2 100644 --- a/src/lib/libcrypto/des/asm/d-win32.asm +++ b/src/lib/libcrypto/des/asm/d-win32.asm | |||
@@ -1,3132 +0,0 @@ | |||
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/y-win32.asm b/src/lib/libcrypto/des/asm/y-win32.asm index af5c102422..e69de29bb2 100644 --- a/src/lib/libcrypto/des/asm/y-win32.asm +++ b/src/lib/libcrypto/des/asm/y-win32.asm | |||
@@ -1,929 +0,0 @@ | |||
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/des.c b/src/lib/libcrypto/des/des.c index 91d7153b34..0197489c9e 100644 --- a/src/lib/libcrypto/des/des.c +++ b/src/lib/libcrypto/des/des.c | |||
@@ -58,6 +58,7 @@ | |||
58 | 58 | ||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
61 | #include <string.h> | ||
61 | #ifndef MSDOS | 62 | #ifndef MSDOS |
62 | #ifndef VMS | 63 | #ifndef VMS |
63 | #include <openssl/opensslconf.h> | 64 | #include <openssl/opensslconf.h> |
@@ -69,7 +70,7 @@ | |||
69 | #include <math.h> | 70 | #include <math.h> |
70 | #endif /* __DECC */ | 71 | #endif /* __DECC */ |
71 | #endif /* VMS */ | 72 | #endif /* VMS */ |
72 | #else | 73 | #else /* MSDOS */ |
73 | #include <io.h> | 74 | #include <io.h> |
74 | #endif | 75 | #endif |
75 | 76 | ||
@@ -88,10 +89,6 @@ | |||
88 | #include <openssl/des.h> | 89 | #include <openssl/des.h> |
89 | #include <openssl/rand.h> | 90 | #include <openssl/rand.h> |
90 | 91 | ||
91 | #if defined(__STDC__) || defined(VMS) || defined(M_XENIX) || defined(MSDOS) | ||
92 | #include <string.h> | ||
93 | #endif | ||
94 | |||
95 | void usage(void); | 92 | void usage(void); |
96 | void doencryption(void); | 93 | void doencryption(void); |
97 | int uufwrite(unsigned char *data, int size, unsigned int num, FILE *fp); | 94 | int uufwrite(unsigned char *data, int size, unsigned int num, FILE *fp); |
diff --git a/src/lib/libcrypto/des/des.h b/src/lib/libcrypto/des/des.h index 98a9c4127c..ead67986d9 100644 --- a/src/lib/libcrypto/des/des.h +++ b/src/lib/libcrypto/des/des.h | |||
@@ -78,10 +78,7 @@ extern "C" { | |||
78 | typedef unsigned char des_cblock[8]; | 78 | typedef unsigned char des_cblock[8]; |
79 | typedef /* const */ unsigned char const_des_cblock[8]; | 79 | typedef /* const */ unsigned char const_des_cblock[8]; |
80 | /* With "const", gcc 2.8.1 on Solaris thinks that des_cblock * | 80 | /* With "const", gcc 2.8.1 on Solaris thinks that des_cblock * |
81 | * and const_des_cblock * are incompatible pointer types. | 81 | * and const_des_cblock * are incompatible pointer types. */ |
82 | * I haven't seen that warning on other systems ... I'll look | ||
83 | * what the standard says. */ | ||
84 | |||
85 | 82 | ||
86 | typedef struct des_ks_struct | 83 | typedef struct des_ks_struct |
87 | { | 84 | { |
@@ -141,8 +138,26 @@ void des_cfb_encrypt(const unsigned char *in,unsigned char *out,int numbits, | |||
141 | int enc); | 138 | int enc); |
142 | void des_ecb_encrypt(const_des_cblock *input,des_cblock *output, | 139 | void des_ecb_encrypt(const_des_cblock *input,des_cblock *output, |
143 | des_key_schedule ks,int enc); | 140 | des_key_schedule ks,int enc); |
141 | |||
142 | /* This is the DES encryption function that gets called by just about | ||
143 | every other DES routine in the library. You should not use this | ||
144 | function except to implement 'modes' of DES. I say this because the | ||
145 | functions that call this routine do the conversion from 'char *' to | ||
146 | long, and this needs to be done to make sure 'non-aligned' memory | ||
147 | access do not occur. The characters are loaded 'little endian'. | ||
148 | Data is a pointer to 2 unsigned long's and ks is the | ||
149 | des_key_schedule to use. enc, is non zero specifies encryption, | ||
150 | zero if decryption. */ | ||
144 | void des_encrypt(DES_LONG *data,des_key_schedule ks, int enc); | 151 | void des_encrypt(DES_LONG *data,des_key_schedule ks, int enc); |
152 | |||
153 | /* This functions is the same as des_encrypt() except that the DES | ||
154 | initial permutation (IP) and final permutation (FP) have been left | ||
155 | out. As for des_encrypt(), you should not use this function. | ||
156 | It is used by the routines in the library that implement triple DES. | ||
157 | IP() des_encrypt2() des_encrypt2() des_encrypt2() FP() is the same | ||
158 | as des_encrypt() des_encrypt() des_encrypt() except faster :-). */ | ||
145 | void des_encrypt2(DES_LONG *data,des_key_schedule ks, int enc); | 159 | void des_encrypt2(DES_LONG *data,des_key_schedule ks, int enc); |
160 | |||
146 | void des_encrypt3(DES_LONG *data, des_key_schedule ks1, | 161 | void des_encrypt3(DES_LONG *data, des_key_schedule ks1, |
147 | des_key_schedule ks2, des_key_schedule ks3); | 162 | des_key_schedule ks2, des_key_schedule ks3); |
148 | void des_decrypt3(DES_LONG *data, des_key_schedule ks1, | 163 | void des_decrypt3(DES_LONG *data, des_key_schedule ks1, |
@@ -192,6 +207,7 @@ int des_read_2passwords(des_cblock *key1,des_cblock *key2, | |||
192 | const char *prompt,int verify); | 207 | const char *prompt,int verify); |
193 | int des_read_pw_string(char *buf,int length,const char *prompt,int verify); | 208 | int des_read_pw_string(char *buf,int length,const char *prompt,int verify); |
194 | void des_set_odd_parity(des_cblock *key); | 209 | void des_set_odd_parity(des_cblock *key); |
210 | int des_check_key_parity(const_des_cblock *key); | ||
195 | int des_is_weak_key(const_des_cblock *key); | 211 | int des_is_weak_key(const_des_cblock *key); |
196 | /* des_set_key (= set_key = des_key_sched = key_sched) calls | 212 | /* des_set_key (= set_key = des_key_sched = key_sched) calls |
197 | * des_set_key_checked if global variable des_check_key is set, | 213 | * des_set_key_checked if global variable des_check_key is set, |
@@ -209,9 +225,6 @@ void des_ofb64_encrypt(const unsigned char *in,unsigned char *out,long length, | |||
209 | des_key_schedule schedule,des_cblock *ivec,int *num); | 225 | des_key_schedule schedule,des_cblock *ivec,int *num); |
210 | int des_read_pw(char *buf,char *buff,int size,const char *prompt,int verify); | 226 | int des_read_pw(char *buf,char *buff,int size,const char *prompt,int verify); |
211 | 227 | ||
212 | /* Extra functions from Mark Murray <mark@grondar.za> */ | ||
213 | void des_cblock_print_file(const_des_cblock *cb, FILE *fp); | ||
214 | |||
215 | /* The following definitions provide compatibility with the MIT Kerberos | 228 | /* The following definitions provide compatibility with the MIT Kerberos |
216 | * library. The des_key_schedule structure is not binary compatible. */ | 229 | * library. The des_key_schedule structure is not binary compatible. */ |
217 | 230 | ||
@@ -241,11 +254,11 @@ void des_cblock_print_file(const_des_cblock *cb, FILE *fp); | |||
241 | # define xcbc_encrypt des_xcbc_encrypt | 254 | # define xcbc_encrypt des_xcbc_encrypt |
242 | # define cbc_cksum des_cbc_cksum | 255 | # define cbc_cksum des_cbc_cksum |
243 | # define quad_cksum des_quad_cksum | 256 | # define quad_cksum des_quad_cksum |
257 | # define check_parity des_check_key_parity | ||
244 | #endif | 258 | #endif |
245 | 259 | ||
246 | typedef des_key_schedule bit_64; | 260 | typedef des_key_schedule bit_64; |
247 | #define des_fixup_key_parity des_set_odd_parity | 261 | #define des_fixup_key_parity des_set_odd_parity |
248 | #define des_check_key_parity check_parity | ||
249 | 262 | ||
250 | #ifdef __cplusplus | 263 | #ifdef __cplusplus |
251 | } | 264 | } |
diff --git a/src/lib/libcrypto/des/des.man b/src/lib/libcrypto/des/des.man index 7e06a1851a..e69de29bb2 100644 --- a/src/lib/libcrypto/des/des.man +++ b/src/lib/libcrypto/des/des.man | |||
@@ -1,186 +0,0 @@ | |||
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.pl b/src/lib/libcrypto/des/des.pl index 8a3f7e3ed6..e69de29bb2 100644 --- a/src/lib/libcrypto/des/des.pl +++ b/src/lib/libcrypto/des/des.pl | |||
@@ -1,552 +0,0 @@ | |||
1 | #!/usr/local/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.pod b/src/lib/libcrypto/des/des.pod new file mode 100644 index 0000000000..bf479e83d2 --- /dev/null +++ b/src/lib/libcrypto/des/des.pod | |||
@@ -0,0 +1,217 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | des - encrypt or decrypt data using Data Encryption Standard | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | B<des> | ||
10 | ( | ||
11 | B<-e> | ||
12 | | | ||
13 | B<-E> | ||
14 | ) | ( | ||
15 | B<-d> | ||
16 | | | ||
17 | B<-D> | ||
18 | ) | ( | ||
19 | B<->[B<cC>][B<ckname>] | ||
20 | ) | | ||
21 | [ | ||
22 | B<-b3hfs> | ||
23 | ] [ | ||
24 | B<-k> | ||
25 | I<key> | ||
26 | ] | ||
27 | ] [ | ||
28 | B<-u>[I<uuname>] | ||
29 | [ | ||
30 | I<input-file> | ||
31 | [ | ||
32 | I<output-file> | ||
33 | ] ] | ||
34 | |||
35 | =head1 NOTE | ||
36 | |||
37 | This page describes the B<des> stand-alone program, not the B<openssl des> | ||
38 | command. | ||
39 | |||
40 | =head1 DESCRIPTION | ||
41 | |||
42 | B<des> | ||
43 | encrypts and decrypts data using the | ||
44 | Data Encryption Standard algorithm. | ||
45 | One of | ||
46 | B<-e>, B<-E> | ||
47 | (for encrypt) or | ||
48 | B<-d>, B<-D> | ||
49 | (for decrypt) must be specified. | ||
50 | It is also possible to use | ||
51 | B<-c> | ||
52 | or | ||
53 | B<-C> | ||
54 | in conjunction or instead of the a encrypt/decrypt option to generate | ||
55 | a 16 character hexadecimal checksum, generated via the | ||
56 | I<des_cbc_cksum>. | ||
57 | |||
58 | Two standard encryption modes are supported by the | ||
59 | B<des> | ||
60 | program, Cipher Block Chaining (the default) and Electronic Code Book | ||
61 | (specified with | ||
62 | B<-b>). | ||
63 | |||
64 | The key used for the DES | ||
65 | algorithm is obtained by prompting the user unless the | ||
66 | B<-k> | ||
67 | I<key> | ||
68 | option is given. | ||
69 | If the key is an argument to the | ||
70 | B<des> | ||
71 | command, it is potentially visible to users executing | ||
72 | ps(1) | ||
73 | or a derivative. To minimise this possibility, | ||
74 | B<des> | ||
75 | takes care to destroy the key argument immediately upon entry. | ||
76 | If your shell keeps a history file be careful to make sure it is not | ||
77 | world readable. | ||
78 | |||
79 | Since this program attempts to maintain compatibility with sunOS's | ||
80 | des(1) command, there are 2 different methods used to convert the user | ||
81 | supplied key to a des key. | ||
82 | Whenever and one or more of | ||
83 | B<-E>, B<-D>, B<-C> | ||
84 | or | ||
85 | B<-3> | ||
86 | options are used, the key conversion procedure will not be compatible | ||
87 | with the sunOS des(1) version but will use all the user supplied | ||
88 | character to generate the des key. | ||
89 | B<des> | ||
90 | command reads from standard input unless | ||
91 | I<input-file> | ||
92 | is specified and writes to standard output unless | ||
93 | I<output-file> | ||
94 | is given. | ||
95 | |||
96 | =head1 OPTIONS | ||
97 | |||
98 | =over 4 | ||
99 | |||
100 | =item B<-b> | ||
101 | |||
102 | Select ECB | ||
103 | (eight bytes at a time) encryption mode. | ||
104 | |||
105 | =item B<-3> | ||
106 | |||
107 | Encrypt using triple encryption. | ||
108 | By default triple cbc encryption is used but if the | ||
109 | B<-b> | ||
110 | option is used then triple ECB encryption is performed. | ||
111 | If the key is less than 8 characters long, the flag has no effect. | ||
112 | |||
113 | =item B<-e> | ||
114 | |||
115 | Encrypt data using an 8 byte key in a manner compatible with sunOS | ||
116 | des(1). | ||
117 | |||
118 | =item B<-E> | ||
119 | |||
120 | Encrypt data using a key of nearly unlimited length (1024 bytes). | ||
121 | This will product a more secure encryption. | ||
122 | |||
123 | =item B<-d> | ||
124 | |||
125 | Decrypt data that was encrypted with the B<-e> option. | ||
126 | |||
127 | =item B<-D> | ||
128 | |||
129 | Decrypt data that was encrypted with the B<-E> option. | ||
130 | |||
131 | =item B<-c> | ||
132 | |||
133 | Generate a 16 character hexadecimal cbc checksum and output this to | ||
134 | stderr. | ||
135 | If a filename was specified after the | ||
136 | B<-c> | ||
137 | option, the checksum is output to that file. | ||
138 | The checksum is generated using a key generated in a sunOS compatible | ||
139 | manner. | ||
140 | |||
141 | =item B<-C> | ||
142 | |||
143 | A cbc checksum is generated in the same manner as described for the | ||
144 | B<-c> | ||
145 | option but the DES key is generated in the same manner as used for the | ||
146 | B<-E> | ||
147 | and | ||
148 | B<-D> | ||
149 | options | ||
150 | |||
151 | =item B<-f> | ||
152 | |||
153 | Does nothing - allowed for compatibility with sunOS des(1) command. | ||
154 | |||
155 | =item B<-s> | ||
156 | |||
157 | Does nothing - allowed for compatibility with sunOS des(1) command. | ||
158 | |||
159 | =item B<-k> I<key> | ||
160 | |||
161 | Use the encryption | ||
162 | I<key> | ||
163 | specified. | ||
164 | |||
165 | =item B<-h> | ||
166 | |||
167 | The | ||
168 | I<key> | ||
169 | is assumed to be a 16 character hexadecimal number. | ||
170 | If the | ||
171 | B<-3> | ||
172 | option is used the key is assumed to be a 32 character hexadecimal | ||
173 | number. | ||
174 | |||
175 | =item B<-u> | ||
176 | |||
177 | This flag is used to read and write uuencoded files. If decrypting, | ||
178 | the input file is assumed to contain uuencoded, DES encrypted data. | ||
179 | If encrypting, the characters following the B<-u> are used as the name of | ||
180 | the uuencoded file to embed in the begin line of the uuencoded | ||
181 | output. If there is no name specified after the B<-u>, the name text.des | ||
182 | will be embedded in the header. | ||
183 | |||
184 | =head1 SEE ALSO | ||
185 | |||
186 | ps(1), | ||
187 | L<des_crypt(3)|des_crypt(3)> | ||
188 | |||
189 | =head1 BUGS | ||
190 | |||
191 | The problem with using the | ||
192 | B<-e> | ||
193 | option is the short key length. | ||
194 | It would be better to use a real 56-bit key rather than an | ||
195 | ASCII-based 56-bit pattern. Knowing that the key was derived from ASCII | ||
196 | radically reduces the time necessary for a brute-force cryptographic attack. | ||
197 | My attempt to remove this problem is to add an alternative text-key to | ||
198 | DES-key function. This alternative function (accessed via | ||
199 | B<-E>, B<-D>, B<-S> | ||
200 | and | ||
201 | B<-3>) | ||
202 | uses DES to help generate the key. | ||
203 | |||
204 | Be carefully when using the B<-u> option. Doing B<des -ud> I<filename> will | ||
205 | not decrypt filename (the B<-u> option will gobble the B<-d> option). | ||
206 | |||
207 | The VMS operating system operates in a world where files are always a | ||
208 | multiple of 512 bytes. This causes problems when encrypted data is | ||
209 | send from Unix to VMS since a 88 byte file will suddenly be padded | ||
210 | with 424 null bytes. To get around this problem, use the B<-u> option | ||
211 | to uuencode the data before it is send to the VMS system. | ||
212 | |||
213 | =head1 AUTHOR | ||
214 | |||
215 | Eric Young (eay@cryptsoft.com) | ||
216 | |||
217 | =cut | ||
diff --git a/src/lib/libcrypto/des/des_crypt.man b/src/lib/libcrypto/des/des_crypt.man index 0ecc416877..e69de29bb2 100644 --- a/src/lib/libcrypto/des/des_crypt.man +++ b/src/lib/libcrypto/des/des_crypt.man | |||
@@ -1,508 +0,0 @@ | |||
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.h b/src/lib/libcrypto/des/des_locl.h index 4dfed199a7..1ace8f5930 100644 --- a/src/lib/libcrypto/des/des_locl.h +++ b/src/lib/libcrypto/des/des_locl.h | |||
@@ -155,7 +155,7 @@ | |||
155 | } \ | 155 | } \ |
156 | } | 156 | } |
157 | 157 | ||
158 | #if defined(WIN32) | 158 | #if defined(WIN32) && defined(_MSC_VER) |
159 | #define ROTATE(a,n) (_lrotr(a,n)) | 159 | #define ROTATE(a,n) (_lrotr(a,n)) |
160 | #else | 160 | #else |
161 | #define ROTATE(a,n) (((a)>>(n))+((a)<<(32-(n)))) | 161 | #define ROTATE(a,n) (((a)>>(n))+((a)<<(32-(n)))) |
diff --git a/src/lib/libcrypto/des/destest.c b/src/lib/libcrypto/des/destest.c index 9ad4ecb072..df0d615d6b 100644 --- a/src/lib/libcrypto/des/destest.c +++ b/src/lib/libcrypto/des/destest.c | |||
@@ -336,8 +336,15 @@ int main(int argc, char *argv[]) | |||
336 | unsigned char cbc_in[40]; | 336 | unsigned char cbc_in[40]; |
337 | unsigned char cbc_out[40]; | 337 | unsigned char cbc_out[40]; |
338 | DES_LONG cs; | 338 | DES_LONG cs; |
339 | unsigned char qret[4][4],cret[8]; | 339 | unsigned char cret[8]; |
340 | DES_LONG lqret[4]; | 340 | #ifdef _CRAY |
341 | struct { | ||
342 | int a:32; | ||
343 | int b:32; | ||
344 | } lqret[2]; | ||
345 | #else | ||
346 | DES_LONG lqret[4]; | ||
347 | #endif | ||
341 | int num; | 348 | int num; |
342 | char *str; | 349 | char *str; |
343 | 350 | ||
@@ -701,43 +708,40 @@ plain[8+4], plain[8+5], plain[8+6], plain[8+7]); | |||
701 | } | 708 | } |
702 | 709 | ||
703 | printf("Doing quad_cksum\n"); | 710 | printf("Doing quad_cksum\n"); |
704 | /* This is obviously done this way especially to puzzle me. Although | 711 | cs=quad_cksum(cbc_data,(des_cblock *)lqret, |
705 | quad_cksum returns up to 4 groups of 8 bytes, this test gets it to | 712 | (long)strlen((char *)cbc_data),2,(des_cblock *)cbc_iv); |
706 | produce 2 groups then treats them as 4 groups of 4 bytes. | 713 | if (cs != 0x70d7a63aL) |
707 | Ben 13 Feb 1999 */ | ||
708 | cs=quad_cksum(cbc_data,(des_cblock *)qret,strlen((char *)cbc_data),2, | ||
709 | &cbc_iv); | ||
710 | |||
711 | { /* Big-endian fix */ | ||
712 | static DES_LONG l=1; | ||
713 | static unsigned char *c=(unsigned char *)&l; | ||
714 | DES_LONG ll; | ||
715 | |||
716 | j=sizeof(lqret[0])-4; | ||
717 | for (i=0; i<4; i++) | ||
718 | { | 714 | { |
719 | lqret[i]=0; | 715 | printf("quad_cksum error, ret %08lx should be 70d7a63a\n", |
720 | memcpy(&(lqret[i]),&(qret[i][0]),4); | 716 | (unsigned long)cs); |
721 | if (!c[0] && (j > 0)) | 717 | err=1; |
722 | lqret[i]=lqret[i]>>(j*8); /* For Cray */ | ||
723 | } | 718 | } |
724 | 719 | #ifdef _CRAY | |
725 | if (!c[0]) | 720 | if (lqret[0].a != 0x327eba8dL) |
726 | { | 721 | { |
727 | ll=lqret[0]^lqret[3]; | 722 | printf("quad_cksum error, out[0] %08lx is not %08lx\n", |
728 | lqret[0]^=ll; | 723 | (unsigned long)lqret[0].a,0x327eba8dUL); |
729 | lqret[3]^=ll; | 724 | err=1; |
730 | ll=lqret[1]^lqret[2]; | ||
731 | lqret[1]^=ll; | ||
732 | lqret[2]^=ll; | ||
733 | } | 725 | } |
734 | } | 726 | if (lqret[0].b != 0x201a49ccL) |
735 | if (cs != 0x70d7a63aL) | ||
736 | { | 727 | { |
737 | printf("quad_cksum error, ret %08lx should be 70d7a63a\n", | 728 | printf("quad_cksum error, out[1] %08lx is not %08lx\n", |
738 | (unsigned long)cs); | 729 | (unsigned long)lqret[0].b,0x201a49ccUL); |
730 | err=1; | ||
731 | } | ||
732 | if (lqret[1].a != 0x70d7a63aL) | ||
733 | { | ||
734 | printf("quad_cksum error, out[2] %08lx is not %08lx\n", | ||
735 | (unsigned long)lqret[1].a,0x70d7a63aUL); | ||
739 | err=1; | 736 | err=1; |
740 | } | 737 | } |
738 | if (lqret[1].b != 0x501c2c26L) | ||
739 | { | ||
740 | printf("quad_cksum error, out[3] %08lx is not %08lx\n", | ||
741 | (unsigned long)lqret[1].b,0x501c2c26UL); | ||
742 | err=1; | ||
743 | } | ||
744 | #else | ||
741 | if (lqret[0] != 0x327eba8dL) | 745 | if (lqret[0] != 0x327eba8dL) |
742 | { | 746 | { |
743 | printf("quad_cksum error, out[0] %08lx is not %08lx\n", | 747 | printf("quad_cksum error, out[0] %08lx is not %08lx\n", |
@@ -763,6 +767,7 @@ plain[8+4], plain[8+5], plain[8+6], plain[8+7]); | |||
763 | err=1; | 767 | err=1; |
764 | } | 768 | } |
765 | #endif | 769 | #endif |
770 | #endif | ||
766 | 771 | ||
767 | printf("input word alignment test"); | 772 | printf("input word alignment test"); |
768 | for (i=0; i<4; i++) | 773 | for (i=0; i<4; i++) |
diff --git a/src/lib/libcrypto/des/doIP b/src/lib/libcrypto/des/doIP index 18cf231303..e69de29bb2 100644 --- a/src/lib/libcrypto/des/doIP +++ b/src/lib/libcrypto/des/doIP | |||
@@ -1,46 +0,0 @@ | |||
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 index 096afd8c46..e69de29bb2 100644 --- a/src/lib/libcrypto/des/doPC1 +++ b/src/lib/libcrypto/des/doPC1 | |||
@@ -1,110 +0,0 @@ | |||
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 index fa5cf74cf7..e69de29bb2 100644 --- a/src/lib/libcrypto/des/doPC2 +++ b/src/lib/libcrypto/des/doPC2 | |||
@@ -1,94 +0,0 @@ | |||
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/fcrypt.c b/src/lib/libcrypto/des/fcrypt.c index fa1b8aa34a..9b21f81cc2 100644 --- a/src/lib/libcrypto/des/fcrypt.c +++ b/src/lib/libcrypto/des/fcrypt.c | |||
@@ -3,7 +3,6 @@ | |||
3 | 3 | ||
4 | /* This version of crypt has been developed from my MIT compatible | 4 | /* This version of crypt has been developed from my MIT compatible |
5 | * DES library. | 5 | * DES library. |
6 | * The library is available at pub/Crypto/DES at ftp.psy.uq.oz.au | ||
7 | * Eric Young (eay@cryptsoft.com) | 6 | * Eric Young (eay@cryptsoft.com) |
8 | */ | 7 | */ |
9 | 8 | ||
diff --git a/src/lib/libcrypto/des/fcrypt_b.c b/src/lib/libcrypto/des/fcrypt_b.c index 83c94054e3..22c87f5983 100644 --- a/src/lib/libcrypto/des/fcrypt_b.c +++ b/src/lib/libcrypto/des/fcrypt_b.c | |||
@@ -97,7 +97,7 @@ void fcrypt_body(DES_LONG *out, des_key_schedule ks, DES_LONG Eswap0, | |||
97 | 97 | ||
98 | for (j=0; j<25; j++) | 98 | for (j=0; j<25; j++) |
99 | { | 99 | { |
100 | #ifdef DES_UNROLL | 100 | #ifndef DES_UNROLL |
101 | register int i; | 101 | register int i; |
102 | 102 | ||
103 | for (i=0; i<32; i+=8) | 103 | for (i=0; i<32; i+=8) |
diff --git a/src/lib/libcrypto/des/ncbc_enc.c b/src/lib/libcrypto/des/ncbc_enc.c index e0e67a417d..3b681691a9 100644 --- a/src/lib/libcrypto/des/ncbc_enc.c +++ b/src/lib/libcrypto/des/ncbc_enc.c | |||
@@ -1,4 +1,9 @@ | |||
1 | /* crypto/des/ncbc_enc.c */ | 1 | /* crypto/des/ncbc_enc.c */ |
2 | /* | ||
3 | * #included by: | ||
4 | * cbc_enc.c (des_cbc_encrypt) | ||
5 | * des_enc.c (des_ncbc_encrypt) | ||
6 | */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 7 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 8 | * All rights reserved. |
4 | * | 9 | * |
diff --git a/src/lib/libcrypto/des/podd.h b/src/lib/libcrypto/des/podd.h index 1b2bfe0843..e69de29bb2 100644 --- a/src/lib/libcrypto/des/podd.h +++ b/src/lib/libcrypto/des/podd.h | |||
@@ -1,75 +0,0 @@ | |||
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/qud_cksm.c b/src/lib/libcrypto/des/qud_cksm.c index 6ce8c61b42..5f0ec5387f 100644 --- a/src/lib/libcrypto/des/qud_cksm.c +++ b/src/lib/libcrypto/des/qud_cksm.c | |||
@@ -80,10 +80,14 @@ DES_LONG des_quad_cksum(const unsigned char *input, des_cblock output[], | |||
80 | int i; | 80 | int i; |
81 | long l; | 81 | long l; |
82 | const unsigned char *cp; | 82 | const unsigned char *cp; |
83 | unsigned char *lp; | 83 | #ifdef _CRAY |
84 | short *lp; | ||
85 | #else | ||
86 | DES_LONG *lp; | ||
87 | #endif | ||
84 | 88 | ||
85 | if (out_count < 1) out_count=1; | 89 | if (out_count < 1) out_count=1; |
86 | lp = &(output[0])[0]; | 90 | lp = (DES_LONG *) &(output[0])[0]; |
87 | 91 | ||
88 | z0=Q_B0((*seed)[0])|Q_B1((*seed)[1])|Q_B2((*seed)[2])|Q_B3((*seed)[3]); | 92 | z0=Q_B0((*seed)[0])|Q_B1((*seed)[1])|Q_B2((*seed)[2])|Q_B3((*seed)[3]); |
89 | z1=Q_B0((*seed)[4])|Q_B1((*seed)[5])|Q_B2((*seed)[6])|Q_B3((*seed)[7]); | 93 | z1=Q_B0((*seed)[4])|Q_B1((*seed)[5])|Q_B2((*seed)[6])|Q_B3((*seed)[7]); |
@@ -114,25 +118,10 @@ DES_LONG des_quad_cksum(const unsigned char *input, des_cblock output[], | |||
114 | } | 118 | } |
115 | if (lp != NULL) | 119 | if (lp != NULL) |
116 | { | 120 | { |
117 | /* I believe I finally have things worked out. | 121 | /* The MIT library assumes that the checksum is |
118 | * The MIT library assumes that the checksum | 122 | * composed of 2*out_count 32 bit ints */ |
119 | * is one huge number and it is returned in a | 123 | *lp++ = z0; |
120 | * host dependant byte order. | 124 | *lp++ = z1; |
121 | */ | ||
122 | static DES_LONG ltmp=1; | ||
123 | static unsigned char *c=(unsigned char *)<mp; | ||
124 | |||
125 | if (c[0]) | ||
126 | { | ||
127 | l2c(z0,lp); | ||
128 | l2c(z1,lp); | ||
129 | } | ||
130 | else | ||
131 | { | ||
132 | lp = &(output[out_count-i-1])[0]; | ||
133 | l2n(z1,lp); | ||
134 | l2n(z0,lp); | ||
135 | } | ||
136 | } | 125 | } |
137 | } | 126 | } |
138 | return(z0); | 127 | return(z0); |
diff --git a/src/lib/libcrypto/des/rand_key.c b/src/lib/libcrypto/des/rand_key.c index 7816a8f25c..ee1a6c274e 100644 --- a/src/lib/libcrypto/des/rand_key.c +++ b/src/lib/libcrypto/des/rand_key.c | |||
@@ -63,7 +63,11 @@ void des_random_seed(des_cblock *key) | |||
63 | 63 | ||
64 | int des_random_key(des_cblock *ret) | 64 | int des_random_key(des_cblock *ret) |
65 | { | 65 | { |
66 | int r = RAND_bytes((unsigned char *)ret, sizeof(des_cblock)); | 66 | do |
67 | { | ||
68 | if (RAND_bytes((unsigned char *)ret, sizeof(des_cblock)) != 1) | ||
69 | return (0); | ||
70 | } while (des_is_weak_key(ret)); | ||
67 | des_set_odd_parity(ret); | 71 | des_set_odd_parity(ret); |
68 | return r; | 72 | return (1); |
69 | } | 73 | } |
diff --git a/src/lib/libcrypto/des/set_key.c b/src/lib/libcrypto/des/set_key.c index bbdc71ba6b..09afd4fc03 100644 --- a/src/lib/libcrypto/des/set_key.c +++ b/src/lib/libcrypto/des/set_key.c | |||
@@ -64,12 +64,27 @@ | |||
64 | * 1.0 First working version | 64 | * 1.0 First working version |
65 | */ | 65 | */ |
66 | #include "des_locl.h" | 66 | #include "des_locl.h" |
67 | #include "podd.h" | ||
68 | #include "sk.h" | ||
69 | 67 | ||
70 | static int check_parity(const_des_cblock *key); | ||
71 | OPENSSL_GLOBAL int des_check_key=0; | 68 | OPENSSL_GLOBAL int des_check_key=0; |
72 | 69 | ||
70 | static const unsigned char odd_parity[256]={ | ||
71 | 1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14, | ||
72 | 16, 16, 19, 19, 21, 21, 22, 22, 25, 25, 26, 26, 28, 28, 31, 31, | ||
73 | 32, 32, 35, 35, 37, 37, 38, 38, 41, 41, 42, 42, 44, 44, 47, 47, | ||
74 | 49, 49, 50, 50, 52, 52, 55, 55, 56, 56, 59, 59, 61, 61, 62, 62, | ||
75 | 64, 64, 67, 67, 69, 69, 70, 70, 73, 73, 74, 74, 76, 76, 79, 79, | ||
76 | 81, 81, 82, 82, 84, 84, 87, 87, 88, 88, 91, 91, 93, 93, 94, 94, | ||
77 | 97, 97, 98, 98,100,100,103,103,104,104,107,107,109,109,110,110, | ||
78 | 112,112,115,115,117,117,118,118,121,121,122,122,124,124,127,127, | ||
79 | 128,128,131,131,133,133,134,134,137,137,138,138,140,140,143,143, | ||
80 | 145,145,146,146,148,148,151,151,152,152,155,155,157,157,158,158, | ||
81 | 161,161,162,162,164,164,167,167,168,168,171,171,173,173,174,174, | ||
82 | 176,176,179,179,181,181,182,182,185,185,186,186,188,188,191,191, | ||
83 | 193,193,194,194,196,196,199,199,200,200,203,203,205,205,206,206, | ||
84 | 208,208,211,211,213,213,214,214,217,217,218,218,220,220,223,223, | ||
85 | 224,224,227,227,229,229,230,230,233,233,234,234,236,236,239,239, | ||
86 | 241,241,242,242,244,244,247,247,248,248,251,251,253,253,254,254}; | ||
87 | |||
73 | void des_set_odd_parity(des_cblock *key) | 88 | void des_set_odd_parity(des_cblock *key) |
74 | { | 89 | { |
75 | int i; | 90 | int i; |
@@ -78,7 +93,7 @@ void des_set_odd_parity(des_cblock *key) | |||
78 | (*key)[i]=odd_parity[(*key)[i]]; | 93 | (*key)[i]=odd_parity[(*key)[i]]; |
79 | } | 94 | } |
80 | 95 | ||
81 | static int check_parity(const_des_cblock *key) | 96 | int des_check_key_parity(const_des_cblock *key) |
82 | { | 97 | { |
83 | int i; | 98 | int i; |
84 | 99 | ||
@@ -145,6 +160,153 @@ int des_is_weak_key(const_des_cblock *key) | |||
145 | #define HPERM_OP(a,t,n,m) ((t)=((((a)<<(16-(n)))^(a))&(m)),\ | 160 | #define HPERM_OP(a,t,n,m) ((t)=((((a)<<(16-(n)))^(a))&(m)),\ |
146 | (a)=(a)^(t)^(t>>(16-(n)))) | 161 | (a)=(a)^(t)^(t>>(16-(n)))) |
147 | 162 | ||
163 | static const DES_LONG des_skb[8][64]={ | ||
164 | { | ||
165 | /* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ | ||
166 | 0x00000000L,0x00000010L,0x20000000L,0x20000010L, | ||
167 | 0x00010000L,0x00010010L,0x20010000L,0x20010010L, | ||
168 | 0x00000800L,0x00000810L,0x20000800L,0x20000810L, | ||
169 | 0x00010800L,0x00010810L,0x20010800L,0x20010810L, | ||
170 | 0x00000020L,0x00000030L,0x20000020L,0x20000030L, | ||
171 | 0x00010020L,0x00010030L,0x20010020L,0x20010030L, | ||
172 | 0x00000820L,0x00000830L,0x20000820L,0x20000830L, | ||
173 | 0x00010820L,0x00010830L,0x20010820L,0x20010830L, | ||
174 | 0x00080000L,0x00080010L,0x20080000L,0x20080010L, | ||
175 | 0x00090000L,0x00090010L,0x20090000L,0x20090010L, | ||
176 | 0x00080800L,0x00080810L,0x20080800L,0x20080810L, | ||
177 | 0x00090800L,0x00090810L,0x20090800L,0x20090810L, | ||
178 | 0x00080020L,0x00080030L,0x20080020L,0x20080030L, | ||
179 | 0x00090020L,0x00090030L,0x20090020L,0x20090030L, | ||
180 | 0x00080820L,0x00080830L,0x20080820L,0x20080830L, | ||
181 | 0x00090820L,0x00090830L,0x20090820L,0x20090830L, | ||
182 | },{ | ||
183 | /* for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 */ | ||
184 | 0x00000000L,0x02000000L,0x00002000L,0x02002000L, | ||
185 | 0x00200000L,0x02200000L,0x00202000L,0x02202000L, | ||
186 | 0x00000004L,0x02000004L,0x00002004L,0x02002004L, | ||
187 | 0x00200004L,0x02200004L,0x00202004L,0x02202004L, | ||
188 | 0x00000400L,0x02000400L,0x00002400L,0x02002400L, | ||
189 | 0x00200400L,0x02200400L,0x00202400L,0x02202400L, | ||
190 | 0x00000404L,0x02000404L,0x00002404L,0x02002404L, | ||
191 | 0x00200404L,0x02200404L,0x00202404L,0x02202404L, | ||
192 | 0x10000000L,0x12000000L,0x10002000L,0x12002000L, | ||
193 | 0x10200000L,0x12200000L,0x10202000L,0x12202000L, | ||
194 | 0x10000004L,0x12000004L,0x10002004L,0x12002004L, | ||
195 | 0x10200004L,0x12200004L,0x10202004L,0x12202004L, | ||
196 | 0x10000400L,0x12000400L,0x10002400L,0x12002400L, | ||
197 | 0x10200400L,0x12200400L,0x10202400L,0x12202400L, | ||
198 | 0x10000404L,0x12000404L,0x10002404L,0x12002404L, | ||
199 | 0x10200404L,0x12200404L,0x10202404L,0x12202404L, | ||
200 | },{ | ||
201 | /* for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 */ | ||
202 | 0x00000000L,0x00000001L,0x00040000L,0x00040001L, | ||
203 | 0x01000000L,0x01000001L,0x01040000L,0x01040001L, | ||
204 | 0x00000002L,0x00000003L,0x00040002L,0x00040003L, | ||
205 | 0x01000002L,0x01000003L,0x01040002L,0x01040003L, | ||
206 | 0x00000200L,0x00000201L,0x00040200L,0x00040201L, | ||
207 | 0x01000200L,0x01000201L,0x01040200L,0x01040201L, | ||
208 | 0x00000202L,0x00000203L,0x00040202L,0x00040203L, | ||
209 | 0x01000202L,0x01000203L,0x01040202L,0x01040203L, | ||
210 | 0x08000000L,0x08000001L,0x08040000L,0x08040001L, | ||
211 | 0x09000000L,0x09000001L,0x09040000L,0x09040001L, | ||
212 | 0x08000002L,0x08000003L,0x08040002L,0x08040003L, | ||
213 | 0x09000002L,0x09000003L,0x09040002L,0x09040003L, | ||
214 | 0x08000200L,0x08000201L,0x08040200L,0x08040201L, | ||
215 | 0x09000200L,0x09000201L,0x09040200L,0x09040201L, | ||
216 | 0x08000202L,0x08000203L,0x08040202L,0x08040203L, | ||
217 | 0x09000202L,0x09000203L,0x09040202L,0x09040203L, | ||
218 | },{ | ||
219 | /* for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 */ | ||
220 | 0x00000000L,0x00100000L,0x00000100L,0x00100100L, | ||
221 | 0x00000008L,0x00100008L,0x00000108L,0x00100108L, | ||
222 | 0x00001000L,0x00101000L,0x00001100L,0x00101100L, | ||
223 | 0x00001008L,0x00101008L,0x00001108L,0x00101108L, | ||
224 | 0x04000000L,0x04100000L,0x04000100L,0x04100100L, | ||
225 | 0x04000008L,0x04100008L,0x04000108L,0x04100108L, | ||
226 | 0x04001000L,0x04101000L,0x04001100L,0x04101100L, | ||
227 | 0x04001008L,0x04101008L,0x04001108L,0x04101108L, | ||
228 | 0x00020000L,0x00120000L,0x00020100L,0x00120100L, | ||
229 | 0x00020008L,0x00120008L,0x00020108L,0x00120108L, | ||
230 | 0x00021000L,0x00121000L,0x00021100L,0x00121100L, | ||
231 | 0x00021008L,0x00121008L,0x00021108L,0x00121108L, | ||
232 | 0x04020000L,0x04120000L,0x04020100L,0x04120100L, | ||
233 | 0x04020008L,0x04120008L,0x04020108L,0x04120108L, | ||
234 | 0x04021000L,0x04121000L,0x04021100L,0x04121100L, | ||
235 | 0x04021008L,0x04121008L,0x04021108L,0x04121108L, | ||
236 | },{ | ||
237 | /* for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ | ||
238 | 0x00000000L,0x10000000L,0x00010000L,0x10010000L, | ||
239 | 0x00000004L,0x10000004L,0x00010004L,0x10010004L, | ||
240 | 0x20000000L,0x30000000L,0x20010000L,0x30010000L, | ||
241 | 0x20000004L,0x30000004L,0x20010004L,0x30010004L, | ||
242 | 0x00100000L,0x10100000L,0x00110000L,0x10110000L, | ||
243 | 0x00100004L,0x10100004L,0x00110004L,0x10110004L, | ||
244 | 0x20100000L,0x30100000L,0x20110000L,0x30110000L, | ||
245 | 0x20100004L,0x30100004L,0x20110004L,0x30110004L, | ||
246 | 0x00001000L,0x10001000L,0x00011000L,0x10011000L, | ||
247 | 0x00001004L,0x10001004L,0x00011004L,0x10011004L, | ||
248 | 0x20001000L,0x30001000L,0x20011000L,0x30011000L, | ||
249 | 0x20001004L,0x30001004L,0x20011004L,0x30011004L, | ||
250 | 0x00101000L,0x10101000L,0x00111000L,0x10111000L, | ||
251 | 0x00101004L,0x10101004L,0x00111004L,0x10111004L, | ||
252 | 0x20101000L,0x30101000L,0x20111000L,0x30111000L, | ||
253 | 0x20101004L,0x30101004L,0x20111004L,0x30111004L, | ||
254 | },{ | ||
255 | /* for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 */ | ||
256 | 0x00000000L,0x08000000L,0x00000008L,0x08000008L, | ||
257 | 0x00000400L,0x08000400L,0x00000408L,0x08000408L, | ||
258 | 0x00020000L,0x08020000L,0x00020008L,0x08020008L, | ||
259 | 0x00020400L,0x08020400L,0x00020408L,0x08020408L, | ||
260 | 0x00000001L,0x08000001L,0x00000009L,0x08000009L, | ||
261 | 0x00000401L,0x08000401L,0x00000409L,0x08000409L, | ||
262 | 0x00020001L,0x08020001L,0x00020009L,0x08020009L, | ||
263 | 0x00020401L,0x08020401L,0x00020409L,0x08020409L, | ||
264 | 0x02000000L,0x0A000000L,0x02000008L,0x0A000008L, | ||
265 | 0x02000400L,0x0A000400L,0x02000408L,0x0A000408L, | ||
266 | 0x02020000L,0x0A020000L,0x02020008L,0x0A020008L, | ||
267 | 0x02020400L,0x0A020400L,0x02020408L,0x0A020408L, | ||
268 | 0x02000001L,0x0A000001L,0x02000009L,0x0A000009L, | ||
269 | 0x02000401L,0x0A000401L,0x02000409L,0x0A000409L, | ||
270 | 0x02020001L,0x0A020001L,0x02020009L,0x0A020009L, | ||
271 | 0x02020401L,0x0A020401L,0x02020409L,0x0A020409L, | ||
272 | },{ | ||
273 | /* for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 */ | ||
274 | 0x00000000L,0x00000100L,0x00080000L,0x00080100L, | ||
275 | 0x01000000L,0x01000100L,0x01080000L,0x01080100L, | ||
276 | 0x00000010L,0x00000110L,0x00080010L,0x00080110L, | ||
277 | 0x01000010L,0x01000110L,0x01080010L,0x01080110L, | ||
278 | 0x00200000L,0x00200100L,0x00280000L,0x00280100L, | ||
279 | 0x01200000L,0x01200100L,0x01280000L,0x01280100L, | ||
280 | 0x00200010L,0x00200110L,0x00280010L,0x00280110L, | ||
281 | 0x01200010L,0x01200110L,0x01280010L,0x01280110L, | ||
282 | 0x00000200L,0x00000300L,0x00080200L,0x00080300L, | ||
283 | 0x01000200L,0x01000300L,0x01080200L,0x01080300L, | ||
284 | 0x00000210L,0x00000310L,0x00080210L,0x00080310L, | ||
285 | 0x01000210L,0x01000310L,0x01080210L,0x01080310L, | ||
286 | 0x00200200L,0x00200300L,0x00280200L,0x00280300L, | ||
287 | 0x01200200L,0x01200300L,0x01280200L,0x01280300L, | ||
288 | 0x00200210L,0x00200310L,0x00280210L,0x00280310L, | ||
289 | 0x01200210L,0x01200310L,0x01280210L,0x01280310L, | ||
290 | },{ | ||
291 | /* for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 */ | ||
292 | 0x00000000L,0x04000000L,0x00040000L,0x04040000L, | ||
293 | 0x00000002L,0x04000002L,0x00040002L,0x04040002L, | ||
294 | 0x00002000L,0x04002000L,0x00042000L,0x04042000L, | ||
295 | 0x00002002L,0x04002002L,0x00042002L,0x04042002L, | ||
296 | 0x00000020L,0x04000020L,0x00040020L,0x04040020L, | ||
297 | 0x00000022L,0x04000022L,0x00040022L,0x04040022L, | ||
298 | 0x00002020L,0x04002020L,0x00042020L,0x04042020L, | ||
299 | 0x00002022L,0x04002022L,0x00042022L,0x04042022L, | ||
300 | 0x00000800L,0x04000800L,0x00040800L,0x04040800L, | ||
301 | 0x00000802L,0x04000802L,0x00040802L,0x04040802L, | ||
302 | 0x00002800L,0x04002800L,0x00042800L,0x04042800L, | ||
303 | 0x00002802L,0x04002802L,0x00042802L,0x04042802L, | ||
304 | 0x00000820L,0x04000820L,0x00040820L,0x04040820L, | ||
305 | 0x00000822L,0x04000822L,0x00040822L,0x04040822L, | ||
306 | 0x00002820L,0x04002820L,0x00042820L,0x04042820L, | ||
307 | 0x00002822L,0x04002822L,0x00042822L,0x04042822L, | ||
308 | }}; | ||
309 | |||
148 | int des_set_key(const_des_cblock *key, des_key_schedule schedule) | 310 | int des_set_key(const_des_cblock *key, des_key_schedule schedule) |
149 | { | 311 | { |
150 | if (des_check_key) | 312 | if (des_check_key) |
@@ -164,7 +326,7 @@ int des_set_key(const_des_cblock *key, des_key_schedule schedule) | |||
164 | */ | 326 | */ |
165 | int des_set_key_checked(const_des_cblock *key, des_key_schedule schedule) | 327 | int des_set_key_checked(const_des_cblock *key, des_key_schedule schedule) |
166 | { | 328 | { |
167 | if (!check_parity(key)) | 329 | if (!des_check_key_parity(key)) |
168 | return(-1); | 330 | return(-1); |
169 | if (des_is_weak_key(key)) | 331 | if (des_is_weak_key(key)) |
170 | return(-2); | 332 | return(-2); |
@@ -186,20 +348,7 @@ void des_set_key_unchecked(const_des_cblock *key, des_key_schedule schedule) | |||
186 | c2l(in,c); | 348 | c2l(in,c); |
187 | c2l(in,d); | 349 | c2l(in,d); |
188 | 350 | ||
189 | /* do PC1 in 60 simple operations */ | 351 | /* do PC1 in 47 simple operations :-) |
190 | /* PERM_OP(d,c,t,4,0x0f0f0f0fL); | ||
191 | HPERM_OP(c,t,-2, 0xcccc0000L); | ||
192 | HPERM_OP(c,t,-1, 0xaaaa0000L); | ||
193 | HPERM_OP(c,t, 8, 0x00ff0000L); | ||
194 | HPERM_OP(c,t,-1, 0xaaaa0000L); | ||
195 | HPERM_OP(d,t,-8, 0xff000000L); | ||
196 | HPERM_OP(d,t, 8, 0x00ff0000L); | ||
197 | HPERM_OP(d,t, 2, 0x33330000L); | ||
198 | d=((d&0x00aa00aaL)<<7L)|((d&0x55005500L)>>7L)|(d&0xaa55aa55L); | ||
199 | d=(d>>8)|((c&0xf0000000L)>>4); | ||
200 | c&=0x0fffffffL; */ | ||
201 | |||
202 | /* I now do it in 47 simple operations :-) | ||
203 | * Thanks to John Fletcher (john_fletcher@lccmail.ocf.llnl.gov) | 352 | * Thanks to John Fletcher (john_fletcher@lccmail.ocf.llnl.gov) |
204 | * for the inspiration. :-) */ | 353 | * for the inspiration. :-) */ |
205 | PERM_OP (d,c,t,4,0x0f0f0f0fL); | 354 | PERM_OP (d,c,t,4,0x0f0f0f0fL); |
@@ -223,9 +372,9 @@ void des_set_key_unchecked(const_des_cblock *key, des_key_schedule schedule) | |||
223 | /* could be a few less shifts but I am to lazy at this | 372 | /* could be a few less shifts but I am to lazy at this |
224 | * point in time to investigate */ | 373 | * point in time to investigate */ |
225 | s= des_skb[0][ (c )&0x3f ]| | 374 | s= des_skb[0][ (c )&0x3f ]| |
226 | des_skb[1][((c>> 6)&0x03)|((c>> 7L)&0x3c)]| | 375 | des_skb[1][((c>> 6L)&0x03)|((c>> 7L)&0x3c)]| |
227 | des_skb[2][((c>>13)&0x0f)|((c>>14L)&0x30)]| | 376 | des_skb[2][((c>>13L)&0x0f)|((c>>14L)&0x30)]| |
228 | des_skb[3][((c>>20)&0x01)|((c>>21L)&0x06) | | 377 | des_skb[3][((c>>20L)&0x01)|((c>>21L)&0x06) | |
229 | ((c>>22L)&0x38)]; | 378 | ((c>>22L)&0x38)]; |
230 | t= des_skb[4][ (d )&0x3f ]| | 379 | t= des_skb[4][ (d )&0x3f ]| |
231 | des_skb[5][((d>> 7L)&0x03)|((d>> 8L)&0x3c)]| | 380 | des_skb[5][((d>> 7L)&0x03)|((d>> 8L)&0x3c)]| |
@@ -245,3 +394,9 @@ int des_key_sched(const_des_cblock *key, des_key_schedule schedule) | |||
245 | { | 394 | { |
246 | return(des_set_key(key,schedule)); | 395 | return(des_set_key(key,schedule)); |
247 | } | 396 | } |
397 | |||
398 | #undef des_fixup_key_parity | ||
399 | void des_fixup_key_parity(des_cblock *key) | ||
400 | { | ||
401 | des_set_odd_parity(key); | ||
402 | } | ||
diff --git a/src/lib/libcrypto/des/shifts.pl b/src/lib/libcrypto/des/shifts.pl index ba686d8ef5..e69de29bb2 100644 --- a/src/lib/libcrypto/des/shifts.pl +++ b/src/lib/libcrypto/des/shifts.pl | |||
@@ -1,198 +0,0 @@ | |||
1 | #!/usr/local/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 index f2ade88c7c..e69de29bb2 100644 --- a/src/lib/libcrypto/des/sk.h +++ b/src/lib/libcrypto/des/sk.h | |||
@@ -1,204 +0,0 @@ | |||
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/testdes.pl b/src/lib/libcrypto/des/testdes.pl index 01a165a963..e69de29bb2 100644 --- a/src/lib/libcrypto/des/testdes.pl +++ b/src/lib/libcrypto/des/testdes.pl | |||
@@ -1,167 +0,0 @@ | |||
1 | #!/usr/local/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 | } | ||