diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-10-05 15:09:28 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-10-05 15:09:28 +0200 |
commit | c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207 (patch) | |
tree | cac3ce030d77b4cbe7c7dc62ed58cfe6d24f73e1 /src/credential/credential_api.c | |
parent | fbb71d527c7d6babf269a8fefce1db291b9f7068 (diff) | |
download | gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.tar.gz gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.zip |
global reindent, now with uncrustify hook enabled
Diffstat (limited to 'src/credential/credential_api.c')
-rw-r--r-- | src/credential/credential_api.c | 358 |
1 files changed, 183 insertions, 175 deletions
diff --git a/src/credential/credential_api.c b/src/credential/credential_api.c index dc1052484..3cbaf6c21 100644 --- a/src/credential/credential_api.c +++ b/src/credential/credential_api.c | |||
@@ -35,12 +35,13 @@ | |||
35 | #include "gnunet_identity_service.h" | 35 | #include "gnunet_identity_service.h" |
36 | 36 | ||
37 | 37 | ||
38 | #define LOG(kind, ...) GNUNET_log_from(kind, "credential-api", __VA_ARGS__) | 38 | #define LOG(kind, ...) GNUNET_log_from (kind, "credential-api", __VA_ARGS__) |
39 | 39 | ||
40 | /** | 40 | /** |
41 | * Handle to a verify request | 41 | * Handle to a verify request |
42 | */ | 42 | */ |
43 | struct GNUNET_CREDENTIAL_Request { | 43 | struct GNUNET_CREDENTIAL_Request |
44 | { | ||
44 | /** | 45 | /** |
45 | * DLL | 46 | * DLL |
46 | */ | 47 | */ |
@@ -81,7 +82,8 @@ struct GNUNET_CREDENTIAL_Request { | |||
81 | /** | 82 | /** |
82 | * Connection to the CREDENTIAL service. | 83 | * Connection to the CREDENTIAL service. |
83 | */ | 84 | */ |
84 | struct GNUNET_CREDENTIAL_Handle { | 85 | struct GNUNET_CREDENTIAL_Handle |
86 | { | ||
85 | /** | 87 | /** |
86 | * Configuration to use. | 88 | * Configuration to use. |
87 | */ | 89 | */ |
@@ -125,7 +127,7 @@ struct GNUNET_CREDENTIAL_Handle { | |||
125 | * @param handle the handle to the CREDENTIAL service | 127 | * @param handle the handle to the CREDENTIAL service |
126 | */ | 128 | */ |
127 | static void | 129 | static void |
128 | reconnect(struct GNUNET_CREDENTIAL_Handle *handle); | 130 | reconnect (struct GNUNET_CREDENTIAL_Handle *handle); |
129 | 131 | ||
130 | 132 | ||
131 | /** | 133 | /** |
@@ -134,12 +136,12 @@ reconnect(struct GNUNET_CREDENTIAL_Handle *handle); | |||
134 | * @param cls the handle | 136 | * @param cls the handle |
135 | */ | 137 | */ |
136 | static void | 138 | static void |
137 | reconnect_task(void *cls) | 139 | reconnect_task (void *cls) |
138 | { | 140 | { |
139 | struct GNUNET_CREDENTIAL_Handle *handle = cls; | 141 | struct GNUNET_CREDENTIAL_Handle *handle = cls; |
140 | 142 | ||
141 | handle->reconnect_task = NULL; | 143 | handle->reconnect_task = NULL; |
142 | reconnect(handle); | 144 | reconnect (handle); |
143 | } | 145 | } |
144 | 146 | ||
145 | 147 | ||
@@ -149,16 +151,16 @@ reconnect_task(void *cls) | |||
149 | * @param handle our handle | 151 | * @param handle our handle |
150 | */ | 152 | */ |
151 | static void | 153 | static void |
152 | force_reconnect(struct GNUNET_CREDENTIAL_Handle *handle) | 154 | force_reconnect (struct GNUNET_CREDENTIAL_Handle *handle) |
153 | { | 155 | { |
154 | GNUNET_MQ_destroy(handle->mq); | 156 | GNUNET_MQ_destroy (handle->mq); |
155 | handle->mq = NULL; | 157 | handle->mq = NULL; |
156 | handle->reconnect_backoff | 158 | handle->reconnect_backoff |
157 | = GNUNET_TIME_STD_BACKOFF(handle->reconnect_backoff); | 159 | = GNUNET_TIME_STD_BACKOFF (handle->reconnect_backoff); |
158 | handle->reconnect_task | 160 | handle->reconnect_task |
159 | = GNUNET_SCHEDULER_add_delayed(handle->reconnect_backoff, | 161 | = GNUNET_SCHEDULER_add_delayed (handle->reconnect_backoff, |
160 | &reconnect_task, | 162 | &reconnect_task, |
161 | handle); | 163 | handle); |
162 | } | 164 | } |
163 | 165 | ||
164 | 166 | ||
@@ -171,12 +173,12 @@ force_reconnect(struct GNUNET_CREDENTIAL_Handle *handle) | |||
171 | * @param error error code | 173 | * @param error error code |
172 | */ | 174 | */ |
173 | static void | 175 | static void |
174 | mq_error_handler(void *cls, | 176 | mq_error_handler (void *cls, |
175 | enum GNUNET_MQ_Error error) | 177 | enum GNUNET_MQ_Error error) |
176 | { | 178 | { |
177 | struct GNUNET_CREDENTIAL_Handle *handle = cls; | 179 | struct GNUNET_CREDENTIAL_Handle *handle = cls; |
178 | 180 | ||
179 | force_reconnect(handle); | 181 | force_reconnect (handle); |
180 | } | 182 | } |
181 | 183 | ||
182 | /** | 184 | /** |
@@ -186,10 +188,10 @@ mq_error_handler(void *cls, | |||
186 | * @param vr_msg the incoming message | 188 | * @param vr_msg the incoming message |
187 | */ | 189 | */ |
188 | static int | 190 | static int |
189 | check_result(void *cls, | 191 | check_result (void *cls, |
190 | const struct DelegationChainResultMessage *vr_msg) | 192 | const struct DelegationChainResultMessage *vr_msg) |
191 | { | 193 | { |
192 | //TODO | 194 | // TODO |
193 | return GNUNET_OK; | 195 | return GNUNET_OK; |
194 | } | 196 | } |
195 | 197 | ||
@@ -201,22 +203,22 @@ check_result(void *cls, | |||
201 | * @param vr_msg the incoming message | 203 | * @param vr_msg the incoming message |
202 | */ | 204 | */ |
203 | static void | 205 | static void |
204 | handle_result(void *cls, | 206 | handle_result (void *cls, |
205 | const struct DelegationChainResultMessage *vr_msg) | 207 | const struct DelegationChainResultMessage *vr_msg) |
206 | { | 208 | { |
207 | struct GNUNET_CREDENTIAL_Handle *handle = cls; | 209 | struct GNUNET_CREDENTIAL_Handle *handle = cls; |
208 | uint32_t r_id = ntohl(vr_msg->id); | 210 | uint32_t r_id = ntohl (vr_msg->id); |
209 | struct GNUNET_CREDENTIAL_Request *vr; | 211 | struct GNUNET_CREDENTIAL_Request *vr; |
210 | size_t mlen = ntohs(vr_msg->header.size) - sizeof(*vr_msg); | 212 | size_t mlen = ntohs (vr_msg->header.size) - sizeof(*vr_msg); |
211 | uint32_t d_count = ntohl(vr_msg->d_count); | 213 | uint32_t d_count = ntohl (vr_msg->d_count); |
212 | uint32_t c_count = ntohl(vr_msg->c_count); | 214 | uint32_t c_count = ntohl (vr_msg->c_count); |
213 | struct GNUNET_CREDENTIAL_Delegation d_chain[d_count]; | 215 | struct GNUNET_CREDENTIAL_Delegation d_chain[d_count]; |
214 | struct GNUNET_CREDENTIAL_Credential creds[c_count]; | 216 | struct GNUNET_CREDENTIAL_Credential creds[c_count]; |
215 | GNUNET_CREDENTIAL_CredentialResultProcessor proc; | 217 | GNUNET_CREDENTIAL_CredentialResultProcessor proc; |
216 | void *proc_cls; | 218 | void *proc_cls; |
217 | 219 | ||
218 | LOG(GNUNET_ERROR_TYPE_DEBUG, | 220 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
219 | "Received verify reply from CREDENTIAL service\n"); | 221 | "Received verify reply from CREDENTIAL service\n"); |
220 | for (vr = handle->request_head; NULL != vr; vr = vr->next) | 222 | for (vr = handle->request_head; NULL != vr; vr = vr->next) |
221 | if (vr->r_id == r_id) | 223 | if (vr->r_id == r_id) |
222 | break; | 224 | break; |
@@ -224,34 +226,36 @@ handle_result(void *cls, | |||
224 | return; | 226 | return; |
225 | proc = vr->verify_proc; | 227 | proc = vr->verify_proc; |
226 | proc_cls = vr->proc_cls; | 228 | proc_cls = vr->proc_cls; |
227 | GNUNET_CONTAINER_DLL_remove(handle->request_head, | 229 | GNUNET_CONTAINER_DLL_remove (handle->request_head, |
228 | handle->request_tail, | 230 | handle->request_tail, |
229 | vr); | 231 | vr); |
230 | GNUNET_MQ_discard(vr->env); | 232 | GNUNET_MQ_discard (vr->env); |
231 | GNUNET_free(vr); | 233 | GNUNET_free (vr); |
232 | GNUNET_assert(GNUNET_OK == | 234 | GNUNET_assert (GNUNET_OK == |
233 | GNUNET_CREDENTIAL_delegation_chain_deserialize(mlen, | 235 | GNUNET_CREDENTIAL_delegation_chain_deserialize (mlen, |
234 | (const char*)&vr_msg[1], | 236 | (const |
235 | d_count, | 237 | char*) &vr_msg |
236 | d_chain, | 238 | [1], |
237 | c_count, | 239 | d_count, |
238 | creds)); | 240 | d_chain, |
239 | if (GNUNET_NO == ntohl(vr_msg->cred_found)) | 241 | c_count, |
240 | { | 242 | creds)); |
241 | proc(proc_cls, | 243 | if (GNUNET_NO == ntohl (vr_msg->cred_found)) |
242 | 0, | 244 | { |
243 | NULL, | 245 | proc (proc_cls, |
244 | 0, | 246 | 0, |
245 | NULL); // TODO | 247 | NULL, |
246 | } | 248 | 0, |
249 | NULL); // TODO | ||
250 | } | ||
247 | else | 251 | else |
248 | { | 252 | { |
249 | proc(proc_cls, | 253 | proc (proc_cls, |
250 | d_count, | 254 | d_count, |
251 | d_chain, | 255 | d_chain, |
252 | c_count, | 256 | c_count, |
253 | creds); | 257 | creds); |
254 | } | 258 | } |
255 | } | 259 | } |
256 | 260 | ||
257 | 261 | ||
@@ -261,34 +265,34 @@ handle_result(void *cls, | |||
261 | * @param handle the handle to the CREDENTIAL service | 265 | * @param handle the handle to the CREDENTIAL service |
262 | */ | 266 | */ |
263 | static void | 267 | static void |
264 | reconnect(struct GNUNET_CREDENTIAL_Handle *handle) | 268 | reconnect (struct GNUNET_CREDENTIAL_Handle *handle) |
265 | { | 269 | { |
266 | struct GNUNET_MQ_MessageHandler handlers[] = { | 270 | struct GNUNET_MQ_MessageHandler handlers[] = { |
267 | GNUNET_MQ_hd_var_size(result, | 271 | GNUNET_MQ_hd_var_size (result, |
268 | GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY_RESULT, | 272 | GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY_RESULT, |
269 | struct DelegationChainResultMessage, | 273 | struct DelegationChainResultMessage, |
270 | handle), | 274 | handle), |
271 | GNUNET_MQ_hd_var_size(result, | 275 | GNUNET_MQ_hd_var_size (result, |
272 | GNUNET_MESSAGE_TYPE_CREDENTIAL_COLLECT_RESULT, | 276 | GNUNET_MESSAGE_TYPE_CREDENTIAL_COLLECT_RESULT, |
273 | struct DelegationChainResultMessage, | 277 | struct DelegationChainResultMessage, |
274 | handle), | 278 | handle), |
275 | GNUNET_MQ_handler_end() | 279 | GNUNET_MQ_handler_end () |
276 | }; | 280 | }; |
277 | struct GNUNET_CREDENTIAL_Request *vr; | 281 | struct GNUNET_CREDENTIAL_Request *vr; |
278 | 282 | ||
279 | GNUNET_assert(NULL == handle->mq); | 283 | GNUNET_assert (NULL == handle->mq); |
280 | LOG(GNUNET_ERROR_TYPE_DEBUG, | 284 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
281 | "Trying to connect to CREDENTIAL\n"); | 285 | "Trying to connect to CREDENTIAL\n"); |
282 | handle->mq = GNUNET_CLIENT_connect(handle->cfg, | 286 | handle->mq = GNUNET_CLIENT_connect (handle->cfg, |
283 | "credential", | 287 | "credential", |
284 | handlers, | 288 | handlers, |
285 | &mq_error_handler, | 289 | &mq_error_handler, |
286 | handle); | 290 | handle); |
287 | if (NULL == handle->mq) | 291 | if (NULL == handle->mq) |
288 | return; | 292 | return; |
289 | for (vr = handle->request_head; NULL != vr; vr = vr->next) | 293 | for (vr = handle->request_head; NULL != vr; vr = vr->next) |
290 | GNUNET_MQ_send_copy(handle->mq, | 294 | GNUNET_MQ_send_copy (handle->mq, |
291 | vr->env); | 295 | vr->env); |
292 | } | 296 | } |
293 | 297 | ||
294 | 298 | ||
@@ -299,18 +303,18 @@ reconnect(struct GNUNET_CREDENTIAL_Handle *handle) | |||
299 | * @return handle to the CREDENTIAL service, or NULL on error | 303 | * @return handle to the CREDENTIAL service, or NULL on error |
300 | */ | 304 | */ |
301 | struct GNUNET_CREDENTIAL_Handle * | 305 | struct GNUNET_CREDENTIAL_Handle * |
302 | GNUNET_CREDENTIAL_connect(const struct GNUNET_CONFIGURATION_Handle *cfg) | 306 | GNUNET_CREDENTIAL_connect (const struct GNUNET_CONFIGURATION_Handle *cfg) |
303 | { | 307 | { |
304 | struct GNUNET_CREDENTIAL_Handle *handle; | 308 | struct GNUNET_CREDENTIAL_Handle *handle; |
305 | 309 | ||
306 | handle = GNUNET_new(struct GNUNET_CREDENTIAL_Handle); | 310 | handle = GNUNET_new (struct GNUNET_CREDENTIAL_Handle); |
307 | handle->cfg = cfg; | 311 | handle->cfg = cfg; |
308 | reconnect(handle); | 312 | reconnect (handle); |
309 | if (NULL == handle->mq) | 313 | if (NULL == handle->mq) |
310 | { | 314 | { |
311 | GNUNET_free(handle); | 315 | GNUNET_free (handle); |
312 | return NULL; | 316 | return NULL; |
313 | } | 317 | } |
314 | return handle; | 318 | return handle; |
315 | } | 319 | } |
316 | 320 | ||
@@ -321,20 +325,20 @@ GNUNET_CREDENTIAL_connect(const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
321 | * @param handle handle of the CREDENTIAL connection to stop | 325 | * @param handle handle of the CREDENTIAL connection to stop |
322 | */ | 326 | */ |
323 | void | 327 | void |
324 | GNUNET_CREDENTIAL_disconnect(struct GNUNET_CREDENTIAL_Handle *handle) | 328 | GNUNET_CREDENTIAL_disconnect (struct GNUNET_CREDENTIAL_Handle *handle) |
325 | { | 329 | { |
326 | if (NULL != handle->mq) | 330 | if (NULL != handle->mq) |
327 | { | 331 | { |
328 | GNUNET_MQ_destroy(handle->mq); | 332 | GNUNET_MQ_destroy (handle->mq); |
329 | handle->mq = NULL; | 333 | handle->mq = NULL; |
330 | } | 334 | } |
331 | if (NULL != handle->reconnect_task) | 335 | if (NULL != handle->reconnect_task) |
332 | { | 336 | { |
333 | GNUNET_SCHEDULER_cancel(handle->reconnect_task); | 337 | GNUNET_SCHEDULER_cancel (handle->reconnect_task); |
334 | handle->reconnect_task = NULL; | 338 | handle->reconnect_task = NULL; |
335 | } | 339 | } |
336 | GNUNET_assert(NULL == handle->request_head); | 340 | GNUNET_assert (NULL == handle->request_head); |
337 | GNUNET_free(handle); | 341 | GNUNET_free (handle); |
338 | } | 342 | } |
339 | 343 | ||
340 | 344 | ||
@@ -344,15 +348,15 @@ GNUNET_CREDENTIAL_disconnect(struct GNUNET_CREDENTIAL_Handle *handle) | |||
344 | * @param lr the verify request to cancel | 348 | * @param lr the verify request to cancel |
345 | */ | 349 | */ |
346 | void | 350 | void |
347 | GNUNET_CREDENTIAL_request_cancel(struct GNUNET_CREDENTIAL_Request *lr) | 351 | GNUNET_CREDENTIAL_request_cancel (struct GNUNET_CREDENTIAL_Request *lr) |
348 | { | 352 | { |
349 | struct GNUNET_CREDENTIAL_Handle *handle = lr->credential_handle; | 353 | struct GNUNET_CREDENTIAL_Handle *handle = lr->credential_handle; |
350 | 354 | ||
351 | GNUNET_CONTAINER_DLL_remove(handle->request_head, | 355 | GNUNET_CONTAINER_DLL_remove (handle->request_head, |
352 | handle->request_tail, | 356 | handle->request_tail, |
353 | lr); | 357 | lr); |
354 | GNUNET_MQ_discard(lr->env); | 358 | GNUNET_MQ_discard (lr->env); |
355 | GNUNET_free(lr); | 359 | GNUNET_free (lr); |
356 | } | 360 | } |
357 | 361 | ||
358 | 362 | ||
@@ -370,12 +374,14 @@ GNUNET_CREDENTIAL_request_cancel(struct GNUNET_CREDENTIAL_Request *lr) | |||
370 | * @return handle to the queued request | 374 | * @return handle to the queued request |
371 | */ | 375 | */ |
372 | struct GNUNET_CREDENTIAL_Request* | 376 | struct GNUNET_CREDENTIAL_Request* |
373 | GNUNET_CREDENTIAL_collect(struct GNUNET_CREDENTIAL_Handle *handle, | 377 | GNUNET_CREDENTIAL_collect (struct GNUNET_CREDENTIAL_Handle *handle, |
374 | const struct GNUNET_CRYPTO_EcdsaPublicKey *issuer_key, | 378 | const struct |
375 | const char *issuer_attribute, | 379 | GNUNET_CRYPTO_EcdsaPublicKey *issuer_key, |
376 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *subject_key, | 380 | const char *issuer_attribute, |
377 | GNUNET_CREDENTIAL_CredentialResultProcessor proc, | 381 | const struct |
378 | void *proc_cls) | 382 | GNUNET_CRYPTO_EcdsaPrivateKey *subject_key, |
383 | GNUNET_CREDENTIAL_CredentialResultProcessor proc, | ||
384 | void *proc_cls) | ||
379 | { | 385 | { |
380 | /* IPC to shorten credential names, return shorten_handle */ | 386 | /* IPC to shorten credential names, return shorten_handle */ |
381 | struct CollectMessage *c_msg; | 387 | struct CollectMessage *c_msg; |
@@ -383,42 +389,42 @@ GNUNET_CREDENTIAL_collect(struct GNUNET_CREDENTIAL_Handle *handle, | |||
383 | size_t nlen; | 389 | size_t nlen; |
384 | 390 | ||
385 | if (NULL == issuer_attribute) | 391 | if (NULL == issuer_attribute) |
386 | { | 392 | { |
387 | GNUNET_break(0); | 393 | GNUNET_break (0); |
388 | return NULL; | 394 | return NULL; |
389 | } | 395 | } |
390 | 396 | ||
391 | //DEBUG LOG | 397 | // DEBUG LOG |
392 | LOG(GNUNET_ERROR_TYPE_DEBUG, | 398 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
393 | "Trying to collect `%s' in CREDENTIAL\n", | 399 | "Trying to collect `%s' in CREDENTIAL\n", |
394 | issuer_attribute); | 400 | issuer_attribute); |
395 | nlen = strlen(issuer_attribute) + 1; | 401 | nlen = strlen (issuer_attribute) + 1; |
396 | if (nlen >= GNUNET_MAX_MESSAGE_SIZE - sizeof(*vr)) | 402 | if (nlen >= GNUNET_MAX_MESSAGE_SIZE - sizeof(*vr)) |
397 | { | 403 | { |
398 | GNUNET_break(0); | 404 | GNUNET_break (0); |
399 | return NULL; | 405 | return NULL; |
400 | } | 406 | } |
401 | vr = GNUNET_new(struct GNUNET_CREDENTIAL_Request); | 407 | vr = GNUNET_new (struct GNUNET_CREDENTIAL_Request); |
402 | vr->credential_handle = handle; | 408 | vr->credential_handle = handle; |
403 | vr->verify_proc = proc; | 409 | vr->verify_proc = proc; |
404 | vr->proc_cls = proc_cls; | 410 | vr->proc_cls = proc_cls; |
405 | vr->r_id = handle->r_id_gen++; | 411 | vr->r_id = handle->r_id_gen++; |
406 | vr->env = GNUNET_MQ_msg_extra(c_msg, | 412 | vr->env = GNUNET_MQ_msg_extra (c_msg, |
407 | nlen, | 413 | nlen, |
408 | GNUNET_MESSAGE_TYPE_CREDENTIAL_COLLECT); | 414 | GNUNET_MESSAGE_TYPE_CREDENTIAL_COLLECT); |
409 | c_msg->id = htonl(vr->r_id); | 415 | c_msg->id = htonl (vr->r_id); |
410 | c_msg->subject_key = *subject_key; | 416 | c_msg->subject_key = *subject_key; |
411 | c_msg->issuer_key = *issuer_key; | 417 | c_msg->issuer_key = *issuer_key; |
412 | c_msg->issuer_attribute_len = htons(strlen(issuer_attribute)); | 418 | c_msg->issuer_attribute_len = htons (strlen (issuer_attribute)); |
413 | GNUNET_memcpy(&c_msg[1], | 419 | GNUNET_memcpy (&c_msg[1], |
414 | issuer_attribute, | 420 | issuer_attribute, |
415 | strlen(issuer_attribute)); | 421 | strlen (issuer_attribute)); |
416 | GNUNET_CONTAINER_DLL_insert(handle->request_head, | 422 | GNUNET_CONTAINER_DLL_insert (handle->request_head, |
417 | handle->request_tail, | 423 | handle->request_tail, |
418 | vr); | 424 | vr); |
419 | if (NULL != handle->mq) | 425 | if (NULL != handle->mq) |
420 | GNUNET_MQ_send_copy(handle->mq, | 426 | GNUNET_MQ_send_copy (handle->mq, |
421 | vr->env); | 427 | vr->env); |
422 | return vr; | 428 | return vr; |
423 | } | 429 | } |
424 | /** | 430 | /** |
@@ -440,14 +446,16 @@ GNUNET_CREDENTIAL_collect(struct GNUNET_CREDENTIAL_Handle *handle, | |||
440 | * @return handle to the queued request | 446 | * @return handle to the queued request |
441 | */ | 447 | */ |
442 | struct GNUNET_CREDENTIAL_Request* | 448 | struct GNUNET_CREDENTIAL_Request* |
443 | GNUNET_CREDENTIAL_verify(struct GNUNET_CREDENTIAL_Handle *handle, | 449 | GNUNET_CREDENTIAL_verify (struct GNUNET_CREDENTIAL_Handle *handle, |
444 | const struct GNUNET_CRYPTO_EcdsaPublicKey *issuer_key, | 450 | const struct GNUNET_CRYPTO_EcdsaPublicKey *issuer_key, |
445 | const char *issuer_attribute, | 451 | const char *issuer_attribute, |
446 | const struct GNUNET_CRYPTO_EcdsaPublicKey *subject_key, | 452 | const struct |
447 | uint32_t credential_count, | 453 | GNUNET_CRYPTO_EcdsaPublicKey *subject_key, |
448 | const struct GNUNET_CREDENTIAL_Credential *credentials, | 454 | uint32_t credential_count, |
449 | GNUNET_CREDENTIAL_CredentialResultProcessor proc, | 455 | const struct |
450 | void *proc_cls) | 456 | GNUNET_CREDENTIAL_Credential *credentials, |
457 | GNUNET_CREDENTIAL_CredentialResultProcessor proc, | ||
458 | void *proc_cls) | ||
451 | { | 459 | { |
452 | /* IPC to shorten credential names, return shorten_handle */ | 460 | /* IPC to shorten credential names, return shorten_handle */ |
453 | struct VerifyMessage *v_msg; | 461 | struct VerifyMessage *v_msg; |
@@ -455,52 +463,52 @@ GNUNET_CREDENTIAL_verify(struct GNUNET_CREDENTIAL_Handle *handle, | |||
455 | size_t nlen; | 463 | size_t nlen; |
456 | size_t clen; | 464 | size_t clen; |
457 | 465 | ||
458 | if (NULL == issuer_attribute || NULL == credentials) | 466 | if ((NULL == issuer_attribute)||(NULL == credentials)) |
459 | { | 467 | { |
460 | GNUNET_break(0); | 468 | GNUNET_break (0); |
461 | return NULL; | 469 | return NULL; |
462 | } | 470 | } |
463 | 471 | ||
464 | clen = GNUNET_CREDENTIAL_credentials_get_size(credential_count, | 472 | clen = GNUNET_CREDENTIAL_credentials_get_size (credential_count, |
465 | credentials); | 473 | credentials); |
466 | 474 | ||
467 | //DEBUG LOG | 475 | // DEBUG LOG |
468 | LOG(GNUNET_ERROR_TYPE_DEBUG, | 476 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
469 | "Trying to verify `%s' in CREDENTIAL\n", | 477 | "Trying to verify `%s' in CREDENTIAL\n", |
470 | issuer_attribute); | 478 | issuer_attribute); |
471 | nlen = strlen(issuer_attribute) + 1 + clen; | 479 | nlen = strlen (issuer_attribute) + 1 + clen; |
472 | if (nlen >= GNUNET_MAX_MESSAGE_SIZE - sizeof(*vr)) | 480 | if (nlen >= GNUNET_MAX_MESSAGE_SIZE - sizeof(*vr)) |
473 | { | 481 | { |
474 | GNUNET_break(0); | 482 | GNUNET_break (0); |
475 | return NULL; | 483 | return NULL; |
476 | } | 484 | } |
477 | vr = GNUNET_new(struct GNUNET_CREDENTIAL_Request); | 485 | vr = GNUNET_new (struct GNUNET_CREDENTIAL_Request); |
478 | vr->credential_handle = handle; | 486 | vr->credential_handle = handle; |
479 | vr->verify_proc = proc; | 487 | vr->verify_proc = proc; |
480 | vr->proc_cls = proc_cls; | 488 | vr->proc_cls = proc_cls; |
481 | vr->r_id = handle->r_id_gen++; | 489 | vr->r_id = handle->r_id_gen++; |
482 | vr->env = GNUNET_MQ_msg_extra(v_msg, | 490 | vr->env = GNUNET_MQ_msg_extra (v_msg, |
483 | nlen, | 491 | nlen, |
484 | GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY); | 492 | GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY); |
485 | v_msg->id = htonl(vr->r_id); | 493 | v_msg->id = htonl (vr->r_id); |
486 | v_msg->subject_key = *subject_key; | 494 | v_msg->subject_key = *subject_key; |
487 | v_msg->c_count = htonl(credential_count); | 495 | v_msg->c_count = htonl (credential_count); |
488 | v_msg->issuer_key = *issuer_key; | 496 | v_msg->issuer_key = *issuer_key; |
489 | v_msg->issuer_attribute_len = htons(strlen(issuer_attribute)); | 497 | v_msg->issuer_attribute_len = htons (strlen (issuer_attribute)); |
490 | GNUNET_memcpy(&v_msg[1], | 498 | GNUNET_memcpy (&v_msg[1], |
491 | issuer_attribute, | 499 | issuer_attribute, |
492 | strlen(issuer_attribute)); | 500 | strlen (issuer_attribute)); |
493 | GNUNET_CREDENTIAL_credentials_serialize(credential_count, | 501 | GNUNET_CREDENTIAL_credentials_serialize (credential_count, |
494 | credentials, | 502 | credentials, |
495 | clen, | 503 | clen, |
496 | ((char*)&v_msg[1]) | 504 | ((char*) &v_msg[1]) |
497 | + strlen(issuer_attribute) + 1); | 505 | + strlen (issuer_attribute) + 1); |
498 | GNUNET_CONTAINER_DLL_insert(handle->request_head, | 506 | GNUNET_CONTAINER_DLL_insert (handle->request_head, |
499 | handle->request_tail, | 507 | handle->request_tail, |
500 | vr); | 508 | vr); |
501 | if (NULL != handle->mq) | 509 | if (NULL != handle->mq) |
502 | GNUNET_MQ_send_copy(handle->mq, | 510 | GNUNET_MQ_send_copy (handle->mq, |
503 | vr->env); | 511 | vr->env); |
504 | return vr; | 512 | return vr; |
505 | } | 513 | } |
506 | 514 | ||