diff options
author | Christian Fuchs <christian.fuchs@cfuchs.net> | 2013-09-09 16:15:32 +0000 |
---|---|---|
committer | Christian Fuchs <christian.fuchs@cfuchs.net> | 2013-09-09 16:15:32 +0000 |
commit | aba599ddd94139578193c9bcdc774ac558a0f15f (patch) | |
tree | fcd27722abc5968b8b5ad21f38a3139093468ad8 /src/scalarproduct | |
parent | 19933122ffe6ff84cb0dcccb2782704f89df54bb (diff) | |
download | gnunet-aba599ddd94139578193c9bcdc774ac558a0f15f.tar.gz gnunet-aba599ddd94139578193c9bcdc774ac558a0f15f.zip |
sanitized the scalarproduct client
fixed a typo in the SP API
changed SP-service to always use GCRYMPI_FMT_STD when sending the result back to client. Even though gcry currently can not print negative numbers, we can just remove the if-else block above it once that's supported
Diffstat (limited to 'src/scalarproduct')
-rw-r--r-- | src/scalarproduct/gnunet-scalarproduct.c | 177 | ||||
-rw-r--r-- | src/scalarproduct/gnunet-service-scalarproduct.c | 28 | ||||
-rw-r--r-- | src/scalarproduct/scalarproduct_api.c | 6 |
3 files changed, 106 insertions, 105 deletions
diff --git a/src/scalarproduct/gnunet-scalarproduct.c b/src/scalarproduct/gnunet-scalarproduct.c index 5939d755e..f56fd7625 100644 --- a/src/scalarproduct/gnunet-scalarproduct.c +++ b/src/scalarproduct/gnunet-scalarproduct.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include "scalarproduct.h" | 34 | #include "scalarproduct.h" |
35 | 35 | ||
36 | #define LOG(kind,...) GNUNET_log_from (kind, "gnunet-scalarproduct",__VA_ARGS__) | 36 | #define LOG(kind,...) GNUNET_log_from (kind, "gnunet-scalarproduct",__VA_ARGS__) |
37 | #define INPUTSTRINGLENGTH 1024 | ||
37 | 38 | ||
38 | struct ScalarProductCallbackClosure | 39 | struct ScalarProductCallbackClosure |
39 | { | 40 | { |
@@ -71,7 +72,7 @@ static char *input_mask = NULL; | |||
71 | /** | 72 | /** |
72 | * Global return value | 73 | * Global return value |
73 | */ | 74 | */ |
74 | static int ret; | 75 | static int ret = -1; |
75 | 76 | ||
76 | 77 | ||
77 | /** | 78 | /** |
@@ -85,7 +86,6 @@ responder_callback (void *cls, | |||
85 | enum GNUNET_SCALARPRODUCT_ResponseStatus status) | 86 | enum GNUNET_SCALARPRODUCT_ResponseStatus status) |
86 | { | 87 | { |
87 | struct ScalarProductCallbackClosure * closure = cls; | 88 | struct ScalarProductCallbackClosure * closure = cls; |
88 | ret = -1; | ||
89 | 89 | ||
90 | switch (status) | 90 | switch (status) |
91 | { | 91 | { |
@@ -104,9 +104,6 @@ responder_callback (void *cls, | |||
104 | default: | 104 | default: |
105 | LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s failed: return code %d\n", GNUNET_h2s (&closure->key), status); | 105 | LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s failed: return code %d\n", GNUNET_h2s (&closure->key), status); |
106 | } | 106 | } |
107 | |||
108 | GNUNET_SCALARPRODUCT_disconnect (); | ||
109 | GNUNET_SCHEDULER_shutdown (); | ||
110 | } | 107 | } |
111 | 108 | ||
112 | 109 | ||
@@ -129,16 +126,17 @@ requester_callback (void *cls, | |||
129 | struct ScalarProductCallbackClosure * closure = cls; | 126 | struct ScalarProductCallbackClosure * closure = cls; |
130 | unsigned char * buf; | 127 | unsigned char * buf; |
131 | gcry_error_t rc; | 128 | gcry_error_t rc; |
132 | ret = -1; | ||
133 | 129 | ||
134 | switch (status) | 130 | switch (status) |
135 | { | 131 | { |
136 | case GNUNET_SCALARPRODUCT_Status_Success: | 132 | case GNUNET_SCALARPRODUCT_Status_Success: |
137 | |||
138 | if (0 == (rc = gcry_mpi_aprint (GCRYMPI_FMT_HEX, &buf, NULL, result))) | 133 | if (0 == (rc = gcry_mpi_aprint (GCRYMPI_FMT_HEX, &buf, NULL, result))) |
139 | printf("%s", buf); | 134 | { |
135 | ret = 0; | ||
136 | printf ("%s", buf); | ||
137 | } | ||
140 | else | 138 | else |
141 | LOG_GCRY(GNUNET_ERROR_TYPE_ERROR, "gcry_mpi_aprint", rc); | 139 | LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_mpi_aprint", rc); |
142 | break; | 140 | break; |
143 | case GNUNET_SCALARPRODUCT_Status_InvalidResponse: | 141 | case GNUNET_SCALARPRODUCT_Status_InvalidResponse: |
144 | LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s with peer %s failed: invalid response received\n", GNUNET_h2s (&closure->key), GNUNET_i2s (&closure->peer)); | 142 | LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s with peer %s failed: invalid response received\n", GNUNET_h2s (&closure->key), GNUNET_i2s (&closure->peer)); |
@@ -151,8 +149,6 @@ requester_callback (void *cls, | |||
151 | default: | 149 | default: |
152 | LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s with peer %s failed: return code %d\n", GNUNET_h2s (&closure->key), GNUNET_i2s (&closure->peer), status); | 150 | LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s with peer %s failed: return code %d\n", GNUNET_h2s (&closure->key), GNUNET_i2s (&closure->peer), status); |
153 | } | 151 | } |
154 | GNUNET_SCALARPRODUCT_disconnect (); | ||
155 | GNUNET_SCHEDULER_shutdown (); | ||
156 | } | 152 | } |
157 | 153 | ||
158 | 154 | ||
@@ -174,156 +170,161 @@ run (void *cls, | |||
174 | char * end; | 170 | char * end; |
175 | int32_t element; | 171 | int32_t element; |
176 | int i; | 172 | int i; |
177 | ret = -1; | ||
178 | int32_t * elements; | 173 | int32_t * elements; |
179 | unsigned char * mask; | 174 | unsigned char * mask; |
180 | unsigned short mask_bytes; | 175 | unsigned short mask_bytes; |
181 | unsigned short element_count; | 176 | unsigned short element_count = 0; |
182 | struct ScalarProductCallbackClosure * closure; | 177 | struct ScalarProductCallbackClosure * closure; |
183 | 178 | ||
184 | if (NULL == input_elements) | 179 | if (NULL == input_elements) |
185 | { | 180 | { |
186 | FPRINTF (stderr, "%s", _ ("You must specify at least one message ID to check!\n")); | 181 | LOG (GNUNET_ERROR_TYPE_ERROR, _ ("You must specify at least one message ID to check!\n")); |
187 | return; | 182 | return; |
188 | } | 183 | } |
189 | 184 | ||
190 | if (NULL == input_key) | 185 | if (NULL == input_key) |
191 | { | 186 | { |
192 | FPRINTF (stderr, "%s", _ ("This program needs a session identifier for comparing vectors.\n")); | 187 | LOG (GNUNET_ERROR_TYPE_ERROR, _ ("This program needs a session identifier for comparing vectors.\n")); |
193 | return; | 188 | return; |
194 | } | 189 | } |
195 | 190 | ||
196 | if (1 > strnlen (input_key, sizeof (struct GNUNET_HashCode))) | 191 | if (1 > strnlen (input_key, sizeof (struct GNUNET_HashCode))) |
197 | { | 192 | { |
198 | FPRINTF (stderr, _ ("Please give a session key for --input_key!\n")); | 193 | LOG (GNUNET_ERROR_TYPE_ERROR, _ ("Please give a session key for --input_key!\n")); |
199 | return; | 194 | return; |
200 | } | 195 | } |
201 | closure = GNUNET_new(struct ScalarProductCallbackClosure); | 196 | closure = GNUNET_new (struct ScalarProductCallbackClosure); |
202 | GNUNET_CRYPTO_hash (input_key, strlen (input_key), &closure->key); | 197 | GNUNET_CRYPTO_hash (input_key, strlen (input_key), &closure->key); |
203 | 198 | ||
204 | if (input_peer_id && GNUNET_OK != GNUNET_CRYPTO_hash_from_string (input_peer_id, | 199 | if (input_peer_id && GNUNET_OK != GNUNET_CRYPTO_hash_from_string (input_peer_id, |
205 | (struct GNUNET_HashCode *) &closure->peer)) | 200 | (struct GNUNET_HashCode *) &closure->peer)) |
206 | { | 201 | { |
207 | FPRINTF (stderr, _ ("Tried to set initiator mode, as peer ID was given. " | 202 | LOG (GNUNET_ERROR_TYPE_ERROR, _ ("Tried to set initiator mode, as peer ID was given. " |
208 | "However, `%s' is not a valid peer identifier.\n"), | 203 | "However, `%s' is not a valid peer identifier.\n"), |
209 | input_peer_id); | 204 | input_peer_id); |
210 | return; | 205 | return; |
211 | } | 206 | } |
212 | 207 | ||
213 | int exit_loop = 0; | 208 | /* Count input_elements_peer1, and put in elements_peer1 array */ |
214 | /* Read input_elements_peer1, and put in elements_peer1 array */ | ||
215 | do | 209 | do |
216 | { | 210 | { |
217 | unsigned int mcount = element_count; | ||
218 | //ignore empty rows of ,,,,,, | ||
219 | while (*begin == ',') | ||
220 | begin++; | ||
221 | // get the length of the current element and replace , with null | 211 | // get the length of the current element and replace , with null |
222 | for (end = begin; *end && *end != ','; end++); | 212 | for (end = begin; *end && *end != ','; end++); |
223 | 213 | ||
224 | if (*end == '\0') | 214 | if (1 == sscanf (begin, "%" SCNd32",", &element)) |
225 | exit_loop = 1; | 215 | { |
226 | 216 | //element in the middle | |
227 | if (*end == ',') | 217 | element_count++; |
228 | *end = '\0'; | 218 | begin = end + 1; |
229 | 219 | } | |
230 | if (1 != sscanf (begin, "%" SCNd32, &element)) | 220 | else if (*begin == 0) |
221 | { | ||
222 | break; | ||
223 | } | ||
224 | else | ||
231 | { | 225 | { |
232 | FPRINTF (stderr, _ ("Could not convert `%s' to int32_t.\n"), begin); | 226 | LOG (GNUNET_ERROR_TYPE_ERROR, _ ("Could not convert `%s' to int32_t.\n"), begin); |
233 | return; | 227 | return; |
234 | } | 228 | } |
229 | } | ||
230 | while (1); | ||
231 | if (0 == element_count) | ||
232 | { | ||
235 | 233 | ||
236 | GNUNET_array_append (elements, mcount, element); | 234 | return; |
237 | element_count++; | 235 | } |
238 | 236 | ||
239 | begin = ++end; | 237 | begin = input_elements; |
238 | elements = GNUNET_malloc (sizeof (int32_t) * element_count); | ||
239 | /* Read input_elements_peer1, and put in elements_peer1 array */ | ||
240 | do | ||
241 | { | ||
242 | // get the length of the current element and replace , with null | ||
243 | for (end = begin; *end && *end != ','; end++); | ||
244 | |||
245 | if (1 == sscanf (begin, "%" SCNd32",", &element)) | ||
246 | { | ||
247 | //element in the middle | ||
248 | element_count++; | ||
249 | begin = end + 1; | ||
250 | } | ||
251 | else if (*begin == 0) | ||
252 | { | ||
253 | break; | ||
254 | } | ||
240 | } | 255 | } |
241 | while (!exit_loop); | 256 | while (1); |
242 | 257 | ||
243 | GNUNET_assert (elements != NULL); | ||
244 | GNUNET_assert (element_count > 1); | ||
245 | mask_bytes = element_count / 8 + (element_count % 8 ? 1 : 0); | 258 | mask_bytes = element_count / 8 + (element_count % 8 ? 1 : 0); |
246 | mask = GNUNET_malloc ((element_count / 8) + 2); | 259 | mask = GNUNET_malloc ((element_count / 8) + 2); |
247 | 260 | ||
248 | /* Read input_mask_peer1 and read in mask_peer1 array */ | 261 | /* Read input_mask_peer1 and read in mask_peer1 array */ |
249 | if (NULL != input_mask) | 262 | if ((NULL != input_peer_id) && (NULL != input_mask)) |
250 | { | 263 | { |
251 | begin = input_mask; | 264 | begin = input_mask; |
252 | unsigned short mask_count = 0; | 265 | unsigned short mask_count = 0; |
253 | int exit_loop = 0; | ||
254 | 266 | ||
255 | do | 267 | do |
256 | { | 268 | { |
257 | //ignore empty rows of ,,,,,, | ||
258 | while (* begin == ',') | ||
259 | begin++; | ||
260 | // get the length of the current element and replace , with null | 269 | // get the length of the current element and replace , with null |
261 | // gnunet_ascii-armor uses base32, thus we can use , as separator! | ||
262 | for (end = begin; *end && *end != ','; end++); | 270 | for (end = begin; *end && *end != ','; end++); |
263 | 271 | ||
264 | if (*end == '\0') | 272 | if (1 == sscanf (begin, "%" SCNd32 ",", &element)) |
265 | exit_loop = 1; | 273 | { |
266 | 274 | //element in the middle | |
267 | if (*end == ',') | 275 | begin = end + 1; |
268 | *end = '\0'; | 276 | } |
269 | 277 | else if (*begin == 0) | |
270 | if (1 != sscanf (begin, "%" SCNd32, &element)) | ||
271 | { | 278 | { |
272 | FPRINTF (stderr, _ ("Could not convert `%s' to int32_t.\n"), begin); | 279 | break; |
280 | } | ||
281 | else | ||
282 | { | ||
283 | LOG (GNUNET_ERROR_TYPE_ERROR, _ ("Could not convert `%s' to int32_t.\n"), begin); | ||
273 | return; | 284 | return; |
274 | } | 285 | } |
275 | 286 | ||
276 | GNUNET_assert (mask_count <= element_count); | ||
277 | |||
278 | if (element) | 287 | if (element) |
279 | mask[mask_count / 8] = mask[mask_count / 8] | 1 << (mask_count % 8); | 288 | mask[mask_count / 8] = mask[mask_count / 8] | 1 << (mask_count % 8); |
280 | |||
281 | mask_count++; | 289 | mask_count++; |
282 | begin = ++end; | ||
283 | } | 290 | } |
284 | while (!exit_loop); | 291 | while (mask_count < element_count); |
285 | // +1 to see if we would have more data, which would indicate malformed/superficial input | ||
286 | GNUNET_assert (mask_count == element_count); | ||
287 | } | 292 | } |
288 | else if (input_peer_id) | 293 | else if (NULL != input_peer_id) |
289 | { | ||
290 | for (i = 0; i <= mask_bytes; i++) | 294 | for (i = 0; i <= mask_bytes; i++) |
291 | mask[i] = UCHAR_MAX; // all 1's | 295 | mask[i] = UCHAR_MAX; // all 1's |
292 | } | ||
293 | |||
294 | 296 | ||
295 | if (input_peer_id && !GNUNET_SCALARPRODUCT_request (cfg, | 297 | if (input_peer_id && (NULL == GNUNET_SCALARPRODUCT_request (cfg, |
296 | &closure->key, | 298 | &closure->key, |
297 | &closure->peer, | 299 | &closure->peer, |
298 | elements, element_count, | 300 | elements, element_count, |
299 | mask, mask_bytes, | 301 | mask, mask_bytes, |
300 | &requester_callback, | 302 | &requester_callback, |
301 | (void *) &closure)) | 303 | (void *) &closure))) |
302 | return; | 304 | return; |
303 | 305 | ||
304 | 306 | if ((NULL == input_peer_id) && (NULL == GNUNET_SCALARPRODUCT_response (cfg, | |
305 | if (!input_peer_id && !GNUNET_SCALARPRODUCT_response (cfg, | 307 | &closure->key, |
306 | &closure->key, | 308 | elements, element_count, |
307 | elements, element_count, | 309 | &responder_callback, |
308 | &responder_callback, | 310 | (void *) &closure))) |
309 | (void *) &closure)) | ||
310 | return; | 311 | return; |
311 | 312 | ||
312 | ret = 0; | 313 | ret = 0; |
313 | } | 314 | } |
314 | 315 | ||
315 | 316 | ||
316 | /** | 317 | /** |
317 | * The main function to the scalarproduct client. | 318 | * The main function to the scalarproduct client. |
318 | * | 319 | * |
319 | * @param argc number of arguments from the command line | 320 | * @param argc number of arguments from the command line |
320 | * @param argv command line arguments | 321 | * @param argv command line arguments |
321 | * @return 0 ok, 1 on error | 322 | * @return 0 ok, 1 on error |
322 | */ | 323 | */ |
323 | int | 324 | int |
324 | main (int argc, char *const *argv) | 325 | main (int argc, char *const *argv) |
325 | { | 326 | { |
326 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | 327 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { |
327 | {'e', "elements", "\"val1,val2,...,valn\"", | 328 | {'e', "elements", "\"val1,val2,...,valn\"", |
328 | gettext_noop ("A comma separated list of elements to compare as vector with our remote peer."), | 329 | gettext_noop ("A comma separated list of elements to compare as vector with our remote peer."), |
329 | 1, &GNUNET_GETOPT_set_string, &input_elements}, | 330 | 1, &GNUNET_GETOPT_set_string, &input_elements}, |
@@ -336,14 +337,14 @@ main (int argc, char *const *argv) | |||
336 | {'k', "key", "TRANSACTION_ID", | 337 | {'k', "key", "TRANSACTION_ID", |
337 | gettext_noop ("Transaction ID shared with peer."), | 338 | gettext_noop ("Transaction ID shared with peer."), |
338 | 1, &GNUNET_GETOPT_set_string, &input_key}, | 339 | 1, &GNUNET_GETOPT_set_string, &input_key}, |
339 | GNUNET_GETOPT_OPTION_END | 340 | GNUNET_GETOPT_OPTION_END |
340 | }; | 341 | }; |
341 | 342 | ||
342 | return (GNUNET_OK == | 343 | return (GNUNET_OK == |
343 | GNUNET_PROGRAM_run (argc, | 344 | GNUNET_PROGRAM_run (argc, |
344 | argv, | 345 | argv, |
345 | "gnunet-scalarproduct", | 346 | "gnunet-scalarproduct", |
346 | gettext_noop ("Calculate the Vectorproduct with a GNUnet peer."), | 347 | gettext_noop ("Calculate the Vectorproduct with a GNUnet peer."), |
347 | options, &run, NULL)) ? ret : 1; | 348 | options, &run, NULL)) ? ret : 1; |
348 | } | 349 | } |
349 | 350 | ||
diff --git a/src/scalarproduct/gnunet-service-scalarproduct.c b/src/scalarproduct/gnunet-service-scalarproduct.c index 8656de3b3..ac2ee5a12 100644 --- a/src/scalarproduct/gnunet-service-scalarproduct.c +++ b/src/scalarproduct/gnunet-service-scalarproduct.c | |||
@@ -504,12 +504,14 @@ do_send_message (void *cls, size_t size, void *buf) | |||
504 | written = size; | 504 | written = size; |
505 | } | 505 | } |
506 | 506 | ||
507 | if (GNUNET_MESSAGE_TYPE_SCALARPRODUCT_SERVICE_TO_CLIENT == ntohs(session->msg->type)){ | 507 | switch (ntohs(session->msg->type)){ |
508 | session->state = FINALIZED; | 508 | case GNUNET_MESSAGE_TYPE_SCALARPRODUCT_SERVICE_TO_CLIENT: |
509 | session->client_transmit_handle = NULL; | 509 | session->state = FINALIZED; |
510 | session->client_transmit_handle = NULL; | ||
511 | break; | ||
512 | default: | ||
513 | session->service_transmit_handle = NULL; | ||
510 | } | 514 | } |
511 | else | ||
512 | session->service_transmit_handle = NULL; | ||
513 | 515 | ||
514 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 516 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
515 | "Sent a message of type %hu.\n", | 517 | "Sent a message of type %hu.\n", |
@@ -1642,6 +1644,7 @@ prepare_client_response (void *cls, | |||
1642 | 1644 | ||
1643 | sign = gcry_mpi_cmp_ui(session->product, 0); | 1645 | sign = gcry_mpi_cmp_ui(session->product, 0); |
1644 | // libgcrypt can not handle a print of a negative number | 1646 | // libgcrypt can not handle a print of a negative number |
1647 | // if (a->sign) return gcry_error (GPG_ERR_INTERNAL); /* Can't handle it yet. */ | ||
1645 | if (0 > sign){ | 1648 | if (0 > sign){ |
1646 | gcry_mpi_sub(value, value, session->product); | 1649 | gcry_mpi_sub(value, value, session->product); |
1647 | } | 1650 | } |
@@ -1652,23 +1655,20 @@ prepare_client_response (void *cls, | |||
1652 | else | 1655 | else |
1653 | range = 0; | 1656 | range = 0; |
1654 | 1657 | ||
1658 | gcry_mpi_release (session->product); | ||
1659 | session->product = NULL; | ||
1660 | |||
1655 | // get representation as string | 1661 | // get representation as string |
1656 | // unfortunately libgcrypt is too stupid to implement print-support in | ||
1657 | // signed GCRYMPI_FMT_STD format, and simply asserts in that case. | ||
1658 | // here is the associated sourcecode: | ||
1659 | // if (a->sign) return gcry_error (GPG_ERR_INTERNAL); /* Can't handle it yet. */ | ||
1660 | if (range | 1662 | if (range |
1661 | && (0 != (rc = gcry_mpi_aprint (GCRYMPI_FMT_USG, | 1663 | && (0 != (rc = gcry_mpi_aprint (GCRYMPI_FMT_STD, |
1662 | &product_exported, | 1664 | &product_exported, |
1663 | &product_length, | 1665 | &product_length, |
1664 | session->product)))){ | 1666 | value)))){ |
1665 | LOG_GCRY(GNUNET_ERROR_TYPE_ERROR, "gcry_mpi_scan", rc); | 1667 | LOG_GCRY(GNUNET_ERROR_TYPE_ERROR, "gcry_mpi_scan", rc); |
1666 | product_length = 0; | 1668 | product_length = 0; |
1667 | range = -1; // signal error with product-length = 0 and range = -1 | 1669 | range = -1; // signal error with product-length = 0 and range = -1 |
1668 | } | 1670 | } |
1669 | 1671 | gcry_mpi_release (value); | |
1670 | gcry_mpi_release (session->product); | ||
1671 | session->product = NULL; | ||
1672 | } | 1672 | } |
1673 | 1673 | ||
1674 | msg_length = sizeof (struct GNUNET_SCALARPRODUCT_client_response) + product_length; | 1674 | msg_length = sizeof (struct GNUNET_SCALARPRODUCT_client_response) + product_length; |
diff --git a/src/scalarproduct/scalarproduct_api.c b/src/scalarproduct/scalarproduct_api.c index b3390f349..ee2e6e5eb 100644 --- a/src/scalarproduct/scalarproduct_api.c +++ b/src/scalarproduct/scalarproduct_api.c | |||
@@ -184,7 +184,7 @@ process_result_message (void *cls, | |||
184 | gcry_mpi_t num; | 184 | gcry_mpi_t num; |
185 | size_t read = 0; | 185 | size_t read = 0; |
186 | 186 | ||
187 | if (0 != (rc = gcry_mpi_scan (&num, GCRYMPI_FMT_USG, &msg[1], product_len, &read))) | 187 | if (0 != (rc = gcry_mpi_scan (&num, GCRYMPI_FMT_STD, &msg[1], product_len, &read))) |
188 | { | 188 | { |
189 | LOG_GCRY(GNUNET_ERROR_TYPE_ERROR, "gcry_mpi_scan", rc); | 189 | LOG_GCRY(GNUNET_ERROR_TYPE_ERROR, "gcry_mpi_scan", rc); |
190 | gcry_mpi_release (result); | 190 | gcry_mpi_release (result); |
@@ -338,7 +338,7 @@ GNUNET_SCALARPRODUCT_response (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
338 | return NULL; | 338 | return NULL; |
339 | } | 339 | } |
340 | h->stats = GNUNET_STATISTICS_create ("scalarproduct-api", cfg); | 340 | h->stats = GNUNET_STATISTICS_create ("scalarproduct-api", cfg); |
341 | if (!h->th) | 341 | if (!h->stats) |
342 | { | 342 | { |
343 | LOG (GNUNET_ERROR_TYPE_ERROR, | 343 | LOG (GNUNET_ERROR_TYPE_ERROR, |
344 | _ ("Failed to send a message to the statistics service\n")); | 344 | _ ("Failed to send a message to the statistics service\n")); |
@@ -431,7 +431,7 @@ GNUNET_SCALARPRODUCT_request (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
431 | return NULL; | 431 | return NULL; |
432 | } | 432 | } |
433 | h->stats = GNUNET_STATISTICS_create ("scalarproduct-api", cfg); | 433 | h->stats = GNUNET_STATISTICS_create ("scalarproduct-api", cfg); |
434 | if (!h->th) | 434 | if (!h->stats) |
435 | { | 435 | { |
436 | LOG (GNUNET_ERROR_TYPE_ERROR, | 436 | LOG (GNUNET_ERROR_TYPE_ERROR, |
437 | _ ("Failed to send a message to the statistics service\n")); | 437 | _ ("Failed to send a message to the statistics service\n")); |