summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rc4
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/rc4')
-rw-r--r--src/lib/libcrypto/rc4/Makefile.ssl5
-rw-r--r--src/lib/libcrypto/rc4/Makefile.uni103
-rw-r--r--src/lib/libcrypto/rc4/asm/r4-win32.asm314
3 files changed, 3 insertions, 419 deletions
diff --git a/src/lib/libcrypto/rc4/Makefile.ssl b/src/lib/libcrypto/rc4/Makefile.ssl
index 2ea95f0298..8d2a795c22 100644
--- a/src/lib/libcrypto/rc4/Makefile.ssl
+++ b/src/lib/libcrypto/rc4/Makefile.ssl
@@ -5,6 +5,7 @@
5DIR= rc4 5DIR= rc4
6TOP= ../.. 6TOP= ../..
7CC= cc 7CC= cc
8CPP= $(CC) -E
8INCLUDES= 9INCLUDES=
9CFLAG=-g 10CFLAG=-g
10INSTALL_PREFIX= 11INSTALL_PREFIX=
@@ -51,7 +52,7 @@ lib: $(LIBOBJ)
51 52
52# elf 53# elf
53asm/rx86-elf.o: asm/rx86unix.cpp 54asm/rx86-elf.o: asm/rx86unix.cpp
54 $(CPP) -DELF asm/rx86unix.cpp | as -o asm/rx86-elf.o 55 $(CPP) -DELF -x c asm/rx86unix.cpp | as -o asm/rx86-elf.o
55 56
56# solaris 57# solaris
57asm/rx86-sol.o: asm/rx86unix.cpp 58asm/rx86-sol.o: asm/rx86unix.cpp
@@ -67,7 +68,7 @@ asm/rx86-out.o: asm/rx86unix.cpp
67asm/rx86bsdi.o: asm/rx86unix.cpp 68asm/rx86bsdi.o: asm/rx86unix.cpp
68 $(CPP) -DBSDI asm/rx86unix.cpp | sed 's/ :/:/' | as -o asm/rx86bsdi.o 69 $(CPP) -DBSDI asm/rx86unix.cpp | sed 's/ :/:/' | as -o asm/rx86bsdi.o
69 70
70asm/rx86unix.cpp: asm/rc4-586.pl 71asm/rx86unix.cpp: asm/rc4-586.pl ../perlasm/x86asm.pl
71 (cd asm; $(PERL) rc4-586.pl cpp >rx86unix.cpp) 72 (cd asm; $(PERL) rc4-586.pl cpp >rx86unix.cpp)
72 73
73files: 74files:
diff --git a/src/lib/libcrypto/rc4/Makefile.uni b/src/lib/libcrypto/rc4/Makefile.uni
index 855d9e50f3..e69de29bb2 100644
--- a/src/lib/libcrypto/rc4/Makefile.uni
+++ b/src/lib/libcrypto/rc4/Makefile.uni
@@ -1,103 +0,0 @@
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
10DIR= rc4
11TOP= .
12CC= gcc
13CFLAG= -O3 -fomit-frame-pointer
14
15CPP= $(CC) -E
16INCLUDES=
17INSTALLTOP=/usr/local/lib
18MAKE= make
19MAKEDEPEND= makedepend
20MAKEFILE= Makefile.uni
21AR= ar r
22RANLIB= ranlib
23
24RC4_ENC=rc4_enc.o
25# or use
26#RC4_ENC=asm/rx86-elf.o
27#RC4_ENC=asm/rx86-out.o
28#RC4_ENC=asm/rx86-sol.o
29#RC4_ENC=asm/rx86bdsi.o
30
31CFLAGS= $(INCLUDES) $(CFLAG)
32
33GENERAL=Makefile
34TEST=rc4test
35APPS=rc4speed
36
37LIB=librc4.a
38LIBSRC=rc4_skey.c rc4_enc.c
39LIBOBJ=rc4_skey.o $(RC4_ENC)
40
41SRC= $(LIBSRC)
42
43EXHEADER= rc4.h
44HEADER= $(EXHEADER) rc4_locl.h
45
46ALL= $(GENERAL) $(SRC) $(HEADER)
47
48all: $(LIB) $(TEST) $(APPS)
49
50$(LIB): $(LIBOBJ)
51 $(AR) $(LIB) $(LIBOBJ)
52 $(RANLIB) $(LIB)
53
54# elf
55asm/rx86-elf.o: asm/rx86unix.cpp
56 $(CPP) -DELF asm/rx86unix.cpp | as -o asm/rx86-elf.o
57
58# solaris
59asm/rx86-sol.o: asm/rx86unix.cpp
60 $(CC) -E -DSOL asm/rx86unix.cpp | sed 's/^#.*//' > asm/rx86-sol.s
61 as -o asm/rx86-sol.o asm/rx86-sol.s
62 rm -f asm/rx86-sol.s
63
64# a.out
65asm/rx86-out.o: asm/rx86unix.cpp
66 $(CPP) -DOUT asm/rx86unix.cpp | as -o asm/rx86-out.o
67
68# bsdi
69asm/rx86bsdi.o: asm/rx86unix.cpp
70 $(CPP) -DBSDI asm/rx86unix.cpp | as -o asm/rx86bsdi.o
71
72asm/rx86unix.cpp:
73 (cd asm; perl rc4-586.pl cpp >rx86unix.cpp)
74
75test: $(TEST)
76 ./$(TEST)
77
78$(TEST): $(TEST).c $(LIB)
79 $(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB)
80
81$(APPS): $(APPS).c $(LIB)
82 $(CC) -o $(APPS) $(CFLAGS) $(APPS).c $(LIB)
83
84lint:
85 lint -DLINT $(INCLUDES) $(SRC)>fluff
86
87depend:
88 $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC)
89
90dclean:
91 perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
92 mv -f Makefile.new $(MAKEFILE)
93
94clean:
95 /bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
96
97cc:
98 $(MAKE) CC="cc" CFLAG="-O" all
99
100gcc:
101 $(MAKE) CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all
102
103# 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
index 70b0f7484c..e69de29bb2 100644
--- a/src/lib/libcrypto/rc4/asm/r4-win32.asm
+++ b/src/lib/libcrypto/rc4/asm/r4-win32.asm
@@ -1,314 +0,0 @@
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
11PUBLIC _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
34L001start:
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
314END