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.ssl41
-rw-r--r--src/lib/libcrypto/rc4/Makefile.uni3
-rw-r--r--src/lib/libcrypto/rc4/asm/rc4-586.pl2
-rw-r--r--src/lib/libcrypto/rc4/asm/rx86unix.cpp358
-rw-r--r--src/lib/libcrypto/rc4/rc4.c6
-rw-r--r--src/lib/libcrypto/rc4/rc4.h (renamed from src/lib/libcrypto/rc4/rc4.org)29
-rw-r--r--src/lib/libcrypto/rc4/rc4_enc.c10
-rw-r--r--src/lib/libcrypto/rc4/rc4_locl.h4
-rw-r--r--src/lib/libcrypto/rc4/rc4_locl.org70
-rw-r--r--src/lib/libcrypto/rc4/rc4_skey.c12
-rw-r--r--src/lib/libcrypto/rc4/rc4s.cpp2
-rw-r--r--src/lib/libcrypto/rc4/rc4speed.c59
-rw-r--r--src/lib/libcrypto/rc4/rc4test.c16
13 files changed, 79 insertions, 533 deletions
diff --git a/src/lib/libcrypto/rc4/Makefile.ssl b/src/lib/libcrypto/rc4/Makefile.ssl
index 19c1e980f3..64092fd4f1 100644
--- a/src/lib/libcrypto/rc4/Makefile.ssl
+++ b/src/lib/libcrypto/rc4/Makefile.ssl
@@ -7,9 +7,11 @@ TOP= ../..
7CC= cc 7CC= cc
8INCLUDES= 8INCLUDES=
9CFLAG=-g 9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
10INSTALLTOP=/usr/local/ssl 12INSTALLTOP=/usr/local/ssl
11MAKE= make -f Makefile.ssl 13MAKE= make -f Makefile.ssl
12MAKEDEPEND= makedepend -f Makefile.ssl 14MAKEDEPEND= $(TOP)/util/domd $(TOP)
13MAKEFILE= Makefile.ssl 15MAKEFILE= Makefile.ssl
14AR= ar r 16AR= ar r
15 17
@@ -44,7 +46,7 @@ all: lib
44 46
45lib: $(LIBOBJ) 47lib: $(LIBOBJ)
46 $(AR) $(LIB) $(LIBOBJ) 48 $(AR) $(LIB) $(LIBOBJ)
47 sh $(TOP)/util/ranlib.sh $(LIB) 49 $(RANLIB) $(LIB)
48 @touch lib 50 @touch lib
49 51
50# elf 52# elf
@@ -63,26 +65,25 @@ asm/rx86-out.o: asm/rx86unix.cpp
63 65
64# bsdi 66# bsdi
65asm/rx86bsdi.o: asm/rx86unix.cpp 67asm/rx86bsdi.o: asm/rx86unix.cpp
66 $(CPP) -DBSDI asm/rx86unix.cpp | as -o asm/rx86bsdi.o 68 $(CPP) -DBSDI asm/rx86unix.cpp | sed 's/ :/:/' | as -o asm/rx86bsdi.o
67 69
68asm/rx86unix.cpp: 70asm/rx86unix.cpp: asm/rc4-586.pl
69 (cd asm; perl rc4-586.pl cpp >rx86unix.cpp) 71 (cd asm; $(PERL) rc4-586.pl cpp >rx86unix.cpp)
70 72
71files: 73files:
72 perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO 74 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
73 75
74links: 76links:
75 /bin/rm -f Makefile 77 @$(TOP)/util/point.sh Makefile.ssl Makefile
76 $(TOP)/util/point.sh Makefile.ssl Makefile ; 78 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
77 $(TOP)/util/mklink.sh ../../include $(EXHEADER) 79 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
78 $(TOP)/util/mklink.sh ../../test $(TEST) 80 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
79 $(TOP)/util/mklink.sh ../../apps $(APPS)
80 81
81install: 82install:
82 @for i in $(EXHEADER) ; \ 83 @for i in $(EXHEADER) ; \
83 do \ 84 do \
84 (cp $$i $(INSTALLTOP)/include/$$i; \ 85 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
85 chmod 644 $(INSTALLTOP)/include/$$i ); \ 86 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
86 done; 87 done;
87 88
88tags: 89tags:
@@ -94,15 +95,19 @@ lint:
94 lint -DLINT $(INCLUDES) $(SRC)>fluff 95 lint -DLINT $(INCLUDES) $(SRC)>fluff
95 96
96depend: 97depend:
97 $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) 98 $(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC)
98 99
99dclean: 100dclean:
100 perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new 101 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
101 mv -f Makefile.new $(MAKEFILE) 102 mv -f Makefile.new $(MAKEFILE)
102 103
103clean: 104clean:
104 /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff asm/*.o 105 rm -f asm/rx86unix.cpp *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff asm/*.o
105
106errors:
107 106
108# DO NOT DELETE THIS LINE -- make depend depends on it. 107# DO NOT DELETE THIS LINE -- make depend depends on it.
108
109rc4_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc4.h
110rc4_enc.o: rc4_locl.h
111rc4_skey.o: ../../include/openssl/opensslconf.h
112rc4_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/rc4.h
113rc4_skey.o: rc4_locl.h
diff --git a/src/lib/libcrypto/rc4/Makefile.uni b/src/lib/libcrypto/rc4/Makefile.uni
index 79dc17b8d1..855d9e50f3 100644
--- a/src/lib/libcrypto/rc4/Makefile.uni
+++ b/src/lib/libcrypto/rc4/Makefile.uni
@@ -19,6 +19,7 @@ MAKE= make
19MAKEDEPEND= makedepend 19MAKEDEPEND= makedepend
20MAKEFILE= Makefile.uni 20MAKEFILE= Makefile.uni
21AR= ar r 21AR= ar r
22RANLIB= ranlib
22 23
23RC4_ENC=rc4_enc.o 24RC4_ENC=rc4_enc.o
24# or use 25# or use
@@ -48,7 +49,7 @@ all: $(LIB) $(TEST) $(APPS)
48 49
49$(LIB): $(LIBOBJ) 50$(LIB): $(LIBOBJ)
50 $(AR) $(LIB) $(LIBOBJ) 51 $(AR) $(LIB) $(LIBOBJ)
51 sh $(TOP)/ranlib.sh $(LIB) 52 $(RANLIB) $(LIB)
52 53
53# elf 54# elf
54asm/rx86-elf.o: asm/rx86unix.cpp 55asm/rx86-elf.o: asm/rx86unix.cpp
diff --git a/src/lib/libcrypto/rc4/asm/rc4-586.pl b/src/lib/libcrypto/rc4/asm/rc4-586.pl
index 0dd8eb1ba9..7ef889e5a1 100644
--- a/src/lib/libcrypto/rc4/asm/rc4-586.pl
+++ b/src/lib/libcrypto/rc4/asm/rc4-586.pl
@@ -1,4 +1,4 @@
1#!/usr/bin/perl 1#!/usr/local/bin/perl
2 2
3# define for pentium pro friendly version 3# define for pentium pro friendly version
4 4
diff --git a/src/lib/libcrypto/rc4/asm/rx86unix.cpp b/src/lib/libcrypto/rc4/asm/rx86unix.cpp
deleted file mode 100644
index ec1d72a110..0000000000
--- a/src/lib/libcrypto/rc4/asm/rx86unix.cpp
+++ /dev/null
@@ -1,358 +0,0 @@
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
36You need to define one of
37ELF - elf systems - linux-elf, NetBSD and DG-UX
38OUT - a.out systems - linux-a.out and FreeBSD
39SOL - solaris systems, which are elf with strange comment lines
40BSDI - 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"
52gcc2_compiled.:
53.text
54 .align ALIGN
55.globl RC4
56 TYPE(RC4,@function)
57RC4:
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.c b/src/lib/libcrypto/rc4/rc4.c
index 127e8a5093..709b7aff35 100644
--- a/src/lib/libcrypto/rc4/rc4.c
+++ b/src/lib/libcrypto/rc4/rc4.c
@@ -59,7 +59,7 @@
59#include <stdio.h> 59#include <stdio.h>
60#include <stdlib.h> 60#include <stdlib.h>
61#include <string.h> 61#include <string.h>
62#include "rc4.h" 62#include <openssl/rc4.h>
63 63
64char *usage[]={ 64char *usage[]={
65"usage: rc4 args\n", 65"usage: rc4 args\n",
@@ -70,9 +70,7 @@ char *usage[]={
70NULL 70NULL
71}; 71};
72 72
73int main(argc, argv) 73int main(int argc, char *argv[])
74int argc;
75char *argv[];
76 { 74 {
77 FILE *in=NULL,*out=NULL; 75 FILE *in=NULL,*out=NULL;
78 char *infile=NULL,*outfile=NULL,*keystr=NULL; 76 char *infile=NULL,*outfile=NULL,*keystr=NULL;
diff --git a/src/lib/libcrypto/rc4/rc4.org b/src/lib/libcrypto/rc4/rc4.h
index c558651af8..7418c2a9a2 100644
--- a/src/lib/libcrypto/rc4/rc4.org
+++ b/src/lib/libcrypto/rc4/rc4.h
@@ -1,4 +1,4 @@
1/* crypto/rc4/rc4.org */ 1/* crypto/rc4/rc4.h */
2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -56,14 +56,6 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 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 59#ifndef HEADER_RC4_H
68#define HEADER_RC4_H 60#define HEADER_RC4_H
69 61
@@ -71,9 +63,11 @@
71extern "C" { 63extern "C" {
72#endif 64#endif
73 65
74/* using int types make the structure larger but make the code faster 66#ifdef NO_RC4
75 * on most boxes I have tested - up to %20 faster. */ 67#error RC4 is disabled.
76#define RC4_INT unsigned int 68#endif
69
70#include <openssl/opensslconf.h> /* RC4_INT */
77 71
78typedef struct rc4_key_st 72typedef struct rc4_key_st
79 { 73 {
@@ -81,21 +75,12 @@ typedef struct rc4_key_st
81 RC4_INT data[256]; 75 RC4_INT data[256];
82 } RC4_KEY; 76 } RC4_KEY;
83 77
84#ifndef NOPROTO
85 78
86char *RC4_options(void); 79const char *RC4_options(void);
87void RC4_set_key(RC4_KEY *key, int len, unsigned char *data); 80void RC4_set_key(RC4_KEY *key, int len, unsigned char *data);
88void RC4(RC4_KEY *key, unsigned long len, unsigned char *indata, 81void RC4(RC4_KEY *key, unsigned long len, unsigned char *indata,
89 unsigned char *outdata); 82 unsigned char *outdata);
90 83
91#else
92
93char *RC4_options();
94void RC4_set_key();
95void RC4();
96
97#endif
98
99#ifdef __cplusplus 84#ifdef __cplusplus
100} 85}
101#endif 86#endif
diff --git a/src/lib/libcrypto/rc4/rc4_enc.c b/src/lib/libcrypto/rc4/rc4_enc.c
index ab8a111b52..3256bea8cc 100644
--- a/src/lib/libcrypto/rc4/rc4_enc.c
+++ b/src/lib/libcrypto/rc4/rc4_enc.c
@@ -56,7 +56,7 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#include "rc4.h" 59#include <openssl/rc4.h>
60#include "rc4_locl.h" 60#include "rc4_locl.h"
61 61
62/* RC4 as implemented from a posting from 62/* RC4 as implemented from a posting from
@@ -67,11 +67,8 @@
67 * Date: Wed, 14 Sep 1994 06:35:31 GMT 67 * Date: Wed, 14 Sep 1994 06:35:31 GMT
68 */ 68 */
69 69
70void RC4(key, len, indata, outdata) 70void RC4(RC4_KEY *key, unsigned long len, unsigned char *indata,
71RC4_KEY *key; 71 unsigned char *outdata)
72unsigned long len;
73unsigned char *indata;
74unsigned char *outdata;
75 { 72 {
76 register RC4_INT *d; 73 register RC4_INT *d;
77 register RC4_INT x,y,tx,ty; 74 register RC4_INT x,y,tx,ty;
@@ -95,7 +92,6 @@ unsigned char *outdata;
95#define RC4_LOOP(a,b,i) LOOP(a[i],b[i]) 92#define RC4_LOOP(a,b,i) LOOP(a[i],b[i])
96#endif 93#endif
97 94
98 i= -(int)len;
99 i=(int)(len>>3L); 95 i=(int)(len>>3L);
100 if (i) 96 if (i)
101 { 97 {
diff --git a/src/lib/libcrypto/rc4/rc4_locl.h b/src/lib/libcrypto/rc4/rc4_locl.h
new file mode 100644
index 0000000000..3bb80b6ce9
--- /dev/null
+++ b/src/lib/libcrypto/rc4/rc4_locl.h
@@ -0,0 +1,4 @@
1#ifndef HEADER_RC4_LOCL_H
2#define HEADER_RC4_LOCL_H
3#include <openssl/opensslconf.h>
4#endif
diff --git a/src/lib/libcrypto/rc4/rc4_locl.org b/src/lib/libcrypto/rc4/rc4_locl.org
deleted file mode 100644
index 1ef4455fb7..0000000000
--- a/src/lib/libcrypto/rc4/rc4_locl.org
+++ /dev/null
@@ -1,70 +0,0 @@
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
diff --git a/src/lib/libcrypto/rc4/rc4_skey.c b/src/lib/libcrypto/rc4/rc4_skey.c
index 0be5fde67b..c67a445f1f 100644
--- a/src/lib/libcrypto/rc4/rc4_skey.c
+++ b/src/lib/libcrypto/rc4/rc4_skey.c
@@ -56,12 +56,13 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#include "rc4.h" 59#include <openssl/rc4.h>
60#include "rc4_locl.h" 60#include "rc4_locl.h"
61#include <openssl/opensslv.h>
61 62
62char *RC4_version="RC4 part of SSLeay 0.9.0b 29-Jun-1998"; 63const char *RC4_version="RC4" OPENSSL_VERSION_PTEXT;
63 64
64char *RC4_options() 65const char *RC4_options(void)
65 { 66 {
66#ifdef RC4_INDEX 67#ifdef RC4_INDEX
67 if (sizeof(RC4_INT) == 1) 68 if (sizeof(RC4_INT) == 1)
@@ -84,10 +85,7 @@ char *RC4_options()
84 * Date: Wed, 14 Sep 1994 06:35:31 GMT 85 * Date: Wed, 14 Sep 1994 06:35:31 GMT
85 */ 86 */
86 87
87void RC4_set_key(key, len, data) 88void RC4_set_key(RC4_KEY *key, int len, register unsigned char *data)
88RC4_KEY *key;
89int len;
90register unsigned char *data;
91 { 89 {
92 register RC4_INT tmp; 90 register RC4_INT tmp;
93 register int id1,id2; 91 register int id1,id2;
diff --git a/src/lib/libcrypto/rc4/rc4s.cpp b/src/lib/libcrypto/rc4/rc4s.cpp
index 39f1727dd3..3814fde997 100644
--- a/src/lib/libcrypto/rc4/rc4s.cpp
+++ b/src/lib/libcrypto/rc4/rc4s.cpp
@@ -32,7 +32,7 @@ void GetTSC(unsigned long& tsc)
32 32
33#include <stdio.h> 33#include <stdio.h>
34#include <stdlib.h> 34#include <stdlib.h>
35#include "rc4.h" 35#include <openssl/rc4.h>
36 36
37void main(int argc,char *argv[]) 37void main(int argc,char *argv[])
38 { 38 {
diff --git a/src/lib/libcrypto/rc4/rc4speed.c b/src/lib/libcrypto/rc4/rc4speed.c
index 5298dad6d0..4fb5ebf573 100644
--- a/src/lib/libcrypto/rc4/rc4speed.c
+++ b/src/lib/libcrypto/rc4/rc4speed.c
@@ -59,19 +59,17 @@
59/* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */ 59/* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */
60/* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */ 60/* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */
61 61
62#ifndef MSDOS 62#if !defined(MSDOS) && (!defined(VMS) || defined(__DECC))
63#define TIMES 63#define TIMES
64#endif 64#endif
65 65
66#include <stdio.h> 66#include <stdio.h>
67#ifndef MSDOS 67
68#include <unistd.h> 68#include <openssl/e_os2.h>
69#else 69#include OPENSSL_UNISTD_IO
70#include <io.h> 70OPENSSL_DECLARE_EXIT
71extern int exit(); 71
72#endif
73#include <signal.h> 72#include <signal.h>
74#ifndef VMS
75#ifndef _IRIX 73#ifndef _IRIX
76#include <time.h> 74#include <time.h>
77#endif 75#endif
@@ -79,34 +77,31 @@ extern int exit();
79#include <sys/types.h> 77#include <sys/types.h>
80#include <sys/times.h> 78#include <sys/times.h>
81#endif 79#endif
82#else /* VMS */ 80
83#include <types.h> 81/* Depending on the VMS version, the tms structure is perhaps defined.
84struct tms { 82 The __TMS macro will show if it was. If it wasn't defined, we should
85 time_t tms_utime; 83 undefine TIMES, since that tells the rest of the program how things
86 time_t tms_stime; 84 should be handled. -- Richard Levitte */
87 time_t tms_uchild; /* I dunno... */ 85#if defined(VMS) && defined(__DECC) && !defined(__TMS)
88 time_t tms_uchildsys; /* so these names are a guess :-) */ 86#undef TIMES
89 }
90#endif 87#endif
88
91#ifndef TIMES 89#ifndef TIMES
92#include <sys/timeb.h> 90#include <sys/timeb.h>
93#endif 91#endif
94 92
95#ifdef sun 93#if defined(sun) || defined(__ultrix)
94#define _POSIX_SOURCE
96#include <limits.h> 95#include <limits.h>
97#include <sys/param.h> 96#include <sys/param.h>
98#endif 97#endif
99 98
100#include "rc4.h" 99#include <openssl/rc4.h>
101 100
102/* The following if from times(3) man page. It may need to be changed */ 101/* The following if from times(3) man page. It may need to be changed */
103#ifndef HZ 102#ifndef HZ
104#ifndef CLK_TCK 103#ifndef CLK_TCK
105#ifndef VMS
106#define HZ 100.0
107#else /* VMS */
108#define HZ 100.0 104#define HZ 100.0
109#endif
110#else /* CLK_TCK */ 105#else /* CLK_TCK */
111#define HZ ((double)CLK_TCK) 106#define HZ ((double)CLK_TCK)
112#endif 107#endif
@@ -115,12 +110,7 @@ struct tms {
115#define BUFSIZE ((long)1024) 110#define BUFSIZE ((long)1024)
116long run=0; 111long run=0;
117 112
118#ifndef NOPROTO
119double Time_F(int s); 113double Time_F(int s);
120#else
121double Time_F();
122#endif
123
124#ifdef SIGALRM 114#ifdef SIGALRM
125#if defined(__STDC__) || defined(sgi) || defined(_AIX) 115#if defined(__STDC__) || defined(sgi) || defined(_AIX)
126#define SIGRETTYPE void 116#define SIGRETTYPE void
@@ -128,14 +118,8 @@ double Time_F();
128#define SIGRETTYPE int 118#define SIGRETTYPE int
129#endif 119#endif
130 120
131#ifndef NOPROTO
132SIGRETTYPE sig_done(int sig); 121SIGRETTYPE sig_done(int sig);
133#else 122SIGRETTYPE sig_done(int sig)
134SIGRETTYPE sig_done();
135#endif
136
137SIGRETTYPE sig_done(sig)
138int sig;
139 { 123 {
140 signal(SIGALRM,sig_done); 124 signal(SIGALRM,sig_done);
141 run=0; 125 run=0;
@@ -148,8 +132,7 @@ int sig;
148#define START 0 132#define START 0
149#define STOP 1 133#define STOP 1
150 134
151double Time_F(s) 135double Time_F(int s)
152int s;
153 { 136 {
154 double ret; 137 double ret;
155#ifdef TIMES 138#ifdef TIMES
@@ -185,9 +168,7 @@ int s;
185#endif 168#endif
186 } 169 }
187 170
188int main(argc,argv) 171int main(int argc, char **argv)
189int argc;
190char **argv;
191 { 172 {
192 long count; 173 long count;
193 static unsigned char buf[BUFSIZE]; 174 static unsigned char buf[BUFSIZE];
diff --git a/src/lib/libcrypto/rc4/rc4test.c b/src/lib/libcrypto/rc4/rc4test.c
index 041e1aff95..5abf8cff30 100644
--- a/src/lib/libcrypto/rc4/rc4test.c
+++ b/src/lib/libcrypto/rc4/rc4test.c
@@ -59,7 +59,15 @@
59#include <stdio.h> 59#include <stdio.h>
60#include <stdlib.h> 60#include <stdlib.h>
61#include <string.h> 61#include <string.h>
62#include "rc4.h" 62
63#ifdef NO_RC4
64int main(int argc, char *argv[])
65{
66 printf("No RC4 support\n");
67 return(0);
68}
69#else
70#include <openssl/rc4.h>
63 71
64unsigned char keys[7][30]={ 72unsigned char keys[7][30]={
65 {8,0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef}, 73 {8,0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef},
@@ -101,9 +109,7 @@ unsigned char output[7][30]={
101 {0}, 109 {0},
102 }; 110 };
103 111
104int main(argc,argv) 112int main(int argc, char *argv[])
105int argc;
106char *argv[];
107 { 113 {
108 int i,err=0; 114 int i,err=0;
109 int j; 115 int j;
@@ -192,4 +198,4 @@ char *argv[];
192 exit(err); 198 exit(err);
193 return(0); 199 return(0);
194 } 200 }
195 201#endif