summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rc4
diff options
context:
space:
mode:
authormarkus <>2002-09-05 12:51:52 +0000
committermarkus <>2002-09-05 12:51:52 +0000
commit5514995a9d5ed91db089875adb509c7781357c0e (patch)
tree2484410a46ba6c05ef94c253da36fbceef990b64 /src/lib/libcrypto/rc4
parentfd9566423b542798f5c8b06e68101a9ea5bb9885 (diff)
downloadopenbsd-5514995a9d5ed91db089875adb509c7781357c0e.tar.gz
openbsd-5514995a9d5ed91db089875adb509c7781357c0e.tar.bz2
openbsd-5514995a9d5ed91db089875adb509c7781357c0e.zip
import openssl-0.9.7-beta1
Diffstat (limited to 'src/lib/libcrypto/rc4')
-rw-r--r--src/lib/libcrypto/rc4/rc4.c12
-rw-r--r--src/lib/libcrypto/rc4/rc4s.cpp2
-rw-r--r--src/lib/libcrypto/rc4/rc4speed.c63
-rw-r--r--src/lib/libcrypto/rc4/rc4test.c24
4 files changed, 43 insertions, 58 deletions
diff --git a/src/lib/libcrypto/rc4/rc4.c b/src/lib/libcrypto/rc4/rc4.c
index 127e8a5093..c2165b0b75 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;
@@ -115,7 +113,7 @@ char *argv[];
115 { 113 {
116bad: 114bad:
117 for (pp=usage; (*pp != NULL); pp++) 115 for (pp=usage; (*pp != NULL); pp++)
118 fprintf(stderr,*pp); 116 fprintf(stderr,"%s",*pp);
119 exit(1); 117 exit(1);
120 } 118 }
121 119
@@ -143,7 +141,7 @@ bad:
143 } 141 }
144 } 142 }
145 143
146#ifdef MSDOS 144#ifdef OPENSSL_SYS_MSDOS
147 /* This should set the file to binary mode. */ 145 /* This should set the file to binary mode. */
148 { 146 {
149#include <fcntl.h> 147#include <fcntl.h>
@@ -164,7 +162,7 @@ bad:
164 keystr=buf; 162 keystr=buf;
165 } 163 }
166 164
167 MD5((unsigned char *)keystr,(unsigned long)strlen(keystr),md); 165 EVP_Digest((unsigned char *)keystr,(unsigned long)strlen(keystr),md,NULL,EVP_md5());
168 memset(keystr,0,strlen(keystr)); 166 memset(keystr,0,strlen(keystr));
169 RC4_set_key(&key,MD5_DIGEST_LENGTH,md); 167 RC4_set_key(&key,MD5_DIGEST_LENGTH,md);
170 168
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..ced98c52df 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(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX)
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(OPENSSL_SYS_VMS_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];
@@ -202,7 +183,7 @@ char **argv;
202#endif 183#endif
203 184
204#ifndef TIMES 185#ifndef TIMES
205 printf("To get the most acurate results, try to run this\n"); 186 printf("To get the most accurate results, try to run this\n");
206 printf("program when this computer is idle.\n"); 187 printf("program when this computer is idle.\n");
207#endif 188#endif
208 189
@@ -262,7 +243,7 @@ char **argv;
262 printf("RC4 set_key per sec = %12.2f (%9.3fuS)\n",a,1.0e6/a); 243 printf("RC4 set_key per sec = %12.2f (%9.3fuS)\n",a,1.0e6/a);
263 printf("RC4 bytes per sec = %12.2f (%9.3fuS)\n",c,8.0e6/c); 244 printf("RC4 bytes per sec = %12.2f (%9.3fuS)\n",c,8.0e6/c);
264 exit(0); 245 exit(0);
265#if defined(LINT) || defined(MSDOS) 246#if defined(LINT) || defined(OPENSSL_SYS_MSDOS)
266 return(0); 247 return(0);
267#endif 248#endif
268 } 249 }
diff --git a/src/lib/libcrypto/rc4/rc4test.c b/src/lib/libcrypto/rc4/rc4test.c
index 041e1aff95..a28d457c8d 100644
--- a/src/lib/libcrypto/rc4/rc4test.c
+++ b/src/lib/libcrypto/rc4/rc4test.c
@@ -59,9 +59,17 @@
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"
63 62
64unsigned char keys[7][30]={ 63#ifdef OPENSSL_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>
71
72static unsigned char keys[7][30]={
65 {8,0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef}, 73 {8,0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef},
66 {8,0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef}, 74 {8,0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef},
67 {8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, 75 {8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
@@ -70,8 +78,8 @@ unsigned char keys[7][30]={
70 {4,0xef,0x01,0x23,0x45}, 78 {4,0xef,0x01,0x23,0x45},
71 }; 79 };
72 80
73unsigned char data_len[7]={8,8,8,20,28,10}; 81static unsigned char data_len[7]={8,8,8,20,28,10};
74unsigned char data[7][30]={ 82static unsigned char data[7][30]={
75 {0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,0xff}, 83 {0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,0xff},
76 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff}, 84 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff},
77 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff}, 85 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff},
@@ -86,7 +94,7 @@ unsigned char data[7][30]={
86 {0}, 94 {0},
87 }; 95 };
88 96
89unsigned char output[7][30]={ 97static unsigned char output[7][30]={
90 {0x75,0xb7,0x87,0x80,0x99,0xe0,0xc5,0x96,0x00}, 98 {0x75,0xb7,0x87,0x80,0x99,0xe0,0xc5,0x96,0x00},
91 {0x74,0x94,0xc2,0xe7,0x10,0x4b,0x08,0x79,0x00}, 99 {0x74,0x94,0xc2,0xe7,0x10,0x4b,0x08,0x79,0x00},
92 {0xde,0x18,0x89,0x41,0xa3,0x37,0x5d,0x3a,0x00}, 100 {0xde,0x18,0x89,0x41,0xa3,0x37,0x5d,0x3a,0x00},
@@ -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