Correct a lot of printing calls. Remove extra arguments...
[openssl.git] / apps / speed.c
index df892c51fb2b06df8db0ba63b287be8c020f0157..a634b117298f4c718b488f9010840c0f855eaed0 100644 (file)
@@ -71,6 +71,8 @@
 
 /* most of this code has been pilfered from my libdes speed.c program */
 
+#ifndef OPENSSL_NO_SPEED
+
 #undef SECONDS
 #define SECONDS                3       
 #define RSA_SECONDS    10
@@ -394,6 +396,20 @@ static double Time_F(int s)
 #endif
        }
 
+
+static const int KDF1_SHA1_len = 20;
+static void *KDF1_SHA1(void *in, size_t inlen, void *out, size_t outlen)
+       {
+#ifndef OPENSSL_NO_SHA
+       if (outlen != SHA_DIGEST_LENGTH)
+               return NULL;
+       return SHA1(in, inlen, out);
+#else
+       return NULL;
+#endif
+       }
+
+
 int MAIN(int, char **);
 
 int MAIN(int argc, char **argv)
@@ -2063,12 +2079,12 @@ int MAIN(int argc, char **argv)
                                        }
                                else
                                        {
-                                       secret_size_a = ECDH_compute_key(secret_a, 
+                                       secret_size_a = ECDH_compute_key(secret_a, KDF1_SHA1_len,
                                                ecdh_b[j]->pub_key,
-                                               ecdh_a[j]);
-                                       secret_size_b = ECDH_compute_key(secret_b, 
+                                               ecdh_a[j], KDF1_SHA1);
+                                       secret_size_b = ECDH_compute_key(secret_b, KDF1_SHA1_len,
                                                ecdh_a[j]->pub_key,
-                                               ecdh_b[j]);
+                                               ecdh_b[j], KDF1_SHA1);
                                        if (secret_size_a != secret_size_b) 
                                                ecdh_checks = 0;
                                        else
@@ -2097,9 +2113,9 @@ int MAIN(int argc, char **argv)
                                        Time_F(START);
                                        for (count=0,run=1; COND(ecdh_c[j][0]); count++)
                                                {
-                                               ECDH_compute_key(secret_a, 
+                                               ECDH_compute_key(secret_a, KDF1_SHA1_len,
                                                ecdh_b[j]->pub_key,
-                                               ecdh_a[j]);
+                                               ecdh_a[j], KDF1_SHA1);
                                                }
                                        d=Time_F(STOP);
                                        BIO_printf(bio_err, mr ? "+R7:%ld:%d:%.2f\n" :"%ld %d-bit ECDH ops in %.2fs\n",
@@ -2366,8 +2382,8 @@ static void pkey_print_message(char *str, char *str2, long num, int bits,
 
 static void print_result(int alg,int run_no,int count,double time_used)
        {
-       BIO_printf(bio_err,mr ? "+R:%ld:%s:%f\n"
-                  : "%ld %s's in %.2fs\n",count,names[alg],time_used);
+       BIO_printf(bio_err,mr ? "+R:%d:%s:%f\n"
+                  : "%d %s's in %.2fs\n",count,names[alg],time_used);
        results[alg][run_no]=((double)count)/time_used*lengths[run_no];
        }
 
@@ -2579,3 +2595,4 @@ static int do_multi(int multi)
        return 1;
        }
 #endif
+#endif