aboutsummaryrefslogtreecommitdiff
path: root/src/util/crypto_ecc_dlog.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-09-05 22:32:52 +0000
committerChristian Grothoff <christian@grothoff.org>2015-09-05 22:32:52 +0000
commit022bc4891b9eb9701f3f003eaf995e3a4731d303 (patch)
tree78072eea94b714909a1ec327c8f1bb3e5965fe99 /src/util/crypto_ecc_dlog.c
parent537de3328e656911aa3c1c84e1ceb6bcaa8ab3d3 (diff)
downloadgnunet-022bc4891b9eb9701f3f003eaf995e3a4731d303.tar.gz
gnunet-022bc4891b9eb9701f3f003eaf995e3a4731d303.zip
-fix ftbfs
Diffstat (limited to 'src/util/crypto_ecc_dlog.c')
-rw-r--r--src/util/crypto_ecc_dlog.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/util/crypto_ecc_dlog.c b/src/util/crypto_ecc_dlog.c
index 29cba3336..1254a036e 100644
--- a/src/util/crypto_ecc_dlog.c
+++ b/src/util/crypto_ecc_dlog.c
@@ -467,6 +467,29 @@ GNUNET_CRYPTO_ecc_rnd (struct GNUNET_CRYPTO_EccDlogContext *edc,
467 467
468 468
469/** 469/**
470 * Obtain a random scalar for point multiplication on the curve and
471 * its multiplicative inverse.
472 *
473 * @param edc calculation context for ECC operations
474 * @param[out] r set to a random scalar on the curve
475 * @param[out] r_inv set to the multiplicative inverse of @a r
476 */
477void
478GNUNET_CRYPTO_ecc_rnd_mpi (struct GNUNET_CRYPTO_EccDlogContext *edc,
479 gcry_mpi_t *r,
480 gcry_mpi_t *r_inv)
481{
482 gcry_mpi_t n;
483
484 *r = GNUNET_CRYPTO_ecc_random_mod_n (edc);
485 /* r_inv = n - r = - r */
486 *r_inv = gcry_mpi_new (0);
487 n = gcry_mpi_ec_get_mpi ("n", edc->ctx, 1);
488 gcry_mpi_sub (*r_inv, n, *r);
489}
490
491
492/**
470 * Free a point value returned by the API. 493 * Free a point value returned by the API.
471 * 494 *
472 * @param p point to free 495 * @param p point to free