aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_crypto_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-07-02 19:58:35 +0000
committerChristian Grothoff <christian@grothoff.org>2015-07-02 19:58:35 +0000
commitfece22eebf8c8d54e79d05f748019e7234823828 (patch)
treef875095ec8a2918a263f273a71b721654cfba612 /src/include/gnunet_crypto_lib.h
parented53a24f07a861edf7edd327c04fc7a23111e3c4 (diff)
downloadgnunet-fece22eebf8c8d54e79d05f748019e7234823828.tar.gz
gnunet-fece22eebf8c8d54e79d05f748019e7234823828.zip
-adding ecc dlog support
Diffstat (limited to 'src/include/gnunet_crypto_lib.h')
-rw-r--r--src/include/gnunet_crypto_lib.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h
index 01fb3f51c..3ee8ea5a7 100644
--- a/src/include/gnunet_crypto_lib.h
+++ b/src/include/gnunet_crypto_lib.h
@@ -1281,6 +1281,45 @@ GNUNET_CRYPTO_cmp_peer_identity (const struct GNUNET_PeerIdentity *first,
1281 1281
1282 1282
1283/** 1283/**
1284 * Internal structure used to cache pre-calculated values for DLOG calculation.
1285 */
1286struct GNUNET_CRYPTO_EccDlogContext;
1287
1288/**
1289 * Do pre-calculation for ECC discrete logarithm for small factors.
1290 *
1291 * @param max maximum value the factor can be
1292 * @param mem memory to use (should be smaller than @a max), must not be zero.
1293 * @return @a max if dlog failed, otherwise the factor
1294 */
1295struct GNUNET_CRYPTO_EccDlogContext *
1296GNUNET_CRYPTO_ecc_dlog_prepare (unsigned int max,
1297 unsigned int mem);
1298
1299
1300
1301/**
1302 * Calculate ECC discrete logarithm for small factors.
1303 *
1304 * @param dlc precalculated values, determine range of factors
1305 * @param input point on the curve to factor
1306 * @return `dlc->max` if dlog failed, otherwise the factor
1307 */
1308unsigned int
1309GNUNET_CRYPTO_ecc_dlog (struct GNUNET_CRYPTO_EccDlogContext *edc,
1310 gcry_mpi_point_t input);
1311
1312
1313/**
1314 * Release precalculated values.
1315 *
1316 * @param dlc dlog context
1317 */
1318void
1319GNUNET_CRYPTO_ecc_dlog_release (struct GNUNET_CRYPTO_EccDlogContext *dlc);
1320
1321
1322/**
1284 * @ingroup crypto 1323 * @ingroup crypto
1285 * Derive key material from a public and a private ECC key. 1324 * Derive key material from a public and a private ECC key.
1286 * 1325 *