Correct wrong usage information.
[openssl.git] / apps / speed.c
index de35c47e47d81adc482f9d3d764af2a0d1707bdb..fea0ffe2cfae09c9af8f4a9d4c3b125be31148c6 100644 (file)
 #include <openssl/err.h>
 #include <openssl/evp.h>
 #include <openssl/objects.h>
+#if !defined(OPENSSL_SYS_MSDOS)
 #include OPENSSL_UNISTD
+#endif
 
 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(OPENSSL_SYS_MACOSX)
 # define USE_TOD
-#elif !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC))
+#elif !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VXWORKS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC))
 # define TIMES
 #endif
-#if !defined(_UNICOS) && !defined(__OpenBSD__) && !defined(sgi) && !defined(__FreeBSD__) && !(defined(__bsdi) || defined(__bsdi__)) && !defined(_AIX) && !defined(OPENSSL_SYS_MPE) && !defined(__NetBSD__) /* FIXME */
+#if !defined(_UNICOS) && !defined(__OpenBSD__) && !defined(sgi) && !defined(__FreeBSD__) && !(defined(__bsdi) || defined(__bsdi__)) && !defined(_AIX) && !defined(OPENSSL_SYS_MPE) && !defined(__NetBSD__) && !defined(OPENSSL_SYS_VXWORKS) /* FIXME */
 # define TIMEB
 #endif
 
 #include <sys/timeb.h>
 #endif
 
-#if !defined(TIMES) && !defined(TIMEB) && !defined(USE_TOD)
+#if !defined(TIMES) && !defined(TIMEB) && !defined(USE_TOD) && !defined(OPENSSL_SYS_VXWORKS)
 #error "It seems neither struct tms nor struct timeb is supported in this platform!"
 #endif
 
 #endif
 
 #ifndef OPENSSL_NO_DES
-#include <openssl/des_old.h>
+#include <openssl/des.h>
+#endif
+#ifndef OPENSSL_NO_AES
+#include <openssl/aes.h>
 #endif
 #ifndef OPENSSL_NO_MD2
 #include <openssl/md2.h>
 # endif
 #endif
 
+#if !defined(OPENSSL_SYS_VMS) && !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MACINTOSH_CLASSIC) && !defined(OPENSSL_SYS_OS2)
+# define HAVE_FORK 1
+#endif
+
 #undef BUFSIZE
 #define BUFSIZE        ((long)1024*8+1)
 int run=0;
@@ -209,27 +218,31 @@ static double Time_F(int s);
 static void print_message(const char *s,long num,int length);
 static void pkey_print_message(char *str,char *str2,long num,int bits,int sec);
 static void print_result(int alg,int run_no,int count,double time_used);
+#ifdef HAVE_FORK
 static int do_multi(int multi);
-#ifdef SIGALRM
-#if defined(__STDC__) || defined(sgi) || defined(_AIX)
-#define SIGRETTYPE void
-#else
-#define SIGRETTYPE int
-#endif 
+#endif
 
-#define ALGOR_NUM      16
+#define ALGOR_NUM      19
 #define SIZE_NUM       5
 #define RSA_NUM                4
 #define DSA_NUM                3
 static const char *names[ALGOR_NUM]={
   "md2","mdc2","md4","md5","hmac(md5)","sha1","rmd160","rc4",
   "des cbc","des ede3","idea cbc",
-  "rc2 cbc","rc5-32/12 cbc","blowfish cbc","cast cbc"};
+  "rc2 cbc","rc5-32/12 cbc","blowfish cbc","cast cbc",
+  "aes-128 cbc","aes-192 cbc","aes-256 cbc"};
 static double results[ALGOR_NUM][SIZE_NUM];
-static int lengths[SIZE_NUM]={8,64,256,1024,8*1024};
+static int lengths[SIZE_NUM]={16,64,256,1024,8*1024};
 static double rsa_results[RSA_NUM][2];
 static double dsa_results[DSA_NUM][2];
 
+#ifdef SIGALRM
+#if defined(__STDC__) || defined(sgi) || defined(_AIX)
+#define SIGRETTYPE void
+#else
+#define SIGRETTYPE int
+#endif 
+
 static SIGRETTYPE sig_done(int sig);
 static SIGRETTYPE sig_done(int sig)
        {
@@ -313,7 +326,23 @@ static double Time_F(int s)
 # if defined(TIMES) && defined(TIMEB)
        else
 # endif
-# ifdef TIMEB
+# ifdef OPENSSL_SYS_VXWORKS
+                {
+               static unsigned long tick_start, tick_end;
+
+               if( s == START )
+                       {
+                       tick_start = tickGet();
+                       return 0;
+                       }
+               else
+                       {
+                       tick_end = tickGet();
+                       ret = (double)(tick_end - tick_start) / (double)sysClkRateGet();
+                       return((ret < 0.001)?0.001:ret);
+                       }
+                }
+# elif defined(TIMEB)
                {
                static struct timeb tstart,tend;
                long i;
@@ -340,14 +369,18 @@ int MAIN(int, char **);
 
 int MAIN(int argc, char **argv)
        {
-       ENGINE *e;
+       ENGINE *e = NULL;
        unsigned char *buf=NULL,*buf2=NULL;
        int mret=1;
-       long count,rsa_count,save_count=0;
+       long count=0,save_count=0;
        int i,j,k;
+#if !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_DSA)
+       long rsa_count;
+#endif
 #ifndef OPENSSL_NO_RSA
        unsigned rsa_num;
 #endif
+       unsigned char md[EVP_MAX_MD_SIZE];
 #ifndef OPENSSL_NO_MD2
        unsigned char md2[MD2_DIGEST_LENGTH];
 #endif
@@ -385,19 +418,37 @@ int MAIN(int argc, char **argv)
 #ifndef OPENSSL_NO_CAST
        CAST_KEY cast_ks;
 #endif
-       static unsigned char key16[16]=
+       static const unsigned char key16[16]=
                {0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
                 0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12};
-       unsigned char iv[8];
+       static const unsigned char key24[24]=
+               {0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
+                0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,
+                0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34};
+       static const unsigned char key32[32]=
+               {0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
+                0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,
+                0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34,
+                0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34,0x56};
+#ifndef OPENSSL_NO_AES
+#define MAX_BLOCK_SIZE 128
+#else
+#define MAX_BLOCK_SIZE 64
+#endif
+       unsigned char DES_iv[8];
+       unsigned char iv[MAX_BLOCK_SIZE/8];
 #ifndef OPENSSL_NO_DES
        DES_cblock *buf_as_des_cblock = NULL;
-       static des_cblock key ={0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0};
-       static des_cblock key2={0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12};
-       static des_cblock key3={0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34};
+       static DES_cblock key ={0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0};
+       static DES_cblock key2={0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12};
+       static DES_cblock key3={0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34};
        DES_key_schedule sch;
        DES_key_schedule sch2;
        DES_key_schedule sch3;
 #endif
+#ifndef OPENSSL_NO_AES
+       AES_KEY aes_ks1, aes_ks2, aes_ks3;
+#endif
 #define        D_MD2           0
 #define        D_MDC2          1
 #define        D_MD4           2
@@ -413,8 +464,11 @@ int MAIN(int argc, char **argv)
 #define        D_CBC_RC5       12
 #define        D_CBC_BF        13
 #define        D_CBC_CAST      14
-#define D_EVP          15
-       double d;
+#define D_CBC_128_AES  15
+#define D_CBC_192_AES  16
+#define D_CBC_256_AES  17
+#define D_EVP          18
+       double d=0.0;
        long c[ALGOR_NUM][SIZE_NUM];
 #define        R_DSA_512       0
 #define        R_DSA_1024      1
@@ -442,9 +496,12 @@ int MAIN(int argc, char **argv)
        int dsa_doit[DSA_NUM];
        int doit[ALGOR_NUM];
        int pr_header=0;
-       const EVP_CIPHER *evp=NULL;
+       const EVP_CIPHER *evp_cipher=NULL;
+       const EVP_MD *evp_md=NULL;
        int decrypt=0;
+#ifdef HAVE_FORK
        int multi=0;
+#endif
 
 #ifndef TIMES
        usertime=-1;
@@ -460,6 +517,9 @@ int MAIN(int argc, char **argv)
                if ((bio_err=BIO_new(BIO_s_file())) != NULL)
                        BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 
+       if (!load_config(bio_err, NULL))
+               goto end;
+
 #ifndef OPENSSL_NO_RSA
        memset(rsa_key,0,sizeof(rsa_key));
        for (i=0; i<RSA_NUM; i++)
@@ -472,7 +532,7 @@ int MAIN(int argc, char **argv)
                goto end;
                }
 #ifndef OPENSSL_NO_DES
-       buf_as_des_cblock = (des_cblock *)buf;
+       buf_as_des_cblock = (DES_cblock *)buf;
 #endif
        if ((buf2=(unsigned char *)OPENSSL_malloc((int)BUFSIZE)) == NULL)
                {
@@ -481,6 +541,7 @@ int MAIN(int argc, char **argv)
                }
 
        memset(c,0,sizeof(c));
+       memset(DES_iv,0,sizeof(DES_iv));
        memset(iv,0,sizeof(iv));
 
        for (i=0; i<ALGOR_NUM; i++)
@@ -510,10 +571,14 @@ int MAIN(int argc, char **argv)
                                BIO_printf(bio_err,"no EVP given\n");
                                goto end;
                                }
-                       evp=EVP_get_cipherbyname(*argv);
-                       if(!evp)
+                       evp_cipher=EVP_get_cipherbyname(*argv);
+                       if(!evp_cipher)
+                               {
+                               evp_md=EVP_get_digestbyname(*argv);
+                               }
+                       if(!evp_cipher && !evp_md)
                                {
-                               BIO_printf(bio_err,"%s is an unknown cipher\n",*argv);
+                               BIO_printf(bio_err,"%s is an unknown cipher or digest\n",*argv);
                                goto end;
                                }
                        doit[D_EVP]=1;
@@ -540,6 +605,7 @@ int MAIN(int argc, char **argv)
                           means all of them should be run) */
                        j--;
                        }
+#ifdef HAVE_FORK
                else if ((argc > 0) && (strcmp(*argv,"-multi") == 0))
                        {
                        argc--;
@@ -555,7 +621,10 @@ int MAIN(int argc, char **argv)
                                BIO_printf(bio_err,"bad multi count\n");
                                goto end;
                                }                               
+                       j--;    /* Otherwise, -mr gets confused with
+                                  an algorithm. */
                        }
+#endif
                else if (argc > 0 && !strcmp(*argv,"-mr"))
                        {
                        mr=1;
@@ -606,6 +675,12 @@ int MAIN(int argc, char **argv)
                else    if (strcmp(*argv,"des-ede3") == 0) doit[D_EDE3_DES]=1;
                else
 #endif
+#ifndef OPENSSL_NO_AES
+                       if (strcmp(*argv,"aes-128-cbc") == 0) doit[D_CBC_128_AES]=1;
+               else    if (strcmp(*argv,"aes-192-cbc") == 0) doit[D_CBC_192_AES]=1;
+               else    if (strcmp(*argv,"aes-256-cbc") == 0) doit[D_CBC_256_AES]=1;
+               else
+#endif
 #ifndef OPENSSL_NO_RSA
 #if 0 /* was: #ifdef RSAref */
                        if (strcmp(*argv,"rsaref") == 0) 
@@ -667,6 +742,15 @@ int MAIN(int argc, char **argv)
                        }
                else
 #endif
+#ifndef OPENSSL_NO_AES
+                       if (strcmp(*argv,"aes") == 0)
+                       {
+                       doit[D_CBC_128_AES]=1;
+                       doit[D_CBC_192_AES]=1;
+                       doit[D_CBC_256_AES]=1;
+                       }
+               else
+#endif
 #ifndef OPENSSL_NO_RSA
                        if (strcmp(*argv,"rsa") == 0)
                        {
@@ -732,8 +816,12 @@ int MAIN(int argc, char **argv)
     !defined(OPENSSL_NO_BF) || !defined(OPENSSL_NO_RC5)
                        BIO_printf(bio_err,"\n");
 #endif
-
+#ifndef OPENSSL_NO_DES
                        BIO_printf(bio_err,"des-cbc  des-ede3 ");
+#endif
+#ifndef OPENSSL_NO_AES
+                       BIO_printf(bio_err,"aes-128-cbc aes-192-cbc aes-256-cbc ");
+#endif
 #ifndef OPENSSL_NO_RC4
                        BIO_printf(bio_err,"rc4");
 #endif
@@ -756,6 +844,9 @@ int MAIN(int argc, char **argv)
 #ifndef OPENSSL_NO_DES
                        BIO_printf(bio_err,"des      ");
 #endif
+#ifndef OPENSSL_NO_AES
+                       BIO_printf(bio_err,"aes      ");
+#endif
 #ifndef OPENSSL_NO_RSA
                        BIO_printf(bio_err,"rsa      ");
 #endif
@@ -764,7 +855,7 @@ int MAIN(int argc, char **argv)
 #endif
 #if !defined(OPENSSL_NO_IDEA) || !defined(OPENSSL_NO_RC2) || \
     !defined(OPENSSL_NO_DES) || !defined(OPENSSL_NO_RSA) || \
-    !defined(OPENSSL_NO_BF)
+    !defined(OPENSSL_NO_BF) || !defined(OPENSSL_NO_AES)
                        BIO_printf(bio_err,"\n");
 #endif
 
@@ -777,7 +868,9 @@ int MAIN(int argc, char **argv)
                        BIO_printf(bio_err,"-evp e          use EVP e.\n");
                        BIO_printf(bio_err,"-decrypt        time decryption instead of encryption (only EVP).\n");
                        BIO_printf(bio_err,"-mr             produce machine readable output.\n");
+#ifdef HAVE_FORK
                        BIO_printf(bio_err,"-multi n        run n benchmarks in parallel.\n");
+#endif
                        goto end;
                        }
                argc--;
@@ -785,8 +878,10 @@ int MAIN(int argc, char **argv)
                j++;
                }
 
+#ifdef HAVE_FORK
        if(multi && do_multi(multi))
                goto show_res;
+#endif
 
        if (j == 0)
                {
@@ -847,6 +942,11 @@ int MAIN(int argc, char **argv)
        DES_set_key_unchecked(&key2,&sch2);
        DES_set_key_unchecked(&key3,&sch3);
 #endif
+#ifndef OPENSSL_NO_AES
+       AES_set_encrypt_key(key16,128,&aes_ks1);
+       AES_set_encrypt_key(key24,192,&aes_ks2);
+       AES_set_encrypt_key(key32,256,&aes_ks3);
+#endif
 #ifndef OPENSSL_NO_IDEA
        idea_set_encrypt_key(key16,&idea_ks);
 #endif
@@ -875,9 +975,9 @@ int MAIN(int argc, char **argv)
        do      {
                long i;
                count*=2;
-               Time_F(START,usertime);
+               Time_F(START);
                for (i=count; i; i--)
-                       des_ecb_encrypt(buf_as_des_cblock,buf_as_des_cblock,
+                       DES_ecb_encrypt(buf_as_des_cblock,buf_as_des_cblock,
                                &sch,DES_ENCRYPT);
                d=Time_F(STOP);
                } while (d <3);
@@ -1040,8 +1140,8 @@ int MAIN(int argc, char **argv)
                HMAC_CTX hctx;
 
                HMAC_CTX_init(&hctx);
-               HMAC_Init(&hctx,(unsigned char *)"This is a key...",
-                       16,EVP_md5());
+               HMAC_Init_ex(&hctx,(unsigned char *)"This is a key...",
+                       16,EVP_md5(), NULL);
 
                for (j=0; j<SIZE_NUM; j++)
                        {
@@ -1049,9 +1149,9 @@ int MAIN(int argc, char **argv)
                        Time_F(START);
                        for (count=0,run=1; COND(c[D_HMAC][j]); count++)
                                {
-                               HMAC_Init(&hctx,NULL,0,NULL);
-                                HMAC_Update(&hctx,buf,lengths[j]);
-                                HMAC_Final(&hctx,&(hmac[0]),NULL);
+                               HMAC_Init_ex(&hctx,NULL,0,NULL,NULL);
+                               HMAC_Update(&hctx,buf,lengths[j]);
+                               HMAC_Final(&hctx,&(hmac[0]),NULL);
                                }
                        d=Time_F(STOP);
                        print_result(D_HMAC,j,count,d);
@@ -1111,7 +1211,7 @@ int MAIN(int argc, char **argv)
                        Time_F(START);
                        for (count=0,run=1; COND(c[D_CBC_DES][j]); count++)
                                DES_ncbc_encrypt(buf,buf,lengths[j],&sch,
-                                                &iv,DES_ENCRYPT);
+                                                &DES_iv,DES_ENCRYPT);
                        d=Time_F(STOP);
                        print_result(D_CBC_DES,j,count,d);
                        }
@@ -1126,12 +1226,57 @@ int MAIN(int argc, char **argv)
                        for (count=0,run=1; COND(c[D_EDE3_DES][j]); count++)
                                DES_ede3_cbc_encrypt(buf,buf,lengths[j],
                                                     &sch,&sch2,&sch3,
-                                                    &iv,DES_ENCRYPT);
+                                                    &DES_iv,DES_ENCRYPT);
                        d=Time_F(STOP);
                        print_result(D_EDE3_DES,j,count,d);
                        }
                }
 #endif
+#ifndef OPENSSL_NO_AES
+       if (doit[D_CBC_128_AES])
+               {
+               for (j=0; j<SIZE_NUM; j++)
+                       {
+                       print_message(names[D_CBC_128_AES],c[D_CBC_128_AES][j],lengths[j]);
+                       Time_F(START);
+                       for (count=0,run=1; COND(c[D_CBC_128_AES][j]); count++)
+                               AES_cbc_encrypt(buf,buf,
+                                       (unsigned long)lengths[j],&aes_ks1,
+                                       iv,AES_ENCRYPT);
+                       d=Time_F(STOP);
+                       print_result(D_CBC_128_AES,j,count,d);
+                       }
+               }
+       if (doit[D_CBC_192_AES])
+               {
+               for (j=0; j<SIZE_NUM; j++)
+                       {
+                       print_message(names[D_CBC_192_AES],c[D_CBC_192_AES][j],lengths[j]);
+                       Time_F(START);
+                       for (count=0,run=1; COND(c[D_CBC_192_AES][j]); count++)
+                               AES_cbc_encrypt(buf,buf,
+                                       (unsigned long)lengths[j],&aes_ks2,
+                                       iv,AES_ENCRYPT);
+                       d=Time_F(STOP);
+                       print_result(D_CBC_192_AES,j,count,d);
+                       }
+               }
+       if (doit[D_CBC_256_AES])
+               {
+               for (j=0; j<SIZE_NUM; j++)
+                       {
+                       print_message(names[D_CBC_256_AES],c[D_CBC_256_AES][j],lengths[j]);
+                       Time_F(START);
+                       for (count=0,run=1; COND(c[D_CBC_256_AES][j]); count++)
+                               AES_cbc_encrypt(buf,buf,
+                                       (unsigned long)lengths[j],&aes_ks3,
+                                       iv,AES_ENCRYPT);
+                       d=Time_F(STOP);
+                       print_result(D_CBC_256_AES,j,count,d);
+                       }
+               }
+
+#endif
 #ifndef OPENSSL_NO_IDEA
        if (doit[D_CBC_IDEA])
                {
@@ -1217,30 +1362,49 @@ int MAIN(int argc, char **argv)
                {
                for (j=0; j<SIZE_NUM; j++)
                        {
-                       EVP_CIPHER_CTX ctx;
-                       int outl;
+                       if (evp_cipher)
+                               {
+                               EVP_CIPHER_CTX ctx;
+                               int outl;
+
+                               names[D_EVP]=OBJ_nid2ln(evp_cipher->nid);
+                               /* -O3 -fschedule-insns messes up an
+                                * optimization here!  names[D_EVP]
+                                * somehow becomes NULL */
+                               print_message(names[D_EVP],save_count,
+                                       lengths[j]);
+
+                               EVP_CIPHER_CTX_init(&ctx);
+                               if(decrypt)
+                                       EVP_DecryptInit_ex(&ctx,evp_cipher,NULL,key16,iv);
+                               else
+                                       EVP_EncryptInit_ex(&ctx,evp_cipher,NULL,key16,iv);
 
-                       names[D_EVP]=OBJ_nid2ln(evp->nid);
-                       print_message(names[D_EVP],save_count,
-                                                 lengths[j]);
-                       EVP_CIPHER_CTX_init(&ctx);
-                       if(decrypt)
-                               EVP_DecryptInit_ex(&ctx,evp,NULL,key16,iv);
-                       else
-                               EVP_EncryptInit_ex(&ctx,evp,NULL,key16,iv);
-                               
-                       Time_F(START);
-                       if(decrypt)
-                               for (count=0,run=1; COND(save_count*4*lengths[0]/lengths[j]); count++)
-                                       EVP_DecryptUpdate(&ctx,buf,&outl,buf,lengths[j]);
-                       else
+                               Time_F(START);
+                               if(decrypt)
+                                       for (count=0,run=1; COND(save_count*4*lengths[0]/lengths[j]); count++)
+                                               EVP_DecryptUpdate(&ctx,buf,&outl,buf,lengths[j]);
+                               else
+                                       for (count=0,run=1; COND(save_count*4*lengths[0]/lengths[j]); count++)
+                                               EVP_EncryptUpdate(&ctx,buf,&outl,buf,lengths[j]);
+                               if(decrypt)
+                                       EVP_DecryptFinal_ex(&ctx,buf,&outl);
+                               else
+                                       EVP_EncryptFinal_ex(&ctx,buf,&outl);
+                               d=Time_F(STOP);
+                               }
+                       if (evp_md)
+                               {
+                               names[D_EVP]=OBJ_nid2ln(evp_md->type);
+                               print_message(names[D_EVP],save_count,
+                                       lengths[j]);
+
+                               Time_F(START);
                                for (count=0,run=1; COND(save_count*4*lengths[0]/lengths[j]); count++)
-                                       EVP_EncryptUpdate(&ctx,buf,&outl,buf,lengths[j]);
-                       if(decrypt)
-                               EVP_DecryptFinal_ex(&ctx,buf,&outl);
-                       else
-                               EVP_EncryptFinal_ex(&ctx,buf,&outl);
-                       d=Time_F(STOP);
+                                       EVP_Digest(buf,lengths[j],&(md[0]),NULL,evp_md,NULL);
+
+                               d=Time_F(STOP);
+                               }
                        print_result(D_EVP,j,count,d);
                        }
                }
@@ -1423,7 +1587,9 @@ int MAIN(int argc, char **argv)
                }
        if (rnd_fake) RAND_cleanup();
 #endif
+#ifdef HAVE_FORK
 show_res:
+#endif
        if(!mr)
                {
                fprintf(stdout,"%s\n",SSLeay_version(SSLEAY_VERSION));
@@ -1437,7 +1603,10 @@ show_res:
                printf("%s ",RC4_options());
 #endif
 #ifndef OPENSSL_NO_DES
-               printf("%s ",des_options());
+               printf("%s ",DES_options());
+#endif
+#ifndef OPENSSL_NO_AES
+               printf("%s ",AES_options());
 #endif
 #ifndef OPENSSL_NO_IDEA
                printf("%s ",idea_options());
@@ -1458,7 +1627,7 @@ show_res:
 #endif
 #ifdef HZ
 #define as_string(s) (#s)
-               printf("HZ=%g", HZ);
+               printf("HZ=%g", (double)HZ);
 # ifdef _SC_CLK_TCK
                printf(" [sysconf value]");
 # endif
@@ -1635,6 +1804,7 @@ static char *sstrsep(char **string, const char *delim)
     return token;
     }
 
+#ifdef HAVE_FORK
 static int do_multi(int multi)
        {
        int n;
@@ -1767,4 +1937,4 @@ static int do_multi(int multi)
                }
        return 1;
        }
-
+#endif