summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/des/speed.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/des/speed.c')
-rw-r--r--src/lib/libcrypto/des/speed.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/lib/libcrypto/des/speed.c b/src/lib/libcrypto/des/speed.c
index 1223edf290..48fc1d49fc 100644
--- a/src/lib/libcrypto/des/speed.c
+++ b/src/lib/libcrypto/des/speed.c
@@ -59,7 +59,7 @@
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#if !defined(MSDOS) && (!defined(VMS) || defined(__DECC)) 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
@@ -82,7 +82,7 @@ OPENSSL_DECLARE_EXIT
82 The __TMS macro will show if it was. If it wasn't defined, we should 82 The __TMS macro will show if it was. If it wasn't defined, we should
83 undefine TIMES, since that tells the rest of the program how things 83 undefine TIMES, since that tells the rest of the program how things
84 should be handled. -- Richard Levitte */ 84 should be handled. -- Richard Levitte */
85#if defined(VMS) && defined(__DECC) && !defined(__TMS) 85#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
86#undef TIMES 86#undef TIMES
87#endif 87#endif
88 88
@@ -176,10 +176,10 @@ int main(int argc, char **argv)
176 { 176 {
177 long count; 177 long count;
178 static unsigned char buf[BUFSIZE]; 178 static unsigned char buf[BUFSIZE];
179 static des_cblock key ={0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0}; 179 static DES_cblock key ={0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0};
180 static des_cblock key2={0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12}; 180 static DES_cblock key2={0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12};
181 static des_cblock key3={0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34}; 181 static DES_cblock key3={0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34};
182 des_key_schedule sch,sch2,sch3; 182 DES_key_schedule sch,sch2,sch3;
183 double a,b,c,d,e; 183 double a,b,c,d,e;
184#ifndef SIGALRM 184#ifndef SIGALRM
185 long ca,cb,cc,cd,ce; 185 long ca,cb,cc,cd,ce;
@@ -190,12 +190,12 @@ int main(int argc, char **argv)
190 printf("program when this computer is idle.\n"); 190 printf("program when this computer is idle.\n");
191#endif 191#endif
192 192
193 des_set_key_unchecked(&key2,sch2); 193 DES_set_key_unchecked(&key2,&sch2);
194 des_set_key_unchecked(&key3,sch3); 194 DES_set_key_unchecked(&key3,&sch3);
195 195
196#ifndef SIGALRM 196#ifndef SIGALRM
197 printf("First we calculate the approximate speed ...\n"); 197 printf("First we calculate the approximate speed ...\n");
198 des_set_key_unchecked(&key,sch); 198 DES_set_key_unchecked(&key,&sch);
199 count=10; 199 count=10;
200 do { 200 do {
201 long i; 201 long i;
@@ -204,7 +204,7 @@ int main(int argc, char **argv)
204 count*=2; 204 count*=2;
205 Time_F(START); 205 Time_F(START);
206 for (i=count; i; i--) 206 for (i=count; i; i--)
207 des_encrypt1(data,&(sch[0]),DES_ENCRYPT); 207 DES_encrypt1(data,&sch,DES_ENCRYPT);
208 d=Time_F(STOP); 208 d=Time_F(STOP);
209 } while (d < 3.0); 209 } while (d < 3.0);
210 ca=count; 210 ca=count;
@@ -225,63 +225,63 @@ int main(int argc, char **argv)
225 225
226 Time_F(START); 226 Time_F(START);
227 for (count=0,run=1; COND(ca); count++) 227 for (count=0,run=1; COND(ca); count++)
228 des_set_key_unchecked(&key,sch); 228 DES_set_key_unchecked(&key,&sch);
229 d=Time_F(STOP); 229 d=Time_F(STOP);
230 printf("%ld set_key's in %.2f seconds\n",count,d); 230 printf("%ld set_key's in %.2f seconds\n",count,d);
231 a=((double)COUNT(ca))/d; 231 a=((double)COUNT(ca))/d;
232 232
233#ifdef SIGALRM 233#ifdef SIGALRM
234 printf("Doing des_encrypt's for 10 seconds\n"); 234 printf("Doing DES_encrypt's for 10 seconds\n");
235 alarm(10); 235 alarm(10);
236#else 236#else
237 printf("Doing des_encrypt %ld times\n",cb); 237 printf("Doing DES_encrypt %ld times\n",cb);
238#endif 238#endif
239 Time_F(START); 239 Time_F(START);
240 for (count=0,run=1; COND(cb); count++) 240 for (count=0,run=1; COND(cb); count++)
241 { 241 {
242 DES_LONG data[2]; 242 DES_LONG data[2];
243 243
244 des_encrypt1(data,&(sch[0]),DES_ENCRYPT); 244 DES_encrypt1(data,&sch,DES_ENCRYPT);
245 } 245 }
246 d=Time_F(STOP); 246 d=Time_F(STOP);
247 printf("%ld des_encrypt's in %.2f second\n",count,d); 247 printf("%ld DES_encrypt's in %.2f second\n",count,d);
248 b=((double)COUNT(cb)*8)/d; 248 b=((double)COUNT(cb)*8)/d;
249 249
250#ifdef SIGALRM 250#ifdef SIGALRM
251 printf("Doing des_cbc_encrypt on %ld byte blocks for 10 seconds\n", 251 printf("Doing DES_cbc_encrypt on %ld byte blocks for 10 seconds\n",
252 BUFSIZE); 252 BUFSIZE);
253 alarm(10); 253 alarm(10);
254#else 254#else
255 printf("Doing des_cbc_encrypt %ld times on %ld byte blocks\n",cc, 255 printf("Doing DES_cbc_encrypt %ld times on %ld byte blocks\n",cc,
256 BUFSIZE); 256 BUFSIZE);
257#endif 257#endif
258 Time_F(START); 258 Time_F(START);
259 for (count=0,run=1; COND(cc); count++) 259 for (count=0,run=1; COND(cc); count++)
260 des_ncbc_encrypt(buf,buf,BUFSIZE,&(sch[0]), 260 DES_ncbc_encrypt(buf,buf,BUFSIZE,&sch,
261 &key,DES_ENCRYPT); 261 &key,DES_ENCRYPT);
262 d=Time_F(STOP); 262 d=Time_F(STOP);
263 printf("%ld des_cbc_encrypt's of %ld byte blocks in %.2f second\n", 263 printf("%ld DES_cbc_encrypt's of %ld byte blocks in %.2f second\n",
264 count,BUFSIZE,d); 264 count,BUFSIZE,d);
265 c=((double)COUNT(cc)*BUFSIZE)/d; 265 c=((double)COUNT(cc)*BUFSIZE)/d;
266 266
267#ifdef SIGALRM 267#ifdef SIGALRM
268 printf("Doing des_ede_cbc_encrypt on %ld byte blocks for 10 seconds\n", 268 printf("Doing DES_ede_cbc_encrypt on %ld byte blocks for 10 seconds\n",
269 BUFSIZE); 269 BUFSIZE);
270 alarm(10); 270 alarm(10);
271#else 271#else
272 printf("Doing des_ede_cbc_encrypt %ld times on %ld byte blocks\n",cd, 272 printf("Doing DES_ede_cbc_encrypt %ld times on %ld byte blocks\n",cd,
273 BUFSIZE); 273 BUFSIZE);
274#endif 274#endif
275 Time_F(START); 275 Time_F(START);
276 for (count=0,run=1; COND(cd); count++) 276 for (count=0,run=1; COND(cd); count++)
277 des_ede3_cbc_encrypt(buf,buf,BUFSIZE, 277 DES_ede3_cbc_encrypt(buf,buf,BUFSIZE,
278 &(sch[0]), 278 &sch,
279 &(sch2[0]), 279 &sch2,
280 &(sch3[0]), 280 &sch3,
281 &key, 281 &key,
282 DES_ENCRYPT); 282 DES_ENCRYPT);
283 d=Time_F(STOP); 283 d=Time_F(STOP);
284 printf("%ld des_ede_cbc_encrypt's of %ld byte blocks in %.2f second\n", 284 printf("%ld DES_ede_cbc_encrypt's of %ld byte blocks in %.2f second\n",
285 count,BUFSIZE,d); 285 count,BUFSIZE,d);
286 d=((double)COUNT(cd)*BUFSIZE)/d; 286 d=((double)COUNT(cd)*BUFSIZE)/d;
287 287
@@ -304,7 +304,7 @@ int main(int argc, char **argv)
304 printf("DES ede cbc bytes per sec = %12.2f (%9.3fuS)\n",d,8.0e6/d); 304 printf("DES ede cbc bytes per sec = %12.2f (%9.3fuS)\n",d,8.0e6/d);
305 printf("crypt per sec = %12.2f (%9.3fuS)\n",e,1.0e6/e); 305 printf("crypt per sec = %12.2f (%9.3fuS)\n",e,1.0e6/e);
306 exit(0); 306 exit(0);
307#if defined(LINT) || defined(MSDOS) 307#if defined(LINT) || defined(OPENSSL_SYS_MSDOS)
308 return(0); 308 return(0);
309#endif 309#endif
310 } 310 }