aboutsummaryrefslogtreecommitdiff
path: root/src/scalarproduct/scalarproduct.h
diff options
context:
space:
mode:
authorChristian Fuchs <christian.fuchs@cfuchs.net>2014-05-07 08:21:49 +0000
committerChristian Fuchs <christian.fuchs@cfuchs.net>2014-05-07 08:21:49 +0000
commit8a2d1e6aedbf1bc95052e63ac67093b89385b0a1 (patch)
tree993d5f09035ce90f8f9a2d50cdcc417631d88227 /src/scalarproduct/scalarproduct.h
parent3a658d6f0923662f193a49af8aae52a83aafae1c (diff)
downloadgnunet-8a2d1e6aedbf1bc95052e63ac67093b89385b0a1.tar.gz
gnunet-8a2d1e6aedbf1bc95052e63ac67093b89385b0a1.zip
WIP commit of scalar product 2.0. It is unfinished and does not yet pass tests. This commit happens because of the move from mesh->cadet.
- reverted SP API back to the original design from 2012 (using key-value pairs) - SP now uses set intersection to determine common elements from the set provided by the user - values are sorted based on their keys after intersection - removed state tracking, as simple tracking is now insufficient. Just checking for conditions directly is easier readable and less buggy - modified/renamed SP message types to reflect the changed behavior of SP
Diffstat (limited to 'src/scalarproduct/scalarproduct.h')
-rw-r--r--src/scalarproduct/scalarproduct.h67
1 files changed, 48 insertions, 19 deletions
diff --git a/src/scalarproduct/scalarproduct.h b/src/scalarproduct/scalarproduct.h
index 5682362fd..9f6036358 100644
--- a/src/scalarproduct/scalarproduct.h
+++ b/src/scalarproduct/scalarproduct.h
@@ -57,7 +57,7 @@ extern "C"
57 * Message type passed from client to service 57 * Message type passed from client to service
58 * to initiate a request or responder role 58 * to initiate a request or responder role
59 */ 59 */
60struct GNUNET_SCALARPRODUCT_client_request 60struct GNUNET_SCALARPRODUCT_computation_message
61{ 61{
62 /** 62 /**
63 * GNUNET message header 63 * GNUNET message header
@@ -67,17 +67,17 @@ struct GNUNET_SCALARPRODUCT_client_request
67 /** 67 /**
68 * how many elements the vector in payload contains 68 * how many elements the vector in payload contains
69 */ 69 */
70 uint32_t element_count GNUNET_PACKED; 70 uint32_t element_count_total GNUNET_PACKED;
71 71
72 /** 72 /**
73 * how many bytes the mask has 73 * contained elements the vector in payload contains
74 */ 74 */
75 uint32_t mask_length GNUNET_PACKED; 75 uint32_t element_count_contained GNUNET_PACKED;
76 76
77 /** 77 /**
78 * the transaction/session key used to identify a session 78 * the transaction/session key used to identify a session
79 */ 79 */
80 struct GNUNET_HashCode key; 80 struct GNUNET_HashCode session_key;
81 81
82 /** 82 /**
83 * the identity of a remote peer we want to communicate with 83 * the identity of a remote peer we want to communicate with
@@ -85,11 +85,32 @@ struct GNUNET_SCALARPRODUCT_client_request
85 struct GNUNET_PeerIdentity peer; 85 struct GNUNET_PeerIdentity peer;
86 86
87 /** 87 /**
88 * followed by long vector[element_count] | [unsigned char mask[mask_bytes]] 88 * followed by struct GNUNET_SCALARPRODUCT_Element[]
89 */ 89 */
90}; 90};
91 91
92/** 92/**
93 * multipart messages following GNUNET_SCALARPRODUCT_client_request
94 */
95struct GNUNET_SCALARPRODUCT_computation_message_multipart
96{
97 /**
98 * GNUNET message header
99 */
100 struct GNUNET_MessageHeader header;
101
102 /**
103 * contained elements the vector in payload contains
104 */
105 uint32_t element_count_contained GNUNET_PACKED;
106
107 /**
108 * followed by struct GNUNET_SCALARPRODUCT_Element[]
109 */
110};
111
112
113/**
93 * Message type passed from requesting service Alice to responding service Bob 114 * Message type passed from requesting service Alice to responding service Bob
94 * to initiate a request and make bob participate in our protocol 115 * to initiate a request and make bob participate in our protocol
95 */ 116 */
@@ -104,28 +125,36 @@ struct GNUNET_SCALARPRODUCT_service_request {
104 */ 125 */
105 uint32_t total_element_count GNUNET_PACKED; 126 uint32_t total_element_count GNUNET_PACKED;
106 127
107 /** 128 /**
108 * how many elements are actually included after the mask was applied. 129 * the transaction/session key used to identify a session
109 */ 130 */
110 uint32_t contained_element_count GNUNET_PACKED; 131 struct GNUNET_HashCode session_id;
111 132
112 /** 133 /**
113 * how many bytes the mask has 134 * Alice's public key
114 */ 135 */
115 uint32_t mask_length GNUNET_PACKED; 136 struct GNUNET_CRYPTO_PaillierPublicKey public_key;
137
138};
116 139
140
141/**
142 * Message type passed from requesting service Alice to responding service Bob
143 * to initiate a request and make bob participate in our protocol
144 */
145struct GNUNET_SCALARPRODUCT_alices_cryptodata_message {
117 /** 146 /**
118 * the transaction/session key used to identify a session 147 * GNUNET message header
119 */ 148 */
120 struct GNUNET_HashCode key; 149 struct GNUNET_MessageHeader header;
121 150
122 /** 151 /**
123 * how many elements the vector in payload contains 152 * how many elements we appended to this message
124 */ 153 */
125 uint32_t element_count GNUNET_PACKED; 154 uint32_t contained_element_count GNUNET_PACKED;
126 155
127 /** 156 /**
128 * followed by mask | public_key | vector[used_element_count] 157 * struct GNUNET_CRYPTO_PaillierCiphertext[contained_element_count]
129 */ 158 */
130}; 159};
131 160
@@ -141,9 +170,9 @@ struct GNUNET_SCALARPRODUCT_multipart_message {
141 /** 170 /**
142 * how many elements we supply within this message 171 * how many elements we supply within this message
143 */ 172 */
144 uint32_t multipart_element_count GNUNET_PACKED; 173 uint32_t contained_element_count GNUNET_PACKED;
145 174
146 // followed by vector[multipart_element_count] or k[i][perm] 175 // struct GNUNET_CRYPTO_PaillierCiphertext[multipart_element_count]
147}; 176};
148 177
149/** 178/**