summaryrefslogtreecommitdiff
path: root/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c')
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c51
1 files changed, 17 insertions, 34 deletions
diff --git a/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c b/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
index 4c835d52a..9f6711275 100644
--- a/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
+++ b/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2013-2017 GNUnet e.V.
+ Copyright (C) 2013-2017, 2021 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -54,7 +54,7 @@ struct MpiElement
/**
* Value represented (a).
*/
- gcry_mpi_t value;
+ struct GNUNET_CRYPTO_EccScalar value;
};
@@ -104,12 +104,12 @@ struct BobServiceSession
/**
* Product of the g_i^{b_i}
*/
- gcry_mpi_point_t prod_g_i_b_i;
+ struct GNUNET_CRYPTO_EccPoint prod_g_i_b_i;
/**
* Product of the h_i^{b_i}
*/
- gcry_mpi_point_t prod_h_i_b_i;
+ struct GNUNET_CRYPTO_EccPoint prod_h_i_b_i;
/**
* How many elements will be supplied in total from the client.
@@ -213,8 +213,6 @@ free_element_cb (void *cls,
static void
destroy_service_session (struct BobServiceSession *s)
{
- unsigned int i;
-
if (GNUNET_YES == s->in_destroy)
return;
s->in_destroy = GNUNET_YES;
@@ -245,21 +243,9 @@ destroy_service_session (struct BobServiceSession *s)
}
if (NULL != s->sorted_elements)
{
- for (i = 0; i < s->used_element_count; i++)
- gcry_mpi_release (s->sorted_elements[i].value);
GNUNET_free (s->sorted_elements);
s->sorted_elements = NULL;
}
- if (NULL != s->prod_g_i_b_i)
- {
- gcry_mpi_point_release (s->prod_g_i_b_i);
- s->prod_g_i_b_i = NULL;
- }
- if (NULL != s->prod_h_i_b_i)
- {
- gcry_mpi_point_release (s->prod_h_i_b_i);
- s->prod_h_i_b_i = NULL;
- }
if (NULL != s->port)
{
GNUNET_CADET_close_port (s->port);
@@ -396,7 +382,7 @@ copy_element_cb (void *cls,
{
struct BobServiceSession *s = cls;
struct GNUNET_SCALARPRODUCT_Element *e = value;
- gcry_mpi_t mval;
+ struct GNUNET_CRYPTO_EccScalar mval;
int64_t val;
mval = gcry_mpi_new (0);
@@ -490,13 +476,12 @@ handle_alices_cryptodata_message (void *cls,
const struct GNUNET_CRYPTO_EccPoint *payload;
uint32_t contained_elements;
unsigned int max;
- unsigned int i;
const struct MpiElement *b_i;
- gcry_mpi_point_t tmp;
- gcry_mpi_point_t g_i;
- gcry_mpi_point_t h_i;
- gcry_mpi_point_t g_i_b_i;
- gcry_mpi_point_t h_i_b_i;
+ struct GNUNET_CRYPTO_EccPoint tmp;
+ struct GNUNET_CRYPTO_EccPoint g_i;
+ struct GNUNET_CRYPTO_EccPoint h_i;
+ struct GNUNET_CRYPTO_EccPoint g_i_b_i;
+ struct GNUNET_CRYPTO_EccPoint h_i_b_i;
contained_elements = ntohl (msg->contained_element_count);
max = GNUNET_CONTAINER_multihashmap_size (s->intersected_elements);
@@ -522,7 +507,7 @@ handle_alices_cryptodata_message (void *cls,
(unsigned int) contained_elements);
payload = (const struct GNUNET_CRYPTO_EccPoint *) &msg[1];
- for (i = 0; i < contained_elements; i++)
+ for (unsigned int i = 0; i < contained_elements; i++)
{
b_i = &s->sorted_elements[i + s->cadet_received_element_count];
g_i = GNUNET_CRYPTO_ecc_bin_to_point (edc,
@@ -747,10 +732,9 @@ cb_channel_incoming (void *cls,
* @return #GNUNET_OK if @a msg is well-formed
*/
static int
-check_bob_client_message_multipart (void *cls,
- const struct
- ComputationBobCryptodataMultipartMessage *
- msg)
+check_bob_client_message_multipart (
+ void *cls,
+ const struct ComputationBobCryptodataMultipartMessage *msg)
{
struct BobServiceSession *s = cls;
uint32_t contained_count;
@@ -781,10 +765,9 @@ check_bob_client_message_multipart (void *cls,
* @param msg the actual message
*/
static void
-handle_bob_client_message_multipart (void *cls,
- const struct
- ComputationBobCryptodataMultipartMessage *
- msg)
+handle_bob_client_message_multipart (
+ void *cls,
+ const struct ComputationBobCryptodataMultipartMessage *msg)
{
struct BobServiceSession *s = cls;
uint32_t contained_count;