X-Git-Url: https://git.openssl.org/gitweb/?a=blobdiff_plain;f=apps%2Fspeed.c;h=92324186f42916121dc1e49aa1cbadf45e00462c;hb=e933f91f50108a43c0198cdc63ecdfdbc77b4d0d;hp=de07054077efcc2bbc3569c3b5273e479c064364;hpb=91f0828c9582106fb7c1c319c2cb21cce7a03e13;p=openssl.git diff --git a/apps/speed.c b/apps/speed.c index de07054077..92324186f4 100644 --- a/apps/speed.c +++ b/apps/speed.c @@ -108,8 +108,14 @@ #include #endif -#ifdef _WIN32 +#if defined(_WIN32) || defined(__CYGWIN__) #include +# if defined(__CYGWIN__) && !defined(_WIN32) + /* should define _WIN32, which normally is mutually + * exclusive with __CYGWIN__, but if it didn't... */ +# define _WIN32 + /* this is done because Cygwin alarm() fails sometimes. */ +# endif #endif #include @@ -274,9 +280,12 @@ static SIGRETTYPE sig_done(int sig) #if defined(_WIN32) -#define SIGALRM +#if !defined(SIGALRM) +# define SIGALRM +#endif static unsigned int lapse,schlock; -static void alarm(unsigned int secs) { lapse = secs*1000; } +static void alarm_win32(unsigned int secs) { lapse = secs*1000; } +#define alarm alarm_win32 static DWORD WINAPI sleepy(VOID *arg) { @@ -480,7 +489,7 @@ int MAIN(int argc, char **argv) #define D_IGE_128_AES 26 #define D_IGE_192_AES 27 #define D_IGE_256_AES 28 -#define D_GHASH 29 +#define D_GHASH 29 double d=0.0; long c[ALGOR_NUM][SIZE_NUM]; #define R_DSA_512 0 @@ -1534,7 +1543,7 @@ int MAIN(int argc, char **argv) print_message(names[D_MD5],c[D_MD5][j],lengths[j]); Time_F(START); for (count=0,run=1; COND(c[D_MD5][j]); count++) - EVP_Digest(&(buf[0]),(unsigned long)lengths[j],&(md5[0]),NULL,EVP_get_digestbyname("md5"),NULL); + MD5(buf,lengths[j],md5); d=Time_F(STOP); print_result(D_MD5,j,count,d); } @@ -2584,7 +2593,7 @@ static void pkey_print_message(const char *str, const char *str2, long num, BIO_printf(bio_err,mr ? "+DTP:%d:%s:%s:%d\n" : "Doing %d bit %s %s's for %ds: ",bits,str,str2,tm); (void)BIO_flush(bio_err); - alarm(RSA_SECONDS); + alarm(tm); #else BIO_printf(bio_err,mr ? "+DNP:%ld:%d:%s:%s\n" : "Doing %ld %d bit %s %s's: ",num,bits,str,str2); @@ -2644,7 +2653,11 @@ static int do_multi(int multi) fds=malloc(multi*sizeof *fds); for(n=0 ; n < multi ; ++n) { - pipe(fd); + if (pipe(fd) == -1) + { + fprintf(stderr, "pipe failure\n"); + exit(1); + } fflush(stdout); fflush(stderr); if(fork()) @@ -2656,7 +2669,11 @@ static int do_multi(int multi) { close(fd[0]); close(1); - dup(fd[1]); + if (dup(fd[1]) == -1) + { + fprintf(stderr, "dup failed\n"); + exit(1); + } close(fd[1]); mr=1; usertime=0; @@ -2739,6 +2756,7 @@ static int do_multi(int multi) else rsa_results[k][1]=d; } +#ifndef OPENSSL_NO_DSA else if(!strncmp(buf,"+F3:",4)) { int k; @@ -2760,6 +2778,7 @@ static int do_multi(int multi) else dsa_results[k][1]=d; } +#endif #ifndef OPENSSL_NO_ECDSA else if(!strncmp(buf,"+F4:",4)) {