aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-07-06 13:25:24 +0000
committerChristian Grothoff <christian@grothoff.org>2016-07-06 13:25:24 +0000
commit6cef8fea0c3b6756870786ebc4db0588373c8f65 (patch)
tree12c4eaf2b805f223e5170b5ce74829212a01d467 /src
parent43864a32204bf109593cbfbc5801f89cf39b7bfa (diff)
downloadgnunet-6cef8fea0c3b6756870786ebc4db0588373c8f65.tar.gz
gnunet-6cef8fea0c3b6756870786ebc4db0588373c8f65.zip
fix dlog API for mteich
Diffstat (limited to 'src')
-rw-r--r--src/include/gnunet_crypto_lib.h6
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c2
-rw-r--r--src/util/crypto_ecc_dlog.c6
3 files changed, 7 insertions, 7 deletions
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h
index 00ecc565f..8002b7710 100644
--- a/src/include/gnunet_crypto_lib.h
+++ b/src/include/gnunet_crypto_lib.h
@@ -1030,7 +1030,7 @@ GNUNET_CRYPTO_kdf_v (void *result,
1030void 1030void
1031GNUNET_CRYPTO_kdf_mod_mpi (gcry_mpi_t *r, 1031GNUNET_CRYPTO_kdf_mod_mpi (gcry_mpi_t *r,
1032 gcry_mpi_t n, 1032 gcry_mpi_t n,
1033 const void *xts, size_t xts_len, 1033 const void *xts, size_t xts_len,
1034 const void *skm, size_t skm_len, 1034 const void *skm, size_t skm_len,
1035 const char *ctx); 1035 const char *ctx);
1036 1036
@@ -1348,7 +1348,7 @@ struct GNUNET_CRYPTO_EccPoint
1348 * 1348 *
1349 * @param max maximum value the factor can be 1349 * @param max maximum value the factor can be
1350 * @param mem memory to use (should be smaller than @a max), must not be zero. 1350 * @param mem memory to use (should be smaller than @a max), must not be zero.
1351 * @return @a max if dlog failed, otherwise the factor 1351 * @return NULL on error
1352 */ 1352 */
1353struct GNUNET_CRYPTO_EccDlogContext * 1353struct GNUNET_CRYPTO_EccDlogContext *
1354GNUNET_CRYPTO_ecc_dlog_prepare (unsigned int max, 1354GNUNET_CRYPTO_ecc_dlog_prepare (unsigned int max,
@@ -1361,7 +1361,7 @@ GNUNET_CRYPTO_ecc_dlog_prepare (unsigned int max,
1361 * 1361 *
1362 * @param dlc precalculated values, determine range of factors 1362 * @param dlc precalculated values, determine range of factors
1363 * @param input point on the curve to factor 1363 * @param input point on the curve to factor
1364 * @return `dlc->max` if dlog failed, otherwise the factor 1364 * @return INT_MAX if dlog failed, otherwise the factor
1365 */ 1365 */
1366int 1366int
1367GNUNET_CRYPTO_ecc_dlog (struct GNUNET_CRYPTO_EccDlogContext *edc, 1367GNUNET_CRYPTO_ecc_dlog (struct GNUNET_CRYPTO_EccDlogContext *edc,
diff --git a/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c b/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
index 196bdbeeb..bf5ee1241 100644
--- a/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
+++ b/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
@@ -472,7 +472,7 @@ compute_scalar_product (struct AliceServiceSession *session,
472 ai_bi = GNUNET_CRYPTO_ecc_dlog (edc, 472 ai_bi = GNUNET_CRYPTO_ecc_dlog (edc,
473 g_ai_bi); 473 g_ai_bi);
474 gcry_mpi_point_release (g_ai_bi); 474 gcry_mpi_point_release (g_ai_bi);
475 if (MAX_RESULT == ai_bi) 475 if (INT_MAX == ai_bi)
476 { 476 {
477 /* result too big */ 477 /* result too big */
478 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 478 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
diff --git a/src/util/crypto_ecc_dlog.c b/src/util/crypto_ecc_dlog.c
index f6eb58a9a..38e2088cc 100644
--- a/src/util/crypto_ecc_dlog.c
+++ b/src/util/crypto_ecc_dlog.c
@@ -151,7 +151,7 @@ GNUNET_CRYPTO_ecc_bin_to_point (struct GNUNET_CRYPTO_EccDlogContext *edc,
151 * 151 *
152 * @param max maximum value the factor can be 152 * @param max maximum value the factor can be
153 * @param mem memory to use (should be smaller than @a max), must not be zero. 153 * @param mem memory to use (should be smaller than @a max), must not be zero.
154 * @return @a max if dlog failed, otherwise the factor 154 * @return NULL on error
155 */ 155 */
156struct GNUNET_CRYPTO_EccDlogContext * 156struct GNUNET_CRYPTO_EccDlogContext *
157GNUNET_CRYPTO_ecc_dlog_prepare (unsigned int max, 157GNUNET_CRYPTO_ecc_dlog_prepare (unsigned int max,
@@ -219,7 +219,7 @@ GNUNET_CRYPTO_ecc_dlog_prepare (unsigned int max,
219 * 219 *
220 * @param edc precalculated values, determine range of factors 220 * @param edc precalculated values, determine range of factors
221 * @param input point on the curve to factor 221 * @param input point on the curve to factor
222 * @return `edc->max` if dlog failed, otherwise the factor 222 * @return INT_MAX if dlog failed, otherwise the factor
223 */ 223 */
224int 224int
225GNUNET_CRYPTO_ecc_dlog (struct GNUNET_CRYPTO_EccDlogContext *edc, 225GNUNET_CRYPTO_ecc_dlog (struct GNUNET_CRYPTO_EccDlogContext *edc,
@@ -237,7 +237,7 @@ GNUNET_CRYPTO_ecc_dlog (struct GNUNET_CRYPTO_EccDlogContext *edc,
237 GNUNET_assert (NULL != g); 237 GNUNET_assert (NULL != g);
238 q = gcry_mpi_point_new (0); 238 q = gcry_mpi_point_new (0);
239 239
240 res = edc->max; 240 res = INT_MAX;
241 for (i=0;i<=edc->max/edc->mem;i++) 241 for (i=0;i<=edc->max/edc->mem;i++)
242 { 242 {
243 if (0 == i) 243 if (0 == i)