X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=apps%2Fs_time.c;h=39fd3b8b4d98d0d3111b27143ab4c807afeaf194;hp=187c09d12e9a33bff5a4b8f9d9a0149089ac4fb5;hb=1d90f280297195f4f1fb42fdeecd0e6f5ee98366;hpb=ec577822f95a8bca0023c5c77cef1a4916822d4a diff --git a/apps/s_time.c b/apps/s_time.c index 187c09d12e..39fd3b8b4d 100644 --- a/apps/s_time.c +++ b/apps/s_time.c @@ -70,10 +70,10 @@ #ifdef NO_STDIO #define APPS_WIN16 #endif +#define USE_SOCKETS #include #include #include -#define USE_SOCKETS #include "apps.h" #include "s_apps.h" #include @@ -82,11 +82,10 @@ #include "wintext.h" #endif -#ifndef MSDOS +#if !defined(MSDOS) && (!defined(VMS) || defined(__DECC)) #define TIMES #endif -#ifndef VMS #ifndef _IRIX #include #endif @@ -94,15 +93,15 @@ #include #include #endif -#else /* VMS */ -#include -struct tms { - time_t tms_utime; - time_t tms_stime; - time_t tms_uchild; /* I dunno... */ - time_t tms_uchildsys; /* so these names are a guess :-) */ - } + +/* Depending on the VMS version, the tms structure is perhaps defined. + The __TMS macro will show if it was. If it wasn't defined, we should + undefine TIMES, since that tells the rest of the program how things + should be handled. -- Richard Levitte */ +#if defined(VMS) && defined(__DECC) && !defined(__TMS) +#undef TIMES #endif + #ifndef TIMES #include #endif @@ -121,11 +120,7 @@ struct tms { */ #ifndef HZ #ifndef CLK_TCK -#ifndef VMS -#define HZ 100.0 -#else /* VMS */ #define HZ 100.0 -#endif #else /* CLK_TCK */ #define HZ ((double)CLK_TCK) #endif @@ -134,6 +129,7 @@ struct tms { #undef PROG #define PROG s_time_main +#undef ioctl #define ioctl ioctlsocket #define SSL_CONNECT_NAME "localhost:4433" @@ -151,18 +147,10 @@ struct tms { extern int verify_depth; extern int verify_error; -#ifndef NOPROTO static void s_time_usage(void); static int parseArgs( int argc, char **argv ); static SSL *doConnection( SSL *scon ); static void s_time_init(void); -#else -static void s_time_usage(); -static int parseArgs(); -static SSL *doConnection(); -static void s_time_init(); -#endif - /*********************************************************************** * Static data declarations @@ -228,7 +216,7 @@ static void s_time_usage(void) file if not specified by this option\n\ -CApath arg - PEM format directory of CA's\n\ -CAfile arg - PEM format file of CA's\n\ --cipher - prefered cipher to use, play with 'openssl ciphers'\n\n"; +-cipher - preferred cipher to use, play with 'openssl ciphers'\n\n"; printf( "usage: s_time \n\n" ); @@ -237,7 +225,7 @@ static void s_time_usage(void) printf("-nbio - Run with non-blocking IO\n"); printf("-ssl2 - Just use SSLv2\n"); printf("-ssl3 - Just use SSLv3\n"); - printf("-bugs - Turn on SSL bug compatability\n"); + printf("-bugs - Turn on SSL bug compatibility\n"); printf("-new - Just time new connections\n"); printf("-reuse - Just time connection reuse\n"); printf("-www page - Retrieve 'page' from the site\n"); @@ -256,15 +244,6 @@ static int parseArgs(int argc, char **argv) verify_depth=0; verify_error=X509_V_OK; -#ifdef FIONBIO - t_nbio=0; -#endif - - apps_startup(); - s_time_init(); - - if (bio_err == NULL) - bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); argc--; argv++; @@ -409,6 +388,8 @@ static double tm_Time_F(int s) * MAIN - main processing area for client * real name depends on MONOLITH */ +int MAIN(int, char **); + int MAIN(int argc, char **argv) { double totalTime = 0.0; @@ -419,6 +400,12 @@ int MAIN(int argc, char **argv) MS_STATIC char buf[1024*8]; int ver; + apps_startup(); + s_time_init(); + + if (bio_err == NULL) + bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); + #if !defined(NO_SSL2) && !defined(NO_SSL3) s_time_meth=SSLv23_client_method(); #elif !defined(NO_SSL3) @@ -431,7 +418,7 @@ int MAIN(int argc, char **argv) if( parseArgs( argc, argv ) < 0 ) goto end; - SSLeay_add_ssl_algorithms(); + OpenSSL_add_ssl_algorithms(); if ((tm_ctx=SSL_CTX_new(s_time_meth)) == NULL) return(1); SSL_CTX_set_quiet_shutdown(tm_ctx,1); @@ -446,7 +433,7 @@ int MAIN(int argc, char **argv) if ((!SSL_CTX_load_verify_locations(tm_ctx,CAfile,CApath)) || (!SSL_CTX_set_default_verify_paths(tm_ctx))) { - /* BIO_printf(bio_err,"error seting default verify locations\n"); */ + /* BIO_printf(bio_err,"error setting default verify locations\n"); */ ERR_print_errors(bio_err); /* goto end; */ } @@ -647,7 +634,7 @@ static SSL *doConnection(SSL *scon) BIO_set_conn_hostname(conn,host); if (scon == NULL) - serverCon=(SSL *)SSL_new(tm_ctx); + serverCon=SSL_new(tm_ctx); else { serverCon=scon; @@ -672,7 +659,13 @@ static SSL *doConnection(SSL *scon) width=i+1; FD_ZERO(&readfds); FD_SET(i,&readfds); - select(width,&readfds,NULL,NULL,NULL); + /* Note: under VMS with SOCKETSHR the 2nd parameter + * is currently of type (int *) whereas under other + * systems it is (void *) if you don't have a cast it + * will choke the compiler: if you do have a cast then + * you can either go for (int *) or (void *). + */ + select(width,(void *)&readfds,NULL,NULL,NULL); continue; } break;