diff options
-rw-r--r-- | src/include/gnunet_testbed_service.h | 17 | ||||
-rw-r--r-- | src/revocation/Makefile.am | 3 | ||||
-rw-r--r-- | src/scalarproduct/gnunet-service-scalarproduct.c | 112 | ||||
-rw-r--r-- | src/set/gnunet-service-set_intersection.c | 1 | ||||
-rw-r--r-- | src/util/Makefile.am | 2 |
5 files changed, 70 insertions, 65 deletions
diff --git a/src/include/gnunet_testbed_service.h b/src/include/gnunet_testbed_service.h index ef5821aab..b96a16732 100644 --- a/src/include/gnunet_testbed_service.h +++ b/src/include/gnunet_testbed_service.h | |||
@@ -1347,11 +1347,13 @@ GNUNET_TESTBED_get_statistics (unsigned int num_peers, | |||
1347 | uint32_t | 1347 | uint32_t |
1348 | GNUNET_TESTBED_get_index (const struct GNUNET_TESTBED_Peer *peer); | 1348 | GNUNET_TESTBED_get_index (const struct GNUNET_TESTBED_Peer *peer); |
1349 | 1349 | ||
1350 | |||
1350 | /** | 1351 | /** |
1351 | * Handle for testbed run helper funtions | 1352 | * Handle for testbed run helper funtions |
1352 | */ | 1353 | */ |
1353 | struct GNUNET_TESTBED_RunHandle; | 1354 | struct GNUNET_TESTBED_RunHandle; |
1354 | 1355 | ||
1356 | |||
1355 | /** | 1357 | /** |
1356 | * Signature of a main function for a testcase. | 1358 | * Signature of a main function for a testcase. |
1357 | * | 1359 | * |
@@ -1366,12 +1368,13 @@ struct GNUNET_TESTBED_RunHandle; | |||
1366 | * failed | 1368 | * failed |
1367 | * @see GNUNET_TESTBED_test_run() | 1369 | * @see GNUNET_TESTBED_test_run() |
1368 | */ | 1370 | */ |
1369 | typedef void (*GNUNET_TESTBED_TestMaster)(void *cls, | 1371 | typedef void |
1370 | struct GNUNET_TESTBED_RunHandle *h, | 1372 | (*GNUNET_TESTBED_TestMaster)(void *cls, |
1371 | unsigned int num_peers, | 1373 | struct GNUNET_TESTBED_RunHandle *h, |
1372 | struct GNUNET_TESTBED_Peer **peers, | 1374 | unsigned int num_peers, |
1373 | unsigned int links_succeeded, | 1375 | struct GNUNET_TESTBED_Peer **peers, |
1374 | unsigned int links_failed); | 1376 | unsigned int links_succeeded, |
1377 | unsigned int links_failed); | ||
1375 | 1378 | ||
1376 | 1379 | ||
1377 | /** | 1380 | /** |
@@ -1447,7 +1450,7 @@ GNUNET_TESTBED_run (const char *host_filename, | |||
1447 | * respective 'enum GNUNET_TESTBED_EventType' | 1450 | * respective 'enum GNUNET_TESTBED_EventType' |
1448 | * (i.e. "(1LL << GNUNET_TESTBED_ET_CONNECT) || ...") | 1451 | * (i.e. "(1LL << GNUNET_TESTBED_ET_CONNECT) || ...") |
1449 | * @param cc controller callback to invoke on events; This callback is called | 1452 | * @param cc controller callback to invoke on events; This callback is called |
1450 | * for all peer start events even if GNUNET_TESTBED_ET_PEER_START isn't | 1453 | * for all peer start events even if #GNUNET_TESTBED_ET_PEER_START isn't |
1451 | * set in the event_mask as this is the only way get access to the | 1454 | * set in the event_mask as this is the only way get access to the |
1452 | * handle of each peer | 1455 | * handle of each peer |
1453 | * @param cc_cls closure for @a cc | 1456 | * @param cc_cls closure for @a cc |
diff --git a/src/revocation/Makefile.am b/src/revocation/Makefile.am index a83850fd0..3deec633e 100644 --- a/src/revocation/Makefile.am +++ b/src/revocation/Makefile.am | |||
@@ -67,9 +67,8 @@ test_revocation_LDADD = \ | |||
67 | check_PROGRAMS = \ | 67 | check_PROGRAMS = \ |
68 | test_revocation | 68 | test_revocation |
69 | 69 | ||
70 | |||
71 | check_SCRIPTS = \ | 70 | check_SCRIPTS = \ |
72 | test_local_revocation.py | 71 | test_local_revocation.py |
73 | 72 | ||
74 | if ENABLE_TEST_RUN | 73 | if ENABLE_TEST_RUN |
75 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH; | 74 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH; |
diff --git a/src/scalarproduct/gnunet-service-scalarproduct.c b/src/scalarproduct/gnunet-service-scalarproduct.c index b5fc1471f..39274e4d4 100644 --- a/src/scalarproduct/gnunet-service-scalarproduct.c +++ b/src/scalarproduct/gnunet-service-scalarproduct.c | |||
@@ -462,7 +462,7 @@ prepare_bobs_cryptodata_message_multipart (void *cls); | |||
462 | 462 | ||
463 | 463 | ||
464 | /** | 464 | /** |
465 | * computes the square sum over a vector of a given length. | 465 | * Computes the square sum over a vector of a given length. |
466 | * | 466 | * |
467 | * @param vector the vector to encrypt | 467 | * @param vector the vector to encrypt |
468 | * @param length the length of the vector | 468 | * @param length the length of the vector |
@@ -474,18 +474,16 @@ compute_square_sum (gcry_mpi_t *vector, | |||
474 | { | 474 | { |
475 | gcry_mpi_t elem; | 475 | gcry_mpi_t elem; |
476 | gcry_mpi_t sum; | 476 | gcry_mpi_t sum; |
477 | int32_t i; | 477 | uint32_t i; |
478 | |||
479 | GNUNET_assert (sum = gcry_mpi_new (0)); | ||
480 | GNUNET_assert (elem = gcry_mpi_new (0)); | ||
481 | 478 | ||
482 | // calculare E(sum (ai ^ 2), publickey) | 479 | GNUNET_assert (NULL != (sum = gcry_mpi_new (0))); |
483 | for (i = 0; i < length; i++) { | 480 | GNUNET_assert (NULL != (elem = gcry_mpi_new (0))); |
481 | for (i = 0; i < length; i++) | ||
482 | { | ||
484 | gcry_mpi_mul (elem, vector[i], vector[i]); | 483 | gcry_mpi_mul (elem, vector[i], vector[i]); |
485 | gcry_mpi_add (sum, sum, elem); | 484 | gcry_mpi_add (sum, sum, elem); |
486 | } | 485 | } |
487 | gcry_mpi_release (elem); | 486 | gcry_mpi_release (elem); |
488 | |||
489 | return sum; | 487 | return sum; |
490 | } | 488 | } |
491 | 489 | ||
@@ -498,62 +496,63 @@ compute_square_sum (gcry_mpi_t *vector, | |||
498 | static void | 496 | static void |
499 | free_session_variables (struct ServiceSession *s) | 497 | free_session_variables (struct ServiceSession *s) |
500 | { | 498 | { |
501 | while (NULL != s->a_head) | 499 | struct SortedValue *e; |
500 | while (NULL != (e = s->a_head)) | ||
502 | { | 501 | { |
503 | struct SortedValue * e = s->a_head; | ||
504 | |||
505 | GNUNET_free (e->elem); | 502 | GNUNET_free (e->elem); |
506 | gcry_mpi_release (e->val); | 503 | gcry_mpi_release (e->val); |
507 | GNUNET_CONTAINER_DLL_remove (s->a_head, s->a_tail, e); | 504 | GNUNET_CONTAINER_DLL_remove (s->a_head, |
505 | s->a_tail, | ||
506 | e); | ||
508 | GNUNET_free (e); | 507 | GNUNET_free (e); |
509 | } | 508 | } |
510 | if (s->e_a) | 509 | if (NULL != s->intersected_elements) |
511 | { | ||
512 | GNUNET_free (s->e_a); | ||
513 | s->e_a = NULL; | ||
514 | } | ||
515 | if (s->sorted_elements) | ||
516 | { | ||
517 | GNUNET_free (s->sorted_elements); | ||
518 | s->sorted_elements = NULL; | ||
519 | } | ||
520 | if (s->intersected_elements) | ||
521 | { | 510 | { |
522 | GNUNET_CONTAINER_multihashmap_destroy (s->intersected_elements); | 511 | GNUNET_CONTAINER_multihashmap_destroy (s->intersected_elements); |
523 | //elements are freed independently in session->a_head/tail | 512 | /* elements are freed independently in above loop over a_head */ |
524 | s->intersected_elements = NULL; | 513 | s->intersected_elements = NULL; |
525 | } | 514 | } |
526 | if (s->intersection_listen) | 515 | if (NULL != s->intersection_listen) |
527 | { | 516 | { |
528 | GNUNET_SET_listen_cancel (s->intersection_listen); | 517 | GNUNET_SET_listen_cancel (s->intersection_listen); |
529 | s->intersection_listen = NULL; | 518 | s->intersection_listen = NULL; |
530 | } | 519 | } |
531 | if (s->intersection_op) | 520 | if (NULL != s->intersection_op) |
532 | { | 521 | { |
533 | GNUNET_SET_operation_cancel (s->intersection_op); | 522 | GNUNET_SET_operation_cancel (s->intersection_op); |
534 | s->intersection_op = NULL; | 523 | s->intersection_op = NULL; |
535 | } | 524 | } |
536 | if (s->intersection_set) | 525 | if (NULL != s->intersection_set) |
537 | { | 526 | { |
538 | GNUNET_SET_destroy (s->intersection_set); | 527 | GNUNET_SET_destroy (s->intersection_set); |
539 | s->intersection_set = NULL; | 528 | s->intersection_set = NULL; |
540 | } | 529 | } |
541 | if (s->msg) | 530 | if (NULL != s->e_a) |
531 | { | ||
532 | GNUNET_free (s->e_a); | ||
533 | s->e_a = NULL; | ||
534 | } | ||
535 | if (NULL != s->sorted_elements) | ||
536 | { | ||
537 | GNUNET_free (s->sorted_elements); | ||
538 | s->sorted_elements = NULL; | ||
539 | } | ||
540 | if (NULL != s->msg) | ||
542 | { | 541 | { |
543 | GNUNET_free (s->msg); | 542 | GNUNET_free (s->msg); |
544 | s->msg = NULL; | 543 | s->msg = NULL; |
545 | } | 544 | } |
546 | if (s->r) | 545 | if (NULL != s->r) |
547 | { | 546 | { |
548 | GNUNET_free (s->r); | 547 | GNUNET_free (s->r); |
549 | s->r = NULL; | 548 | s->r = NULL; |
550 | } | 549 | } |
551 | if (s->r_prime) | 550 | if (NULL != s->r_prime) |
552 | { | 551 | { |
553 | GNUNET_free (s->r_prime); | 552 | GNUNET_free (s->r_prime); |
554 | s->r_prime = NULL; | 553 | s->r_prime = NULL; |
555 | } | 554 | } |
556 | if (s->product) | 555 | if (NULL != s->product) |
557 | { | 556 | { |
558 | gcry_mpi_release (s->product); | 557 | gcry_mpi_release (s->product); |
559 | s->product = NULL; | 558 | s->product = NULL; |
@@ -562,12 +561,13 @@ free_session_variables (struct ServiceSession *s) | |||
562 | 561 | ||
563 | 562 | ||
564 | /** | 563 | /** |
565 | * Primitive callback for copying over a message, as they | 564 | * Primitive callback for copying over a message, as they usually are |
566 | * usually are too complex to be handled in the callback itself. | 565 | * too complex to be handled in the callback itself. Clears a |
567 | * clears a session-callback, if a session was handed over and the transmit handle was stored | 566 | * session-callback, if a session was handed over and the transmit |
567 | * handle was stored. | ||
568 | * | 568 | * |
569 | * @param cls the session containing the message object | 569 | * @param cls the session containing the message object |
570 | * @param size the size of the buffer we got | 570 | * @param size the size of the @a buf we got |
571 | * @param buf the buffer to copy the message to | 571 | * @param buf the buffer to copy the message to |
572 | * @return 0 if we couldn't copy, else the size copied over | 572 | * @return 0 if we couldn't copy, else the size copied over |
573 | */ | 573 | */ |
@@ -576,47 +576,44 @@ cb_transfer_message (void *cls, | |||
576 | size_t size, | 576 | size_t size, |
577 | void *buf) | 577 | void *buf) |
578 | { | 578 | { |
579 | struct ServiceSession * s = cls; | 579 | struct ServiceSession *s = cls; |
580 | uint16_t type; | 580 | uint16_t type; |
581 | 581 | ||
582 | s->client_transmit_handle = NULL; | ||
582 | GNUNET_assert (buf); | 583 | GNUNET_assert (buf); |
583 | if (ntohs (s->msg->size) != size) | 584 | if (ntohs (s->msg->size) > size) |
584 | { | 585 | { |
585 | GNUNET_break (0); | 586 | GNUNET_break (0); |
586 | return 0; | 587 | return 0; |
587 | } | 588 | } |
588 | 589 | size = ntohs (s->msg->size); | |
589 | type = ntohs (s->msg->type); | 590 | type = ntohs (s->msg->type); |
590 | memcpy (buf, s->msg, size); | 591 | memcpy (buf, |
592 | s->msg, | ||
593 | size); | ||
591 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 594 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
592 | "Sent a message of type %hu.\n", | 595 | "Sending a message of type %u.\n", |
593 | type); | 596 | (unsigned int) type); |
594 | GNUNET_free (s->msg); | 597 | GNUNET_free (s->msg); |
595 | s->msg = NULL; | 598 | s->msg = NULL; |
596 | 599 | ||
597 | switch (type) | 600 | switch (type) |
598 | { | 601 | { |
599 | case GNUNET_MESSAGE_TYPE_SCALARPRODUCT_RESULT: | 602 | case GNUNET_MESSAGE_TYPE_SCALARPRODUCT_RESULT: |
600 | s->client_transmit_handle = NULL; | ||
601 | free_session_variables (s); | 603 | free_session_variables (s); |
604 | // FIXME: that does not fully clean up 's' | ||
602 | break; | 605 | break; |
603 | |||
604 | case GNUNET_MESSAGE_TYPE_SCALARPRODUCT_SESSION_INITIALIZATION: | 606 | case GNUNET_MESSAGE_TYPE_SCALARPRODUCT_SESSION_INITIALIZATION: |
605 | s->service_transmit_handle = NULL; | ||
606 | break; | 607 | break; |
607 | |||
608 | case GNUNET_MESSAGE_TYPE_SCALARPRODUCT_ALICE_CRYPTODATA: | 608 | case GNUNET_MESSAGE_TYPE_SCALARPRODUCT_ALICE_CRYPTODATA: |
609 | case GNUNET_MESSAGE_TYPE_SCALARPRODUCT_ALICE_CRYPTODATA_MULTIPART: | 609 | case GNUNET_MESSAGE_TYPE_SCALARPRODUCT_ALICE_CRYPTODATA_MULTIPART: |
610 | s->service_transmit_handle = NULL; | ||
611 | if (s->used_element_count != s->transferred_element_count) | 610 | if (s->used_element_count != s->transferred_element_count) |
612 | prepare_alices_cyrptodata_message_multipart (s); | 611 | prepare_alices_cyrptodata_message_multipart (s); |
613 | else | 612 | else |
614 | s->channel = NULL; | 613 | s->channel = NULL; |
615 | break; | 614 | break; |
616 | |||
617 | case GNUNET_MESSAGE_TYPE_SCALARPRODUCT_BOB_CRYPTODATA: | 615 | case GNUNET_MESSAGE_TYPE_SCALARPRODUCT_BOB_CRYPTODATA: |
618 | case GNUNET_MESSAGE_TYPE_SCALARPRODUCT_BOB_CRYPTODATA_MULTIPART: | 616 | case GNUNET_MESSAGE_TYPE_SCALARPRODUCT_BOB_CRYPTODATA_MULTIPART: |
619 | s->service_transmit_handle = NULL; | ||
620 | if (s->used_element_count != s->transferred_element_count) | 617 | if (s->used_element_count != s->transferred_element_count) |
621 | prepare_bobs_cryptodata_message_multipart (s); | 618 | prepare_bobs_cryptodata_message_multipart (s); |
622 | else | 619 | else |
@@ -633,15 +630,17 @@ cb_transfer_message (void *cls, | |||
633 | * Finds a not terminated client/service session in the | 630 | * Finds a not terminated client/service session in the |
634 | * given DLL based on session key, element count and state. | 631 | * given DLL based on session key, element count and state. |
635 | * | 632 | * |
633 | * FIXME: Use hashmap based on key instead of linear search. | ||
634 | * | ||
636 | * @param tail - the tail of the DLL | 635 | * @param tail - the tail of the DLL |
637 | * @param key - the key we want to search for | 636 | * @param key - the key we want to search for |
638 | * @param peerid - a pointer to the peer ID of the associated peer, NULL to ignore | 637 | * @param peerid - a pointer to the peer ID of the associated peer, NULL to ignore |
639 | * @return a pointer to a matching session, or NULL | 638 | * @return a pointer to a matching session, or NULL |
640 | */ | 639 | */ |
641 | static struct ServiceSession * | 640 | static struct ServiceSession * |
642 | find_matching_session (struct ServiceSession * tail, | 641 | find_matching_session (struct ServiceSession *tail, |
643 | const struct GNUNET_HashCode * key, | 642 | const struct GNUNET_HashCode *key, |
644 | const struct GNUNET_PeerIdentity * peerid) | 643 | const struct GNUNET_PeerIdentity *peerid) |
645 | { | 644 | { |
646 | struct ServiceSession * s; | 645 | struct ServiceSession * s; |
647 | 646 | ||
@@ -683,7 +682,8 @@ cb_client_disconnect (void *cls, | |||
683 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 682 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
684 | "Client %p disconnected from us.\n", | 683 | "Client %p disconnected from us.\n", |
685 | client); | 684 | client); |
686 | s = GNUNET_SERVER_client_get_user_context (client, struct ServiceSession); | 685 | s = GNUNET_SERVER_client_get_user_context (client, |
686 | struct ServiceSession); | ||
687 | if (NULL == s) | 687 | if (NULL == s) |
688 | return; | 688 | return; |
689 | GNUNET_CONTAINER_DLL_remove (from_client_head, | 689 | GNUNET_CONTAINER_DLL_remove (from_client_head, |
@@ -717,8 +717,8 @@ cb_client_disconnect (void *cls, | |||
717 | /** | 717 | /** |
718 | * Notify the client that the session has succeeded or failed completely. | 718 | * Notify the client that the session has succeeded or failed completely. |
719 | * This message gets sent to | 719 | * This message gets sent to |
720 | * * alice's client if bob disconnected or to | 720 | * - Alice's client if Bob disconnected or to |
721 | * * bob's client if the operation completed or alice disconnected | 721 | * - Bob's client if the operation completed or Alice disconnected |
722 | * | 722 | * |
723 | * @param cls the associated client session | 723 | * @param cls the associated client session |
724 | * @param tc the task context handed to us by the scheduler, unused | 724 | * @param tc the task context handed to us by the scheduler, unused |
@@ -737,7 +737,7 @@ prepare_client_end_notification (void *cls, | |||
737 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_SCALARPRODUCT_RESULT); | 737 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_SCALARPRODUCT_RESULT); |
738 | // signal error if not signalized, positive result-range field but zero length. | 738 | // signal error if not signalized, positive result-range field but zero length. |
739 | msg->product_length = htonl (0); | 739 | msg->product_length = htonl (0); |
740 | msg->status = htonl(session->active); | 740 | msg->status = htonl (session->active); |
741 | session->msg = &msg->header; | 741 | session->msg = &msg->header; |
742 | 742 | ||
743 | //transmit this message to our client | 743 | //transmit this message to our client |
@@ -2674,6 +2674,8 @@ shutdown_task (void *cls, | |||
2674 | do_shutdown = GNUNET_YES; | 2674 | do_shutdown = GNUNET_YES; |
2675 | 2675 | ||
2676 | // terminate all owned open channels. | 2676 | // terminate all owned open channels. |
2677 | // FIXME: this should be unnecessary, as we should | ||
2678 | // get client disconnect events that create the same effect. | ||
2677 | for (s = from_client_head; NULL != s; s = s->next) | 2679 | for (s = from_client_head; NULL != s; s = s->next) |
2678 | { | 2680 | { |
2679 | if ((GNUNET_NO != s->active) && (NULL != s->channel)) | 2681 | if ((GNUNET_NO != s->active) && (NULL != s->channel)) |
diff --git a/src/set/gnunet-service-set_intersection.c b/src/set/gnunet-service-set_intersection.c index ed21cd1bb..5d1b2d2b5 100644 --- a/src/set/gnunet-service-set_intersection.c +++ b/src/set/gnunet-service-set_intersection.c | |||
@@ -1041,6 +1041,7 @@ intersection_evaluate (struct Operation *op, | |||
1041 | msg->element_count = htonl (op->state->my_element_count); | 1041 | msg->element_count = htonl (op->state->my_element_count); |
1042 | GNUNET_MQ_send (op->mq, | 1042 | GNUNET_MQ_send (op->mq, |
1043 | ev); | 1043 | ev); |
1044 | op->state->phase = PHASE_COUNT_SENT; | ||
1044 | if (NULL != opaque_context) | 1045 | if (NULL != opaque_context) |
1045 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1046 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1046 | "Sent op request with context message\n"); | 1047 | "Sent op request with context message\n"); |
diff --git a/src/util/Makefile.am b/src/util/Makefile.am index 6aa32db08..4613be59c 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am | |||
@@ -291,7 +291,7 @@ test_bio_LDADD = \ | |||
291 | test_os_start_process_SOURCES = \ | 291 | test_os_start_process_SOURCES = \ |
292 | test_os_start_process.c | 292 | test_os_start_process.c |
293 | test_os_start_process_LDADD = \ | 293 | test_os_start_process_LDADD = \ |
294 | libgnunetutil.la | 294 | libgnunetutil.la |
295 | test_os_start_process_DEPENDENCIES = \ | 295 | test_os_start_process_DEPENDENCIES = \ |
296 | libgnunetutil.la \ | 296 | libgnunetutil.la \ |
297 | $(WINCAT) | 297 | $(WINCAT) |