summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rc2
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/rc2')
-rw-r--r--src/lib/libcrypto/rc2/rc2speed.c63
-rw-r--r--src/lib/libcrypto/rc2/rc2test.c33
2 files changed, 38 insertions, 58 deletions
diff --git a/src/lib/libcrypto/rc2/rc2speed.c b/src/lib/libcrypto/rc2/rc2speed.c
index 6cd8ea8f27..47d34b444e 100644
--- a/src/lib/libcrypto/rc2/rc2speed.c
+++ b/src/lib/libcrypto/rc2/rc2speed.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,48 +77,40 @@ 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 "rc2.h" 99#include <openssl/rc2.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 105#endif
110#else /* CLK_TCK */ 106#else /* CLK_TCK */
111#define HZ ((double)CLK_TCK) 107#define HZ ((double)CLK_TCK)
112#endif 108#endif
113#endif
114 109
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
@@ -287,7 +268,7 @@ char **argv;
287 printf("RC2 raw ecb bytes per sec = %12.2f (%9.3fuS)\n",b,8.0e6/b); 268 printf("RC2 raw ecb bytes per sec = %12.2f (%9.3fuS)\n",b,8.0e6/b);
288 printf("RC2 cbc bytes per sec = %12.2f (%9.3fuS)\n",c,8.0e6/c); 269 printf("RC2 cbc bytes per sec = %12.2f (%9.3fuS)\n",c,8.0e6/c);
289 exit(0); 270 exit(0);
290#if defined(LINT) || defined(MSDOS) 271#if defined(LINT) || defined(OPENSSL_SYS_MSDOS)
291 return(0); 272 return(0);
292#endif 273#endif
293 } 274 }
diff --git a/src/lib/libcrypto/rc2/rc2test.c b/src/lib/libcrypto/rc2/rc2test.c
index 9d0f8016ec..d9a2a0a1cb 100644
--- a/src/lib/libcrypto/rc2/rc2test.c
+++ b/src/lib/libcrypto/rc2/rc2test.c
@@ -62,9 +62,17 @@
62#include <stdio.h> 62#include <stdio.h>
63#include <string.h> 63#include <string.h>
64#include <stdlib.h> 64#include <stdlib.h>
65#include "rc2.h"
66 65
67unsigned char RC2key[4][16]={ 66#ifdef OPENSSL_NO_RC2
67int main(int argc, char *argv[])
68{
69 printf("No RC2 support\n");
70 return(0);
71}
72#else
73#include <openssl/rc2.h>
74
75static unsigned char RC2key[4][16]={
68 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 76 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
69 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, 77 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
70 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 78 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@@ -75,14 +83,14 @@ unsigned char RC2key[4][16]={
75 0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F}, 83 0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F},
76 }; 84 };
77 85
78unsigned char RC2plain[4][8]={ 86static unsigned char RC2plain[4][8]={
79 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, 87 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
80 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, 88 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
81 {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}, 89 {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},
82 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, 90 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
83 }; 91 };
84 92
85unsigned char RC2cipher[4][8]={ 93static unsigned char RC2cipher[4][8]={
86 {0x1C,0x19,0x8A,0x83,0x8D,0xF0,0x28,0xB7}, 94 {0x1C,0x19,0x8A,0x83,0x8D,0xF0,0x28,0xB7},
87 {0x21,0x82,0x9C,0x78,0xA9,0xF9,0xC0,0x74}, 95 {0x21,0x82,0x9C,0x78,0xA9,0xF9,0xC0,0x74},
88 {0x13,0xDB,0x35,0x17,0xD3,0x21,0x86,0x9E}, 96 {0x13,0xDB,0x35,0x17,0xD3,0x21,0x86,0x9E},
@@ -125,19 +133,11 @@ static unsigned char cfb_cipher64[CFB_TEST_SIZE]={
125 }; 133 };
126 134
127 135
128#ifndef NOPROTO
129/*static int cfb64_test(unsigned char *cfb_cipher);*/ 136/*static int cfb64_test(unsigned char *cfb_cipher);*/
130static char *pt(unsigned char *p); 137static char *pt(unsigned char *p);
131#else
132/*static int cfb64_test(); */
133static char *pt();
134#endif 138#endif
135 139
136#endif 140int main(int argc, char *argv[])
137
138int main(argc,argv)
139int argc;
140char *argv[];
141 { 141 {
142 int i,n,err=0; 142 int i,n,err=0;
143 RC2_KEY key; 143 RC2_KEY key;
@@ -208,8 +208,7 @@ char *argv[];
208 } 208 }
209 209
210#ifdef undef 210#ifdef undef
211static int cfb64_test(cfb_cipher) 211static int cfb64_test(unsigned char *cfb_cipher)
212unsigned char *cfb_cipher;
213 { 212 {
214 IDEA_KEY_SCHEDULE eks,dks; 213 IDEA_KEY_SCHEDULE eks,dks;
215 int err=0,i,n; 214 int err=0,i,n;
@@ -247,8 +246,7 @@ unsigned char *cfb_cipher;
247 return(err); 246 return(err);
248 } 247 }
249 248
250static char *pt(p) 249static char *pt(unsigned char *p)
251unsigned char *p;
252 { 250 {
253 static char bufs[10][20]; 251 static char bufs[10][20];
254 static int bnum=0; 252 static int bnum=0;
@@ -268,3 +266,4 @@ unsigned char *p;
268 } 266 }
269 267
270#endif 268#endif
269#endif