aboutsummaryrefslogtreecommitdiff
path: root/src/multicast/gnunet-service-multicast.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/multicast/gnunet-service-multicast.c')
-rw-r--r--src/multicast/gnunet-service-multicast.c72
1 files changed, 36 insertions, 36 deletions
diff --git a/src/multicast/gnunet-service-multicast.c b/src/multicast/gnunet-service-multicast.c
index 4d2868669..39789360c 100644
--- a/src/multicast/gnunet-service-multicast.c
+++ b/src/multicast/gnunet-service-multicast.c
@@ -157,17 +157,17 @@ struct Channel
157 /** 157 /**
158 * Public key of the target group. 158 * Public key of the target group.
159 */ 159 */
160 struct GNUNET_CRYPTO_EddsaPublicKey group_key; 160 struct GNUNET_CRYPTO_EddsaPublicKey group_pub_key;
161 161
162 /** 162 /**
163 * Hash of @a group_key. 163 * Hash of @a group_pub_key.
164 */ 164 */
165 struct GNUNET_HashCode group_key_hash; 165 struct GNUNET_HashCode group_pub_hash;
166 166
167 /** 167 /**
168 * Public key of the joining member. 168 * Public key of the joining member.
169 */ 169 */
170 struct GNUNET_CRYPTO_EcdsaPublicKey member_key; 170 struct GNUNET_CRYPTO_EcdsaPublicKey member_pub_key;
171 171
172 /** 172 /**
173 * Remote peer identity. 173 * Remote peer identity.
@@ -735,7 +735,7 @@ cadet_notify_transmit_ready (void *cls, size_t buf_size, void *buf)
735 } 735 }
736 else if (0 == --chn->msgs_pending) 736 else if (0 == --chn->msgs_pending)
737 { 737 {
738 client_send_ack (&chn->group_key_hash); 738 client_send_ack (&chn->group_pub_hash);
739 } 739 }
740 return msg_size; 740 return msg_size;
741} 741}
@@ -770,10 +770,10 @@ cadet_send_channel (struct Channel *chn, const struct GNUNET_MessageHeader *msg)
770 * 770 *
771 * @param peer 771 * @param peer
772 * Peer to connect to. 772 * Peer to connect to.
773 * @param group_key 773 * @param group_pub_key
774 * Public key of group the channel belongs to. 774 * Public key of group the channel belongs to.
775 * @param group_key_hash 775 * @param group_pub_hash
776 * Hash of @a group_key. 776 * Hash of @a group_pub_key.
777 * 777 *
778 * @return Channel. 778 * @return Channel.
779 */ 779 */
@@ -782,15 +782,15 @@ cadet_channel_create (struct Group *grp, struct GNUNET_PeerIdentity *peer)
782{ 782{
783 struct Channel *chn = GNUNET_malloc (sizeof (*chn)); 783 struct Channel *chn = GNUNET_malloc (sizeof (*chn));
784 chn->grp = grp; 784 chn->grp = grp;
785 chn->group_key = grp->pub_key; 785 chn->group_pub_key = grp->pub_key;
786 chn->group_key_hash = grp->pub_key_hash; 786 chn->group_pub_hash = grp->pub_key_hash;
787 chn->peer = *peer; 787 chn->peer = *peer;
788 chn->direction = DIR_OUTGOING; 788 chn->direction = DIR_OUTGOING;
789 chn->join_status = JOIN_WAITING; 789 chn->join_status = JOIN_WAITING;
790 chn->channel = GNUNET_CADET_channel_create (cadet, chn, &chn->peer, 790 chn->channel = GNUNET_CADET_channel_create (cadet, chn, &chn->peer,
791 GNUNET_APPLICATION_TYPE_MULTICAST, 791 GNUNET_APPLICATION_TYPE_MULTICAST,
792 GNUNET_CADET_OPTION_RELIABLE); 792 GNUNET_CADET_OPTION_RELIABLE);
793 GNUNET_CONTAINER_multihashmap_put (channels_out, &chn->group_key_hash, chn, 793 GNUNET_CONTAINER_multihashmap_put (channels_out, &chn->group_pub_hash, chn,
794 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); 794 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
795 return chn; 795 return chn;
796} 796}
@@ -817,13 +817,13 @@ cadet_send_join_request (struct Member *mem)
817 817
818static int 818static int
819cadet_send_join_decision_cb (void *cls, 819cadet_send_join_decision_cb (void *cls,
820 const struct GNUNET_HashCode *group_key_hash, 820 const struct GNUNET_HashCode *group_pub_hash,
821 void *channel) 821 void *channel)
822{ 822{
823 const struct MulticastJoinDecisionMessageHeader *hdcsn = cls; 823 const struct MulticastJoinDecisionMessageHeader *hdcsn = cls;
824 struct Channel *chn = channel; 824 struct Channel *chn = channel;
825 825
826 if (0 == memcmp (&hdcsn->member_key, &chn->member_key, sizeof (chn->member_key)) 826 if (0 == memcmp (&hdcsn->member_pub_key, &chn->member_pub_key, sizeof (chn->member_pub_key))
827 && 0 == memcmp (&hdcsn->peer, &chn->peer, sizeof (chn->peer))) 827 && 0 == memcmp (&hdcsn->peer, &chn->peer, sizeof (chn->peer)))
828 { 828 {
829 cadet_send_channel (chn, &hdcsn->header); 829 cadet_send_channel (chn, &hdcsn->header);
@@ -958,7 +958,7 @@ client_recv_member_join (void *cls, struct GNUNET_SERVER_Client *client,
958 958
959 GNUNET_CRYPTO_ecdsa_key_get_public (&msg->member_key, &mem_pub_key); 959 GNUNET_CRYPTO_ecdsa_key_get_public (&msg->member_key, &mem_pub_key);
960 GNUNET_CRYPTO_hash (&mem_pub_key, sizeof (mem_pub_key), &mem_pub_key_hash); 960 GNUNET_CRYPTO_hash (&mem_pub_key, sizeof (mem_pub_key), &mem_pub_key_hash);
961 GNUNET_CRYPTO_hash (&msg->group_key, sizeof (msg->group_key), &pub_key_hash); 961 GNUNET_CRYPTO_hash (&msg->group_pub_key, sizeof (msg->group_pub_key), &pub_key_hash);
962 962
963 struct GNUNET_CONTAINER_MultiHashMap * 963 struct GNUNET_CONTAINER_MultiHashMap *
964 grp_mem = GNUNET_CONTAINER_multihashmap_get (group_members, &pub_key_hash); 964 grp_mem = GNUNET_CONTAINER_multihashmap_get (group_members, &pub_key_hash);
@@ -979,7 +979,7 @@ client_recv_member_join (void *cls, struct GNUNET_SERVER_Client *client,
979 979
980 grp = &mem->grp; 980 grp = &mem->grp;
981 grp->is_origin = GNUNET_NO; 981 grp->is_origin = GNUNET_NO;
982 grp->pub_key = msg->group_key; 982 grp->pub_key = msg->group_pub_key;
983 grp->pub_key_hash = pub_key_hash; 983 grp->pub_key_hash = pub_key_hash;
984 984
985 if (NULL == grp_mem) 985 if (NULL == grp_mem)
@@ -1046,13 +1046,13 @@ client_recv_member_join (void *cls, struct GNUNET_SERVER_Client *client,
1046 req = GNUNET_malloc (sizeof (*req) + join_msg_size); 1046 req = GNUNET_malloc (sizeof (*req) + join_msg_size);
1047 req->header.size = htons (sizeof (*req) + join_msg_size); 1047 req->header.size = htons (sizeof (*req) + join_msg_size);
1048 req->header.type = htons (GNUNET_MESSAGE_TYPE_MULTICAST_JOIN_REQUEST); 1048 req->header.type = htons (GNUNET_MESSAGE_TYPE_MULTICAST_JOIN_REQUEST);
1049 req->group_key = grp->pub_key; 1049 req->group_pub_key = grp->pub_key;
1050 req->peer = this_peer; 1050 req->peer = this_peer;
1051 GNUNET_CRYPTO_ecdsa_key_get_public (&mem->priv_key, &req->member_key); 1051 GNUNET_CRYPTO_ecdsa_key_get_public (&mem->priv_key, &req->member_pub_key);
1052 if (0 < join_msg_size) 1052 if (0 < join_msg_size)
1053 memcpy (&req[1], join_msg, join_msg_size); 1053 memcpy (&req[1], join_msg, join_msg_size);
1054 1054
1055 req->member_key = mem->pub_key; 1055 req->member_pub_key = mem->pub_key;
1056 req->purpose.size = htonl (msg_size 1056 req->purpose.size = htonl (msg_size
1057 - sizeof (req->header) 1057 - sizeof (req->header)
1058 - sizeof (req->reserved) 1058 - sizeof (req->reserved)
@@ -1128,7 +1128,7 @@ client_recv_join_decision (void *cls, struct GNUNET_SERVER_Client *client,
1128 if (NULL != grp_mem) 1128 if (NULL != grp_mem)
1129 { 1129 {
1130 struct GNUNET_HashCode member_key_hash; 1130 struct GNUNET_HashCode member_key_hash;
1131 GNUNET_CRYPTO_hash (&hdcsn->member_key, sizeof (hdcsn->member_key), 1131 GNUNET_CRYPTO_hash (&hdcsn->member_pub_key, sizeof (hdcsn->member_pub_key),
1132 &member_key_hash); 1132 &member_key_hash);
1133 mem = GNUNET_CONTAINER_multihashmap_get (grp_mem, &member_key_hash); 1133 mem = GNUNET_CONTAINER_multihashmap_get (grp_mem, &member_key_hash);
1134 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1134 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1215,11 +1215,11 @@ client_recv_multicast_request (void *cls, struct GNUNET_SERVER_Client *client,
1215 1215
1216 /* FIXME: yucky, should use separate message structs for P2P and CS! */ 1216 /* FIXME: yucky, should use separate message structs for P2P and CS! */
1217 out = (struct GNUNET_MULTICAST_RequestHeader *) GNUNET_copy_message (m); 1217 out = (struct GNUNET_MULTICAST_RequestHeader *) GNUNET_copy_message (m);
1218 out->member_key = mem->pub_key; 1218 out->member_pub_key = mem->pub_key;
1219 out->fragment_id = GNUNET_ntohll (++mem->max_fragment_id); 1219 out->fragment_id = GNUNET_ntohll (++mem->max_fragment_id);
1220 out->purpose.size = htonl (ntohs (out->header.size) 1220 out->purpose.size = htonl (ntohs (out->header.size)
1221 - sizeof (out->header) 1221 - sizeof (out->header)
1222 - sizeof (out->member_key) 1222 - sizeof (out->member_pub_key)
1223 - sizeof (out->signature)); 1223 - sizeof (out->signature));
1224 out->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_MULTICAST_REQUEST); 1224 out->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_MULTICAST_REQUEST);
1225 1225
@@ -1551,26 +1551,26 @@ cadet_recv_join_request (void *cls,
1551 if (GNUNET_OK != 1551 if (GNUNET_OK !=
1552 GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_MULTICAST_REQUEST, 1552 GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_MULTICAST_REQUEST,
1553 &req->purpose, &req->signature, 1553 &req->purpose, &req->signature,
1554 &req->member_key)) 1554 &req->member_pub_key))
1555 { 1555 {
1556 GNUNET_break_op (0); 1556 GNUNET_break_op (0);
1557 return GNUNET_SYSERR; 1557 return GNUNET_SYSERR;
1558 } 1558 }
1559 1559
1560 struct GNUNET_HashCode group_key_hash; 1560 struct GNUNET_HashCode group_pub_hash;
1561 GNUNET_CRYPTO_hash (&req->group_key, sizeof (req->group_key), &group_key_hash); 1561 GNUNET_CRYPTO_hash (&req->group_pub_key, sizeof (req->group_pub_key), &group_pub_hash);
1562 1562
1563 struct Channel *chn = GNUNET_malloc (sizeof *chn); 1563 struct Channel *chn = GNUNET_malloc (sizeof *chn);
1564 chn->channel = channel; 1564 chn->channel = channel;
1565 chn->group_key = req->group_key; 1565 chn->group_pub_key = req->group_pub_key;
1566 chn->group_key_hash = group_key_hash; 1566 chn->group_pub_hash = group_pub_hash;
1567 chn->member_key = req->member_key; 1567 chn->member_pub_key = req->member_pub_key;
1568 chn->peer = req->peer; 1568 chn->peer = req->peer;
1569 chn->join_status = JOIN_WAITING; 1569 chn->join_status = JOIN_WAITING;
1570 GNUNET_CONTAINER_multihashmap_put (channels_in, &chn->group_key_hash, chn, 1570 GNUNET_CONTAINER_multihashmap_put (channels_in, &chn->group_pub_hash, chn,
1571 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); 1571 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
1572 1572
1573 client_send_all (&group_key_hash, m); 1573 client_send_all (&group_pub_hash, m);
1574 return GNUNET_OK; 1574 return GNUNET_OK;
1575} 1575}
1576 1576
@@ -1670,13 +1670,13 @@ cadet_recv_message (void *cls,
1670 if (GNUNET_OK != 1670 if (GNUNET_OK !=
1671 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_MULTICAST_MESSAGE, 1671 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_MULTICAST_MESSAGE,
1672 &msg->purpose, &msg->signature, 1672 &msg->purpose, &msg->signature,
1673 &chn->group_key)) 1673 &chn->group_pub_key))
1674 { 1674 {
1675 GNUNET_break_op (0); 1675 GNUNET_break_op (0);
1676 return GNUNET_SYSERR; 1676 return GNUNET_SYSERR;
1677 } 1677 }
1678 1678
1679 client_send_all (&chn->group_key_hash, m); 1679 client_send_all (&chn->group_pub_hash, m);
1680 return GNUNET_OK; 1680 return GNUNET_OK;
1681} 1681}
1682 1682
@@ -1706,7 +1706,7 @@ cadet_recv_request (void *cls,
1706 } 1706 }
1707 if (ntohl (req->purpose.size) != (size 1707 if (ntohl (req->purpose.size) != (size
1708 - sizeof (req->header) 1708 - sizeof (req->header)
1709 - sizeof (req->member_key) 1709 - sizeof (req->member_pub_key)
1710 - sizeof (req->signature))) 1710 - sizeof (req->signature)))
1711 { 1711 {
1712 GNUNET_break_op (0); 1712 GNUNET_break_op (0);
@@ -1715,13 +1715,13 @@ cadet_recv_request (void *cls,
1715 if (GNUNET_OK != 1715 if (GNUNET_OK !=
1716 GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_MULTICAST_REQUEST, 1716 GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_MULTICAST_REQUEST,
1717 &req->purpose, &req->signature, 1717 &req->purpose, &req->signature,
1718 &req->member_key)) 1718 &req->member_pub_key))
1719 { 1719 {
1720 GNUNET_break_op (0); 1720 GNUNET_break_op (0);
1721 return GNUNET_SYSERR; 1721 return GNUNET_SYSERR;
1722 } 1722 }
1723 1723
1724 client_send_origin (&chn->group_key_hash, m); 1724 client_send_origin (&chn->group_pub_hash, m);
1725 return GNUNET_OK; 1725 return GNUNET_OK;
1726} 1726}
1727 1727
@@ -1745,7 +1745,7 @@ cadet_recv_replay_request (void *cls,
1745 struct Channel *chn = *ctx; 1745 struct Channel *chn = *ctx;
1746 1746
1747 memcpy (&rep, m, sizeof (rep)); 1747 memcpy (&rep, m, sizeof (rep));
1748 memcpy (&rep.member_key, &chn->member_key, sizeof (chn->member_key)); 1748 memcpy (&rep.member_pub_key, &chn->member_pub_key, sizeof (chn->member_pub_key));
1749 1749
1750 struct GNUNET_CONTAINER_MultiHashMap * 1750 struct GNUNET_CONTAINER_MultiHashMap *
1751 grp_replay_req = GNUNET_CONTAINER_multihashmap_get (replay_req_cadet, 1751 grp_replay_req = GNUNET_CONTAINER_multihashmap_get (replay_req_cadet,
@@ -1763,7 +1763,7 @@ cadet_recv_replay_request (void *cls,
1763 GNUNET_CONTAINER_multihashmap_put (grp_replay_req, &key_hash, chn, 1763 GNUNET_CONTAINER_multihashmap_put (grp_replay_req, &key_hash, chn,
1764 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); 1764 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
1765 1765
1766 client_send_random (&chn->group_key_hash, &rep.header); 1766 client_send_random (&chn->group_pub_hash, &rep.header);
1767 return GNUNET_OK; 1767 return GNUNET_OK;
1768} 1768}
1769 1769