diff options
author | ryker <> | 1998-10-05 20:13:16 +0000 |
---|---|---|
committer | ryker <> | 1998-10-05 20:13:16 +0000 |
commit | 9e43e2ac1373d5be5c6500c1bc3b1dd6ee9584b4 (patch) | |
tree | 51ff319f3510104698e541954d10ad98f9125f36 /src/lib/libcrypto/rc4 | |
parent | 9e77c62555877f9a64805c49d0dcd7dbfbb40f4e (diff) | |
download | openbsd-9e43e2ac1373d5be5c6500c1bc3b1dd6ee9584b4.tar.gz openbsd-9e43e2ac1373d5be5c6500c1bc3b1dd6ee9584b4.tar.bz2 openbsd-9e43e2ac1373d5be5c6500c1bc3b1dd6ee9584b4.zip |
Import of SSLeay-0.9.0b with RSA and IDEA stubbed + OpenBSD build
functionality for shared libs.
Note that routines such as sslv2_init and friends that use RSA will
not work due to lack of RSA in this library.
Needs documentation and help from ports for easy upgrade to full
functionality where legally possible.
Diffstat (limited to 'src/lib/libcrypto/rc4')
-rw-r--r-- | src/lib/libcrypto/rc4/Makefile.uni | 102 | ||||
-rw-r--r-- | src/lib/libcrypto/rc4/asm/r4-win32.asm | 314 | ||||
-rw-r--r-- | src/lib/libcrypto/rc4/asm/rx86unix.cpp | 358 | ||||
-rw-r--r-- | src/lib/libcrypto/rc4/rc4.org | 103 | ||||
-rw-r--r-- | src/lib/libcrypto/rc4/rc4_locl.org | 70 |
5 files changed, 947 insertions, 0 deletions
diff --git a/src/lib/libcrypto/rc4/Makefile.uni b/src/lib/libcrypto/rc4/Makefile.uni new file mode 100644 index 0000000000..79dc17b8d1 --- /dev/null +++ b/src/lib/libcrypto/rc4/Makefile.uni | |||
@@ -0,0 +1,102 @@ | |||
1 | # Targets | ||
2 | # make - twidle the options yourself :-) | ||
3 | # make cc - standard cc options | ||
4 | # make gcc - standard gcc options | ||
5 | # make x86-elf - linux-elf etc | ||
6 | # make x86-out - linux-a.out, FreeBSD etc | ||
7 | # make x86-solaris | ||
8 | # make x86-bdsi | ||
9 | |||
10 | DIR= rc4 | ||
11 | TOP= . | ||
12 | CC= gcc | ||
13 | CFLAG= -O3 -fomit-frame-pointer | ||
14 | |||
15 | CPP= $(CC) -E | ||
16 | INCLUDES= | ||
17 | INSTALLTOP=/usr/local/lib | ||
18 | MAKE= make | ||
19 | MAKEDEPEND= makedepend | ||
20 | MAKEFILE= Makefile.uni | ||
21 | AR= ar r | ||
22 | |||
23 | RC4_ENC=rc4_enc.o | ||
24 | # or use | ||
25 | #RC4_ENC=asm/rx86-elf.o | ||
26 | #RC4_ENC=asm/rx86-out.o | ||
27 | #RC4_ENC=asm/rx86-sol.o | ||
28 | #RC4_ENC=asm/rx86bdsi.o | ||
29 | |||
30 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
31 | |||
32 | GENERAL=Makefile | ||
33 | TEST=rc4test | ||
34 | APPS=rc4speed | ||
35 | |||
36 | LIB=librc4.a | ||
37 | LIBSRC=rc4_skey.c rc4_enc.c | ||
38 | LIBOBJ=rc4_skey.o $(RC4_ENC) | ||
39 | |||
40 | SRC= $(LIBSRC) | ||
41 | |||
42 | EXHEADER= rc4.h | ||
43 | HEADER= $(EXHEADER) rc4_locl.h | ||
44 | |||
45 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
46 | |||
47 | all: $(LIB) $(TEST) $(APPS) | ||
48 | |||
49 | $(LIB): $(LIBOBJ) | ||
50 | $(AR) $(LIB) $(LIBOBJ) | ||
51 | sh $(TOP)/ranlib.sh $(LIB) | ||
52 | |||
53 | # elf | ||
54 | asm/rx86-elf.o: asm/rx86unix.cpp | ||
55 | $(CPP) -DELF asm/rx86unix.cpp | as -o asm/rx86-elf.o | ||
56 | |||
57 | # solaris | ||
58 | asm/rx86-sol.o: asm/rx86unix.cpp | ||
59 | $(CC) -E -DSOL asm/rx86unix.cpp | sed 's/^#.*//' > asm/rx86-sol.s | ||
60 | as -o asm/rx86-sol.o asm/rx86-sol.s | ||
61 | rm -f asm/rx86-sol.s | ||
62 | |||
63 | # a.out | ||
64 | asm/rx86-out.o: asm/rx86unix.cpp | ||
65 | $(CPP) -DOUT asm/rx86unix.cpp | as -o asm/rx86-out.o | ||
66 | |||
67 | # bsdi | ||
68 | asm/rx86bsdi.o: asm/rx86unix.cpp | ||
69 | $(CPP) -DBSDI asm/rx86unix.cpp | as -o asm/rx86bsdi.o | ||
70 | |||
71 | asm/rx86unix.cpp: | ||
72 | (cd asm; perl rc4-586.pl cpp >rx86unix.cpp) | ||
73 | |||
74 | test: $(TEST) | ||
75 | ./$(TEST) | ||
76 | |||
77 | $(TEST): $(TEST).c $(LIB) | ||
78 | $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB) | ||
79 | |||
80 | $(APPS): $(APPS).c $(LIB) | ||
81 | $(CC) -o $(APPS) $(CFLAGS) $(APPS).c $(LIB) | ||
82 | |||
83 | lint: | ||
84 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
85 | |||
86 | depend: | ||
87 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | ||
88 | |||
89 | dclean: | ||
90 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
91 | mv -f Makefile.new $(MAKEFILE) | ||
92 | |||
93 | clean: | ||
94 | /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
95 | |||
96 | cc: | ||
97 | $(MAKE) CC="cc" CFLAG="-O" all | ||
98 | |||
99 | gcc: | ||
100 | $(MAKE) CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all | ||
101 | |||
102 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
diff --git a/src/lib/libcrypto/rc4/asm/r4-win32.asm b/src/lib/libcrypto/rc4/asm/r4-win32.asm new file mode 100644 index 0000000000..70b0f7484c --- /dev/null +++ b/src/lib/libcrypto/rc4/asm/r4-win32.asm | |||
@@ -0,0 +1,314 @@ | |||
1 | ; Don't even think of reading this code | ||
2 | ; It was automatically generated by rc4-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 rc4-586.asm | ||
8 | .386 | ||
9 | .model FLAT | ||
10 | _TEXT SEGMENT | ||
11 | PUBLIC _RC4 | ||
12 | |||
13 | _RC4 PROC NEAR | ||
14 | ; | ||
15 | push ebp | ||
16 | push ebx | ||
17 | mov ebp, DWORD PTR 12[esp] | ||
18 | mov ebx, DWORD PTR 16[esp] | ||
19 | push esi | ||
20 | push edi | ||
21 | mov ecx, DWORD PTR [ebp] | ||
22 | mov edx, DWORD PTR 4[ebp] | ||
23 | mov esi, DWORD PTR 28[esp] | ||
24 | inc ecx | ||
25 | sub esp, 12 | ||
26 | add ebp, 8 | ||
27 | and ecx, 255 | ||
28 | lea ebx, DWORD PTR [esi+ebx-8] | ||
29 | mov edi, DWORD PTR 44[esp] | ||
30 | mov DWORD PTR 8[esp],ebx | ||
31 | mov eax, DWORD PTR [ecx*4+ebp] | ||
32 | cmp ebx, esi | ||
33 | jl $L000end | ||
34 | L001start: | ||
35 | add esi, 8 | ||
36 | ; Round 0 | ||
37 | add edx, eax | ||
38 | and edx, 255 | ||
39 | inc ecx | ||
40 | mov ebx, DWORD PTR [edx*4+ebp] | ||
41 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
42 | add ebx, eax | ||
43 | and ecx, 255 | ||
44 | and ebx, 255 | ||
45 | mov DWORD PTR [edx*4+ebp],eax | ||
46 | nop | ||
47 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
48 | mov eax, DWORD PTR [ecx*4+ebp] | ||
49 | mov BYTE PTR [esp], bl | ||
50 | ; Round 1 | ||
51 | add edx, eax | ||
52 | and edx, 255 | ||
53 | inc ecx | ||
54 | mov ebx, DWORD PTR [edx*4+ebp] | ||
55 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
56 | add ebx, eax | ||
57 | and ecx, 255 | ||
58 | and ebx, 255 | ||
59 | mov DWORD PTR [edx*4+ebp],eax | ||
60 | nop | ||
61 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
62 | mov eax, DWORD PTR [ecx*4+ebp] | ||
63 | mov BYTE PTR 1[esp],bl | ||
64 | ; Round 2 | ||
65 | add edx, eax | ||
66 | and edx, 255 | ||
67 | inc ecx | ||
68 | mov ebx, DWORD PTR [edx*4+ebp] | ||
69 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
70 | add ebx, eax | ||
71 | and ecx, 255 | ||
72 | and ebx, 255 | ||
73 | mov DWORD PTR [edx*4+ebp],eax | ||
74 | nop | ||
75 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
76 | mov eax, DWORD PTR [ecx*4+ebp] | ||
77 | mov BYTE PTR 2[esp],bl | ||
78 | ; Round 3 | ||
79 | add edx, eax | ||
80 | and edx, 255 | ||
81 | inc ecx | ||
82 | mov ebx, DWORD PTR [edx*4+ebp] | ||
83 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
84 | add ebx, eax | ||
85 | and ecx, 255 | ||
86 | and ebx, 255 | ||
87 | mov DWORD PTR [edx*4+ebp],eax | ||
88 | nop | ||
89 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
90 | mov eax, DWORD PTR [ecx*4+ebp] | ||
91 | mov BYTE PTR 3[esp],bl | ||
92 | ; Round 4 | ||
93 | add edx, eax | ||
94 | and edx, 255 | ||
95 | inc ecx | ||
96 | mov ebx, DWORD PTR [edx*4+ebp] | ||
97 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
98 | add ebx, eax | ||
99 | and ecx, 255 | ||
100 | and ebx, 255 | ||
101 | mov DWORD PTR [edx*4+ebp],eax | ||
102 | nop | ||
103 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
104 | mov eax, DWORD PTR [ecx*4+ebp] | ||
105 | mov BYTE PTR 4[esp],bl | ||
106 | ; Round 5 | ||
107 | add edx, eax | ||
108 | and edx, 255 | ||
109 | inc ecx | ||
110 | mov ebx, DWORD PTR [edx*4+ebp] | ||
111 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
112 | add ebx, eax | ||
113 | and ecx, 255 | ||
114 | and ebx, 255 | ||
115 | mov DWORD PTR [edx*4+ebp],eax | ||
116 | nop | ||
117 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
118 | mov eax, DWORD PTR [ecx*4+ebp] | ||
119 | mov BYTE PTR 5[esp],bl | ||
120 | ; Round 6 | ||
121 | add edx, eax | ||
122 | and edx, 255 | ||
123 | inc ecx | ||
124 | mov ebx, DWORD PTR [edx*4+ebp] | ||
125 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
126 | add ebx, eax | ||
127 | and ecx, 255 | ||
128 | and ebx, 255 | ||
129 | mov DWORD PTR [edx*4+ebp],eax | ||
130 | nop | ||
131 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
132 | mov eax, DWORD PTR [ecx*4+ebp] | ||
133 | mov BYTE PTR 6[esp],bl | ||
134 | ; Round 7 | ||
135 | add edx, eax | ||
136 | and edx, 255 | ||
137 | inc ecx | ||
138 | mov ebx, DWORD PTR [edx*4+ebp] | ||
139 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
140 | add ebx, eax | ||
141 | and ecx, 255 | ||
142 | and ebx, 255 | ||
143 | mov DWORD PTR [edx*4+ebp],eax | ||
144 | nop | ||
145 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
146 | add edi, 8 | ||
147 | mov BYTE PTR 7[esp],bl | ||
148 | ; apply the cipher text | ||
149 | mov eax, DWORD PTR [esp] | ||
150 | mov ebx, DWORD PTR [esi-8] | ||
151 | xor eax, ebx | ||
152 | mov ebx, DWORD PTR [esi-4] | ||
153 | mov DWORD PTR [edi-8],eax | ||
154 | mov eax, DWORD PTR 4[esp] | ||
155 | xor eax, ebx | ||
156 | mov ebx, DWORD PTR 8[esp] | ||
157 | mov DWORD PTR [edi-4],eax | ||
158 | mov eax, DWORD PTR [ecx*4+ebp] | ||
159 | cmp esi, ebx | ||
160 | jle L001start | ||
161 | $L000end: | ||
162 | ; Round 0 | ||
163 | add ebx, 8 | ||
164 | inc esi | ||
165 | cmp ebx, esi | ||
166 | jl $L002finished | ||
167 | mov DWORD PTR 8[esp],ebx | ||
168 | add edx, eax | ||
169 | and edx, 255 | ||
170 | inc ecx | ||
171 | mov ebx, DWORD PTR [edx*4+ebp] | ||
172 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
173 | add ebx, eax | ||
174 | and ecx, 255 | ||
175 | and ebx, 255 | ||
176 | mov DWORD PTR [edx*4+ebp],eax | ||
177 | nop | ||
178 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
179 | mov eax, DWORD PTR [ecx*4+ebp] | ||
180 | mov bh, BYTE PTR [esi-1] | ||
181 | xor bl, bh | ||
182 | mov BYTE PTR [edi], bl | ||
183 | ; Round 1 | ||
184 | mov ebx, DWORD PTR 8[esp] | ||
185 | cmp ebx, esi | ||
186 | jle $L002finished | ||
187 | inc esi | ||
188 | add edx, eax | ||
189 | and edx, 255 | ||
190 | inc ecx | ||
191 | mov ebx, DWORD PTR [edx*4+ebp] | ||
192 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
193 | add ebx, eax | ||
194 | and ecx, 255 | ||
195 | and ebx, 255 | ||
196 | mov DWORD PTR [edx*4+ebp],eax | ||
197 | nop | ||
198 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
199 | mov eax, DWORD PTR [ecx*4+ebp] | ||
200 | mov bh, BYTE PTR [esi-1] | ||
201 | xor bl, bh | ||
202 | mov BYTE PTR 1[edi],bl | ||
203 | ; Round 2 | ||
204 | mov ebx, DWORD PTR 8[esp] | ||
205 | cmp ebx, esi | ||
206 | jle $L002finished | ||
207 | inc esi | ||
208 | add edx, eax | ||
209 | and edx, 255 | ||
210 | inc ecx | ||
211 | mov ebx, DWORD PTR [edx*4+ebp] | ||
212 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
213 | add ebx, eax | ||
214 | and ecx, 255 | ||
215 | and ebx, 255 | ||
216 | mov DWORD PTR [edx*4+ebp],eax | ||
217 | nop | ||
218 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
219 | mov eax, DWORD PTR [ecx*4+ebp] | ||
220 | mov bh, BYTE PTR [esi-1] | ||
221 | xor bl, bh | ||
222 | mov BYTE PTR 2[edi],bl | ||
223 | ; Round 3 | ||
224 | mov ebx, DWORD PTR 8[esp] | ||
225 | cmp ebx, esi | ||
226 | jle $L002finished | ||
227 | inc esi | ||
228 | add edx, eax | ||
229 | and edx, 255 | ||
230 | inc ecx | ||
231 | mov ebx, DWORD PTR [edx*4+ebp] | ||
232 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
233 | add ebx, eax | ||
234 | and ecx, 255 | ||
235 | and ebx, 255 | ||
236 | mov DWORD PTR [edx*4+ebp],eax | ||
237 | nop | ||
238 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
239 | mov eax, DWORD PTR [ecx*4+ebp] | ||
240 | mov bh, BYTE PTR [esi-1] | ||
241 | xor bl, bh | ||
242 | mov BYTE PTR 3[edi],bl | ||
243 | ; Round 4 | ||
244 | mov ebx, DWORD PTR 8[esp] | ||
245 | cmp ebx, esi | ||
246 | jle $L002finished | ||
247 | inc esi | ||
248 | add edx, eax | ||
249 | and edx, 255 | ||
250 | inc ecx | ||
251 | mov ebx, DWORD PTR [edx*4+ebp] | ||
252 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
253 | add ebx, eax | ||
254 | and ecx, 255 | ||
255 | and ebx, 255 | ||
256 | mov DWORD PTR [edx*4+ebp],eax | ||
257 | nop | ||
258 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
259 | mov eax, DWORD PTR [ecx*4+ebp] | ||
260 | mov bh, BYTE PTR [esi-1] | ||
261 | xor bl, bh | ||
262 | mov BYTE PTR 4[edi],bl | ||
263 | ; Round 5 | ||
264 | mov ebx, DWORD PTR 8[esp] | ||
265 | cmp ebx, esi | ||
266 | jle $L002finished | ||
267 | inc esi | ||
268 | add edx, eax | ||
269 | and edx, 255 | ||
270 | inc ecx | ||
271 | mov ebx, DWORD PTR [edx*4+ebp] | ||
272 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
273 | add ebx, eax | ||
274 | and ecx, 255 | ||
275 | and ebx, 255 | ||
276 | mov DWORD PTR [edx*4+ebp],eax | ||
277 | nop | ||
278 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
279 | mov eax, DWORD PTR [ecx*4+ebp] | ||
280 | mov bh, BYTE PTR [esi-1] | ||
281 | xor bl, bh | ||
282 | mov BYTE PTR 5[edi],bl | ||
283 | ; Round 6 | ||
284 | mov ebx, DWORD PTR 8[esp] | ||
285 | cmp ebx, esi | ||
286 | jle $L002finished | ||
287 | inc esi | ||
288 | add edx, eax | ||
289 | and edx, 255 | ||
290 | inc ecx | ||
291 | mov ebx, DWORD PTR [edx*4+ebp] | ||
292 | mov DWORD PTR [ecx*4+ebp-4],ebx | ||
293 | add ebx, eax | ||
294 | and ecx, 255 | ||
295 | and ebx, 255 | ||
296 | mov DWORD PTR [edx*4+ebp],eax | ||
297 | nop | ||
298 | mov ebx, DWORD PTR [ebx*4+ebp] | ||
299 | mov bh, BYTE PTR [esi-1] | ||
300 | xor bl, bh | ||
301 | mov BYTE PTR 6[edi],bl | ||
302 | $L002finished: | ||
303 | dec ecx | ||
304 | add esp, 12 | ||
305 | mov DWORD PTR [ebp-4],edx | ||
306 | mov BYTE PTR [ebp-8],cl | ||
307 | pop edi | ||
308 | pop esi | ||
309 | pop ebx | ||
310 | pop ebp | ||
311 | ret | ||
312 | _RC4 ENDP | ||
313 | _TEXT ENDS | ||
314 | END | ||
diff --git a/src/lib/libcrypto/rc4/asm/rx86unix.cpp b/src/lib/libcrypto/rc4/asm/rx86unix.cpp new file mode 100644 index 0000000000..ec1d72a110 --- /dev/null +++ b/src/lib/libcrypto/rc4/asm/rx86unix.cpp | |||
@@ -0,0 +1,358 @@ | |||
1 | /* Run the C pre-processor over this file with one of the following defined | ||
2 | * ELF - elf object files, | ||
3 | * OUT - a.out object files, | ||
4 | * BSDI - BSDI style a.out object files | ||
5 | * SOL - Solaris style elf | ||
6 | */ | ||
7 | |||
8 | #define TYPE(a,b) .type a,b | ||
9 | #define SIZE(a,b) .size a,b | ||
10 | |||
11 | #if defined(OUT) || defined(BSDI) | ||
12 | #define RC4 _RC4 | ||
13 | |||
14 | #endif | ||
15 | |||
16 | #ifdef OUT | ||
17 | #define OK 1 | ||
18 | #define ALIGN 4 | ||
19 | #endif | ||
20 | |||
21 | #ifdef BSDI | ||
22 | #define OK 1 | ||
23 | #define ALIGN 4 | ||
24 | #undef SIZE | ||
25 | #undef TYPE | ||
26 | #define SIZE(a,b) | ||
27 | #define TYPE(a,b) | ||
28 | #endif | ||
29 | |||
30 | #if defined(ELF) || defined(SOL) | ||
31 | #define OK 1 | ||
32 | #define ALIGN 16 | ||
33 | #endif | ||
34 | |||
35 | #ifndef OK | ||
36 | You need to define one of | ||
37 | ELF - elf systems - linux-elf, NetBSD and DG-UX | ||
38 | OUT - a.out systems - linux-a.out and FreeBSD | ||
39 | SOL - solaris systems, which are elf with strange comment lines | ||
40 | BSDI - a.out with a very primative version of as. | ||
41 | #endif | ||
42 | |||
43 | /* Let the Assembler begin :-) */ | ||
44 | /* Don't even think of reading this code */ | ||
45 | /* It was automatically generated by rc4-586.pl */ | ||
46 | /* Which is a perl program used to generate the x86 assember for */ | ||
47 | /* any of elf, a.out, BSDI,Win32, or Solaris */ | ||
48 | /* eric <eay@cryptsoft.com> */ | ||
49 | |||
50 | .file "rc4-586.s" | ||
51 | .version "01.01" | ||
52 | gcc2_compiled.: | ||
53 | .text | ||
54 | .align ALIGN | ||
55 | .globl RC4 | ||
56 | TYPE(RC4,@function) | ||
57 | RC4: | ||
58 | |||
59 | pushl %ebp | ||
60 | pushl %ebx | ||
61 | movl 12(%esp), %ebp | ||
62 | movl 16(%esp), %ebx | ||
63 | pushl %esi | ||
64 | pushl %edi | ||
65 | movl (%ebp), %ecx | ||
66 | movl 4(%ebp), %edx | ||
67 | movl 28(%esp), %esi | ||
68 | incl %ecx | ||
69 | subl $12, %esp | ||
70 | addl $8, %ebp | ||
71 | andl $255, %ecx | ||
72 | leal -8(%ebx,%esi,), %ebx | ||
73 | movl 44(%esp), %edi | ||
74 | movl %ebx, 8(%esp) | ||
75 | movl (%ebp,%ecx,4), %eax | ||
76 | cmpl %esi, %ebx | ||
77 | jl .L000end | ||
78 | .L001start: | ||
79 | addl $8, %esi | ||
80 | /* Round 0 */ | ||
81 | addl %eax, %edx | ||
82 | andl $255, %edx | ||
83 | incl %ecx | ||
84 | movl (%ebp,%edx,4), %ebx | ||
85 | movl %ebx, -4(%ebp,%ecx,4) | ||
86 | addl %eax, %ebx | ||
87 | andl $255, %ecx | ||
88 | andl $255, %ebx | ||
89 | movl %eax, (%ebp,%edx,4) | ||
90 | nop | ||
91 | movl (%ebp,%ebx,4), %ebx | ||
92 | movl (%ebp,%ecx,4), %eax | ||
93 | movb %bl, (%esp) | ||
94 | /* Round 1 */ | ||
95 | addl %eax, %edx | ||
96 | andl $255, %edx | ||
97 | incl %ecx | ||
98 | movl (%ebp,%edx,4), %ebx | ||
99 | movl %ebx, -4(%ebp,%ecx,4) | ||
100 | addl %eax, %ebx | ||
101 | andl $255, %ecx | ||
102 | andl $255, %ebx | ||
103 | movl %eax, (%ebp,%edx,4) | ||
104 | nop | ||
105 | movl (%ebp,%ebx,4), %ebx | ||
106 | movl (%ebp,%ecx,4), %eax | ||
107 | movb %bl, 1(%esp) | ||
108 | /* Round 2 */ | ||
109 | addl %eax, %edx | ||
110 | andl $255, %edx | ||
111 | incl %ecx | ||
112 | movl (%ebp,%edx,4), %ebx | ||
113 | movl %ebx, -4(%ebp,%ecx,4) | ||
114 | addl %eax, %ebx | ||
115 | andl $255, %ecx | ||
116 | andl $255, %ebx | ||
117 | movl %eax, (%ebp,%edx,4) | ||
118 | nop | ||
119 | movl (%ebp,%ebx,4), %ebx | ||
120 | movl (%ebp,%ecx,4), %eax | ||
121 | movb %bl, 2(%esp) | ||
122 | /* Round 3 */ | ||
123 | addl %eax, %edx | ||
124 | andl $255, %edx | ||
125 | incl %ecx | ||
126 | movl (%ebp,%edx,4), %ebx | ||
127 | movl %ebx, -4(%ebp,%ecx,4) | ||
128 | addl %eax, %ebx | ||
129 | andl $255, %ecx | ||
130 | andl $255, %ebx | ||
131 | movl %eax, (%ebp,%edx,4) | ||
132 | nop | ||
133 | movl (%ebp,%ebx,4), %ebx | ||
134 | movl (%ebp,%ecx,4), %eax | ||
135 | movb %bl, 3(%esp) | ||
136 | /* Round 4 */ | ||
137 | addl %eax, %edx | ||
138 | andl $255, %edx | ||
139 | incl %ecx | ||
140 | movl (%ebp,%edx,4), %ebx | ||
141 | movl %ebx, -4(%ebp,%ecx,4) | ||
142 | addl %eax, %ebx | ||
143 | andl $255, %ecx | ||
144 | andl $255, %ebx | ||
145 | movl %eax, (%ebp,%edx,4) | ||
146 | nop | ||
147 | movl (%ebp,%ebx,4), %ebx | ||
148 | movl (%ebp,%ecx,4), %eax | ||
149 | movb %bl, 4(%esp) | ||
150 | /* Round 5 */ | ||
151 | addl %eax, %edx | ||
152 | andl $255, %edx | ||
153 | incl %ecx | ||
154 | movl (%ebp,%edx,4), %ebx | ||
155 | movl %ebx, -4(%ebp,%ecx,4) | ||
156 | addl %eax, %ebx | ||
157 | andl $255, %ecx | ||
158 | andl $255, %ebx | ||
159 | movl %eax, (%ebp,%edx,4) | ||
160 | nop | ||
161 | movl (%ebp,%ebx,4), %ebx | ||
162 | movl (%ebp,%ecx,4), %eax | ||
163 | movb %bl, 5(%esp) | ||
164 | /* Round 6 */ | ||
165 | addl %eax, %edx | ||
166 | andl $255, %edx | ||
167 | incl %ecx | ||
168 | movl (%ebp,%edx,4), %ebx | ||
169 | movl %ebx, -4(%ebp,%ecx,4) | ||
170 | addl %eax, %ebx | ||
171 | andl $255, %ecx | ||
172 | andl $255, %ebx | ||
173 | movl %eax, (%ebp,%edx,4) | ||
174 | nop | ||
175 | movl (%ebp,%ebx,4), %ebx | ||
176 | movl (%ebp,%ecx,4), %eax | ||
177 | movb %bl, 6(%esp) | ||
178 | /* Round 7 */ | ||
179 | addl %eax, %edx | ||
180 | andl $255, %edx | ||
181 | incl %ecx | ||
182 | movl (%ebp,%edx,4), %ebx | ||
183 | movl %ebx, -4(%ebp,%ecx,4) | ||
184 | addl %eax, %ebx | ||
185 | andl $255, %ecx | ||
186 | andl $255, %ebx | ||
187 | movl %eax, (%ebp,%edx,4) | ||
188 | nop | ||
189 | movl (%ebp,%ebx,4), %ebx | ||
190 | addl $8, %edi | ||
191 | movb %bl, 7(%esp) | ||
192 | /* apply the cipher text */ | ||
193 | movl (%esp), %eax | ||
194 | movl -8(%esi), %ebx | ||
195 | xorl %ebx, %eax | ||
196 | movl -4(%esi), %ebx | ||
197 | movl %eax, -8(%edi) | ||
198 | movl 4(%esp), %eax | ||
199 | xorl %ebx, %eax | ||
200 | movl 8(%esp), %ebx | ||
201 | movl %eax, -4(%edi) | ||
202 | movl (%ebp,%ecx,4), %eax | ||
203 | cmpl %ebx, %esi | ||
204 | jle .L001start | ||
205 | .L000end: | ||
206 | /* Round 0 */ | ||
207 | addl $8, %ebx | ||
208 | incl %esi | ||
209 | cmpl %esi, %ebx | ||
210 | jl .L002finished | ||
211 | movl %ebx, 8(%esp) | ||
212 | addl %eax, %edx | ||
213 | andl $255, %edx | ||
214 | incl %ecx | ||
215 | movl (%ebp,%edx,4), %ebx | ||
216 | movl %ebx, -4(%ebp,%ecx,4) | ||
217 | addl %eax, %ebx | ||
218 | andl $255, %ecx | ||
219 | andl $255, %ebx | ||
220 | movl %eax, (%ebp,%edx,4) | ||
221 | nop | ||
222 | movl (%ebp,%ebx,4), %ebx | ||
223 | movl (%ebp,%ecx,4), %eax | ||
224 | movb -1(%esi), %bh | ||
225 | xorb %bh, %bl | ||
226 | movb %bl, (%edi) | ||
227 | /* Round 1 */ | ||
228 | movl 8(%esp), %ebx | ||
229 | cmpl %esi, %ebx | ||
230 | jle .L002finished | ||
231 | incl %esi | ||
232 | addl %eax, %edx | ||
233 | andl $255, %edx | ||
234 | incl %ecx | ||
235 | movl (%ebp,%edx,4), %ebx | ||
236 | movl %ebx, -4(%ebp,%ecx,4) | ||
237 | addl %eax, %ebx | ||
238 | andl $255, %ecx | ||
239 | andl $255, %ebx | ||
240 | movl %eax, (%ebp,%edx,4) | ||
241 | nop | ||
242 | movl (%ebp,%ebx,4), %ebx | ||
243 | movl (%ebp,%ecx,4), %eax | ||
244 | movb -1(%esi), %bh | ||
245 | xorb %bh, %bl | ||
246 | movb %bl, 1(%edi) | ||
247 | /* Round 2 */ | ||
248 | movl 8(%esp), %ebx | ||
249 | cmpl %esi, %ebx | ||
250 | jle .L002finished | ||
251 | incl %esi | ||
252 | addl %eax, %edx | ||
253 | andl $255, %edx | ||
254 | incl %ecx | ||
255 | movl (%ebp,%edx,4), %ebx | ||
256 | movl %ebx, -4(%ebp,%ecx,4) | ||
257 | addl %eax, %ebx | ||
258 | andl $255, %ecx | ||
259 | andl $255, %ebx | ||
260 | movl %eax, (%ebp,%edx,4) | ||
261 | nop | ||
262 | movl (%ebp,%ebx,4), %ebx | ||
263 | movl (%ebp,%ecx,4), %eax | ||
264 | movb -1(%esi), %bh | ||
265 | xorb %bh, %bl | ||
266 | movb %bl, 2(%edi) | ||
267 | /* Round 3 */ | ||
268 | movl 8(%esp), %ebx | ||
269 | cmpl %esi, %ebx | ||
270 | jle .L002finished | ||
271 | incl %esi | ||
272 | addl %eax, %edx | ||
273 | andl $255, %edx | ||
274 | incl %ecx | ||
275 | movl (%ebp,%edx,4), %ebx | ||
276 | movl %ebx, -4(%ebp,%ecx,4) | ||
277 | addl %eax, %ebx | ||
278 | andl $255, %ecx | ||
279 | andl $255, %ebx | ||
280 | movl %eax, (%ebp,%edx,4) | ||
281 | nop | ||
282 | movl (%ebp,%ebx,4), %ebx | ||
283 | movl (%ebp,%ecx,4), %eax | ||
284 | movb -1(%esi), %bh | ||
285 | xorb %bh, %bl | ||
286 | movb %bl, 3(%edi) | ||
287 | /* Round 4 */ | ||
288 | movl 8(%esp), %ebx | ||
289 | cmpl %esi, %ebx | ||
290 | jle .L002finished | ||
291 | incl %esi | ||
292 | addl %eax, %edx | ||
293 | andl $255, %edx | ||
294 | incl %ecx | ||
295 | movl (%ebp,%edx,4), %ebx | ||
296 | movl %ebx, -4(%ebp,%ecx,4) | ||
297 | addl %eax, %ebx | ||
298 | andl $255, %ecx | ||
299 | andl $255, %ebx | ||
300 | movl %eax, (%ebp,%edx,4) | ||
301 | nop | ||
302 | movl (%ebp,%ebx,4), %ebx | ||
303 | movl (%ebp,%ecx,4), %eax | ||
304 | movb -1(%esi), %bh | ||
305 | xorb %bh, %bl | ||
306 | movb %bl, 4(%edi) | ||
307 | /* Round 5 */ | ||
308 | movl 8(%esp), %ebx | ||
309 | cmpl %esi, %ebx | ||
310 | jle .L002finished | ||
311 | incl %esi | ||
312 | addl %eax, %edx | ||
313 | andl $255, %edx | ||
314 | incl %ecx | ||
315 | movl (%ebp,%edx,4), %ebx | ||
316 | movl %ebx, -4(%ebp,%ecx,4) | ||
317 | addl %eax, %ebx | ||
318 | andl $255, %ecx | ||
319 | andl $255, %ebx | ||
320 | movl %eax, (%ebp,%edx,4) | ||
321 | nop | ||
322 | movl (%ebp,%ebx,4), %ebx | ||
323 | movl (%ebp,%ecx,4), %eax | ||
324 | movb -1(%esi), %bh | ||
325 | xorb %bh, %bl | ||
326 | movb %bl, 5(%edi) | ||
327 | /* Round 6 */ | ||
328 | movl 8(%esp), %ebx | ||
329 | cmpl %esi, %ebx | ||
330 | jle .L002finished | ||
331 | incl %esi | ||
332 | addl %eax, %edx | ||
333 | andl $255, %edx | ||
334 | incl %ecx | ||
335 | movl (%ebp,%edx,4), %ebx | ||
336 | movl %ebx, -4(%ebp,%ecx,4) | ||
337 | addl %eax, %ebx | ||
338 | andl $255, %ecx | ||
339 | andl $255, %ebx | ||
340 | movl %eax, (%ebp,%edx,4) | ||
341 | nop | ||
342 | movl (%ebp,%ebx,4), %ebx | ||
343 | movb -1(%esi), %bh | ||
344 | xorb %bh, %bl | ||
345 | movb %bl, 6(%edi) | ||
346 | .L002finished: | ||
347 | decl %ecx | ||
348 | addl $12, %esp | ||
349 | movl %edx, -4(%ebp) | ||
350 | movb %cl, -8(%ebp) | ||
351 | popl %edi | ||
352 | popl %esi | ||
353 | popl %ebx | ||
354 | popl %ebp | ||
355 | ret | ||
356 | .RC4_end: | ||
357 | SIZE(RC4,.RC4_end-RC4) | ||
358 | .ident "RC4" | ||
diff --git a/src/lib/libcrypto/rc4/rc4.org b/src/lib/libcrypto/rc4/rc4.org new file mode 100644 index 0000000000..c558651af8 --- /dev/null +++ b/src/lib/libcrypto/rc4/rc4.org | |||
@@ -0,0 +1,103 @@ | |||
1 | /* crypto/rc4/rc4.org */ | ||
2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
60 | * | ||
61 | * Always modify rc4.org since rc4.h is automatically generated from | ||
62 | * it during SSLeay configuration. | ||
63 | * | ||
64 | * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
65 | */ | ||
66 | |||
67 | #ifndef HEADER_RC4_H | ||
68 | #define HEADER_RC4_H | ||
69 | |||
70 | #ifdef __cplusplus | ||
71 | extern "C" { | ||
72 | #endif | ||
73 | |||
74 | /* using int types make the structure larger but make the code faster | ||
75 | * on most boxes I have tested - up to %20 faster. */ | ||
76 | #define RC4_INT unsigned int | ||
77 | |||
78 | typedef struct rc4_key_st | ||
79 | { | ||
80 | RC4_INT x,y; | ||
81 | RC4_INT data[256]; | ||
82 | } RC4_KEY; | ||
83 | |||
84 | #ifndef NOPROTO | ||
85 | |||
86 | char *RC4_options(void); | ||
87 | void RC4_set_key(RC4_KEY *key, int len, unsigned char *data); | ||
88 | void RC4(RC4_KEY *key, unsigned long len, unsigned char *indata, | ||
89 | unsigned char *outdata); | ||
90 | |||
91 | #else | ||
92 | |||
93 | char *RC4_options(); | ||
94 | void RC4_set_key(); | ||
95 | void RC4(); | ||
96 | |||
97 | #endif | ||
98 | |||
99 | #ifdef __cplusplus | ||
100 | } | ||
101 | #endif | ||
102 | |||
103 | #endif | ||
diff --git a/src/lib/libcrypto/rc4/rc4_locl.org b/src/lib/libcrypto/rc4/rc4_locl.org new file mode 100644 index 0000000000..1ef4455fb7 --- /dev/null +++ b/src/lib/libcrypto/rc4/rc4_locl.org | |||
@@ -0,0 +1,70 @@ | |||
1 | /* crypto/rc4/rc4_locl.org */ | ||
2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
60 | * | ||
61 | * Always modify bf_locl.org since bf_locl.h is automatically generated from | ||
62 | * it during SSLeay configuration. | ||
63 | * | ||
64 | * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
65 | */ | ||
66 | |||
67 | /* if this is defined data[i] is used instead of *data, this is a %20 | ||
68 | * speedup on x86 */ | ||
69 | #undef RC4_INDEX | ||
70 | |||