* @return The share, or NULL on error.
*/
struct GNUNET_SECRETSHARING_Share *
-GNUNET_SECRETSHARING_share_read (const void *data, size_t len, size_t *readlen)
+GNUNET_SECRETSHARING_share_read (const void *data,
+ size_t len,
+ size_t *readlen)
{
struct GNUNET_SECRETSHARING_Share *share;
const struct GNUNET_SECRETSHARING_ShareHeaderNBO *sh = data;
size_t n;
uint16_t payload_size;
- payload_size = ntohs (sh->num_peers) *
- (sizeof (uint16_t) + sizeof (struct GNUNET_SECRETSHARING_FieldElement) +
+ payload_size = ntohs (sh->num_peers) *
+ (sizeof (uint16_t) + sizeof (struct GNUNET_SECRETSHARING_FieldElement) +
sizeof (struct GNUNET_PeerIdentity));
if (NULL != readlen)
p += n;
n = share->num_peers * sizeof (struct GNUNET_SECRETSHARING_FieldElement);
- share->hom_share_commitments = GNUNET_malloc (n);
- memcpy (share->hom_share_commitments, p, n);
+ share->sigmas = GNUNET_malloc (n);
+ memcpy (share->sigmas, p, n);
p += n;
n = share->num_peers * sizeof (uint16_t);
char *p;
int n;
- payload_size = ntohs (sh->num_peers) *
- (sizeof (uint16_t) + sizeof (struct GNUNET_SECRETSHARING_FieldElement) +
+ payload_size = share->num_peers *
+ (sizeof (uint16_t) + sizeof (struct GNUNET_SECRETSHARING_FieldElement) +
sizeof (struct GNUNET_PeerIdentity));
if (NULL != writelen)
p += n;
n = share->num_peers * sizeof (struct GNUNET_SECRETSHARING_FieldElement);
- memcpy (p, share->hom_share_commitments, n);
+ memcpy (p, share->sigmas, n);
p += n;
n = share->num_peers * sizeof (uint16_t);
return GNUNET_OK;
}
+
+void
+GNUNET_SECRETSHARING_share_destroy (struct GNUNET_SECRETSHARING_Share *share)
+{
+ GNUNET_free (share->original_indices);
+ share->original_indices = NULL;
+ GNUNET_free (share->sigmas);
+ share->sigmas = NULL;
+ GNUNET_free (share->peers);
+ share->peers = NULL;
+ GNUNET_free (share);
+}
+
+