aboutsummaryrefslogtreecommitdiff
path: root/src/scalarproduct
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-12-05 22:39:04 +0000
committerChristian Grothoff <christian@grothoff.org>2013-12-05 22:39:04 +0000
commitca8bdfec727b75ccf41a6caa9fa811c4a4d94b90 (patch)
tree2b59e6246e4bce643ac1670ebf50b2cb728b07d8 /src/scalarproduct
parent3f7fec57bf6c2f58bdf1add19ba3315c78b21ef9 (diff)
downloadgnunet-ca8bdfec727b75ccf41a6caa9fa811c4a4d94b90.tar.gz
gnunet-ca8bdfec727b75ccf41a6caa9fa811c4a4d94b90.zip
-r was captured in request, do not free here
Diffstat (limited to 'src/scalarproduct')
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/scalarproduct/gnunet-service-scalarproduct.c b/src/scalarproduct/gnunet-service-scalarproduct.c
index 11b564b9b..d11a86b26 100644
--- a/src/scalarproduct/gnunet-service-scalarproduct.c
+++ b/src/scalarproduct/gnunet-service-scalarproduct.c
@@ -1235,11 +1235,14 @@ compute_service_response (struct ServiceSession * request,
1235 rand_pi_prime = GNUNET_malloc (sizeof (gcry_mpi_t) * count); 1235 rand_pi_prime = GNUNET_malloc (sizeof (gcry_mpi_t) * count);
1236 1236
1237 // convert responder session to from long to mpi 1237 // convert responder session to from long to mpi
1238 for (i = 0, j = 0; i < response->total && j < count; i++) { 1238 for (i = 0, j = 0; i < response->total && j < count; i++)
1239 if (request->mask[i / 8] & (1 << (i % 8))) { 1239 {
1240 if (request->mask[i / 8] & (1 << (i % 8)))
1241 {
1240 value = response->vector[i] >= 0 ? response->vector[i] : -response->vector[i]; 1242 value = response->vector[i] >= 0 ? response->vector[i] : -response->vector[i];
1241 // long to gcry_mpi_t 1243 // long to gcry_mpi_t
1242 if (0 > response->vector[i]) { 1244 if (0 > response->vector[i])
1245 {
1243 b[j] = gcry_mpi_new (0); 1246 b[j] = gcry_mpi_new (0);
1244 gcry_mpi_sub_ui (b[j], b[j], value); 1247 gcry_mpi_sub_ui (b[j], b[j], value);
1245 } 1248 }
@@ -1327,7 +1330,8 @@ compute_service_response (struct ServiceSession * request,
1327 // vectors, which get rid of all the lookups in p/q. 1330 // vectors, which get rid of all the lookups in p/q.
1328 // however, ap/aq are not absolutely necessary but are just abstraction 1331 // however, ap/aq are not absolutely necessary but are just abstraction
1329 // Calculate Kp = E(S + a_pi) (+) E(S - r_pi - b_pi) 1332 // Calculate Kp = E(S + a_pi) (+) E(S - r_pi - b_pi)
1330 for (i = 0; i < count; i++) { 1333 for (i = 0; i < count; i++)
1334 {
1331 // E(S - r_pi - b_pi) 1335 // E(S - r_pi - b_pi)
1332 gcry_mpi_sub (r[i], my_offset, rand_pi[i]); 1336 gcry_mpi_sub (r[i], my_offset, rand_pi[i]);
1333 gcry_mpi_sub (r[i], r[i], b_pi[i]); 1337 gcry_mpi_sub (r[i], r[i], b_pi[i]);
@@ -1388,7 +1392,6 @@ except:
1388 { 1392 {
1389 gcry_mpi_release (b[i]); 1393 gcry_mpi_release (b[i]);
1390 gcry_mpi_release (request->a[i]); 1394 gcry_mpi_release (request->a[i]);
1391 gcry_mpi_release (r[i]);
1392 gcry_mpi_release (r_prime[i]); 1395 gcry_mpi_release (r_prime[i]);
1393 } 1396 }
1394 1397