/*
This file is part of GNUnet.
- (C) 2013, 2014 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2013, 2014 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
* Maximum number of elements we can put into a single cryptodata
* message
*/
-#define ELEMENT_CAPACITY ((GNUNET_SERVER_MAX_MESSAGE_SIZE - 1 - sizeof (struct AliceCryptodataMessage)) / sizeof (struct GNUNET_CRYPTO_PaillierCiphertext))
+#define ELEMENT_CAPACITY ((GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE - 1 - sizeof (struct AliceCryptodataMessage)) / sizeof (struct GNUNET_CRYPTO_PaillierCiphertext))
/**
if (todo_count > ELEMENT_CAPACITY)
todo_count = ELEMENT_CAPACITY;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Sending %u crypto values to Bob\n",
- (unsigned int) todo_count);
+ "Sending %u/%u crypto values to Bob\n",
+ (unsigned int) todo_count,
+ (unsigned int) s->used_element_count);
e = GNUNET_MQ_msg_extra (msg,
todo_count * sizeof (struct GNUNET_CRYPTO_PaillierCiphertext),
msg->contained_element_count = htonl (todo_count);
payload = (struct GNUNET_CRYPTO_PaillierCiphertext *) &msg[1];
a = gcry_mpi_new (0);
- for (i = off; i < todo_count; i++)
+ for (i = off; i < off + todo_count; i++)
{
gcry_mpi_add (a,
s->sorted_elements[i].value,
my_offset);
- GNUNET_CRYPTO_paillier_encrypt (&my_pubkey,
- a,
- 3,
- &payload[i - off]);
+ GNUNET_assert (3 ==
+ GNUNET_CRYPTO_paillier_encrypt (&my_pubkey,
+ a,
+ 3,
+ &payload[i - off]));
}
gcry_mpi_release (a);
off += todo_count;
elements = (const struct GNUNET_SCALARPRODUCT_Element *) &msg[1];
for (i = 0; i < contained_count; i++)
{
- if (0 == GNUNET_ntohll (elements[i].value))
- continue;
elem = GNUNET_new (struct GNUNET_SCALARPRODUCT_Element);
memcpy (elem,
&elements[i],
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Shutting down, initiating cleanup.\n");
+ // FIXME: we have to cut our connections to CADET first!
if (NULL != my_cadet)
{
GNUNET_CADET_disconnect (my_cadet);