diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-09-05 17:44:50 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-09-05 17:44:50 +0000 |
commit | f1a73a358739cd2bebf7b83ef1c097a04dc50cd4 (patch) | |
tree | c613cee2f4e64c86bc5c1d360e0868997bf6a7ae /src/util/crypto_ecc_dlog.c | |
parent | 59df216f6ad04e9131ee4fa43e14055252a71651 (diff) | |
download | gnunet-f1a73a358739cd2bebf7b83ef1c097a04dc50cd4.tar.gz gnunet-f1a73a358739cd2bebf7b83ef1c097a04dc50cd4.zip |
add GNUNET_CRYPTO_ecc_pmul_mpi
Diffstat (limited to 'src/util/crypto_ecc_dlog.c')
-rw-r--r-- | src/util/crypto_ecc_dlog.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/util/crypto_ecc_dlog.c b/src/util/crypto_ecc_dlog.c index 13ee1e6be..29cba3336 100644 --- a/src/util/crypto_ecc_dlog.c +++ b/src/util/crypto_ecc_dlog.c | |||
@@ -407,6 +407,28 @@ GNUNET_CRYPTO_ecc_add (struct GNUNET_CRYPTO_EccDlogContext *edc, | |||
407 | 407 | ||
408 | 408 | ||
409 | /** | 409 | /** |
410 | * Multiply the point @a p on the elliptic curve by @a val. | ||
411 | * | ||
412 | * @param edc calculation context for ECC operations | ||
413 | * @param p point to multiply | ||
414 | * @param val (positive) value to encode into a point | ||
415 | * @return representation of the value as an ECC point, | ||
416 | * must be freed using #GNUNET_CRYPTO_ecc_free() | ||
417 | */ | ||
418 | gcry_mpi_point_t | ||
419 | GNUNET_CRYPTO_ecc_pmul_mpi (struct GNUNET_CRYPTO_EccDlogContext *edc, | ||
420 | gcry_mpi_point_t p, | ||
421 | gcry_mpi_t val) | ||
422 | { | ||
423 | gcry_mpi_point_t r; | ||
424 | |||
425 | r = gcry_mpi_point_new (0); | ||
426 | gcry_mpi_ec_mul (r, val, p, edc->ctx); | ||
427 | return r; | ||
428 | } | ||
429 | |||
430 | |||
431 | /** | ||
410 | * Obtain a random point on the curve and its | 432 | * Obtain a random point on the curve and its |
411 | * additive inverse. Both returned values | 433 | * additive inverse. Both returned values |
412 | * must be freed using #GNUNET_CRYPTO_ecc_free(). | 434 | * must be freed using #GNUNET_CRYPTO_ecc_free(). |