gcry_ctx_t ctx;
gcry_mpi_t q;
+ BENCHMARK_START (ecdsa_key_get_public);
+
sexp = decode_private_ecdsa_key (priv);
GNUNET_assert (NULL != sexp);
GNUNET_assert (0 == gcry_mpi_ec_new (&ctx, sexp, NULL));
GNUNET_CRYPTO_mpi_print_unsigned (pub->q_y, sizeof (pub->q_y), q);
gcry_mpi_release (q);
gcry_ctx_release (ctx);
+
+ BENCHMARK_END (ecdsa_key_get_public);
}
gcry_ctx_t ctx;
gcry_mpi_t q;
+ BENCHMARK_START (eddsa_key_get_public);
+
sexp = decode_private_eddsa_key (priv);
GNUNET_assert (NULL != sexp);
GNUNET_assert (0 == gcry_mpi_ec_new (&ctx, sexp, NULL));
GNUNET_CRYPTO_mpi_print_unsigned (pub->q_y, sizeof (pub->q_y), q);
gcry_mpi_release (q);
gcry_ctx_release (ctx);
+
+ BENCHMARK_END (eddsa_key_get_public);
}
gcry_ctx_t ctx;
gcry_mpi_t q;
+ BENCHMARK_START (ecdhe_key_get_public);
+
sexp = decode_private_ecdhe_key (priv);
GNUNET_assert (NULL != sexp);
GNUNET_assert (0 == gcry_mpi_ec_new (&ctx, sexp, NULL));
GNUNET_CRYPTO_mpi_print_unsigned (pub->q_y, sizeof (pub->q_y), q);
gcry_mpi_release (q);
gcry_ctx_release (ctx);
+
+ BENCHMARK_END (ecdhe_key_get_public);
}
gcry_mpi_t d;
int rc;
+ BENCHMARK_START (ecdhe_key_create);
+
/* NOTE: For libgcrypt >= 1.7, we do not need the 'eddsa' flag here,
but should also be harmless. For libgcrypt < 1.7, using 'eddsa'
disables an expensive key testing routine. We do not want to run
gcry_sexp_release (priv_sexp);
GNUNET_CRYPTO_mpi_print_unsigned (pk->d, sizeof (pk->d), d);
gcry_mpi_release (d);
+
+ BENCHMARK_END (ecdhe_key_create);
+
return GNUNET_OK;
}
gcry_mpi_t d;
int rc;
+ BENCHMARK_START (ecdsa_key_create);
+
if (0 != (rc = gcry_sexp_build (&s_keyparam, NULL,
"(genkey(ecc(curve \"" CURVE "\")"
"(flags)))")))
priv = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey);
GNUNET_CRYPTO_mpi_print_unsigned (priv->d, sizeof (priv->d), d);
gcry_mpi_release (d);
+
+ BENCHMARK_END (ecdsa_key_create);
+
return priv;
}
gcry_mpi_t d;
int rc;
+ BENCHMARK_START (eddsa_key_create);
+
#if CRYPTO_BUG
again:
#endif
}
#endif
+ BENCHMARK_END (eddsa_key_create);
+
return priv;
}
int rc;
gcry_mpi_t rs[2];
+ BENCHMARK_START (ecdsa_sign);
+
priv_sexp = decode_private_ecdsa_key (priv);
data = data_to_ecdsa_value (purpose);
if (0 != (rc = gcry_pk_sign (&sig_sexp, data, priv_sexp)))
GNUNET_CRYPTO_mpi_print_unsigned (sig->s, sizeof (sig->s), rs[1]);
gcry_mpi_release (rs[0]);
gcry_mpi_release (rs[1]);
+
+ BENCHMARK_END (ecdsa_sign);
+
return GNUNET_OK;
}
int rc;
gcry_mpi_t rs[2];
-#if ENABLE_BENCHMARK
- struct BenchmarkData *bd = get_benchmark_data ();
- bd->eddsa_sign_count++;
-#endif
+ BENCHMARK_START (eddsa_sign);
priv_sexp = decode_private_eddsa_key (priv);
data = data_to_eddsa_value (purpose);
GNUNET_CRYPTO_mpi_print_unsigned (sig->s, sizeof (sig->s), rs[1]);
gcry_mpi_release (rs[0]);
gcry_mpi_release (rs[1]);
+
+ BENCHMARK_END (eddsa_sign);
+
return GNUNET_OK;
}
gcry_sexp_t pub_sexpr;
int rc;
+ BENCHMARK_START (ecdsa_verify);
+
if (purpose != ntohl (validate->purpose))
return GNUNET_SYSERR; /* purpose mismatch */
LOG (GNUNET_ERROR_TYPE_INFO,
_("ECDSA signature verification failed at %s:%d: %s\n"), __FILE__,
__LINE__, gcry_strerror (rc));
+ BENCHMARK_END (ecdsa_verify);
return GNUNET_SYSERR;
}
+ BENCHMARK_END (ecdsa_verify);
return GNUNET_OK;
}
gcry_sexp_t pub_sexpr;
int rc;
+ BENCHMARK_START (eddsa_verify);
+
if (purpose != ntohl (validate->purpose))
return GNUNET_SYSERR; /* purpose mismatch */
LOG (GNUNET_ERROR_TYPE_INFO,
_("EdDSA signature verification failed at %s:%d: %s\n"), __FILE__,
__LINE__, gcry_strerror (rc));
+ BENCHMARK_END (eddsa_verify);
return GNUNET_SYSERR;
}
+ BENCHMARK_END (eddsa_verify);
return GNUNET_OK;
}
unsigned char xbuf[256 / 8];
size_t rsize;
+ BENCHMARK_START (ecc_ecdh);
+
/* first, extract the q = dP value from the public key */
if (0 != gcry_sexp_build (&pub_sexpr, NULL,
"(public-key(ecc(curve " CURVE ")(q %b)))",
rsize,
key_material);
gcry_mpi_release (result_x);
+ BENCHMARK_END (ecc_ecdh);
return GNUNET_OK;
}
gcry_sexp_t pub_sexpr;
int ret;
+ BENCHMARK_START (eddsa_ecdh);
+
/* first, extract the q = dP value from the public key */
if (0 != gcry_sexp_build (&pub_sexpr, NULL,
"(public-key(ecc(curve " CURVE ")(q %b)))",
key_material);
gcry_mpi_point_release (result);
gcry_ctx_release (ctx);
+ BENCHMARK_END (eddsa_ecdh);
return ret;
}
gcry_sexp_t pub_sexpr;
int ret;
+ BENCHMARK_START (ecdsa_ecdh);
+
/* first, extract the q = dP value from the public key */
if (0 != gcry_sexp_build (&pub_sexpr, NULL,
"(public-key(ecc(curve " CURVE ")(q %b)))",
key_material);
gcry_mpi_point_release (result);
gcry_ctx_release (ctx);
+ BENCHMARK_END (ecdsa_ecdh);
return ret;
}
gcry_sexp_t pub_sexpr;
int ret;
+ BENCHMARK_START (ecdh_eddsa);
+
/* first, extract the q = dP value from the public key */
if (0 != gcry_sexp_build (&pub_sexpr, NULL,
"(public-key(ecc(curve " CURVE ")(q %b)))",
key_material);
gcry_mpi_point_release (result);
gcry_ctx_release (ctx);
+ BENCHMARK_END (ecdh_eddsa);
return ret;
}