diff options
-rw-r--r-- | po/POTFILES.in | 3 | ||||
-rw-r--r-- | src/include/gnunet_crypto_lib.h | 14 | ||||
-rw-r--r-- | src/util/crypto_ecc_dlog.c | 23 |
3 files changed, 39 insertions, 1 deletions
diff --git a/po/POTFILES.in b/po/POTFILES.in index d756a2c37..b36509fdf 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in | |||
@@ -250,9 +250,9 @@ src/psyc/gnunet-service-psyc.c | |||
250 | src/psyc/psyc_api.c | 250 | src/psyc/psyc_api.c |
251 | src/psycstore/gnunet-service-psycstore.c | 251 | src/psycstore/gnunet-service-psycstore.c |
252 | src/psycstore/plugin_psycstore_sqlite.c | 252 | src/psycstore/plugin_psycstore_sqlite.c |
253 | src/psycstore/psyc_util_lib.c | ||
254 | src/psycstore/psycstore_api.c | 253 | src/psycstore/psycstore_api.c |
255 | src/psycstore/psyc_util_lib.c | 254 | src/psycstore/psyc_util_lib.c |
255 | src/psycstore/psyc_util_lib.c | ||
256 | src/pt/gnunet-daemon-pt.c | 256 | src/pt/gnunet-daemon-pt.c |
257 | src/regex/gnunet-daemon-regexprofiler.c | 257 | src/regex/gnunet-daemon-regexprofiler.c |
258 | src/regex/gnunet-regex-profiler.c | 258 | src/regex/gnunet-regex-profiler.c |
@@ -446,6 +446,7 @@ src/util/server_nc.c | |||
446 | src/util/server_tc.c | 446 | src/util/server_tc.c |
447 | src/util/service.c | 447 | src/util/service.c |
448 | src/util/signal.c | 448 | src/util/signal.c |
449 | src/util/socks.c | ||
449 | src/util/speedup.c | 450 | src/util/speedup.c |
450 | src/util/strings.c | 451 | src/util/strings.c |
451 | src/util/time.c | 452 | src/util/time.c |
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h index e3d938382..33ad1af2b 100644 --- a/src/include/gnunet_crypto_lib.h +++ b/src/include/gnunet_crypto_lib.h | |||
@@ -1427,6 +1427,20 @@ GNUNET_CRYPTO_ecc_rnd (struct GNUNET_CRYPTO_EccDlogContext *edc, | |||
1427 | 1427 | ||
1428 | 1428 | ||
1429 | /** | 1429 | /** |
1430 | * Obtain a random scalar for point multiplication on the curve and | ||
1431 | * its multiplicative inverse. | ||
1432 | * | ||
1433 | * @param edc calculation context for ECC operations | ||
1434 | * @param[out] r set to a random scalar on the curve | ||
1435 | * @param[out] r_inv set to the multiplicative inverse of @a r | ||
1436 | */ | ||
1437 | void | ||
1438 | GNUNET_CRYPTO_ecc_rnd_mpi (struct GNUNET_CRYPTO_EccDlogContext *edc, | ||
1439 | gcry_mpi_t *r, | ||
1440 | gcry_mpi_t *r_inv); | ||
1441 | |||
1442 | |||
1443 | /** | ||
1430 | * Generate a random value mod n. | 1444 | * Generate a random value mod n. |
1431 | * | 1445 | * |
1432 | * @param edc ECC context | 1446 | * @param edc ECC context |
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 | */ | ||
477 | void | ||
478 | GNUNET_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 |