Merge branch 'master' of ssh://gnunet.org/gnunet
[oweals/gnunet.git] / src / secretsharing / gnunet-service-secretsharing.c
index a264bfdd5cad2a2c455f3b6c19a4ac3601d3709e..ddbe815766f312da393fd109f69e7f35df0d472c 100644 (file)
@@ -473,7 +473,7 @@ normalize_peers (struct GNUNET_PeerIdentity *listed,
   if (GNUNET_NO == local_peer_in_list)
     normalized[n - 1] = my_peer;
 
-  memcpy (normalized,
+  GNUNET_memcpy (normalized,
           listed,
           num_listed * sizeof (struct GNUNET_PeerIdentity));
   qsort (normalized,
@@ -605,6 +605,7 @@ decrypt_session_destroy (struct DecryptSession *ds)
   GNUNET_free (ds);
 }
 
+
 static void
 keygen_info_destroy (struct KeygenPeerInfo *info)
 {
@@ -621,7 +622,7 @@ keygen_info_destroy (struct KeygenPeerInfo *info)
   if (NULL != info->preshare_commitment)
   {
     gcry_mpi_release (info->preshare_commitment);
-    info->presecret_commitment = NULL;
+    info->preshare_commitment = NULL;
   }
 }
 
@@ -768,7 +769,7 @@ keygen_round1_new_element (void *cls,
   {
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                 "keygen commit data with wrong size (%u) in consensus, "
-                " %u expected\n",
+                " %lu expected\n",
                 element->size, sizeof (struct GNUNET_SECRETSHARING_KeygenCommitData));
     return;
   }
@@ -1038,10 +1039,10 @@ get_fair_encryption_challenge (const struct GNUNET_SECRETSHARING_FairEncryption
   } hash_data;
   struct GNUNET_HashCode e_hash;
 
-  memcpy (&hash_data.c, &fe->c, sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
-  memcpy (&hash_data.h, &fe->h, GNUNET_SECRETSHARING_ELGAMAL_BITS / 8);
-  memcpy (&hash_data.t1, &fe->t1, GNUNET_SECRETSHARING_ELGAMAL_BITS / 8);
-  memcpy (&hash_data.t2, &fe->t2, GNUNET_CRYPTO_PAILLIER_BITS * 2 / 8);
+  GNUNET_memcpy (&hash_data.c, &fe->c, sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
+  GNUNET_memcpy (&hash_data.h, &fe->h, GNUNET_SECRETSHARING_ELGAMAL_BITS / 8);
+  GNUNET_memcpy (&hash_data.t1, &fe->t1, GNUNET_SECRETSHARING_ELGAMAL_BITS / 8);
+  GNUNET_memcpy (&hash_data.t2, &fe->t2, GNUNET_CRYPTO_PAILLIER_BITS * 2 / 8);
 
   GNUNET_CRYPTO_mpi_scan_unsigned (&e, &e_hash, sizeof (struct GNUNET_HashCode));
   gcry_mpi_mod (e, e, elgamal_q);
@@ -1429,7 +1430,7 @@ keygen_round2_new_element (void *cls,
   {
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                 "keygen round2 data with wrong size (%u) in consensus, "
-                " %u expected\n",
+                " %lu expected\n",
                 element->size, expected_element_size);
     return;
   }
@@ -1891,8 +1892,7 @@ decrypt_new_element (void *cls,
 
   if (NULL != info->partial_decryption)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "decrypt element duplicate\n",
-                GNUNET_i2s (&d->peer));
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "decrypt element duplicate\n");
     return;
   }
 
@@ -1947,7 +1947,7 @@ decrypt_new_element (void *cls,
     char *tmp2_str;
     tmp1_str = mpi_to_str (tmp1);
     tmp2_str = mpi_to_str (tmp2);
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "P%u: Received invalid partial decryption from P%u (eqn 1), expected %s got %s\n",
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "P%u: Received invalid partial decryption from P%ld (eqn 1), expected %s got %s\n",
                 session->share->my_peer, info - session->info, tmp1_str, tmp2_str);
     GNUNET_free (tmp1_str);
     GNUNET_free (tmp2_str);
@@ -1963,7 +1963,7 @@ decrypt_new_element (void *cls,
 
   if (0 != gcry_mpi_cmp (tmp1, tmp2))
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "P%u: Received invalid partial decryption from P%u (eqn 2)\n",
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "P%u: Received invalid partial decryption from P%ld (eqn 2)\n",
                 session->share->my_peer, info - session->info);
     goto cleanup;
   }