diff options
Diffstat (limited to 'src/revocation/revocation_api.c')
-rw-r--r-- | src/revocation/revocation_api.c | 298 |
1 files changed, 146 insertions, 152 deletions
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c index 90f15a17a..091f6ae85 100644 --- a/src/revocation/revocation_api.c +++ b/src/revocation/revocation_api.c | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
@@ -33,9 +33,7 @@ | |||
33 | /** | 33 | /** |
34 | * Handle for the key revocation query. | 34 | * Handle for the key revocation query. |
35 | */ | 35 | */ |
36 | struct GNUNET_REVOCATION_Query | 36 | struct GNUNET_REVOCATION_Query { |
37 | { | ||
38 | |||
39 | /** | 37 | /** |
40 | * Message queue to the service. | 38 | * Message queue to the service. |
41 | */ | 39 | */ |
@@ -50,7 +48,6 @@ struct GNUNET_REVOCATION_Query | |||
50 | * Closure for @e func. | 48 | * Closure for @e func. |
51 | */ | 49 | */ |
52 | void *func_cls; | 50 | void *func_cls; |
53 | |||
54 | }; | 51 | }; |
55 | 52 | ||
56 | 53 | ||
@@ -64,16 +61,16 @@ struct GNUNET_REVOCATION_Query | |||
64 | * @param error error code | 61 | * @param error error code |
65 | */ | 62 | */ |
66 | static void | 63 | static void |
67 | query_mq_error_handler (void *cls, | 64 | query_mq_error_handler(void *cls, |
68 | enum GNUNET_MQ_Error error) | 65 | enum GNUNET_MQ_Error error) |
69 | { | 66 | { |
70 | struct GNUNET_REVOCATION_Query *q = cls; | 67 | struct GNUNET_REVOCATION_Query *q = cls; |
71 | 68 | ||
72 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 69 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
73 | "Revocation query MQ error\n"); | 70 | "Revocation query MQ error\n"); |
74 | q->func (q->func_cls, | 71 | q->func(q->func_cls, |
75 | GNUNET_SYSERR); | 72 | GNUNET_SYSERR); |
76 | GNUNET_REVOCATION_query_cancel (q); | 73 | GNUNET_REVOCATION_query_cancel(q); |
77 | } | 74 | } |
78 | 75 | ||
79 | 76 | ||
@@ -84,17 +81,17 @@ query_mq_error_handler (void *cls, | |||
84 | * @param qrm response we got | 81 | * @param qrm response we got |
85 | */ | 82 | */ |
86 | static void | 83 | static void |
87 | handle_revocation_query_response (void *cls, | 84 | handle_revocation_query_response(void *cls, |
88 | const struct QueryResponseMessage *qrm) | 85 | const struct QueryResponseMessage *qrm) |
89 | { | 86 | { |
90 | struct GNUNET_REVOCATION_Query *q = cls; | 87 | struct GNUNET_REVOCATION_Query *q = cls; |
91 | 88 | ||
92 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 89 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
93 | "Revocation query result: %d\n", | 90 | "Revocation query result: %d\n", |
94 | (uint32_t) ntohl (qrm->is_valid)); | 91 | (uint32_t)ntohl(qrm->is_valid)); |
95 | q->func (q->func_cls, | 92 | q->func(q->func_cls, |
96 | ntohl (qrm->is_valid)); | 93 | ntohl(qrm->is_valid)); |
97 | GNUNET_REVOCATION_query_cancel (q); | 94 | GNUNET_REVOCATION_query_cancel(q); |
98 | } | 95 | } |
99 | 96 | ||
100 | 97 | ||
@@ -108,41 +105,41 @@ handle_revocation_query_response (void *cls, | |||
108 | * @return handle to use in #GNUNET_REVOCATION_query_cancel to stop REVOCATION from invoking the callback | 105 | * @return handle to use in #GNUNET_REVOCATION_query_cancel to stop REVOCATION from invoking the callback |
109 | */ | 106 | */ |
110 | struct GNUNET_REVOCATION_Query * | 107 | struct GNUNET_REVOCATION_Query * |
111 | GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg, | 108 | GNUNET_REVOCATION_query(const struct GNUNET_CONFIGURATION_Handle *cfg, |
112 | const struct GNUNET_CRYPTO_EcdsaPublicKey *key, | 109 | const struct GNUNET_CRYPTO_EcdsaPublicKey *key, |
113 | GNUNET_REVOCATION_Callback func, | 110 | GNUNET_REVOCATION_Callback func, |
114 | void *func_cls) | 111 | void *func_cls) |
115 | { | 112 | { |
116 | struct GNUNET_REVOCATION_Query *q | 113 | struct GNUNET_REVOCATION_Query *q |
117 | = GNUNET_new (struct GNUNET_REVOCATION_Query); | 114 | = GNUNET_new(struct GNUNET_REVOCATION_Query); |
118 | struct GNUNET_MQ_MessageHandler handlers[] = { | 115 | struct GNUNET_MQ_MessageHandler handlers[] = { |
119 | GNUNET_MQ_hd_fixed_size (revocation_query_response, | 116 | GNUNET_MQ_hd_fixed_size(revocation_query_response, |
120 | GNUNET_MESSAGE_TYPE_REVOCATION_QUERY_RESPONSE, | 117 | GNUNET_MESSAGE_TYPE_REVOCATION_QUERY_RESPONSE, |
121 | struct QueryResponseMessage, | 118 | struct QueryResponseMessage, |
122 | q), | 119 | q), |
123 | GNUNET_MQ_handler_end () | 120 | GNUNET_MQ_handler_end() |
124 | }; | 121 | }; |
125 | struct QueryMessage *qm; | 122 | struct QueryMessage *qm; |
126 | struct GNUNET_MQ_Envelope *env; | 123 | struct GNUNET_MQ_Envelope *env; |
127 | 124 | ||
128 | q->mq = GNUNET_CLIENT_connect (cfg, | 125 | q->mq = GNUNET_CLIENT_connect(cfg, |
129 | "revocation", | 126 | "revocation", |
130 | handlers, | 127 | handlers, |
131 | &query_mq_error_handler, | 128 | &query_mq_error_handler, |
132 | q); | 129 | q); |
133 | if (NULL == q->mq) | 130 | if (NULL == q->mq) |
134 | { | 131 | { |
135 | GNUNET_free (q); | 132 | GNUNET_free(q); |
136 | return NULL; | 133 | return NULL; |
137 | } | 134 | } |
138 | q->func = func; | 135 | q->func = func; |
139 | q->func_cls = func_cls; | 136 | q->func_cls = func_cls; |
140 | env = GNUNET_MQ_msg (qm, | 137 | env = GNUNET_MQ_msg(qm, |
141 | GNUNET_MESSAGE_TYPE_REVOCATION_QUERY); | 138 | GNUNET_MESSAGE_TYPE_REVOCATION_QUERY); |
142 | qm->reserved = htonl (0); | 139 | qm->reserved = htonl(0); |
143 | qm->key = *key; | 140 | qm->key = *key; |
144 | GNUNET_MQ_send (q->mq, | 141 | GNUNET_MQ_send(q->mq, |
145 | env); | 142 | env); |
146 | return q; | 143 | return q; |
147 | } | 144 | } |
148 | 145 | ||
@@ -153,23 +150,21 @@ GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
153 | * @param q query to cancel | 150 | * @param q query to cancel |
154 | */ | 151 | */ |
155 | void | 152 | void |
156 | GNUNET_REVOCATION_query_cancel (struct GNUNET_REVOCATION_Query *q) | 153 | GNUNET_REVOCATION_query_cancel(struct GNUNET_REVOCATION_Query *q) |
157 | { | 154 | { |
158 | if (NULL != q->mq) | 155 | if (NULL != q->mq) |
159 | { | 156 | { |
160 | GNUNET_MQ_destroy (q->mq); | 157 | GNUNET_MQ_destroy(q->mq); |
161 | q->mq = NULL; | 158 | q->mq = NULL; |
162 | } | 159 | } |
163 | GNUNET_free (q); | 160 | GNUNET_free(q); |
164 | } | 161 | } |
165 | 162 | ||
166 | 163 | ||
167 | /** | 164 | /** |
168 | * Handle for the key revocation operation. | 165 | * Handle for the key revocation operation. |
169 | */ | 166 | */ |
170 | struct GNUNET_REVOCATION_Handle | 167 | struct GNUNET_REVOCATION_Handle { |
171 | { | ||
172 | |||
173 | /** | 168 | /** |
174 | * Message queue to the service. | 169 | * Message queue to the service. |
175 | */ | 170 | */ |
@@ -184,7 +179,6 @@ struct GNUNET_REVOCATION_Handle | |||
184 | * Closure for @e func. | 179 | * Closure for @e func. |
185 | */ | 180 | */ |
186 | void *func_cls; | 181 | void *func_cls; |
187 | |||
188 | }; | 182 | }; |
189 | 183 | ||
190 | 184 | ||
@@ -198,16 +192,16 @@ struct GNUNET_REVOCATION_Handle | |||
198 | * @param error error code | 192 | * @param error error code |
199 | */ | 193 | */ |
200 | static void | 194 | static void |
201 | revocation_mq_error_handler (void *cls, | 195 | revocation_mq_error_handler(void *cls, |
202 | enum GNUNET_MQ_Error error) | 196 | enum GNUNET_MQ_Error error) |
203 | { | 197 | { |
204 | struct GNUNET_REVOCATION_Handle *h = cls; | 198 | struct GNUNET_REVOCATION_Handle *h = cls; |
205 | 199 | ||
206 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 200 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, |
207 | "Revocation MQ error\n"); | 201 | "Revocation MQ error\n"); |
208 | h->func (h->func_cls, | 202 | h->func(h->func_cls, |
209 | GNUNET_SYSERR); | 203 | GNUNET_SYSERR); |
210 | GNUNET_REVOCATION_revoke_cancel (h); | 204 | GNUNET_REVOCATION_revoke_cancel(h); |
211 | } | 205 | } |
212 | 206 | ||
213 | 207 | ||
@@ -218,17 +212,17 @@ revocation_mq_error_handler (void *cls, | |||
218 | * @param rrm response we got | 212 | * @param rrm response we got |
219 | */ | 213 | */ |
220 | static void | 214 | static void |
221 | handle_revocation_response (void *cls, | 215 | handle_revocation_response(void *cls, |
222 | const struct RevocationResponseMessage *rrm) | 216 | const struct RevocationResponseMessage *rrm) |
223 | { | 217 | { |
224 | struct GNUNET_REVOCATION_Handle *h = cls; | 218 | struct GNUNET_REVOCATION_Handle *h = cls; |
225 | 219 | ||
226 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 220 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
227 | "Revocation transmission result: %d\n", | 221 | "Revocation transmission result: %d\n", |
228 | (uint32_t) ntohl (rrm->is_valid)); | 222 | (uint32_t)ntohl(rrm->is_valid)); |
229 | h->func (h->func_cls, | 223 | h->func(h->func_cls, |
230 | ntohl (rrm->is_valid)); | 224 | ntohl(rrm->is_valid)); |
231 | GNUNET_REVOCATION_revoke_cancel (h); | 225 | GNUNET_REVOCATION_revoke_cancel(h); |
232 | } | 226 | } |
233 | 227 | ||
234 | 228 | ||
@@ -248,64 +242,64 @@ handle_revocation_response (void *cls, | |||
248 | * @return handle to use in #GNUNET_REVOCATION_revoke_cancel to stop REVOCATION from invoking the callback | 242 | * @return handle to use in #GNUNET_REVOCATION_revoke_cancel to stop REVOCATION from invoking the callback |
249 | */ | 243 | */ |
250 | struct GNUNET_REVOCATION_Handle * | 244 | struct GNUNET_REVOCATION_Handle * |
251 | GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, | 245 | GNUNET_REVOCATION_revoke(const struct GNUNET_CONFIGURATION_Handle *cfg, |
252 | const struct GNUNET_CRYPTO_EcdsaPublicKey *key, | 246 | const struct GNUNET_CRYPTO_EcdsaPublicKey *key, |
253 | const struct GNUNET_CRYPTO_EcdsaSignature *sig, | 247 | const struct GNUNET_CRYPTO_EcdsaSignature *sig, |
254 | uint64_t pow, | 248 | uint64_t pow, |
255 | GNUNET_REVOCATION_Callback func, | 249 | GNUNET_REVOCATION_Callback func, |
256 | void *func_cls) | 250 | void *func_cls) |
257 | { | 251 | { |
258 | struct GNUNET_REVOCATION_Handle *h | 252 | struct GNUNET_REVOCATION_Handle *h |
259 | = GNUNET_new (struct GNUNET_REVOCATION_Handle); | 253 | = GNUNET_new(struct GNUNET_REVOCATION_Handle); |
260 | struct GNUNET_MQ_MessageHandler handlers[] = { | 254 | struct GNUNET_MQ_MessageHandler handlers[] = { |
261 | GNUNET_MQ_hd_fixed_size (revocation_response, | 255 | GNUNET_MQ_hd_fixed_size(revocation_response, |
262 | GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE_RESPONSE, | 256 | GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE_RESPONSE, |
263 | struct RevocationResponseMessage, | 257 | struct RevocationResponseMessage, |
264 | h), | 258 | h), |
265 | GNUNET_MQ_handler_end () | 259 | GNUNET_MQ_handler_end() |
266 | }; | 260 | }; |
267 | unsigned long long matching_bits; | 261 | unsigned long long matching_bits; |
268 | struct RevokeMessage *rm; | 262 | struct RevokeMessage *rm; |
269 | struct GNUNET_MQ_Envelope *env; | 263 | struct GNUNET_MQ_Envelope *env; |
270 | 264 | ||
271 | if ( (GNUNET_OK == | 265 | if ((GNUNET_OK == |
272 | GNUNET_CONFIGURATION_get_value_number (cfg, | 266 | GNUNET_CONFIGURATION_get_value_number(cfg, |
273 | "REVOCATION", | 267 | "REVOCATION", |
274 | "WORKBITS", | 268 | "WORKBITS", |
275 | &matching_bits)) && | 269 | &matching_bits)) && |
276 | (GNUNET_YES != | 270 | (GNUNET_YES != |
277 | GNUNET_REVOCATION_check_pow (key, | 271 | GNUNET_REVOCATION_check_pow(key, |
278 | pow, | 272 | pow, |
279 | (unsigned int) matching_bits)) ) | 273 | (unsigned int)matching_bits))) |
280 | { | 274 | { |
281 | GNUNET_break (0); | 275 | GNUNET_break(0); |
282 | GNUNET_free (h); | 276 | GNUNET_free(h); |
283 | return NULL; | 277 | return NULL; |
284 | } | 278 | } |
285 | 279 | ||
286 | h->mq = GNUNET_CLIENT_connect (cfg, | 280 | h->mq = GNUNET_CLIENT_connect(cfg, |
287 | "revocation", | 281 | "revocation", |
288 | handlers, | 282 | handlers, |
289 | &revocation_mq_error_handler, | 283 | &revocation_mq_error_handler, |
290 | h); | 284 | h); |
291 | if (NULL == h->mq) | 285 | if (NULL == h->mq) |
292 | { | 286 | { |
293 | GNUNET_free (h); | 287 | GNUNET_free(h); |
294 | return NULL; | 288 | return NULL; |
295 | } | 289 | } |
296 | h->func = func; | 290 | h->func = func; |
297 | h->func_cls = func_cls; | 291 | h->func_cls = func_cls; |
298 | env = GNUNET_MQ_msg (rm, | 292 | env = GNUNET_MQ_msg(rm, |
299 | GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE); | 293 | GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE); |
300 | rm->reserved = htonl (0); | 294 | rm->reserved = htonl(0); |
301 | rm->proof_of_work = pow; | 295 | rm->proof_of_work = pow; |
302 | rm->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION); | 296 | rm->purpose.purpose = htonl(GNUNET_SIGNATURE_PURPOSE_REVOCATION); |
303 | rm->purpose.size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + | 297 | rm->purpose.size = htonl(sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose) + |
304 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); | 298 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)); |
305 | rm->public_key = *key; | 299 | rm->public_key = *key; |
306 | rm->signature = *sig; | 300 | rm->signature = *sig; |
307 | GNUNET_MQ_send (h->mq, | 301 | GNUNET_MQ_send(h->mq, |
308 | env); | 302 | env); |
309 | return h; | 303 | return h; |
310 | } | 304 | } |
311 | 305 | ||
@@ -316,14 +310,14 @@ GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
316 | * @param h operation to cancel | 310 | * @param h operation to cancel |
317 | */ | 311 | */ |
318 | void | 312 | void |
319 | GNUNET_REVOCATION_revoke_cancel (struct GNUNET_REVOCATION_Handle *h) | 313 | GNUNET_REVOCATION_revoke_cancel(struct GNUNET_REVOCATION_Handle *h) |
320 | { | 314 | { |
321 | if (NULL != h->mq) | 315 | if (NULL != h->mq) |
322 | { | 316 | { |
323 | GNUNET_MQ_destroy (h->mq); | 317 | GNUNET_MQ_destroy(h->mq); |
324 | h->mq = NULL; | 318 | h->mq = NULL; |
325 | } | 319 | } |
326 | GNUNET_free (h); | 320 | GNUNET_free(h); |
327 | } | 321 | } |
328 | 322 | ||
329 | 323 | ||
@@ -335,18 +329,18 @@ GNUNET_REVOCATION_revoke_cancel (struct GNUNET_REVOCATION_Handle *h) | |||
335 | * @param result where to write the resulting hash | 329 | * @param result where to write the resulting hash |
336 | */ | 330 | */ |
337 | static void | 331 | static void |
338 | pow_hash (const void *buf, | 332 | pow_hash(const void *buf, |
339 | size_t buf_len, | 333 | size_t buf_len, |
340 | struct GNUNET_HashCode *result) | 334 | struct GNUNET_HashCode *result) |
341 | { | 335 | { |
342 | GNUNET_break (0 == | 336 | GNUNET_break(0 == |
343 | gcry_kdf_derive (buf, buf_len, | 337 | gcry_kdf_derive(buf, buf_len, |
344 | GCRY_KDF_SCRYPT, | 338 | GCRY_KDF_SCRYPT, |
345 | 1 /* subalgo */, | 339 | 1 /* subalgo */, |
346 | "gnunet-revocation-proof-of-work", | 340 | "gnunet-revocation-proof-of-work", |
347 | strlen ("gnunet-revocation-proof-of-work"), | 341 | strlen("gnunet-revocation-proof-of-work"), |
348 | 2 /* iterations; keep cost of individual op small */, | 342 | 2 /* iterations; keep cost of individual op small */, |
349 | sizeof (struct GNUNET_HashCode), result)); | 343 | sizeof(struct GNUNET_HashCode), result)); |
350 | } | 344 | } |
351 | 345 | ||
352 | 346 | ||
@@ -357,12 +351,12 @@ pow_hash (const void *buf, | |||
357 | * @return the number of leading zero bits. | 351 | * @return the number of leading zero bits. |
358 | */ | 352 | */ |
359 | static unsigned int | 353 | static unsigned int |
360 | count_leading_zeroes (const struct GNUNET_HashCode *hash) | 354 | count_leading_zeroes(const struct GNUNET_HashCode *hash) |
361 | { | 355 | { |
362 | unsigned int hash_count; | 356 | unsigned int hash_count; |
363 | 357 | ||
364 | hash_count = 0; | 358 | hash_count = 0; |
365 | while ((0 == GNUNET_CRYPTO_hash_get_bit (hash, hash_count))) | 359 | while ((0 == GNUNET_CRYPTO_hash_get_bit(hash, hash_count))) |
366 | hash_count++; | 360 | hash_count++; |
367 | return hash_count; | 361 | return hash_count; |
368 | } | 362 | } |
@@ -378,19 +372,19 @@ count_leading_zeroes (const struct GNUNET_HashCode *hash) | |||
378 | * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not | 372 | * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not |
379 | */ | 373 | */ |
380 | int | 374 | int |
381 | GNUNET_REVOCATION_check_pow (const struct GNUNET_CRYPTO_EcdsaPublicKey *key, | 375 | GNUNET_REVOCATION_check_pow(const struct GNUNET_CRYPTO_EcdsaPublicKey *key, |
382 | uint64_t pow, | 376 | uint64_t pow, |
383 | unsigned int matching_bits) | 377 | unsigned int matching_bits) |
384 | { | 378 | { |
385 | char buf[sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) + | 379 | char buf[sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) + |
386 | sizeof (pow)] GNUNET_ALIGN; | 380 | sizeof(pow)] GNUNET_ALIGN; |
387 | struct GNUNET_HashCode result; | 381 | struct GNUNET_HashCode result; |
388 | 382 | ||
389 | GNUNET_memcpy (buf, &pow, sizeof (pow)); | 383 | GNUNET_memcpy(buf, &pow, sizeof(pow)); |
390 | GNUNET_memcpy (&buf[sizeof (pow)], key, | 384 | GNUNET_memcpy(&buf[sizeof(pow)], key, |
391 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); | 385 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)); |
392 | pow_hash (buf, sizeof (buf), &result); | 386 | pow_hash(buf, sizeof(buf), &result); |
393 | return (count_leading_zeroes (&result) >= | 387 | return (count_leading_zeroes(&result) >= |
394 | matching_bits) ? GNUNET_YES : GNUNET_NO; | 388 | matching_bits) ? GNUNET_YES : GNUNET_NO; |
395 | } | 389 | } |
396 | 390 | ||
@@ -402,19 +396,19 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_CRYPTO_EcdsaPublicKey *key, | |||
402 | * @param sig where to write the revocation signature | 396 | * @param sig where to write the revocation signature |
403 | */ | 397 | */ |
404 | void | 398 | void |
405 | GNUNET_REVOCATION_sign_revocation (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | 399 | GNUNET_REVOCATION_sign_revocation(const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, |
406 | struct GNUNET_CRYPTO_EcdsaSignature *sig) | 400 | struct GNUNET_CRYPTO_EcdsaSignature *sig) |
407 | { | 401 | { |
408 | struct RevokeMessage rm; | 402 | struct RevokeMessage rm; |
409 | 403 | ||
410 | rm.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION); | 404 | rm.purpose.purpose = htonl(GNUNET_SIGNATURE_PURPOSE_REVOCATION); |
411 | rm.purpose.size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + | 405 | rm.purpose.size = htonl(sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose) + |
412 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); | 406 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)); |
413 | GNUNET_CRYPTO_ecdsa_key_get_public (key, &rm.public_key); | 407 | GNUNET_CRYPTO_ecdsa_key_get_public(key, &rm.public_key); |
414 | GNUNET_assert (GNUNET_OK == | 408 | GNUNET_assert(GNUNET_OK == |
415 | GNUNET_CRYPTO_ecdsa_sign (key, | 409 | GNUNET_CRYPTO_ecdsa_sign(key, |
416 | &rm.purpose, | 410 | &rm.purpose, |
417 | sig)); | 411 | sig)); |
418 | } | 412 | } |
419 | 413 | ||
420 | 414 | ||