OLD | NEW |
1 /* apps/speed.c -*- mode:C; c-file-style: "eay" -*- */ | 1 /* apps/speed.c -*- mode:C; c-file-style: "eay" -*- */ |
2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * This package is an SSL implementation written | 5 * This package is an SSL implementation written |
6 * by Eric Young (eay@cryptsoft.com). | 6 * by Eric Young (eay@cryptsoft.com). |
7 * The implementation was written so as to conform with Netscapes SSL. | 7 * The implementation was written so as to conform with Netscapes SSL. |
8 * | 8 * |
9 * This library is free for commercial and non-commercial use as long as | 9 * This library is free for commercial and non-commercial use as long as |
10 * the following conditions are aheared to. The following conditions | 10 * the following conditions are aheared to. The following conditions |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 #include <openssl/evp.h> | 101 #include <openssl/evp.h> |
102 #include <openssl/objects.h> | 102 #include <openssl/objects.h> |
103 #if !defined(OPENSSL_SYS_MSDOS) | 103 #if !defined(OPENSSL_SYS_MSDOS) |
104 #include OPENSSL_UNISTD | 104 #include OPENSSL_UNISTD |
105 #endif | 105 #endif |
106 | 106 |
107 #ifndef OPENSSL_SYS_NETWARE | 107 #ifndef OPENSSL_SYS_NETWARE |
108 #include <signal.h> | 108 #include <signal.h> |
109 #endif | 109 #endif |
110 | 110 |
111 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defin
ed(OPENSSL_SYS_MACOSX) | 111 #ifdef _WIN32 |
112 # define USE_TOD | 112 #include <windows.h> |
113 #elif !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VXWORKS) && (!defined(
OPENSSL_SYS_VMS) || defined(__DECC)) | |
114 # define TIMES | |
115 #endif | |
116 #if !defined(_UNICOS) && !defined(__OpenBSD__) && !defined(sgi) && !defined(__Fr
eeBSD__) && !(defined(__bsdi) || defined(__bsdi__)) && !defined(_AIX) && !define
d(OPENSSL_SYS_MPE) && !defined(__NetBSD__) && !defined(OPENSSL_SYS_VXWORKS) /* F
IXME */ | |
117 # define TIMEB | |
118 #endif | |
119 | |
120 #if defined(OPENSSL_SYS_NETWARE) | |
121 #undef TIMES | |
122 #undef TIMEB | |
123 #include <time.h> | |
124 #endif | |
125 | |
126 #ifndef _IRIX | |
127 # include <time.h> | |
128 #endif | |
129 #ifdef TIMES | |
130 # include <sys/types.h> | |
131 # include <sys/times.h> | |
132 #endif | |
133 #ifdef USE_TOD | |
134 # include <sys/time.h> | |
135 # include <sys/resource.h> | |
136 #endif | |
137 | |
138 /* Depending on the VMS version, the tms structure is perhaps defined. | |
139 The __TMS macro will show if it was. If it wasn't defined, we should | |
140 undefine TIMES, since that tells the rest of the program how things | |
141 should be handled.» » » » -- Richard Levitte */ | |
142 #if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS) | |
143 #undef TIMES | |
144 #endif | |
145 | |
146 #ifdef TIMEB | |
147 #include <sys/timeb.h> | |
148 #endif | |
149 | |
150 #if !defined(TIMES) && !defined(TIMEB) && !defined(USE_TOD) && !defined(OPENSSL_
SYS_VXWORKS) && !defined(OPENSSL_SYS_NETWARE) | |
151 #error "It seems neither struct tms nor struct timeb is supported in this platfo
rm!" | |
152 #endif | |
153 | |
154 #if defined(sun) || defined(__ultrix) | |
155 #define _POSIX_SOURCE | |
156 #include <limits.h> | |
157 #include <sys/param.h> | |
158 #endif | 113 #endif |
159 | 114 |
160 #include <openssl/bn.h> | 115 #include <openssl/bn.h> |
161 #ifndef OPENSSL_NO_DES | 116 #ifndef OPENSSL_NO_DES |
162 #include <openssl/des.h> | 117 #include <openssl/des.h> |
163 #endif | 118 #endif |
164 #ifndef OPENSSL_NO_AES | 119 #ifndef OPENSSL_NO_AES |
165 #include <openssl/aes.h> | 120 #include <openssl/aes.h> |
166 #endif | 121 #endif |
167 #ifndef OPENSSL_NO_CAMELLIA | 122 #ifndef OPENSSL_NO_CAMELLIA |
(...skipping 14 matching lines...) Expand all Loading... |
182 #ifndef OPENSSL_NO_HMAC | 137 #ifndef OPENSSL_NO_HMAC |
183 #include <openssl/hmac.h> | 138 #include <openssl/hmac.h> |
184 #endif | 139 #endif |
185 #include <openssl/evp.h> | 140 #include <openssl/evp.h> |
186 #ifndef OPENSSL_NO_SHA | 141 #ifndef OPENSSL_NO_SHA |
187 #include <openssl/sha.h> | 142 #include <openssl/sha.h> |
188 #endif | 143 #endif |
189 #ifndef OPENSSL_NO_RIPEMD | 144 #ifndef OPENSSL_NO_RIPEMD |
190 #include <openssl/ripemd.h> | 145 #include <openssl/ripemd.h> |
191 #endif | 146 #endif |
| 147 #ifndef OPENSSL_NO_WHIRLPOOL |
| 148 #include <openssl/whrlpool.h> |
| 149 #endif |
192 #ifndef OPENSSL_NO_RC4 | 150 #ifndef OPENSSL_NO_RC4 |
193 #include <openssl/rc4.h> | 151 #include <openssl/rc4.h> |
194 #endif | 152 #endif |
195 #ifndef OPENSSL_NO_RC5 | 153 #ifndef OPENSSL_NO_RC5 |
196 #include <openssl/rc5.h> | 154 #include <openssl/rc5.h> |
197 #endif | 155 #endif |
198 #ifndef OPENSSL_NO_RC2 | 156 #ifndef OPENSSL_NO_RC2 |
199 #include <openssl/rc2.h> | 157 #include <openssl/rc2.h> |
200 #endif | 158 #endif |
201 #ifndef OPENSSL_NO_IDEA | 159 #ifndef OPENSSL_NO_IDEA |
(...skipping 17 matching lines...) Expand all Loading... |
219 #include <openssl/dsa.h> | 177 #include <openssl/dsa.h> |
220 #include "./testdsa.h" | 178 #include "./testdsa.h" |
221 #endif | 179 #endif |
222 #ifndef OPENSSL_NO_ECDSA | 180 #ifndef OPENSSL_NO_ECDSA |
223 #include <openssl/ecdsa.h> | 181 #include <openssl/ecdsa.h> |
224 #endif | 182 #endif |
225 #ifndef OPENSSL_NO_ECDH | 183 #ifndef OPENSSL_NO_ECDH |
226 #include <openssl/ecdh.h> | 184 #include <openssl/ecdh.h> |
227 #endif | 185 #endif |
228 | 186 |
229 /* | |
230 * The following "HZ" timing stuff should be sync'd up with the code in | |
231 * crypto/tmdiff.[ch]. That appears to try to do the same job, though I think | |
232 * this code is more up to date than libcrypto's so there may be features to | |
233 * migrate over first. This is used in two places further down AFAICS. | |
234 * The point is that nothing in openssl actually *uses* that tmdiff stuff, so | |
235 * either speed.c should be using it or it should go because it's obviously not | |
236 * useful enough. Anyone want to do a janitorial job on this? | |
237 */ | |
238 | |
239 /* The following if from times(3) man page. It may need to be changed */ | |
240 #ifndef HZ | |
241 # if defined(_SC_CLK_TCK) \ | |
242 && (!defined(OPENSSL_SYS_VMS) || __CTRL_VER >= 70000000) | |
243 # define HZ sysconf(_SC_CLK_TCK) | |
244 # else | |
245 # ifndef CLK_TCK | |
246 # ifndef _BSD_CLK_TCK_ /* FreeBSD hack */ | |
247 # define HZ 100.0 | |
248 # else /* _BSD_CLK_TCK_ */ | |
249 # define HZ ((double)_BSD_CLK_TCK_) | |
250 # endif | |
251 # else /* CLK_TCK */ | |
252 # define HZ ((double)CLK_TCK) | |
253 # endif | |
254 # endif | |
255 #endif | |
256 | |
257 #ifndef HAVE_FORK | 187 #ifndef HAVE_FORK |
258 # if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL
_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_NETWA
RE) | 188 # if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL
_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_NETWA
RE) |
259 # define HAVE_FORK 0 | 189 # define HAVE_FORK 0 |
260 # else | 190 # else |
261 # define HAVE_FORK 1 | 191 # define HAVE_FORK 1 |
262 # endif | 192 # endif |
263 #endif | 193 #endif |
264 | 194 |
265 #if HAVE_FORK | 195 #if HAVE_FORK |
266 # undef NO_FORK | 196 #undef NO_FORK |
267 #else | 197 #else |
268 # define NO_FORK | 198 #define NO_FORK |
269 #endif | 199 #endif |
270 | 200 |
271 #undef BUFSIZE | 201 #undef BUFSIZE |
272 #define BUFSIZE ((long)1024*8+1) | 202 #define BUFSIZE ((long)1024*8+1) |
273 int run=0; | 203 int run=0; |
274 | 204 |
275 static char ftime_used = 0, times_used = 0, gettimeofday_used = 0, getrusage_use
d = 0; | |
276 static int mr=0; | 205 static int mr=0; |
277 static int usertime=1; | 206 static int usertime=1; |
278 | 207 |
279 static double Time_F(int s); | 208 static double Time_F(int s); |
280 static void print_message(const char *s,long num,int length); | 209 static void print_message(const char *s,long num,int length); |
281 static void pkey_print_message(const char *str, const char *str2, | 210 static void pkey_print_message(const char *str, const char *str2, |
282 long num, int bits, int sec); | 211 long num, int bits, int sec); |
283 static void print_result(int alg,int run_no,int count,double time_used); | 212 static void print_result(int alg,int run_no,int count,double time_used); |
284 #ifndef NO_FORK | 213 #ifndef NO_FORK |
285 static int do_multi(int multi); | 214 static int do_multi(int multi); |
286 #endif | 215 #endif |
287 | 216 |
288 #define ALGOR_NUM» 28 | 217 #define ALGOR_NUM» 29 |
289 #define SIZE_NUM 5 | 218 #define SIZE_NUM 5 |
290 #define RSA_NUM 4 | 219 #define RSA_NUM 4 |
291 #define DSA_NUM 3 | 220 #define DSA_NUM 3 |
292 | 221 |
293 #define EC_NUM 16 | 222 #define EC_NUM 16 |
294 #define MAX_ECDH_SIZE 256 | 223 #define MAX_ECDH_SIZE 256 |
295 | 224 |
296 static const char *names[ALGOR_NUM]={ | 225 static const char *names[ALGOR_NUM]={ |
297 "md2","mdc2","md4","md5","hmac(md5)","sha1","rmd160","rc4", | 226 "md2","mdc2","md4","md5","hmac(md5)","sha1","rmd160","rc4", |
298 "des cbc","des ede3","idea cbc","seed cbc", | 227 "des cbc","des ede3","idea cbc","seed cbc", |
299 "rc2 cbc","rc5-32/12 cbc","blowfish cbc","cast cbc", | 228 "rc2 cbc","rc5-32/12 cbc","blowfish cbc","cast cbc", |
300 "aes-128 cbc","aes-192 cbc","aes-256 cbc", | 229 "aes-128 cbc","aes-192 cbc","aes-256 cbc", |
301 "camellia-128 cbc","camellia-192 cbc","camellia-256 cbc", | 230 "camellia-128 cbc","camellia-192 cbc","camellia-256 cbc", |
302 "evp","sha256","sha512", | 231 "evp","sha256","sha512","whirlpool", |
303 "aes-128 ige","aes-192 ige","aes-256 ige"}; | 232 "aes-128 ige","aes-192 ige","aes-256 ige"}; |
304 static double results[ALGOR_NUM][SIZE_NUM]; | 233 static double results[ALGOR_NUM][SIZE_NUM]; |
305 static int lengths[SIZE_NUM]={16,64,256,1024,8*1024}; | 234 static int lengths[SIZE_NUM]={16,64,256,1024,8*1024}; |
306 #ifndef OPENSSL_NO_RSA | 235 #ifndef OPENSSL_NO_RSA |
307 static double rsa_results[RSA_NUM][2]; | 236 static double rsa_results[RSA_NUM][2]; |
308 #endif | 237 #endif |
309 #ifndef OPENSSL_NO_DSA | 238 #ifndef OPENSSL_NO_DSA |
310 static double dsa_results[DSA_NUM][2]; | 239 static double dsa_results[DSA_NUM][2]; |
311 #endif | 240 #endif |
312 #ifndef OPENSSL_NO_ECDSA | 241 #ifndef OPENSSL_NO_ECDSA |
(...skipping 22 matching lines...) Expand all Loading... |
335 run=0; | 264 run=0; |
336 #ifdef LINT | 265 #ifdef LINT |
337 sig=sig; | 266 sig=sig; |
338 #endif | 267 #endif |
339 } | 268 } |
340 #endif | 269 #endif |
341 | 270 |
342 #define START 0 | 271 #define START 0 |
343 #define STOP 1 | 272 #define STOP 1 |
344 | 273 |
345 #if defined(OPENSSL_SYS_NETWARE) | 274 #if defined(_WIN32) |
346 | 275 |
347 /* for NetWare the best we can do is use clock() which returns the | 276 #define SIGALRM |
348 * time, in hundredths of a second, since the NLM began executing | 277 static unsigned int lapse,schlock; |
349 */ | 278 static void alarm(unsigned int secs) { lapse = secs*1000; } |
| 279 |
| 280 static DWORD WINAPI sleepy(VOID *arg) |
| 281 » { |
| 282 » schlock = 1; |
| 283 » Sleep(lapse); |
| 284 » run = 0; |
| 285 » return 0; |
| 286 » } |
| 287 |
350 static double Time_F(int s) | 288 static double Time_F(int s) |
351 { | 289 { |
352 » double ret; | 290 » if (s == START) |
| 291 » » { |
| 292 » » HANDLE» thr; |
| 293 » » schlock = 0; |
| 294 » » thr = CreateThread(NULL,4096,sleepy,NULL,0,NULL); |
| 295 » » if (thr==NULL) |
| 296 » » » { |
| 297 » » » DWORD ret=GetLastError(); |
| 298 » » » BIO_printf(bio_err,"unable to CreateThread (%d)",ret); |
| 299 » » » ExitProcess(ret); |
| 300 » » » } |
| 301 » » CloseHandle(thr);» » /* detach the thread» */ |
| 302 » » while (!schlock) Sleep(0);» /* scheduler spinlock» */ |
| 303 » » } |
353 | 304 |
354 static clock_t tstart,tend; | 305 » return app_tminterval(s,usertime); |
355 | 306 » } |
356 if (s == START) | |
357 { | |
358 tstart=clock(); | |
359 return(0); | |
360 } | |
361 else | |
362 { | |
363 tend=clock(); | |
364 ret=(double)((double)(tend)-(double)(tstart)); | |
365 return((ret < 0.001)?0.001:ret); | |
366 } | |
367 } | |
368 | |
369 #else | 307 #else |
370 | 308 |
371 static double Time_F(int s) | 309 static double Time_F(int s) |
372 { | 310 { |
373 » double ret; | 311 » return app_tminterval(s,usertime); |
374 | 312 » } |
375 #ifdef USE_TOD | |
376 » if(usertime) | |
377 » » { | |
378 » » static struct rusage tstart,tend; | |
379 | |
380 » » getrusage_used = 1; | |
381 » » if (s == START) | |
382 » » » { | |
383 » » » getrusage(RUSAGE_SELF,&tstart); | |
384 » » » return(0); | |
385 » » » } | |
386 » » else | |
387 » » » { | |
388 » » » long i; | |
389 | |
390 » » » getrusage(RUSAGE_SELF,&tend); | |
391 » » » i=(long)tend.ru_utime.tv_usec-(long)tstart.ru_utime.tv_u
sec; | |
392 » » » ret=((double)(tend.ru_utime.tv_sec-tstart.ru_utime.tv_se
c)) | |
393 » » » +((double)i)/1000000.0; | |
394 » » » return((ret < 0.001)?0.001:ret); | |
395 » » » } | |
396 » » } | |
397 » else | |
398 » » { | |
399 » » static struct timeval tstart,tend; | |
400 » » long i; | |
401 | |
402 » » gettimeofday_used = 1; | |
403 » » if (s == START) | |
404 » » » { | |
405 » » » gettimeofday(&tstart,NULL); | |
406 » » » return(0); | |
407 » » » } | |
408 » » else | |
409 » » » { | |
410 » » » gettimeofday(&tend,NULL); | |
411 » » » i=(long)tend.tv_usec-(long)tstart.tv_usec; | |
412 » » » ret=((double)(tend.tv_sec-tstart.tv_sec))+((double)i)/10
00000.0; | |
413 » » » return((ret < 0.001)?0.001:ret); | |
414 » » » } | |
415 » » } | |
416 #else /* ndef USE_TOD */ | |
417 » » | |
418 # ifdef TIMES | |
419 » if (usertime) | |
420 » » { | |
421 » » static struct tms tstart,tend; | |
422 | |
423 » » times_used = 1; | |
424 » » if (s == START) | |
425 » » » { | |
426 » » » times(&tstart); | |
427 » » » return(0); | |
428 » » » } | |
429 » » else | |
430 » » » { | |
431 » » » times(&tend); | |
432 » » » ret = HZ; | |
433 » » » ret=(double)(tend.tms_utime-tstart.tms_utime) / ret; | |
434 » » » return((ret < 1e-3)?1e-3:ret); | |
435 » » » } | |
436 » » } | |
437 # endif /* times() */ | |
438 # if defined(TIMES) && defined(TIMEB) | |
439 » else | |
440 # endif | |
441 # ifdef OPENSSL_SYS_VXWORKS | |
442 { | |
443 » » static unsigned long tick_start, tick_end; | |
444 | |
445 » » if( s == START ) | |
446 » » » { | |
447 » » » tick_start = tickGet(); | |
448 » » » return 0; | |
449 » » » } | |
450 » » else | |
451 » » » { | |
452 » » » tick_end = tickGet(); | |
453 » » » ret = (double)(tick_end - tick_start) / (double)sysClkRa
teGet(); | |
454 » » » return((ret < 0.001)?0.001:ret); | |
455 » » » } | |
456 } | |
457 # elif defined(TIMEB) | |
458 » » { | |
459 » » static struct timeb tstart,tend; | |
460 » » long i; | |
461 | |
462 » » ftime_used = 1; | |
463 » » if (s == START) | |
464 » » » { | |
465 » » » ftime(&tstart); | |
466 » » » return(0); | |
467 » » » } | |
468 » » else | |
469 » » » { | |
470 » » » ftime(&tend); | |
471 » » » i=(long)tend.millitm-(long)tstart.millitm; | |
472 » » » ret=((double)(tend.time-tstart.time))+((double)i)/1000.0
; | |
473 » » » return((ret < 0.001)?0.001:ret); | |
474 » » » } | |
475 » » } | |
476 # endif | |
477 #endif | 313 #endif |
478 } | |
479 #endif /* if defined(OPENSSL_SYS_NETWARE) */ | |
480 | 314 |
481 | 315 |
482 #ifndef OPENSSL_NO_ECDH | 316 #ifndef OPENSSL_NO_ECDH |
483 static const int KDF1_SHA1_len = 20; | 317 static const int KDF1_SHA1_len = 20; |
484 static void *KDF1_SHA1(const void *in, size_t inlen, void *out, size_t *outlen) | 318 static void *KDF1_SHA1(const void *in, size_t inlen, void *out, size_t *outlen) |
485 { | 319 { |
486 #ifndef OPENSSL_NO_SHA | 320 #ifndef OPENSSL_NO_SHA |
487 if (*outlen < SHA_DIGEST_LENGTH) | 321 if (*outlen < SHA_DIGEST_LENGTH) |
488 return NULL; | 322 return NULL; |
489 else | 323 else |
490 *outlen = SHA_DIGEST_LENGTH; | 324 *outlen = SHA_DIGEST_LENGTH; |
491 return SHA1(in, inlen, out); | 325 return SHA1(in, inlen, out); |
492 #else | 326 #else |
493 return NULL; | 327 return NULL; |
494 #endif /* OPENSSL_NO_SHA */ | 328 #endif /* OPENSSL_NO_SHA */ |
495 } | 329 } |
496 #endif /* OPENSSL_NO_ECDH */ | 330 #endif /* OPENSSL_NO_ECDH */ |
497 | 331 |
498 | 332 |
499 int MAIN(int, char **); | 333 int MAIN(int, char **); |
500 | 334 |
501 int MAIN(int argc, char **argv) | 335 int MAIN(int argc, char **argv) |
502 { | 336 { |
503 #ifndef OPENSSL_NO_ENGINE | |
504 ENGINE *e = NULL; | |
505 #endif | |
506 unsigned char *buf=NULL,*buf2=NULL; | 337 unsigned char *buf=NULL,*buf2=NULL; |
507 int mret=1; | 338 int mret=1; |
508 long count=0,save_count=0; | 339 long count=0,save_count=0; |
509 int i,j,k; | 340 int i,j,k; |
510 #if !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_DSA) | 341 #if !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_DSA) |
511 long rsa_count; | 342 long rsa_count; |
512 #endif | 343 #endif |
513 #ifndef OPENSSL_NO_RSA | 344 #ifndef OPENSSL_NO_RSA |
514 unsigned rsa_num; | 345 unsigned rsa_num; |
515 #endif | 346 #endif |
(...skipping 13 matching lines...) Expand all Loading... |
529 #endif | 360 #endif |
530 #ifndef OPENSSL_NO_SHA | 361 #ifndef OPENSSL_NO_SHA |
531 unsigned char sha[SHA_DIGEST_LENGTH]; | 362 unsigned char sha[SHA_DIGEST_LENGTH]; |
532 #ifndef OPENSSL_NO_SHA256 | 363 #ifndef OPENSSL_NO_SHA256 |
533 unsigned char sha256[SHA256_DIGEST_LENGTH]; | 364 unsigned char sha256[SHA256_DIGEST_LENGTH]; |
534 #endif | 365 #endif |
535 #ifndef OPENSSL_NO_SHA512 | 366 #ifndef OPENSSL_NO_SHA512 |
536 unsigned char sha512[SHA512_DIGEST_LENGTH]; | 367 unsigned char sha512[SHA512_DIGEST_LENGTH]; |
537 #endif | 368 #endif |
538 #endif | 369 #endif |
| 370 #ifndef OPENSSL_NO_WHIRLPOOL |
| 371 unsigned char whirlpool[WHIRLPOOL_DIGEST_LENGTH]; |
| 372 #endif |
539 #ifndef OPENSSL_NO_RIPEMD | 373 #ifndef OPENSSL_NO_RIPEMD |
540 unsigned char rmd160[RIPEMD160_DIGEST_LENGTH]; | 374 unsigned char rmd160[RIPEMD160_DIGEST_LENGTH]; |
541 #endif | 375 #endif |
542 #ifndef OPENSSL_NO_RC4 | 376 #ifndef OPENSSL_NO_RC4 |
543 RC4_KEY rc4_ks; | 377 RC4_KEY rc4_ks; |
544 #endif | 378 #endif |
545 #ifndef OPENSSL_NO_RC5 | 379 #ifndef OPENSSL_NO_RC5 |
546 RC5_32_KEY rc5_ks; | 380 RC5_32_KEY rc5_ks; |
547 #endif | 381 #endif |
548 #ifndef OPENSSL_NO_RC2 | 382 #ifndef OPENSSL_NO_RC2 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34,0x56}; | 420 0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34,0x56}; |
587 #endif | 421 #endif |
588 #ifndef OPENSSL_NO_AES | 422 #ifndef OPENSSL_NO_AES |
589 #define MAX_BLOCK_SIZE 128 | 423 #define MAX_BLOCK_SIZE 128 |
590 #else | 424 #else |
591 #define MAX_BLOCK_SIZE 64 | 425 #define MAX_BLOCK_SIZE 64 |
592 #endif | 426 #endif |
593 unsigned char DES_iv[8]; | 427 unsigned char DES_iv[8]; |
594 unsigned char iv[2*MAX_BLOCK_SIZE/8]; | 428 unsigned char iv[2*MAX_BLOCK_SIZE/8]; |
595 #ifndef OPENSSL_NO_DES | 429 #ifndef OPENSSL_NO_DES |
596 DES_cblock *buf_as_des_cblock = NULL; | |
597 static DES_cblock key ={0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0}; | 430 static DES_cblock key ={0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0}; |
598 static DES_cblock key2={0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12}; | 431 static DES_cblock key2={0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12}; |
599 static DES_cblock key3={0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34}; | 432 static DES_cblock key3={0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34}; |
600 DES_key_schedule sch; | 433 DES_key_schedule sch; |
601 DES_key_schedule sch2; | 434 DES_key_schedule sch2; |
602 DES_key_schedule sch3; | 435 DES_key_schedule sch3; |
603 #endif | 436 #endif |
604 #ifndef OPENSSL_NO_AES | 437 #ifndef OPENSSL_NO_AES |
605 AES_KEY aes_ks1, aes_ks2, aes_ks3; | 438 AES_KEY aes_ks1, aes_ks2, aes_ks3; |
606 #endif | 439 #endif |
(...skipping 18 matching lines...) Expand all Loading... |
625 #define D_CBC_CAST 15 | 458 #define D_CBC_CAST 15 |
626 #define D_CBC_128_AES 16 | 459 #define D_CBC_128_AES 16 |
627 #define D_CBC_192_AES 17 | 460 #define D_CBC_192_AES 17 |
628 #define D_CBC_256_AES 18 | 461 #define D_CBC_256_AES 18 |
629 #define D_CBC_128_CML 19 | 462 #define D_CBC_128_CML 19 |
630 #define D_CBC_192_CML 20 | 463 #define D_CBC_192_CML 20 |
631 #define D_CBC_256_CML 21 | 464 #define D_CBC_256_CML 21 |
632 #define D_EVP 22 | 465 #define D_EVP 22 |
633 #define D_SHA256 23 | 466 #define D_SHA256 23 |
634 #define D_SHA512 24 | 467 #define D_SHA512 24 |
635 #define D_IGE_128_AES 25 | 468 #define D_WHIRLPOOL» 25 |
636 #define D_IGE_192_AES 26 | 469 #define D_IGE_128_AES 26 |
637 #define D_IGE_256_AES 27 | 470 #define D_IGE_192_AES 27 |
| 471 #define D_IGE_256_AES 28 |
638 double d=0.0; | 472 double d=0.0; |
639 long c[ALGOR_NUM][SIZE_NUM]; | 473 long c[ALGOR_NUM][SIZE_NUM]; |
640 #define R_DSA_512 0 | 474 #define R_DSA_512 0 |
641 #define R_DSA_1024 1 | 475 #define R_DSA_1024 1 |
642 #define R_DSA_2048 2 | 476 #define R_DSA_2048 2 |
643 #define R_RSA_512 0 | 477 #define R_RSA_512 0 |
644 #define R_RSA_1024 1 | 478 #define R_RSA_1024 1 |
645 #define R_RSA_2048 2 | 479 #define R_RSA_2048 2 |
646 #define R_RSA_4096 3 | 480 #define R_RSA_4096 3 |
647 | 481 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 memset(rsa_key,0,sizeof(rsa_key)); | 633 memset(rsa_key,0,sizeof(rsa_key)); |
800 for (i=0; i<RSA_NUM; i++) | 634 for (i=0; i<RSA_NUM; i++) |
801 rsa_key[i]=NULL; | 635 rsa_key[i]=NULL; |
802 #endif | 636 #endif |
803 | 637 |
804 if ((buf=(unsigned char *)OPENSSL_malloc((int)BUFSIZE)) == NULL) | 638 if ((buf=(unsigned char *)OPENSSL_malloc((int)BUFSIZE)) == NULL) |
805 { | 639 { |
806 BIO_printf(bio_err,"out of memory\n"); | 640 BIO_printf(bio_err,"out of memory\n"); |
807 goto end; | 641 goto end; |
808 } | 642 } |
809 #ifndef OPENSSL_NO_DES | |
810 buf_as_des_cblock = (DES_cblock *)buf; | |
811 #endif | |
812 if ((buf2=(unsigned char *)OPENSSL_malloc((int)BUFSIZE)) == NULL) | 643 if ((buf2=(unsigned char *)OPENSSL_malloc((int)BUFSIZE)) == NULL) |
813 { | 644 { |
814 BIO_printf(bio_err,"out of memory\n"); | 645 BIO_printf(bio_err,"out of memory\n"); |
815 goto end; | 646 goto end; |
816 } | 647 } |
817 | 648 |
818 memset(c,0,sizeof(c)); | 649 memset(c,0,sizeof(c)); |
819 memset(DES_iv,0,sizeof(DES_iv)); | 650 memset(DES_iv,0,sizeof(DES_iv)); |
820 memset(iv,0,sizeof(iv)); | 651 memset(iv,0,sizeof(iv)); |
821 | 652 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 #ifndef OPENSSL_NO_ENGINE | 707 #ifndef OPENSSL_NO_ENGINE |
877 else if ((argc > 0) && (strcmp(*argv,"-engine") == 0)) | 708 else if ((argc > 0) && (strcmp(*argv,"-engine") == 0)) |
878 { | 709 { |
879 argc--; | 710 argc--; |
880 argv++; | 711 argv++; |
881 if(argc == 0) | 712 if(argc == 0) |
882 { | 713 { |
883 BIO_printf(bio_err,"no engine given\n"); | 714 BIO_printf(bio_err,"no engine given\n"); |
884 goto end; | 715 goto end; |
885 } | 716 } |
886 e = setup_engine(bio_err, *argv, 0); | 717 setup_engine(bio_err, *argv, 0); |
887 /* j will be increased again further down. We just | 718 /* j will be increased again further down. We just |
888 don't want speed to confuse an engine with an | 719 don't want speed to confuse an engine with an |
889 algorithm, especially when none is given (which | 720 algorithm, especially when none is given (which |
890 means all of them should be run) */ | 721 means all of them should be run) */ |
891 j--; | 722 j--; |
892 } | 723 } |
893 #endif | 724 #endif |
894 #ifndef NO_FORK | 725 #ifndef NO_FORK |
895 else if ((argc > 0) && (strcmp(*argv,"-multi") == 0)) | 726 else if ((argc > 0) && (strcmp(*argv,"-multi") == 0)) |
896 { | 727 { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 else | 778 else |
948 #ifndef OPENSSL_NO_SHA256 | 779 #ifndef OPENSSL_NO_SHA256 |
949 if (strcmp(*argv,"sha256") == 0) doit[D_SHA256]=1; | 780 if (strcmp(*argv,"sha256") == 0) doit[D_SHA256]=1; |
950 else | 781 else |
951 #endif | 782 #endif |
952 #ifndef OPENSSL_NO_SHA512 | 783 #ifndef OPENSSL_NO_SHA512 |
953 if (strcmp(*argv,"sha512") == 0) doit[D_SHA512]=1; | 784 if (strcmp(*argv,"sha512") == 0) doit[D_SHA512]=1; |
954 else | 785 else |
955 #endif | 786 #endif |
956 #endif | 787 #endif |
| 788 #ifndef OPENSSL_NO_WHIRLPOOL |
| 789 if (strcmp(*argv,"whirlpool") == 0) doit[D_WHIRLPOOL]=1; |
| 790 else |
| 791 #endif |
957 #ifndef OPENSSL_NO_RIPEMD | 792 #ifndef OPENSSL_NO_RIPEMD |
958 if (strcmp(*argv,"ripemd") == 0) doit[D_RMD160]=1; | 793 if (strcmp(*argv,"ripemd") == 0) doit[D_RMD160]=1; |
959 else | 794 else |
960 if (strcmp(*argv,"rmd160") == 0) doit[D_RMD160]=1; | 795 if (strcmp(*argv,"rmd160") == 0) doit[D_RMD160]=1; |
961 else | 796 else |
962 if (strcmp(*argv,"ripemd160") == 0) doit[D_RMD160]=1; | 797 if (strcmp(*argv,"ripemd160") == 0) doit[D_RMD160]=1; |
963 else | 798 else |
964 #endif | 799 #endif |
965 #ifndef OPENSSL_NO_RC4 | 800 #ifndef OPENSSL_NO_RC4 |
966 if (strcmp(*argv,"rc4") == 0) doit[D_RC4]=1; | 801 if (strcmp(*argv,"rc4") == 0) doit[D_RC4]=1; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 #endif | 993 #endif |
1159 #ifndef OPENSSL_NO_SHA1 | 994 #ifndef OPENSSL_NO_SHA1 |
1160 BIO_printf(bio_err,"sha1 "); | 995 BIO_printf(bio_err,"sha1 "); |
1161 #endif | 996 #endif |
1162 #ifndef OPENSSL_NO_SHA256 | 997 #ifndef OPENSSL_NO_SHA256 |
1163 BIO_printf(bio_err,"sha256 "); | 998 BIO_printf(bio_err,"sha256 "); |
1164 #endif | 999 #endif |
1165 #ifndef OPENSSL_NO_SHA512 | 1000 #ifndef OPENSSL_NO_SHA512 |
1166 BIO_printf(bio_err,"sha512 "); | 1001 BIO_printf(bio_err,"sha512 "); |
1167 #endif | 1002 #endif |
| 1003 #ifndef OPENSSL_NO_WHIRLPOOL |
| 1004 BIO_printf(bio_err,"whirlpool"); |
| 1005 #endif |
1168 #ifndef OPENSSL_NO_RIPEMD160 | 1006 #ifndef OPENSSL_NO_RIPEMD160 |
1169 BIO_printf(bio_err,"rmd160"); | 1007 BIO_printf(bio_err,"rmd160"); |
1170 #endif | 1008 #endif |
1171 #if !defined(OPENSSL_NO_MD2) || !defined(OPENSSL_NO_MDC2) || \ | 1009 #if !defined(OPENSSL_NO_MD2) || !defined(OPENSSL_NO_MDC2) || \ |
1172 !defined(OPENSSL_NO_MD4) || !defined(OPENSSL_NO_MD5) || \ | 1010 !defined(OPENSSL_NO_MD4) || !defined(OPENSSL_NO_MD5) || \ |
1173 !defined(OPENSSL_NO_SHA1) || !defined(OPENSSL_NO_RIPEMD160) | 1011 !defined(OPENSSL_NO_SHA1) || !defined(OPENSSL_NO_RIPEMD160) || \ |
| 1012 !defined(OPENSSL_NO_WHIRLPOOL) |
1174 BIO_printf(bio_err,"\n"); | 1013 BIO_printf(bio_err,"\n"); |
1175 #endif | 1014 #endif |
1176 | 1015 |
1177 #ifndef OPENSSL_NO_IDEA | 1016 #ifndef OPENSSL_NO_IDEA |
1178 BIO_printf(bio_err,"idea-cbc "); | 1017 BIO_printf(bio_err,"idea-cbc "); |
1179 #endif | 1018 #endif |
1180 #ifndef OPENSSL_NO_SEED | 1019 #ifndef OPENSSL_NO_SEED |
1181 BIO_printf(bio_err,"seed-cbc "); | 1020 BIO_printf(bio_err,"seed-cbc "); |
1182 #endif | 1021 #endif |
1183 #ifndef OPENSSL_NO_RC2 | 1022 #ifndef OPENSSL_NO_RC2 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1290 { | 1129 { |
1291 for (i=0; i<ALGOR_NUM; i++) | 1130 for (i=0; i<ALGOR_NUM; i++) |
1292 { | 1131 { |
1293 if (i != D_EVP) | 1132 if (i != D_EVP) |
1294 doit[i]=1; | 1133 doit[i]=1; |
1295 } | 1134 } |
1296 for (i=0; i<RSA_NUM; i++) | 1135 for (i=0; i<RSA_NUM; i++) |
1297 rsa_doit[i]=1; | 1136 rsa_doit[i]=1; |
1298 for (i=0; i<DSA_NUM; i++) | 1137 for (i=0; i<DSA_NUM; i++) |
1299 dsa_doit[i]=1; | 1138 dsa_doit[i]=1; |
| 1139 #ifndef OPENSSL_NO_ECDSA |
| 1140 for (i=0; i<EC_NUM; i++) |
| 1141 ecdsa_doit[i]=1; |
| 1142 #endif |
| 1143 #ifndef OPENSSL_NO_ECDH |
| 1144 for (i=0; i<EC_NUM; i++) |
| 1145 ecdh_doit[i]=1; |
| 1146 #endif |
1300 } | 1147 } |
1301 for (i=0; i<ALGOR_NUM; i++) | 1148 for (i=0; i<ALGOR_NUM; i++) |
1302 if (doit[i]) pr_header++; | 1149 if (doit[i]) pr_header++; |
1303 | 1150 |
1304 if (usertime == 0 && !mr) | 1151 if (usertime == 0 && !mr) |
1305 BIO_printf(bio_err,"You have chosen to measure elapsed time inst
ead of user CPU time.\n"); | 1152 BIO_printf(bio_err,"You have chosen to measure elapsed time inst
ead of user CPU time.\n"); |
1306 if (usertime <= 0 && !mr) | |
1307 { | |
1308 BIO_printf(bio_err,"To get the most accurate results, try to run
this\n"); | |
1309 BIO_printf(bio_err,"program when this computer is idle.\n"); | |
1310 } | |
1311 | 1153 |
1312 #ifndef OPENSSL_NO_RSA | 1154 #ifndef OPENSSL_NO_RSA |
1313 for (i=0; i<RSA_NUM; i++) | 1155 for (i=0; i<RSA_NUM; i++) |
1314 { | 1156 { |
1315 const unsigned char *p; | 1157 const unsigned char *p; |
1316 | 1158 |
1317 p=rsa_data[i]; | 1159 p=rsa_data[i]; |
1318 rsa_key[i]=d2i_RSAPrivateKey(NULL,&p,rsa_data_length[i]); | 1160 rsa_key[i]=d2i_RSAPrivateKey(NULL,&p,rsa_data_length[i]); |
1319 if (rsa_key[i] == NULL) | 1161 if (rsa_key[i] == NULL) |
1320 { | 1162 { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1381 #endif | 1223 #endif |
1382 #ifndef SIGALRM | 1224 #ifndef SIGALRM |
1383 #ifndef OPENSSL_NO_DES | 1225 #ifndef OPENSSL_NO_DES |
1384 BIO_printf(bio_err,"First we calculate the approximate speed ...\n"); | 1226 BIO_printf(bio_err,"First we calculate the approximate speed ...\n"); |
1385 count=10; | 1227 count=10; |
1386 do { | 1228 do { |
1387 long it; | 1229 long it; |
1388 count*=2; | 1230 count*=2; |
1389 Time_F(START); | 1231 Time_F(START); |
1390 for (it=count; it; it--) | 1232 for (it=count; it; it--) |
1391 » » » DES_ecb_encrypt(buf_as_des_cblock,buf_as_des_cblock, | 1233 » » » DES_ecb_encrypt((DES_cblock *)buf, |
| 1234 » » » » (DES_cblock *)buf, |
1392 &sch,DES_ENCRYPT); | 1235 &sch,DES_ENCRYPT); |
1393 d=Time_F(STOP); | 1236 d=Time_F(STOP); |
1394 } while (d <3); | 1237 } while (d <3); |
1395 save_count=count; | 1238 save_count=count; |
1396 c[D_MD2][0]=count/10; | 1239 c[D_MD2][0]=count/10; |
1397 c[D_MDC2][0]=count/10; | 1240 c[D_MDC2][0]=count/10; |
1398 c[D_MD4][0]=count; | 1241 c[D_MD4][0]=count; |
1399 c[D_MD5][0]=count; | 1242 c[D_MD5][0]=count; |
1400 c[D_HMAC][0]=count; | 1243 c[D_HMAC][0]=count; |
1401 c[D_SHA1][0]=count; | 1244 c[D_SHA1][0]=count; |
1402 c[D_RMD160][0]=count; | 1245 c[D_RMD160][0]=count; |
1403 c[D_RC4][0]=count*5; | 1246 c[D_RC4][0]=count*5; |
1404 c[D_CBC_DES][0]=count; | 1247 c[D_CBC_DES][0]=count; |
1405 c[D_EDE3_DES][0]=count/3; | 1248 c[D_EDE3_DES][0]=count/3; |
1406 c[D_CBC_IDEA][0]=count; | 1249 c[D_CBC_IDEA][0]=count; |
1407 c[D_CBC_SEED][0]=count; | 1250 c[D_CBC_SEED][0]=count; |
1408 c[D_CBC_RC2][0]=count; | 1251 c[D_CBC_RC2][0]=count; |
1409 c[D_CBC_RC5][0]=count; | 1252 c[D_CBC_RC5][0]=count; |
1410 c[D_CBC_BF][0]=count; | 1253 c[D_CBC_BF][0]=count; |
1411 c[D_CBC_CAST][0]=count; | 1254 c[D_CBC_CAST][0]=count; |
1412 c[D_CBC_128_AES][0]=count; | 1255 c[D_CBC_128_AES][0]=count; |
1413 c[D_CBC_192_AES][0]=count; | 1256 c[D_CBC_192_AES][0]=count; |
1414 c[D_CBC_256_AES][0]=count; | 1257 c[D_CBC_256_AES][0]=count; |
1415 c[D_CBC_128_CML][0]=count; | 1258 c[D_CBC_128_CML][0]=count; |
1416 c[D_CBC_192_CML][0]=count; | 1259 c[D_CBC_192_CML][0]=count; |
1417 c[D_CBC_256_CML][0]=count; | 1260 c[D_CBC_256_CML][0]=count; |
1418 c[D_SHA256][0]=count; | 1261 c[D_SHA256][0]=count; |
1419 c[D_SHA512][0]=count; | 1262 c[D_SHA512][0]=count; |
| 1263 c[D_WHIRLPOOL][0]=count; |
1420 c[D_IGE_128_AES][0]=count; | 1264 c[D_IGE_128_AES][0]=count; |
1421 c[D_IGE_192_AES][0]=count; | 1265 c[D_IGE_192_AES][0]=count; |
1422 c[D_IGE_256_AES][0]=count; | 1266 c[D_IGE_256_AES][0]=count; |
1423 | 1267 |
1424 for (i=1; i<SIZE_NUM; i++) | 1268 for (i=1; i<SIZE_NUM; i++) |
1425 { | 1269 { |
1426 c[D_MD2][i]=c[D_MD2][0]*4*lengths[0]/lengths[i]; | 1270 c[D_MD2][i]=c[D_MD2][0]*4*lengths[0]/lengths[i]; |
1427 c[D_MDC2][i]=c[D_MDC2][0]*4*lengths[0]/lengths[i]; | 1271 c[D_MDC2][i]=c[D_MDC2][0]*4*lengths[0]/lengths[i]; |
1428 c[D_MD4][i]=c[D_MD4][0]*4*lengths[0]/lengths[i]; | 1272 c[D_MD4][i]=c[D_MD4][0]*4*lengths[0]/lengths[i]; |
1429 c[D_MD5][i]=c[D_MD5][0]*4*lengths[0]/lengths[i]; | 1273 c[D_MD5][i]=c[D_MD5][0]*4*lengths[0]/lengths[i]; |
1430 c[D_HMAC][i]=c[D_HMAC][0]*4*lengths[0]/lengths[i]; | 1274 c[D_HMAC][i]=c[D_HMAC][0]*4*lengths[0]/lengths[i]; |
1431 c[D_SHA1][i]=c[D_SHA1][0]*4*lengths[0]/lengths[i]; | 1275 c[D_SHA1][i]=c[D_SHA1][0]*4*lengths[0]/lengths[i]; |
1432 c[D_RMD160][i]=c[D_RMD160][0]*4*lengths[0]/lengths[i]; | 1276 c[D_RMD160][i]=c[D_RMD160][0]*4*lengths[0]/lengths[i]; |
1433 c[D_SHA256][i]=c[D_SHA256][0]*4*lengths[0]/lengths[i]; | 1277 c[D_SHA256][i]=c[D_SHA256][0]*4*lengths[0]/lengths[i]; |
1434 c[D_SHA512][i]=c[D_SHA512][0]*4*lengths[0]/lengths[i]; | 1278 c[D_SHA512][i]=c[D_SHA512][0]*4*lengths[0]/lengths[i]; |
| 1279 c[D_WHIRLPOOL][i]=c[D_WHIRLPOOL][0]*4*lengths[0]/lengths[i]; |
1435 } | 1280 } |
1436 for (i=1; i<SIZE_NUM; i++) | 1281 for (i=1; i<SIZE_NUM; i++) |
1437 { | 1282 { |
1438 long l0,l1; | 1283 long l0,l1; |
1439 | 1284 |
1440 l0=(long)lengths[i-1]; | 1285 l0=(long)lengths[i-1]; |
1441 l1=(long)lengths[i]; | 1286 l1=(long)lengths[i]; |
1442 c[D_RC4][i]=c[D_RC4][i-1]*l0/l1; | 1287 c[D_RC4][i]=c[D_RC4][i-1]*l0/l1; |
1443 c[D_CBC_DES][i]=c[D_CBC_DES][i-1]*l0/l1; | 1288 c[D_CBC_DES][i]=c[D_CBC_DES][i-1]*l0/l1; |
1444 c[D_EDE3_DES][i]=c[D_EDE3_DES][i-1]*l0/l1; | 1289 c[D_EDE3_DES][i]=c[D_EDE3_DES][i-1]*l0/l1; |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1608 | 1453 |
1609 #define COND(d) (count < (d)) | 1454 #define COND(d) (count < (d)) |
1610 #define COUNT(d) (d) | 1455 #define COUNT(d) (d) |
1611 #else | 1456 #else |
1612 /* not worth fixing */ | 1457 /* not worth fixing */ |
1613 # error "You cannot disable DES on systems without SIGALRM." | 1458 # error "You cannot disable DES on systems without SIGALRM." |
1614 #endif /* OPENSSL_NO_DES */ | 1459 #endif /* OPENSSL_NO_DES */ |
1615 #else | 1460 #else |
1616 #define COND(c) (run) | 1461 #define COND(c) (run) |
1617 #define COUNT(d) (count) | 1462 #define COUNT(d) (count) |
| 1463 #ifndef _WIN32 |
1618 signal(SIGALRM,sig_done); | 1464 signal(SIGALRM,sig_done); |
| 1465 #endif |
1619 #endif /* SIGALRM */ | 1466 #endif /* SIGALRM */ |
1620 | 1467 |
1621 #ifndef OPENSSL_NO_MD2 | 1468 #ifndef OPENSSL_NO_MD2 |
1622 if (doit[D_MD2]) | 1469 if (doit[D_MD2]) |
1623 { | 1470 { |
1624 for (j=0; j<SIZE_NUM; j++) | 1471 for (j=0; j<SIZE_NUM; j++) |
1625 { | 1472 { |
1626 print_message(names[D_MD2],c[D_MD2][j],lengths[j]); | 1473 print_message(names[D_MD2],c[D_MD2][j],lengths[j]); |
1627 Time_F(START); | 1474 Time_F(START); |
1628 for (count=0,run=1; COND(c[D_MD2][j]); count++) | 1475 for (count=0,run=1; COND(c[D_MD2][j]); count++) |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1738 { | 1585 { |
1739 print_message(names[D_SHA512],c[D_SHA512][j],lengths[j])
; | 1586 print_message(names[D_SHA512],c[D_SHA512][j],lengths[j])
; |
1740 Time_F(START); | 1587 Time_F(START); |
1741 for (count=0,run=1; COND(c[D_SHA512][j]); count++) | 1588 for (count=0,run=1; COND(c[D_SHA512][j]); count++) |
1742 SHA512(buf,lengths[j],sha512); | 1589 SHA512(buf,lengths[j],sha512); |
1743 d=Time_F(STOP); | 1590 d=Time_F(STOP); |
1744 print_result(D_SHA512,j,count,d); | 1591 print_result(D_SHA512,j,count,d); |
1745 } | 1592 } |
1746 } | 1593 } |
1747 #endif | 1594 #endif |
| 1595 #endif |
| 1596 |
| 1597 #ifndef OPENSSL_NO_WHIRLPOOL |
| 1598 if (doit[D_WHIRLPOOL]) |
| 1599 { |
| 1600 for (j=0; j<SIZE_NUM; j++) |
| 1601 { |
| 1602 print_message(names[D_WHIRLPOOL],c[D_WHIRLPOOL][j],lengt
hs[j]); |
| 1603 Time_F(START); |
| 1604 for (count=0,run=1; COND(c[D_WHIRLPOOL][j]); count++) |
| 1605 WHIRLPOOL(buf,lengths[j],whirlpool); |
| 1606 d=Time_F(STOP); |
| 1607 print_result(D_WHIRLPOOL,j,count,d); |
| 1608 } |
| 1609 } |
| 1610 #endif |
1748 | 1611 |
1749 #endif | |
1750 #ifndef OPENSSL_NO_RIPEMD | 1612 #ifndef OPENSSL_NO_RIPEMD |
1751 if (doit[D_RMD160]) | 1613 if (doit[D_RMD160]) |
1752 { | 1614 { |
1753 for (j=0; j<SIZE_NUM; j++) | 1615 for (j=0; j<SIZE_NUM; j++) |
1754 { | 1616 { |
1755 print_message(names[D_RMD160],c[D_RMD160][j],lengths[j])
; | 1617 print_message(names[D_RMD160],c[D_RMD160][j],lengths[j])
; |
1756 Time_F(START); | 1618 Time_F(START); |
1757 for (count=0,run=1; COND(c[D_RMD160][j]); count++) | 1619 for (count=0,run=1; COND(c[D_RMD160][j]); count++) |
1758 EVP_Digest(buf,(unsigned long)lengths[j],&(rmd16
0[0]),NULL,EVP_ripemd160(),NULL); | 1620 EVP_Digest(buf,(unsigned long)lengths[j],&(rmd16
0[0]),NULL,EVP_ripemd160(),NULL); |
1759 d=Time_F(STOP); | 1621 d=Time_F(STOP); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1843 Time_F(START); | 1705 Time_F(START); |
1844 for (count=0,run=1; COND(c[D_CBC_256_AES][j]); count++) | 1706 for (count=0,run=1; COND(c[D_CBC_256_AES][j]); count++) |
1845 AES_cbc_encrypt(buf,buf, | 1707 AES_cbc_encrypt(buf,buf, |
1846 (unsigned long)lengths[j],&aes_ks3, | 1708 (unsigned long)lengths[j],&aes_ks3, |
1847 iv,AES_ENCRYPT); | 1709 iv,AES_ENCRYPT); |
1848 d=Time_F(STOP); | 1710 d=Time_F(STOP); |
1849 print_result(D_CBC_256_AES,j,count,d); | 1711 print_result(D_CBC_256_AES,j,count,d); |
1850 } | 1712 } |
1851 } | 1713 } |
1852 | 1714 |
| 1715 #if 0 /* ANDROID */ |
1853 if (doit[D_IGE_128_AES]) | 1716 if (doit[D_IGE_128_AES]) |
1854 { | 1717 { |
1855 for (j=0; j<SIZE_NUM; j++) | 1718 for (j=0; j<SIZE_NUM; j++) |
1856 { | 1719 { |
1857 print_message(names[D_IGE_128_AES],c[D_IGE_128_AES][j],l
engths[j]); | 1720 print_message(names[D_IGE_128_AES],c[D_IGE_128_AES][j],l
engths[j]); |
1858 Time_F(START); | 1721 Time_F(START); |
1859 for (count=0,run=1; COND(c[D_IGE_128_AES][j]); count++) | 1722 for (count=0,run=1; COND(c[D_IGE_128_AES][j]); count++) |
1860 AES_ige_encrypt(buf,buf2, | 1723 AES_ige_encrypt(buf,buf2, |
1861 (unsigned long)lengths[j],&aes_ks1, | 1724 (unsigned long)lengths[j],&aes_ks1, |
1862 iv,AES_ENCRYPT); | 1725 iv,AES_ENCRYPT); |
(...skipping 22 matching lines...) Expand all Loading... |
1885 print_message(names[D_IGE_256_AES],c[D_IGE_256_AES][j],l
engths[j]); | 1748 print_message(names[D_IGE_256_AES],c[D_IGE_256_AES][j],l
engths[j]); |
1886 Time_F(START); | 1749 Time_F(START); |
1887 for (count=0,run=1; COND(c[D_IGE_256_AES][j]); count++) | 1750 for (count=0,run=1; COND(c[D_IGE_256_AES][j]); count++) |
1888 AES_ige_encrypt(buf,buf2, | 1751 AES_ige_encrypt(buf,buf2, |
1889 (unsigned long)lengths[j],&aes_ks3, | 1752 (unsigned long)lengths[j],&aes_ks3, |
1890 iv,AES_ENCRYPT); | 1753 iv,AES_ENCRYPT); |
1891 d=Time_F(STOP); | 1754 d=Time_F(STOP); |
1892 print_result(D_IGE_256_AES,j,count,d); | 1755 print_result(D_IGE_256_AES,j,count,d); |
1893 } | 1756 } |
1894 } | 1757 } |
| 1758 |
| 1759 |
| 1760 #endif |
1895 #endif | 1761 #endif |
1896 #ifndef OPENSSL_NO_CAMELLIA | 1762 #ifndef OPENSSL_NO_CAMELLIA |
1897 if (doit[D_CBC_128_CML]) | 1763 if (doit[D_CBC_128_CML]) |
1898 { | 1764 { |
1899 for (j=0; j<SIZE_NUM; j++) | 1765 for (j=0; j<SIZE_NUM; j++) |
1900 { | 1766 { |
1901 print_message(names[D_CBC_128_CML],c[D_CBC_128_CML][j],l
engths[j]); | 1767 print_message(names[D_CBC_128_CML],c[D_CBC_128_CML][j],l
engths[j]); |
1902 Time_F(START); | 1768 Time_F(START); |
1903 for (count=0,run=1; COND(c[D_CBC_128_CML][j]); count++) | 1769 for (count=0,run=1; COND(c[D_CBC_128_CML][j]); count++) |
1904 Camellia_cbc_encrypt(buf,buf, | 1770 Camellia_cbc_encrypt(buf,buf, |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2497 #ifndef OPENSSL_NO_AES | 2363 #ifndef OPENSSL_NO_AES |
2498 printf("%s ",AES_options()); | 2364 printf("%s ",AES_options()); |
2499 #endif | 2365 #endif |
2500 #ifndef OPENSSL_NO_IDEA | 2366 #ifndef OPENSSL_NO_IDEA |
2501 printf("%s ",idea_options()); | 2367 printf("%s ",idea_options()); |
2502 #endif | 2368 #endif |
2503 #ifndef OPENSSL_NO_BF | 2369 #ifndef OPENSSL_NO_BF |
2504 printf("%s ",BF_options()); | 2370 printf("%s ",BF_options()); |
2505 #endif | 2371 #endif |
2506 fprintf(stdout,"\n%s\n",SSLeay_version(SSLEAY_CFLAGS)); | 2372 fprintf(stdout,"\n%s\n",SSLeay_version(SSLEAY_CFLAGS)); |
2507 printf("available timing options: "); | |
2508 #ifdef TIMES | |
2509 printf("TIMES "); | |
2510 #endif | |
2511 #ifdef TIMEB | |
2512 printf("TIMEB "); | |
2513 #endif | |
2514 #ifdef USE_TOD | |
2515 printf("USE_TOD "); | |
2516 #endif | |
2517 #ifdef HZ | |
2518 #define as_string(s) (#s) | |
2519 { | |
2520 double dbl = HZ; | |
2521 printf("HZ=%g", dbl); | |
2522 } | |
2523 # ifdef _SC_CLK_TCK | |
2524 printf(" [sysconf value]"); | |
2525 # endif | |
2526 #endif | |
2527 printf("\n"); | |
2528 printf("timing function used: %s%s%s%s%s%s%s\n", | |
2529 (ftime_used ? "ftime" : ""), | |
2530 (ftime_used + times_used > 1 ? "," : ""), | |
2531 (times_used ? "times" : ""), | |
2532 (ftime_used + times_used + gettimeofday_used > 1 ? "," :
""), | |
2533 (gettimeofday_used ? "gettimeofday" : ""), | |
2534 (ftime_used + times_used + gettimeofday_used + getrusage_
used > 1 ? "," : ""), | |
2535 (getrusage_used ? "getrusage" : "")); | |
2536 } | 2373 } |
2537 | 2374 |
2538 if (pr_header) | 2375 if (pr_header) |
2539 { | 2376 { |
2540 if(mr) | 2377 if(mr) |
2541 fprintf(stdout,"+H"); | 2378 fprintf(stdout,"+H"); |
2542 else | 2379 else |
2543 { | 2380 { |
2544 fprintf(stdout,"The 'numbers' are in 1000s of bytes per
second processed.\n"); | 2381 fprintf(stdout,"The 'numbers' are in 1000s of bytes per
second processed.\n"); |
2545 fprintf(stdout,"type "); | 2382 fprintf(stdout,"type "); |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2782 fds[n]=fd[0]; | 2619 fds[n]=fd[0]; |
2783 } | 2620 } |
2784 else | 2621 else |
2785 { | 2622 { |
2786 close(fd[0]); | 2623 close(fd[0]); |
2787 close(1); | 2624 close(1); |
2788 dup(fd[1]); | 2625 dup(fd[1]); |
2789 close(fd[1]); | 2626 close(fd[1]); |
2790 mr=1; | 2627 mr=1; |
2791 usertime=0; | 2628 usertime=0; |
| 2629 free(fds); |
2792 return 0; | 2630 return 0; |
2793 } | 2631 } |
2794 printf("Forked child %d\n",n); | 2632 printf("Forked child %d\n",n); |
2795 } | 2633 } |
2796 | 2634 |
2797 /* for now, assume the pipe is long enough to take all the output */ | 2635 /* for now, assume the pipe is long enough to take all the output */ |
2798 for(n=0 ; n < multi ; ++n) | 2636 for(n=0 ; n < multi ; ++n) |
2799 { | 2637 { |
2800 FILE *f; | 2638 FILE *f; |
2801 char buf[1024]; | 2639 char buf[1024]; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2860 rsa_results[k][0]=1/(1/rsa_results[k][0]
+1/d); | 2698 rsa_results[k][0]=1/(1/rsa_results[k][0]
+1/d); |
2861 else | 2699 else |
2862 rsa_results[k][0]=d; | 2700 rsa_results[k][0]=d; |
2863 | 2701 |
2864 d=atof(sstrsep(&p,sep)); | 2702 d=atof(sstrsep(&p,sep)); |
2865 if(n) | 2703 if(n) |
2866 rsa_results[k][1]=1/(1/rsa_results[k][1]
+1/d); | 2704 rsa_results[k][1]=1/(1/rsa_results[k][1]
+1/d); |
2867 else | 2705 else |
2868 rsa_results[k][1]=d; | 2706 rsa_results[k][1]=d; |
2869 } | 2707 } |
| 2708 #ifndef OPENSSL_NO_DSA |
2870 else if(!strncmp(buf,"+F3:",4)) | 2709 else if(!strncmp(buf,"+F3:",4)) |
2871 { | 2710 { |
2872 int k; | 2711 int k; |
2873 double d; | 2712 double d; |
2874 | 2713 |
2875 p=buf+4; | 2714 p=buf+4; |
2876 k=atoi(sstrsep(&p,sep)); | 2715 k=atoi(sstrsep(&p,sep)); |
2877 sstrsep(&p,sep); | 2716 sstrsep(&p,sep); |
2878 | 2717 |
2879 d=atof(sstrsep(&p,sep)); | 2718 d=atof(sstrsep(&p,sep)); |
2880 if(n) | 2719 if(n) |
2881 dsa_results[k][0]=1/(1/dsa_results[k][0]
+1/d); | 2720 dsa_results[k][0]=1/(1/dsa_results[k][0]
+1/d); |
2882 else | 2721 else |
2883 dsa_results[k][0]=d; | 2722 dsa_results[k][0]=d; |
2884 | 2723 |
2885 d=atof(sstrsep(&p,sep)); | 2724 d=atof(sstrsep(&p,sep)); |
2886 if(n) | 2725 if(n) |
2887 dsa_results[k][1]=1/(1/dsa_results[k][1]
+1/d); | 2726 dsa_results[k][1]=1/(1/dsa_results[k][1]
+1/d); |
2888 else | 2727 else |
2889 dsa_results[k][1]=d; | 2728 dsa_results[k][1]=d; |
2890 } | 2729 } |
| 2730 #endif |
2891 #ifndef OPENSSL_NO_ECDSA | 2731 #ifndef OPENSSL_NO_ECDSA |
2892 else if(!strncmp(buf,"+F4:",4)) | 2732 else if(!strncmp(buf,"+F4:",4)) |
2893 { | 2733 { |
2894 int k; | 2734 int k; |
2895 double d; | 2735 double d; |
2896 | 2736 |
2897 p=buf+4; | 2737 p=buf+4; |
2898 k=atoi(sstrsep(&p,sep)); | 2738 k=atoi(sstrsep(&p,sep)); |
2899 sstrsep(&p,sep); | 2739 sstrsep(&p,sep); |
2900 | 2740 |
(...skipping 29 matching lines...) Expand all Loading... |
2930 | 2770 |
2931 } | 2771 } |
2932 #endif | 2772 #endif |
2933 | 2773 |
2934 else if(!strncmp(buf,"+H:",3)) | 2774 else if(!strncmp(buf,"+H:",3)) |
2935 { | 2775 { |
2936 } | 2776 } |
2937 else | 2777 else |
2938 fprintf(stderr,"Unknown type '%s' from child %d\
n",buf,n); | 2778 fprintf(stderr,"Unknown type '%s' from child %d\
n",buf,n); |
2939 } | 2779 } |
| 2780 |
| 2781 fclose(f); |
2940 } | 2782 } |
| 2783 free(fds); |
2941 return 1; | 2784 return 1; |
2942 } | 2785 } |
2943 #endif | 2786 #endif |
2944 #endif | 2787 #endif |
OLD | NEW |