X-Git-Url: https://git.openssl.org/?a=blobdiff_plain;f=apps%2Fs_time.c;h=a43df6bb92ac66b36c423d1be8345ef19ac33810;hb=462f79ec44fb9259c48be448b231df3073c000d9;hp=56835925364975b44187f3d671e6fb9bbbec1fd9;hpb=e170a5c050b6bb84a353466975ac9532f439b33e;p=openssl.git diff --git a/apps/s_time.c b/apps/s_time.c index 5683592536..a43df6bb92 100644 --- a/apps/s_time.c +++ b/apps/s_time.c @@ -59,7 +59,7 @@ #define NO_SHUTDOWN /*----------------------------------------- - cntime - SSL client connection timer program + s_time - SSL client connection timer program Written and donated by Larry Streepy -----------------------------------------*/ @@ -67,26 +67,29 @@ #include #include +#if defined(NO_RSA) && !defined(NO_SSL2) +#define NO_SSL2 +#endif + #ifdef NO_STDIO #define APPS_WIN16 #endif -#include "x509.h" -#include "ssl.h" -#include "pem.h" #define USE_SOCKETS +#include +#include +#include #include "apps.h" #include "s_apps.h" -#include "err.h" +#include #ifdef WIN32_STUFF #include "winmain.h" #include "wintext.h" #endif -#ifndef MSDOS +#if !defined(MSDOS) && (!defined(VMS) || defined(__DECC)) #define TIMES #endif -#ifndef VMS #ifndef _IRIX #include #endif @@ -94,15 +97,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 +124,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 +133,7 @@ struct tms { #undef PROG #define PROG s_time_main +#undef ioctl #define ioctl ioctlsocket #define SSL_CONNECT_NAME "localhost:4433" @@ -151,18 +151,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 @@ -190,7 +182,7 @@ static int t_nbio=0; static int exitNow = 0; /* Set when it's time to exit main */ #endif -static void s_time_init() +static void s_time_init(void) { host=SSL_CONNECT_NAME; t_cert_file=NULL; @@ -218,19 +210,19 @@ static void s_time_init() /*********************************************************************** * usage - display usage message */ -static void s_time_usage() +static void s_time_usage(void) { static char umsg[] = "\ -time arg - max number of seconds to collect data, default %d\n\ -verify arg - turn on peer certificate verification, arg == depth\n\ -cert arg - certificate file to use, PEM format assumed\n\ --key arg - RSA file to use, PEM format assumed, in cert file if\n\ - not specified but cert fill is.\n\ +-key arg - RSA file to use, PEM format assumed, key is in cert file\n\ + 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"; - printf( "usage: client \n\n" ); + printf( "usage: s_time \n\n" ); printf("-connect host:port - host:port to connect to (default is %s)\n",SSL_CONNECT_NAME); #ifdef FIONBIO @@ -250,23 +242,12 @@ static void s_time_usage() * * Returns 0 if ok, -1 on bad args */ -static int parseArgs(argc,argv) -int argc; -char **argv; +static int parseArgs(int argc, char **argv) { int badop = 0; 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++; @@ -377,8 +358,7 @@ bad: #define START 0 #define STOP 1 -static double tm_Time_F(s) -int s; +static double tm_Time_F(int s) { static double ret; #ifdef TIMES @@ -412,10 +392,7 @@ int s; * MAIN - main processing area for client * real name depends on MONOLITH */ -int -MAIN(argc,argv) -int argc; -char **argv; +int MAIN(int argc, char **argv) { double totalTime = 0.0; int nConn = 0; @@ -425,6 +402,12 @@ 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) @@ -639,9 +622,7 @@ end: * Returns: * SSL * = the connection pointer. */ -static SSL * -doConnection(scon) -SSL *scon; +static SSL *doConnection(SSL *scon) { BIO *conn; SSL *serverCon; @@ -680,7 +661,13 @@ 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;