aboutsummaryrefslogtreecommitdiff
path: root/crypto.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto.c')
-rw-r--r--crypto.c53
1 files changed, 37 insertions, 16 deletions
diff --git a/crypto.c b/crypto.c
index e870f2b..6c1b501 100644
--- a/crypto.c
+++ b/crypto.c
@@ -219,7 +219,9 @@ ec_point_cmp (const gcry_mpi_point_t a, const gcry_mpi_point_t b)
brandt_assert (a && b);
if (!ax || !bx || !ay || !by)
{
- weprintf ("could not init point in point_cmp");
+ GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
+ "libbrandt",
+ "could not init point in point_cmp\n");
return 1;
}
@@ -410,8 +412,10 @@ smc_init1 (uint16_t size1)
{
if (NULL == (ret[i] = gcry_mpi_point_new (0)))
{
- weprintf ("could not init point in 1 dimensional array. "
- "out of memory?");
+ GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
+ "libbrandt",
+ "could not init point in 1 dimensional array. "
+ "out of memory?\n");
smc_free1 (ret, size1);
return NULL;
}
@@ -464,8 +468,11 @@ smc_init2 (uint16_t size1, uint16_t size2)
{
if (NULL == (ret[i][j] = gcry_mpi_point_new (0)))
{
- weprintf ("could not init point in 2 dimensional array. "
- "out of memory?");
+ GNUNET_log_from (
+ GNUNET_ERROR_TYPE_ERROR,
+ "libbrandt",
+ "could not init point in 2 dimensional array. "
+ "out of memory?\n");
smc_free2 (ret, size1, size2);
GNUNET_assert (0);
}
@@ -527,8 +534,11 @@ smc_init3 (uint16_t size1, uint16_t size2, uint16_t size3)
{
if (NULL == (ret[i][j][k] = gcry_mpi_point_new (0)))
{
- weprintf ("could not init point in 2 dimensional array. "
- "out of memory?");
+ GNUNET_log_from (
+ GNUNET_ERROR_TYPE_ERROR,
+ "libbrandt",
+ "could not init point in 2 dimensional array. "
+ "out of memory?\n");
smc_free3 (ret, size1, size2, size3);
GNUNET_assert (0);
}
@@ -651,7 +661,9 @@ smc_recv_keyshare (struct BRANDT_Auction *ad,
if (buflen != (sizeof (struct ec_mpi) + sizeof (*proof1)))
{
- weprintf ("wrong size of received key share");
+ GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING,
+ "libbrandt",
+ "wrong size of received key share\n");
goto quit;
}
@@ -659,7 +671,9 @@ smc_recv_keyshare (struct BRANDT_Auction *ad,
ec_point_parse (y, (struct ec_mpi *)buf);
if (smc_zkp_dl_check (y, proof1))
{
- weprintf ("wrong zkp1 for public key share received");
+ GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING,
+ "libbrandt",
+ "wrong zkp1 for public key share received\n");
goto quit;
}
@@ -785,7 +799,9 @@ smc_recv_encrypted_bid (struct BRANDT_Auction *ad,
(0 < ad->m ? 2 : 1) * sizeof (struct proof_2dle)) ||
NULL == (ct = smc_init2 (2, ad->k)))
{
- weprintf ("wrong size of received encrypted bid");
+ GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING,
+ "libbrandt",
+ "wrong size of received encrypted bid\n");
goto quit;
}
@@ -801,7 +817,9 @@ smc_recv_encrypted_bid (struct BRANDT_Auction *ad,
proof3 = (struct proof_0og *)(cur + 2 * sizeof (struct ec_mpi));
if (smc_zkp_0og_check (ad->Y, ct[0][j], ct[1][j], proof3))
{
- weprintf ("wrong zkp3 for alpha, beta received");
+ GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING,
+ "libbrandt",
+ "wrong zkp3 for alpha, beta received\n");
goto quit;
}
gcry_mpi_ec_add (alpha_sum, alpha_sum, ct[0][j], ec_ctx);
@@ -825,7 +843,9 @@ smc_recv_encrypted_bid (struct BRANDT_Auction *ad,
ec_gen,
(struct proof_2dle *)cur))
{
- weprintf ("wrong zkp2 for alpha, beta received");
+ GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING,
+ "libbrandt",
+ "wrong zkp2 for alpha, beta received\n");
goto quit;
}
@@ -841,8 +861,11 @@ smc_recv_encrypted_bid (struct BRANDT_Auction *ad,
ec_gen,
(struct proof_2dle *)cur))
{
- weprintf ("wrong second zkp2 for alpha, beta received. "
- "bid not allowed for this user in M+1st price auctions.");
+ GNUNET_log_from (
+ GNUNET_ERROR_TYPE_WARNING,
+ "libbrandt",
+ "wrong second zkp2 for alpha, beta received. "
+ "bid not allowed for this user in M+1st price auctions.\n");
goto quit;
}
}
@@ -1381,7 +1404,5 @@ smc_zkp_0og_check (const gcry_mpi_point_t y,
gcry_mpi_point_release (right);
gcry_mpi_point_release (tmp);
- if (ret)
- weprintf ("ret: 0x%x", ret);
return ret;
}