use 'svalue' that is actually a signed integer, as otherwise cmp with 0 is always...
[oweals/gnunet.git] / src / scalarproduct / gnunet-service-scalarproduct.c
index 748157cae0e85ce67ec123fd60fbaff779f557b5..38a22b1f6810ddb9576b4b60220b07b361a5f98b 100644 (file)
@@ -1287,16 +1287,19 @@ compute_service_response (struct ServiceSession * request,
 
   // generate r, p and q
   rand = initialize_mpi_vector (count);
-  for (i = 0; i < count; i++) {
-    value = (int32_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX);
+  for (i = 0; i < count; i++)
+  {
+    int32_t svalue;
+
+    svalue = (int32_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX);
 
     // long to gcry_mpi_t
-    if (value < 0)
+    if (svalue < 0)
       gcry_mpi_sub_ui (rand[i],
                        rand[i],
-                       -value);
+                       -svalue);
     else
-      rand[i] = gcry_mpi_set_ui (rand[i], value);
+      rand[i] = gcry_mpi_set_ui (rand[i], svalue);
   }
   p = GNUNET_CRYPTO_random_permute (GNUNET_CRYPTO_QUALITY_WEAK, count);
   q = GNUNET_CRYPTO_random_permute (GNUNET_CRYPTO_QUALITY_WEAK, count);