/* 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
/* The following if from times(3) man page. It may need to be changed */
#ifndef HZ
-# ifdef _SC_CLK_TCK
+# if defined(_SC_CLK_TCK) \
+ && (!defined(OPENSSL_SYS_VMS) || __CTRL_VER >= 70000000)
# define HZ ((double)sysconf(_SC_CLK_TCK))
# else
# ifndef CLK_TCK
#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)
{
+#ifndef OPENSSL_NO_ENGINE
ENGINE *e = NULL;
+#endif
unsigned char *buf=NULL,*buf2=NULL;
int mret=1;
long count=0,save_count=0;
j--; /* Otherwise, -elapsed gets confused with
an algorithm. */
}
+#ifndef OPENSSL_NO_ENGINE
else if ((argc > 0) && (strcmp(*argv,"-engine") == 0))
{
argc--;
means all of them should be run) */
j--;
}
+#endif
#ifdef HAVE_FORK
else if ((argc > 0) && (strcmp(*argv,"-multi") == 0))
{
#if defined(TIMES) || defined(USE_TOD)
BIO_printf(bio_err,"-elapsed measure time in real time instead of CPU user time.\n");
#endif
+#ifndef OPENSSL_NO_ENGINE
BIO_printf(bio_err,"-engine e use engine e, possibly a hardware device.\n");
+#endif
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");
else
EVP_EncryptFinal_ex(&ctx,buf,&outl);
d=Time_F(STOP);
+ EVP_CIPHER_CTX_cleanup(&ctx);
}
if (evp_md)
{
}
else
{
+#if 1
+ EC_GROUP_precompute_mult(ecdsa[j]->group, NULL);
+#endif
/* Perform ECDSA signature test */
EC_KEY_generate_key(ecdsa[j]);
ret = ECDSA_sign(0, buf, 20, ecdsasig,
}
else
{
- ecdh_b[j]->group = ecdh_a[j]->group;
+ ecdh_b[j]->group = EC_GROUP_dup(ecdh_a[j]->group);
/* generate two ECDH key pairs */
if (!EC_KEY_generate_key(ecdh_a[j]) ||
}
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
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",
#endif
apps_shutdown();
- EXIT(mret);
+ OPENSSL_EXIT(mret);
}
static void print_message(const char *s, long num, int length)
return 1;
}
#endif
+#endif