aboutsummaryrefslogtreecommitdiff
path: root/src/scalarproduct/scalarproduct_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-04-18 21:11:08 +0200
committerChristian Grothoff <christian@grothoff.org>2021-04-18 21:11:08 +0200
commit75cfa6370bc902765c26b50bb858c9a5bc1e8e48 (patch)
treefdadaf6e2736ad79c9f79576bf9a056ea9d0a6f5 /src/scalarproduct/scalarproduct_api.c
parent5ec7af75ea9f8ed86cf28a8efed9a917345d1681 (diff)
downloadgnunet-75cfa6370bc902765c26b50bb858c9a5bc1e8e48.tar.gz
gnunet-75cfa6370bc902765c26b50bb858c9a5bc1e8e48.zip
SCALARPRODUCT: migrating logic from libgcrypt to libsodium (#6818).
Diffstat (limited to 'src/scalarproduct/scalarproduct_api.c')
-rw-r--r--src/scalarproduct/scalarproduct_api.c50
1 files changed, 20 insertions, 30 deletions
diff --git a/src/scalarproduct/scalarproduct_api.c b/src/scalarproduct/scalarproduct_api.c
index b2a90c222..4ac39614a 100644
--- a/src/scalarproduct/scalarproduct_api.c
+++ b/src/scalarproduct/scalarproduct_api.c
@@ -42,14 +42,10 @@
42 * @param status processing status code 42 * @param status processing status code
43 */ 43 */
44typedef void 44typedef void
45(*GNUNET_SCALARPRODUCT_ResponseMessageHandler) (struct 45(*GNUNET_SCALARPRODUCT_ResponseMessageHandler) (
46 GNUNET_SCALARPRODUCT_ComputationHandle 46 struct GNUNET_SCALARPRODUCT_ComputationHandle *h,
47 *h, 47 const struct ClientResponseMessage *msg,
48 const struct 48 enum GNUNET_SCALARPRODUCT_ResponseStatus status);
49 ClientResponseMessage *msg,
50 enum
51 GNUNET_SCALARPRODUCT_ResponseStatus
52 status);
53 49
54 50
55/** 51/**
@@ -172,13 +168,12 @@ check_unique (const struct GNUNET_SCALARPRODUCT_Element *elements,
172 uint32_t element_count) 168 uint32_t element_count)
173{ 169{
174 struct GNUNET_CONTAINER_MultiHashMap *map; 170 struct GNUNET_CONTAINER_MultiHashMap *map;
175 uint32_t i;
176 int ok; 171 int ok;
177 172
178 ok = GNUNET_OK; 173 ok = GNUNET_OK;
179 map = GNUNET_CONTAINER_multihashmap_create (2 * element_count, 174 map = GNUNET_CONTAINER_multihashmap_create (2 * element_count,
180 GNUNET_YES); 175 GNUNET_YES);
181 for (i = 0; i < element_count; i++) 176 for (uint32_t i = 0; i < element_count; i++)
182 if (GNUNET_OK != 177 if (GNUNET_OK !=
183 GNUNET_CONTAINER_multihashmap_put (map, 178 GNUNET_CONTAINER_multihashmap_put (map,
184 &elements[i].key, 179 &elements[i].key,
@@ -227,16 +222,13 @@ mq_error_handler (void *cls,
227 * @return a new handle for this computation 222 * @return a new handle for this computation
228 */ 223 */
229struct GNUNET_SCALARPRODUCT_ComputationHandle * 224struct GNUNET_SCALARPRODUCT_ComputationHandle *
230GNUNET_SCALARPRODUCT_accept_computation (const struct 225GNUNET_SCALARPRODUCT_accept_computation (
231 GNUNET_CONFIGURATION_Handle *cfg, 226 const struct GNUNET_CONFIGURATION_Handle *cfg,
232 const struct 227 const struct GNUNET_HashCode *session_key,
233 GNUNET_HashCode *session_key, 228 const struct GNUNET_SCALARPRODUCT_Element *elements,
234 const struct 229 uint32_t element_count,
235 GNUNET_SCALARPRODUCT_Element *elements, 230 GNUNET_SCALARPRODUCT_ContinuationWithStatus cont,
236 uint32_t element_count, 231 void *cont_cls)
237 GNUNET_SCALARPRODUCT_ContinuationWithStatus
238 cont,
239 void *cont_cls)
240{ 232{
241 struct GNUNET_SCALARPRODUCT_ComputationHandle *h 233 struct GNUNET_SCALARPRODUCT_ComputationHandle *h
242 = GNUNET_new (struct GNUNET_SCALARPRODUCT_ComputationHandle); 234 = GNUNET_new (struct GNUNET_SCALARPRODUCT_ComputationHandle);
@@ -389,16 +381,14 @@ process_result_message (struct GNUNET_SCALARPRODUCT_ComputationHandle *h,
389 * @return a new handle for this computation 381 * @return a new handle for this computation
390 */ 382 */
391struct GNUNET_SCALARPRODUCT_ComputationHandle * 383struct GNUNET_SCALARPRODUCT_ComputationHandle *
392GNUNET_SCALARPRODUCT_start_computation (const struct 384GNUNET_SCALARPRODUCT_start_computation (
393 GNUNET_CONFIGURATION_Handle *cfg, 385 const struct GNUNET_CONFIGURATION_Handle *cfg,
394 const struct 386 const struct GNUNET_HashCode *session_key,
395 GNUNET_HashCode *session_key, 387 const struct GNUNET_PeerIdentity *peer,
396 const struct GNUNET_PeerIdentity *peer, 388 const struct GNUNET_SCALARPRODUCT_Element *elements,
397 const struct 389 uint32_t element_count,
398 GNUNET_SCALARPRODUCT_Element *elements, 390 GNUNET_SCALARPRODUCT_DatumProcessor cont,
399 uint32_t element_count, 391 void *cont_cls)
400 GNUNET_SCALARPRODUCT_DatumProcessor cont,
401 void *cont_cls)
402{ 392{
403 struct GNUNET_SCALARPRODUCT_ComputationHandle *h 393 struct GNUNET_SCALARPRODUCT_ComputationHandle *h
404 = GNUNET_new (struct GNUNET_SCALARPRODUCT_ComputationHandle); 394 = GNUNET_new (struct GNUNET_SCALARPRODUCT_ComputationHandle);