[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r34336 - gnunet/src/secretsharing
From: |
gnunet |
Subject: |
[GNUnet-SVN] r34336 - gnunet/src/secretsharing |
Date: |
Sun, 5 Oct 2014 03:24:47 +0200 |
Author: grothoff
Date: 2014-10-05 03:24:47 +0200 (Sun, 05 Oct 2014)
New Revision: 34336
Modified:
gnunet/src/secretsharing/gnunet-service-secretsharing.c
Log:
-check return value
Modified: gnunet/src/secretsharing/gnunet-service-secretsharing.c
===================================================================
--- gnunet/src/secretsharing/gnunet-service-secretsharing.c 2014-10-05
01:24:33 UTC (rev 34335)
+++ gnunet/src/secretsharing/gnunet-service-secretsharing.c 2014-10-05
01:24:47 UTC (rev 34336)
@@ -723,7 +723,7 @@
GNUNET_assert (NULL != v);
// Randomize v such that 0 < v < elgamal_q.
// The '- 1' is necessary as bitlength(q) = bitlength(p) - 1.
- do
+ do
{
gcry_mpi_randomize (v, GNUNET_SECRETSHARING_ELGAMAL_BITS - 1,
GCRY_WEAK_RANDOM);
} while ((gcry_mpi_cmp_ui (v, 0) == 0) || (gcry_mpi_cmp (v, elgamal_q) >=
0));
@@ -1326,7 +1326,10 @@
d->purpose.size = htonl (element_size - offsetof (struct
GNUNET_SECRETSHARING_KeygenRevealData, purpose));
d->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_SECRETSHARING_DKG2);
- GNUNET_CRYPTO_eddsa_sign (my_peer_private_key, &d->purpose, &d->signature);
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_CRYPTO_eddsa_sign (my_peer_private_key,
+ &d->purpose,
+ &d->signature));
GNUNET_CONSENSUS_insert (ks->consensus, element, NULL, NULL);
GNUNET_free (element); /* FIXME: maybe stack-allocate instead? */
@@ -1477,7 +1480,7 @@
gcry_mpi_set_ui (ks->public_key, 1);
}
gcry_mpi_mulm (ks->public_key, ks->public_key, public_key_share, elgamal_p);
-
+
gcry_mpi_release (public_key_share);
public_key_share = NULL;
@@ -1551,7 +1554,7 @@
// Using pow(double,double) is a bit sketchy.
// We count players from 1, but shares from 0.
gcry_mpi_t tmp;
- gcry_mpi_set_ui (j_to_k, (unsigned int) pow(j+1, k));
+ gcry_mpi_set_ui (j_to_k, (unsigned int) pow(j+1, k));
tmp = keygen_reveal_get_exp_coeff (ks, d, k);
gcry_mpi_powm (tmp, tmp, j_to_k, elgamal_p);
gcry_mpi_mulm (prod, prod, tmp, elgamal_p);
@@ -1583,7 +1586,7 @@
}
}
-
+
info->round2_valid = GNUNET_YES;
gcry_mpi_release (preshare);
@@ -1876,7 +1879,7 @@
d = element->data;
info = get_decrypt_peer_info (session, &d->peer);
-
+
if (NULL == info)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "decrypt element from invalid peer
(%s)\n",
@@ -1901,7 +1904,7 @@
GNUNET_CRYPTO_hash (offsetof (struct GNUNET_SECRETSHARING_DecryptData,
ciphertext) + (char *) d,
- offsetof (struct GNUNET_SECRETSHARING_DecryptData,
nizk_response) -
+ offsetof (struct GNUNET_SECRETSHARING_DecryptData,
nizk_response) -
offsetof (struct GNUNET_SECRETSHARING_DecryptData,
ciphertext),
&challenge_hash);
@@ -2044,7 +2047,7 @@
// create the zero knowledge proof
// randomly choose beta such that 0 < beta < q
- do
+ do
{
gcry_mpi_randomize (beta, GNUNET_SECRETSHARING_ELGAMAL_BITS - 1,
GCRY_WEAK_RANDOM);
} while ((gcry_mpi_cmp_ui (beta, 0) == 0) || (gcry_mpi_cmp (beta, elgamal_q)
>= 0));
@@ -2057,7 +2060,7 @@
// the challenge is the hash of everything up to the response
GNUNET_CRYPTO_hash (offsetof (struct GNUNET_SECRETSHARING_DecryptData,
ciphertext) + (char *) &d,
- offsetof (struct GNUNET_SECRETSHARING_DecryptData,
nizk_response) -
+ offsetof (struct GNUNET_SECRETSHARING_DecryptData,
nizk_response) -
offsetof (struct GNUNET_SECRETSHARING_DecryptData,
ciphertext),
&challenge_hash);
@@ -2073,7 +2076,7 @@
d.purpose.size = htonl (element.size - offsetof (struct
GNUNET_SECRETSHARING_DecryptData, purpose));
d.purpose.purpose = htonl
(GNUNET_SIGNATURE_PURPOSE_SECRETSHARING_DECRYPTION);
-
+
GNUNET_CRYPTO_eddsa_sign (my_peer_private_key, &d.purpose, &d.signature);
GNUNET_CONSENSUS_insert (ds->consensus, &element, NULL, NULL);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r34336 - gnunet/src/secretsharing,
gnunet <=