diff options
author | Christian Fuchs <christian.fuchs@cfuchs.net> | 2013-09-02 13:57:17 +0000 |
---|---|---|
committer | Christian Fuchs <christian.fuchs@cfuchs.net> | 2013-09-02 13:57:17 +0000 |
commit | c9b0b7850190a2deec71bc8029a8db58ad809fd5 (patch) | |
tree | 4905976fd71a20ed952ed11c59e10fdcd0557f4d | |
parent | 24a5d2fbc4f6fd9be36a59f0e53ddf9f511d3826 (diff) | |
download | gnunet-c9b0b7850190a2deec71bc8029a8db58ad809fd5.tar.gz gnunet-c9b0b7850190a2deec71bc8029a8db58ad809fd5.zip |
remmoved deprecated headerfile from scalarproduct
updated includes where appropiate
-rw-r--r-- | src/include/gnunet_scalarproduct_service.h | 1 | ||||
-rw-r--r-- | src/scalarproduct/gnunet-scalarproduct.c | 1 | ||||
-rw-r--r-- | src/scalarproduct/gnunet-service-scalarproduct.c | 1 | ||||
-rw-r--r-- | src/scalarproduct/gnunet_scalarproduct.h | 276 | ||||
-rw-r--r-- | src/scalarproduct/scalarproduct.h | 14 |
5 files changed, 15 insertions, 278 deletions
diff --git a/src/include/gnunet_scalarproduct_service.h b/src/include/gnunet_scalarproduct_service.h index 5affd6377..cdf2cc437 100644 --- a/src/include/gnunet_scalarproduct_service.h +++ b/src/include/gnunet_scalarproduct_service.h | |||
@@ -27,7 +27,6 @@ | |||
27 | #ifndef GNUNET_SCALARPRODUCT_SERVICE_H | 27 | #ifndef GNUNET_SCALARPRODUCT_SERVICE_H |
28 | #define GNUNET_SCALARPRODUCT_SERVICE_H | 28 | #define GNUNET_SCALARPRODUCT_SERVICE_H |
29 | #define GCRYPT_NO_DEPRECATED | 29 | #define GCRYPT_NO_DEPRECATED |
30 | // including gcrypt crashes netbeans after the next restart... | ||
31 | #include <gcrypt.h> | 30 | #include <gcrypt.h> |
32 | 31 | ||
33 | #ifdef __cplusplus | 32 | #ifdef __cplusplus |
diff --git a/src/scalarproduct/gnunet-scalarproduct.c b/src/scalarproduct/gnunet-scalarproduct.c index 16c0e173a..2fc2ab720 100644 --- a/src/scalarproduct/gnunet-scalarproduct.c +++ b/src/scalarproduct/gnunet-scalarproduct.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include "gnunet_util_lib.h" | 31 | #include "gnunet_util_lib.h" |
32 | #include "gnunet_scalarproduct_service.h" | 32 | #include "gnunet_scalarproduct_service.h" |
33 | #include "gnunet_protocols.h" | 33 | #include "gnunet_protocols.h" |
34 | #include "scalarproduct.h" | ||
34 | 35 | ||
35 | #define LOG(kind,...) GNUNET_log_from (kind, "gnunet-scalarproduct",__VA_ARGS__) | 36 | #define LOG(kind,...) GNUNET_log_from (kind, "gnunet-scalarproduct",__VA_ARGS__) |
36 | /** | 37 | /** |
diff --git a/src/scalarproduct/gnunet-service-scalarproduct.c b/src/scalarproduct/gnunet-service-scalarproduct.c index 9d0a8a2e7..be942c576 100644 --- a/src/scalarproduct/gnunet-service-scalarproduct.c +++ b/src/scalarproduct/gnunet-service-scalarproduct.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include "gnunet_applications.h" | 31 | #include "gnunet_applications.h" |
32 | #include "gnunet_protocols.h" | 32 | #include "gnunet_protocols.h" |
33 | #include "gnunet_scalarproduct_service.h" | 33 | #include "gnunet_scalarproduct_service.h" |
34 | #include "gnunet_scalarproduct.h" | ||
35 | #include "scalarproduct.h" | 34 | #include "scalarproduct.h" |
36 | 35 | ||
37 | #define LOG(kind,...) GNUNET_log_from (kind, "scalarproduct", __VA_ARGS__) | 36 | #define LOG(kind,...) GNUNET_log_from (kind, "scalarproduct", __VA_ARGS__) |
diff --git a/src/scalarproduct/gnunet_scalarproduct.h b/src/scalarproduct/gnunet_scalarproduct.h deleted file mode 100644 index fc4e718b3..000000000 --- a/src/scalarproduct/gnunet_scalarproduct.h +++ /dev/null | |||
@@ -1,276 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2013 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file scalarproduct/gnunet_scalarproduct.h | ||
23 | * @brief API to the scalarproduct service | ||
24 | * @author Christian M. Fuchs | ||
25 | */ | ||
26 | |||
27 | #ifndef GNUNET_SCALARPRODUCT_H | ||
28 | #define GNUNET_SCALARPRODUCT_H | ||
29 | |||
30 | /////////////////////////////////////////////////////////////////////////////// | ||
31 | // Defines | ||
32 | /////////////////////////////////////////////////////////////////////////////// | ||
33 | #define DISABLE_CRYPTO | ||
34 | |||
35 | /** | ||
36 | * Length of the key used for encryption | ||
37 | */ | ||
38 | #define KEYBITS 2048 | ||
39 | |||
40 | /** | ||
41 | * When performing our crypto, we may add two encrypted values with each | ||
42 | * a maximal length of GNUNET_CRYPTO_RSA_DATA_ENCODING_LENGTH. | ||
43 | * thus we can receive a slightly longer element (+1 byte) | ||
44 | */ | ||
45 | #define PAILLIER_ELEMENT_LENGTH (2*KEYBITS/8 +1) | ||
46 | |||
47 | #ifdef __cplusplus | ||
48 | extern "C" | ||
49 | { | ||
50 | #endif | ||
51 | |||
52 | /////////////////////////////////////////////////////////////////////////////// | ||
53 | // Service Structure Definitions | ||
54 | /////////////////////////////////////////////////////////////////////////////// | ||
55 | |||
56 | /** | ||
57 | * Message type passed from requesting service Alice to responding service Bob | ||
58 | * to initiate a request and make bob participate in our protocol | ||
59 | */ | ||
60 | struct GNUNET_SCALARPRODUCT_service_request { | ||
61 | /** | ||
62 | * GNUNET message header | ||
63 | */ | ||
64 | struct GNUNET_MessageHeader header; | ||
65 | |||
66 | /** | ||
67 | * how many bytes the mask has | ||
68 | */ | ||
69 | uint16_t mask_length GNUNET_PACKED; | ||
70 | |||
71 | /** | ||
72 | * the length of the publickey contained within this message | ||
73 | */ | ||
74 | uint16_t pk_length GNUNET_PACKED; | ||
75 | |||
76 | /** | ||
77 | * the transaction/session key used to identify a session | ||
78 | */ | ||
79 | struct GNUNET_HashCode key; | ||
80 | |||
81 | /** | ||
82 | * how many elements the vector in payload contains | ||
83 | */ | ||
84 | uint16_t element_count GNUNET_PACKED; | ||
85 | |||
86 | /** | ||
87 | * how many elements are actually included after the mask was applied. | ||
88 | */ | ||
89 | uint16_t used_element_count GNUNET_PACKED; | ||
90 | |||
91 | /** | ||
92 | * followed by mask | public_key | vector[used_element_count] | ||
93 | */ | ||
94 | }; | ||
95 | |||
96 | /** | ||
97 | * Message type passed from responding service Bob to responding service Alice | ||
98 | * to complete a request and allow Alice to compute the result | ||
99 | */ | ||
100 | struct GNUNET_SCALARPRODUCT_service_response { | ||
101 | /** | ||
102 | * GNUNET message header | ||
103 | */ | ||
104 | struct GNUNET_MessageHeader header; | ||
105 | |||
106 | /** | ||
107 | * how many elements the vector in payload contains | ||
108 | */ | ||
109 | uint16_t element_count GNUNET_PACKED; | ||
110 | |||
111 | /** | ||
112 | * how many elements are actually included after the mask was applied. | ||
113 | */ | ||
114 | uint16_t used_element_count GNUNET_PACKED; | ||
115 | |||
116 | /** | ||
117 | * the transaction/session key used to identify a session | ||
118 | */ | ||
119 | struct GNUNET_HashCode key; | ||
120 | |||
121 | /** | ||
122 | * followed by s | s' | kp[] | kq[] | ||
123 | */ | ||
124 | }; | ||
125 | |||
126 | /////////////////////////////////////////////////////////////////////////////// | ||
127 | // Service Structure Definitions | ||
128 | /////////////////////////////////////////////////////////////////////////////// | ||
129 | |||
130 | /** | ||
131 | * state a session can be in | ||
132 | */ | ||
133 | enum SessionState | ||
134 | { | ||
135 | WAITING_FOR_BOBS_CONNECT, | ||
136 | MESSAGE_FROM_RESPONDING_CLIENT_RECEIVED, | ||
137 | WAITING_FOR_RESPONSE_FROM_SERVICE, | ||
138 | REQUEST_FROM_SERVICE_RECEIVED, | ||
139 | FINALIZED | ||
140 | }; | ||
141 | |||
142 | /** | ||
143 | * role a peer in a session can assume | ||
144 | */ | ||
145 | enum PeerRole | ||
146 | { | ||
147 | ALICE, | ||
148 | BOB | ||
149 | }; | ||
150 | |||
151 | |||
152 | /** | ||
153 | * A scalarproduct session which tracks: | ||
154 | * | ||
155 | * a request form the client to our final response. | ||
156 | * or | ||
157 | * a request from a service to us(service). | ||
158 | */ | ||
159 | struct ServiceSession | ||
160 | { | ||
161 | /** | ||
162 | * the role this peer has | ||
163 | */ | ||
164 | enum PeerRole role; | ||
165 | |||
166 | /** | ||
167 | * session information is kept in a DLL | ||
168 | */ | ||
169 | struct ServiceSession *next; | ||
170 | |||
171 | /** | ||
172 | * session information is kept in a DLL | ||
173 | */ | ||
174 | struct ServiceSession *prev; | ||
175 | |||
176 | /** | ||
177 | * (hopefully) unique transaction ID | ||
178 | */ | ||
179 | struct GNUNET_HashCode key; | ||
180 | |||
181 | /** | ||
182 | * state of the session | ||
183 | */ | ||
184 | enum SessionState state; | ||
185 | |||
186 | /** | ||
187 | * Alice or Bob's peerID | ||
188 | */ | ||
189 | struct GNUNET_PeerIdentity peer; | ||
190 | |||
191 | /** | ||
192 | * the client this request is related to | ||
193 | */ | ||
194 | struct GNUNET_SERVER_Client * client; | ||
195 | |||
196 | /** | ||
197 | * how many elements we were supplied with from the client | ||
198 | */ | ||
199 | uint16_t element_count; | ||
200 | |||
201 | /** | ||
202 | * how many elements actually are used after applying the mask | ||
203 | */ | ||
204 | uint16_t used_element_count; | ||
205 | |||
206 | /** | ||
207 | * how many bytes the mask is long. | ||
208 | * just for convenience so we don't have to re-re-re calculate it each time | ||
209 | */ | ||
210 | uint16_t mask_length; | ||
211 | |||
212 | /** | ||
213 | * all the vector elements we received | ||
214 | */ | ||
215 | int32_t * vector; | ||
216 | |||
217 | /** | ||
218 | * mask of which elements to check | ||
219 | */ | ||
220 | unsigned char * mask; | ||
221 | |||
222 | /** | ||
223 | * Public key of the remote service, only used by bob | ||
224 | */ | ||
225 | gcry_sexp_t remote_pubkey; | ||
226 | |||
227 | /** | ||
228 | * E(ai)(Bob) or ai(Alice) after applying the mask | ||
229 | */ | ||
230 | gcry_mpi_t * a; | ||
231 | |||
232 | /** | ||
233 | * The computed scalar | ||
234 | */ | ||
235 | gcry_mpi_t product; | ||
236 | |||
237 | /** | ||
238 | * My transmit handle for the current message to a alice/bob | ||
239 | */ | ||
240 | struct GNUNET_MESH_TransmitHandle * service_transmit_handle; | ||
241 | |||
242 | /** | ||
243 | * My transmit handle for the current message to the client | ||
244 | */ | ||
245 | struct GNUNET_SERVER_TransmitHandle * client_transmit_handle; | ||
246 | |||
247 | /** | ||
248 | * tunnel-handle associated with our mesh handle | ||
249 | */ | ||
250 | struct GNUNET_MESH_Tunnel * tunnel; | ||
251 | |||
252 | }; | ||
253 | |||
254 | /** | ||
255 | * We need to do a minimum of bookkeeping to maintain track of our transmit handles. | ||
256 | * each msg is associated with a session and handle. using this information we can determine which msg was sent. | ||
257 | */ | ||
258 | struct MessageObject | ||
259 | { | ||
260 | /** | ||
261 | * The handle used to transmit with this request | ||
262 | */ | ||
263 | void ** transmit_handle; | ||
264 | |||
265 | /** | ||
266 | * The message to send | ||
267 | */ | ||
268 | struct GNUNET_MessageHeader * msg; | ||
269 | }; | ||
270 | |||
271 | #ifdef __cplusplus | ||
272 | } | ||
273 | #endif | ||
274 | |||
275 | #endif /* GNUNET_SCALARPRODUCT_H */ | ||
276 | |||
diff --git a/src/scalarproduct/scalarproduct.h b/src/scalarproduct/scalarproduct.h index 5d6b82a35..43a866cf1 100644 --- a/src/scalarproduct/scalarproduct.h +++ b/src/scalarproduct/scalarproduct.h | |||
@@ -33,6 +33,20 @@ | |||
33 | extern "C" | 33 | extern "C" |
34 | { | 34 | { |
35 | #endif | 35 | #endif |
36 | /////////////////////////////////////////////////////////////////////////////// | ||
37 | // Defines | ||
38 | /////////////////////////////////////////////////////////////////////////////// | ||
39 | /** | ||
40 | * Length of the key used for encryption | ||
41 | */ | ||
42 | #define KEYBITS 2048 | ||
43 | |||
44 | /** | ||
45 | * When performing our crypto, we may add two encrypted values with each | ||
46 | * a maximal length of GNUNET_CRYPTO_RSA_DATA_ENCODING_LENGTH. | ||
47 | * thus we can receive a slightly longer element (+1 byte) | ||
48 | */ | ||
49 | #define PAILLIER_ELEMENT_LENGTH (2*KEYBITS/8 +1) | ||
36 | 50 | ||
37 | /////////////////////////////////////////////////////////////////////////////// | 51 | /////////////////////////////////////////////////////////////////////////////// |
38 | // Scalar Product Message Types | 52 | // Scalar Product Message Types |