aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/common_logging.c4
-rw-r--r--src/util/container_bloomfilter.c16
-rw-r--r--src/util/container_multihashmap.c34
-rw-r--r--src/util/crypto_hash.c72
-rw-r--r--src/util/crypto_ksk.c30
-rw-r--r--src/util/crypto_rsa.c10
-rw-r--r--src/util/perf_crypto_hash.c10
-rw-r--r--src/util/pseudonym.c48
-rw-r--r--src/util/test_container_bloomfilter.c8
-rw-r--r--src/util/test_container_multihashmap.c4
-rw-r--r--src/util/test_crypto_hash.c20
-rw-r--r--src/util/test_crypto_ksk.c6
-rw-r--r--src/util/test_pseudonym.c26
13 files changed, 144 insertions, 144 deletions
diff --git a/src/util/common_logging.c b/src/util/common_logging.c
index 2c0fd57a8..82878a02a 100644
--- a/src/util/common_logging.c
+++ b/src/util/common_logging.c
@@ -903,7 +903,7 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind)
903 * @return string form; will be overwritten by next call to GNUNET_h2s. 903 * @return string form; will be overwritten by next call to GNUNET_h2s.
904 */ 904 */
905const char * 905const char *
906GNUNET_h2s (const GNUNET_HashCode * hc) 906GNUNET_h2s (const struct GNUNET_HashCode * hc)
907{ 907{
908 static struct GNUNET_CRYPTO_HashAsciiEncoded ret; 908 static struct GNUNET_CRYPTO_HashAsciiEncoded ret;
909 909
@@ -921,7 +921,7 @@ GNUNET_h2s (const GNUNET_HashCode * hc)
921 * @return string form; will be overwritten by next call to GNUNET_h2s_full. 921 * @return string form; will be overwritten by next call to GNUNET_h2s_full.
922 */ 922 */
923const char * 923const char *
924GNUNET_h2s_full (const GNUNET_HashCode * hc) 924GNUNET_h2s_full (const struct GNUNET_HashCode * hc)
925{ 925{
926 static struct GNUNET_CRYPTO_HashAsciiEncoded ret; 926 static struct GNUNET_CRYPTO_HashAsciiEncoded ret;
927 927
diff --git a/src/util/container_bloomfilter.c b/src/util/container_bloomfilter.c
index 8c226f67d..8d0852fc9 100644
--- a/src/util/container_bloomfilter.c
+++ b/src/util/container_bloomfilter.c
@@ -340,9 +340,9 @@ typedef int (*BitIterator) (void *cls,
340 */ 340 */
341static void 341static void
342iterateBits (const struct GNUNET_CONTAINER_BloomFilter *bf, 342iterateBits (const struct GNUNET_CONTAINER_BloomFilter *bf,
343 BitIterator callback, void *arg, const GNUNET_HashCode * key) 343 BitIterator callback, void *arg, const struct GNUNET_HashCode * key)
344{ 344{
345 GNUNET_HashCode tmp[2]; 345 struct GNUNET_HashCode tmp[2];
346 int bitCount; 346 int bitCount;
347 unsigned int round; 347 unsigned int round;
348 unsigned int slot = 0; 348 unsigned int slot = 0;
@@ -354,7 +354,7 @@ iterateBits (const struct GNUNET_CONTAINER_BloomFilter *bf,
354 GNUNET_assert (bf->bitArraySize * 8LL > bf->bitArraySize); 354 GNUNET_assert (bf->bitArraySize * 8LL > bf->bitArraySize);
355 while (bitCount > 0) 355 while (bitCount > 0)
356 { 356 {
357 while (slot < (sizeof (GNUNET_HashCode) / sizeof (uint32_t))) 357 while (slot < (sizeof (struct GNUNET_HashCode) / sizeof (uint32_t)))
358 { 358 {
359 if (GNUNET_YES != 359 if (GNUNET_YES !=
360 callback (arg, bf, 360 callback (arg, bf,
@@ -368,7 +368,7 @@ iterateBits (const struct GNUNET_CONTAINER_BloomFilter *bf,
368 } 368 }
369 if (bitCount > 0) 369 if (bitCount > 0)
370 { 370 {
371 GNUNET_CRYPTO_hash (&tmp[round & 1], sizeof (GNUNET_HashCode), 371 GNUNET_CRYPTO_hash (&tmp[round & 1], sizeof (struct GNUNET_HashCode),
372 &tmp[(round + 1) & 1]); 372 &tmp[(round + 1) & 1]);
373 round++; 373 round++;
374 slot = 0; 374 slot = 0;
@@ -696,7 +696,7 @@ GNUNET_CONTAINER_bloomfilter_clear (struct GNUNET_CONTAINER_BloomFilter *bf)
696 */ 696 */
697int 697int
698GNUNET_CONTAINER_bloomfilter_test (const struct GNUNET_CONTAINER_BloomFilter 698GNUNET_CONTAINER_bloomfilter_test (const struct GNUNET_CONTAINER_BloomFilter
699 *bf, const GNUNET_HashCode * e) 699 *bf, const struct GNUNET_HashCode * e)
700{ 700{
701 int res; 701 int res;
702 702
@@ -716,7 +716,7 @@ GNUNET_CONTAINER_bloomfilter_test (const struct GNUNET_CONTAINER_BloomFilter
716 */ 716 */
717void 717void
718GNUNET_CONTAINER_bloomfilter_add (struct GNUNET_CONTAINER_BloomFilter *bf, 718GNUNET_CONTAINER_bloomfilter_add (struct GNUNET_CONTAINER_BloomFilter *bf,
719 const GNUNET_HashCode * e) 719 const struct GNUNET_HashCode * e)
720{ 720{
721 if (NULL == bf) 721 if (NULL == bf)
722 return; 722 return;
@@ -801,7 +801,7 @@ GNUNET_CONTAINER_bloomfilter_or2 (struct GNUNET_CONTAINER_BloomFilter *bf,
801 */ 801 */
802void 802void
803GNUNET_CONTAINER_bloomfilter_remove (struct GNUNET_CONTAINER_BloomFilter *bf, 803GNUNET_CONTAINER_bloomfilter_remove (struct GNUNET_CONTAINER_BloomFilter *bf,
804 const GNUNET_HashCode * e) 804 const struct GNUNET_HashCode * e)
805{ 805{
806 if (NULL == bf) 806 if (NULL == bf)
807 return; 807 return;
@@ -827,7 +827,7 @@ GNUNET_CONTAINER_bloomfilter_resize (struct GNUNET_CONTAINER_BloomFilter *bf,
827 void *iterator_cls, size_t size, 827 void *iterator_cls, size_t size,
828 unsigned int k) 828 unsigned int k)
829{ 829{
830 GNUNET_HashCode hc; 830 struct GNUNET_HashCode hc;
831 unsigned int i; 831 unsigned int i;
832 832
833 GNUNET_free (bf->bitArray); 833 GNUNET_free (bf->bitArray);
diff --git a/src/util/container_multihashmap.c b/src/util/container_multihashmap.c
index 7e53a6440..ada98251c 100644
--- a/src/util/container_multihashmap.c
+++ b/src/util/container_multihashmap.c
@@ -39,7 +39,7 @@ struct MapEntry
39 /** 39 /**
40 * Key for the entry. 40 * Key for the entry.
41 */ 41 */
42 GNUNET_HashCode key; 42 struct GNUNET_HashCode key;
43 43
44 /** 44 /**
45 * Value of the entry. 45 * Value of the entry.
@@ -130,7 +130,7 @@ GNUNET_CONTAINER_multihashmap_destroy (struct GNUNET_CONTAINER_MultiHashMap
130 */ 130 */
131static unsigned int 131static unsigned int
132idx_of (const struct GNUNET_CONTAINER_MultiHashMap *m, 132idx_of (const struct GNUNET_CONTAINER_MultiHashMap *m,
133 const GNUNET_HashCode * key) 133 const struct GNUNET_HashCode * key)
134{ 134{
135 GNUNET_assert (m != NULL); 135 GNUNET_assert (m != NULL);
136 return (*(unsigned int *) key) % m->map_length; 136 return (*(unsigned int *) key) % m->map_length;
@@ -163,14 +163,14 @@ GNUNET_CONTAINER_multihashmap_size (const struct GNUNET_CONTAINER_MultiHashMap
163 */ 163 */
164void * 164void *
165GNUNET_CONTAINER_multihashmap_get (const struct GNUNET_CONTAINER_MultiHashMap 165GNUNET_CONTAINER_multihashmap_get (const struct GNUNET_CONTAINER_MultiHashMap
166 *map, const GNUNET_HashCode * key) 166 *map, const struct GNUNET_HashCode * key)
167{ 167{
168 struct MapEntry *e; 168 struct MapEntry *e;
169 169
170 e = map->map[idx_of (map, key)]; 170 e = map->map[idx_of (map, key)];
171 while (e != NULL) 171 while (e != NULL)
172 { 172 {
173 if (0 == memcmp (key, &e->key, sizeof (GNUNET_HashCode))) 173 if (0 == memcmp (key, &e->key, sizeof (struct GNUNET_HashCode)))
174 return e->value; 174 return e->value;
175 e = e->next; 175 e = e->next;
176 } 176 }
@@ -197,7 +197,7 @@ GNUNET_CONTAINER_multihashmap_iterate (const struct
197 unsigned int i; 197 unsigned int i;
198 struct MapEntry *e; 198 struct MapEntry *e;
199 struct MapEntry *n; 199 struct MapEntry *n;
200 GNUNET_HashCode kc; 200 struct GNUNET_HashCode kc;
201 201
202 count = 0; 202 count = 0;
203 GNUNET_assert (map != NULL); 203 GNUNET_assert (map != NULL);
@@ -233,7 +233,7 @@ GNUNET_CONTAINER_multihashmap_iterate (const struct
233 */ 233 */
234int 234int
235GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map, 235GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map,
236 const GNUNET_HashCode * key, void *value) 236 const struct GNUNET_HashCode * key, void *value)
237{ 237{
238 struct MapEntry *e; 238 struct MapEntry *e;
239 struct MapEntry *p; 239 struct MapEntry *p;
@@ -244,7 +244,7 @@ GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map,
244 e = map->map[i]; 244 e = map->map[i];
245 while (e != NULL) 245 while (e != NULL)
246 { 246 {
247 if ((0 == memcmp (key, &e->key, sizeof (GNUNET_HashCode))) && 247 if ((0 == memcmp (key, &e->key, sizeof (struct GNUNET_HashCode))) &&
248 (value == e->value)) 248 (value == e->value))
249 { 249 {
250 if (p == NULL) 250 if (p == NULL)
@@ -272,7 +272,7 @@ GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map,
272 */ 272 */
273int 273int
274GNUNET_CONTAINER_multihashmap_remove_all (struct GNUNET_CONTAINER_MultiHashMap 274GNUNET_CONTAINER_multihashmap_remove_all (struct GNUNET_CONTAINER_MultiHashMap
275 *map, const GNUNET_HashCode * key) 275 *map, const struct GNUNET_HashCode * key)
276{ 276{
277 struct MapEntry *e; 277 struct MapEntry *e;
278 struct MapEntry *p; 278 struct MapEntry *p;
@@ -285,7 +285,7 @@ GNUNET_CONTAINER_multihashmap_remove_all (struct GNUNET_CONTAINER_MultiHashMap
285 e = map->map[i]; 285 e = map->map[i];
286 while (e != NULL) 286 while (e != NULL)
287 { 287 {
288 if (0 == memcmp (key, &e->key, sizeof (GNUNET_HashCode))) 288 if (0 == memcmp (key, &e->key, sizeof (struct GNUNET_HashCode)))
289 { 289 {
290 if (p == NULL) 290 if (p == NULL)
291 map->map[i] = e->next; 291 map->map[i] = e->next;
@@ -321,14 +321,14 @@ GNUNET_CONTAINER_multihashmap_remove_all (struct GNUNET_CONTAINER_MultiHashMap
321int 321int
322GNUNET_CONTAINER_multihashmap_contains (const struct 322GNUNET_CONTAINER_multihashmap_contains (const struct
323 GNUNET_CONTAINER_MultiHashMap *map, 323 GNUNET_CONTAINER_MultiHashMap *map,
324 const GNUNET_HashCode * key) 324 const struct GNUNET_HashCode * key)
325{ 325{
326 struct MapEntry *e; 326 struct MapEntry *e;
327 327
328 e = map->map[idx_of (map, key)]; 328 e = map->map[idx_of (map, key)];
329 while (e != NULL) 329 while (e != NULL)
330 { 330 {
331 if (0 == memcmp (key, &e->key, sizeof (GNUNET_HashCode))) 331 if (0 == memcmp (key, &e->key, sizeof (struct GNUNET_HashCode)))
332 return GNUNET_YES; 332 return GNUNET_YES;
333 e = e->next; 333 e = e->next;
334 } 334 }
@@ -349,7 +349,7 @@ GNUNET_CONTAINER_multihashmap_contains (const struct
349int 349int
350GNUNET_CONTAINER_multihashmap_contains_value (const struct 350GNUNET_CONTAINER_multihashmap_contains_value (const struct
351 GNUNET_CONTAINER_MultiHashMap 351 GNUNET_CONTAINER_MultiHashMap
352 *map, const GNUNET_HashCode * key, 352 *map, const struct GNUNET_HashCode * key,
353 const void *value) 353 const void *value)
354{ 354{
355 struct MapEntry *e; 355 struct MapEntry *e;
@@ -357,7 +357,7 @@ GNUNET_CONTAINER_multihashmap_contains_value (const struct
357 e = map->map[idx_of (map, key)]; 357 e = map->map[idx_of (map, key)];
358 while (e != NULL) 358 while (e != NULL)
359 { 359 {
360 if ((0 == memcmp (key, &e->key, sizeof (GNUNET_HashCode))) && 360 if ((0 == memcmp (key, &e->key, sizeof (struct GNUNET_HashCode))) &&
361 (e->value == value)) 361 (e->value == value))
362 return GNUNET_YES; 362 return GNUNET_YES;
363 e = e->next; 363 e = e->next;
@@ -416,7 +416,7 @@ grow (struct GNUNET_CONTAINER_MultiHashMap *map)
416 */ 416 */
417int 417int
418GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map, 418GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map,
419 const GNUNET_HashCode * key, void *value, 419 const struct GNUNET_HashCode * key, void *value,
420 enum GNUNET_CONTAINER_MultiHashMapOption opt) 420 enum GNUNET_CONTAINER_MultiHashMapOption opt)
421{ 421{
422 struct MapEntry *e; 422 struct MapEntry *e;
@@ -429,7 +429,7 @@ GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map,
429 e = map->map[i]; 429 e = map->map[i];
430 while (e != NULL) 430 while (e != NULL)
431 { 431 {
432 if (0 == memcmp (key, &e->key, sizeof (GNUNET_HashCode))) 432 if (0 == memcmp (key, &e->key, sizeof (struct GNUNET_HashCode)))
433 { 433 {
434 if (opt == GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY) 434 if (opt == GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)
435 return GNUNET_SYSERR; 435 return GNUNET_SYSERR;
@@ -467,7 +467,7 @@ GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map,
467int 467int
468GNUNET_CONTAINER_multihashmap_get_multiple (const struct 468GNUNET_CONTAINER_multihashmap_get_multiple (const struct
469 GNUNET_CONTAINER_MultiHashMap *map, 469 GNUNET_CONTAINER_MultiHashMap *map,
470 const GNUNET_HashCode * key, 470 const struct GNUNET_HashCode * key,
471 GNUNET_CONTAINER_HashMapIterator it, 471 GNUNET_CONTAINER_HashMapIterator it,
472 void *it_cls) 472 void *it_cls)
473{ 473{
@@ -480,7 +480,7 @@ GNUNET_CONTAINER_multihashmap_get_multiple (const struct
480 while (NULL != (e = n)) 480 while (NULL != (e = n))
481 { 481 {
482 n = e->next; 482 n = e->next;
483 if (0 != memcmp (key, &e->key, sizeof (GNUNET_HashCode))) 483 if (0 != memcmp (key, &e->key, sizeof (struct GNUNET_HashCode)))
484 continue; 484 continue;
485 if ((it != NULL) && (GNUNET_OK != it (it_cls, key, e->value))) 485 if ((it != NULL) && (GNUNET_OK != it (it_cls, key, e->value)))
486 return GNUNET_SYSERR; 486 return GNUNET_SYSERR;
diff --git a/src/util/crypto_hash.c b/src/util/crypto_hash.c
index 4d957c00e..04225b3dc 100644
--- a/src/util/crypto_hash.c
+++ b/src/util/crypto_hash.c
@@ -49,7 +49,7 @@
49 * @param ret pointer to where to write the hashcode 49 * @param ret pointer to where to write the hashcode
50 */ 50 */
51void 51void
52GNUNET_CRYPTO_hash (const void *block, size_t size, GNUNET_HashCode * ret) 52GNUNET_CRYPTO_hash (const void *block, size_t size, struct GNUNET_HashCode * ret)
53{ 53{
54 gcry_md_hash_buffer (GCRY_MD_SHA512, ret, block, size); 54 gcry_md_hash_buffer (GCRY_MD_SHA512, ret, block, size);
55} 55}
@@ -140,7 +140,7 @@ struct GNUNET_CRYPTO_FileHashContext
140 */ 140 */
141static void 141static void
142file_hash_finish (struct GNUNET_CRYPTO_FileHashContext *fhc, 142file_hash_finish (struct GNUNET_CRYPTO_FileHashContext *fhc,
143 const GNUNET_HashCode * res) 143 const struct GNUNET_HashCode * res)
144{ 144{
145 fhc->callback (fhc->callback_cls, res); 145 fhc->callback (fhc->callback_cls, res);
146 GNUNET_free (fhc->filename); 146 GNUNET_free (fhc->filename);
@@ -161,7 +161,7 @@ static void
161file_hash_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 161file_hash_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
162{ 162{
163 struct GNUNET_CRYPTO_FileHashContext *fhc = cls; 163 struct GNUNET_CRYPTO_FileHashContext *fhc = cls;
164 GNUNET_HashCode *res; 164 struct GNUNET_HashCode *res;
165 size_t delta; 165 size_t delta;
166 166
167 fhc->task = GNUNET_SCHEDULER_NO_TASK; 167 fhc->task = GNUNET_SCHEDULER_NO_TASK;
@@ -179,7 +179,7 @@ file_hash_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
179 fhc->offset += delta; 179 fhc->offset += delta;
180 if (fhc->offset == fhc->fsize) 180 if (fhc->offset == fhc->fsize)
181 { 181 {
182 res = (GNUNET_HashCode *) gcry_md_read (fhc->md, GCRY_MD_SHA512); 182 res = (struct GNUNET_HashCode *) gcry_md_read (fhc->md, GCRY_MD_SHA512);
183 file_hash_finish (fhc, res); 183 file_hash_finish (fhc, res);
184 return; 184 return;
185 } 185 }
@@ -272,7 +272,7 @@ GNUNET_CRYPTO_hash_file_cancel (struct GNUNET_CRYPTO_FileHashContext *fhc)
272 * safely cast to char*, a '\\0' termination is set). 272 * safely cast to char*, a '\\0' termination is set).
273 */ 273 */
274void 274void
275GNUNET_CRYPTO_hash_to_enc (const GNUNET_HashCode * block, 275GNUNET_CRYPTO_hash_to_enc (const struct GNUNET_HashCode * block,
276 struct GNUNET_CRYPTO_HashAsciiEncoded *result) 276 struct GNUNET_CRYPTO_HashAsciiEncoded *result)
277{ 277{
278 char *np; 278 char *np;
@@ -296,7 +296,7 @@ GNUNET_CRYPTO_hash_to_enc (const GNUNET_HashCode * block,
296 */ 296 */
297int 297int
298GNUNET_CRYPTO_hash_from_string2 (const char *enc, size_t enclen, 298GNUNET_CRYPTO_hash_from_string2 (const char *enc, size_t enclen,
299 GNUNET_HashCode * result) 299 struct GNUNET_HashCode * result)
300{ 300{
301 char upper_enc[enclen]; 301 char upper_enc[enclen];
302 char* up_ptr = upper_enc; 302 char* up_ptr = upper_enc;
@@ -321,8 +321,8 @@ GNUNET_CRYPTO_hash_from_string2 (const char *enc, size_t enclen,
321 * hashcode proximity. 321 * hashcode proximity.
322 */ 322 */
323unsigned int 323unsigned int
324GNUNET_CRYPTO_hash_distance_u32 (const GNUNET_HashCode * a, 324GNUNET_CRYPTO_hash_distance_u32 (const struct GNUNET_HashCode * a,
325 const GNUNET_HashCode * b) 325 const struct GNUNET_HashCode * b)
326{ 326{
327 unsigned int x1 = (a->bits[1] - b->bits[1]) >> 16; 327 unsigned int x1 = (a->bits[1] - b->bits[1]) >> 16;
328 unsigned int x2 = (b->bits[1] - a->bits[1]) >> 16; 328 unsigned int x2 = (b->bits[1] - a->bits[1]) >> 16;
@@ -339,11 +339,11 @@ GNUNET_CRYPTO_hash_distance_u32 (const GNUNET_HashCode * a,
339 */ 339 */
340void 340void
341GNUNET_CRYPTO_hash_create_random (enum GNUNET_CRYPTO_Quality mode, 341GNUNET_CRYPTO_hash_create_random (enum GNUNET_CRYPTO_Quality mode,
342 GNUNET_HashCode * result) 342 struct GNUNET_HashCode * result)
343{ 343{
344 int i; 344 int i;
345 345
346 for (i = (sizeof (GNUNET_HashCode) / sizeof (uint32_t)) - 1; i >= 0; i--) 346 for (i = (sizeof (struct GNUNET_HashCode) / sizeof (uint32_t)) - 1; i >= 0; i--)
347 result->bits[i] = GNUNET_CRYPTO_random_u32 (mode, UINT32_MAX); 347 result->bits[i] = GNUNET_CRYPTO_random_u32 (mode, UINT32_MAX);
348} 348}
349 349
@@ -356,13 +356,13 @@ GNUNET_CRYPTO_hash_create_random (enum GNUNET_CRYPTO_Quality mode,
356 * @param result set to b - a 356 * @param result set to b - a
357 */ 357 */
358void 358void
359GNUNET_CRYPTO_hash_difference (const GNUNET_HashCode * a, 359GNUNET_CRYPTO_hash_difference (const struct GNUNET_HashCode * a,
360 const GNUNET_HashCode * b, 360 const struct GNUNET_HashCode * b,
361 GNUNET_HashCode * result) 361 struct GNUNET_HashCode * result)
362{ 362{
363 int i; 363 int i;
364 364
365 for (i = (sizeof (GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0; i--) 365 for (i = (sizeof (struct GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0; i--)
366 result->bits[i] = b->bits[i] - a->bits[i]; 366 result->bits[i] = b->bits[i] - a->bits[i];
367} 367}
368 368
@@ -375,12 +375,12 @@ GNUNET_CRYPTO_hash_difference (const GNUNET_HashCode * a,
375 * @param result set to a + delta 375 * @param result set to a + delta
376 */ 376 */
377void 377void
378GNUNET_CRYPTO_hash_sum (const GNUNET_HashCode * a, 378GNUNET_CRYPTO_hash_sum (const struct GNUNET_HashCode * a,
379 const GNUNET_HashCode * delta, GNUNET_HashCode * result) 379 const struct GNUNET_HashCode * delta, struct GNUNET_HashCode * result)
380{ 380{
381 int i; 381 int i;
382 382
383 for (i = (sizeof (GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0; i--) 383 for (i = (sizeof (struct GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0; i--)
384 result->bits[i] = delta->bits[i] + a->bits[i]; 384 result->bits[i] = delta->bits[i] + a->bits[i];
385} 385}
386 386
@@ -393,12 +393,12 @@ GNUNET_CRYPTO_hash_sum (const GNUNET_HashCode * a,
393 * @param result set to a ^ b 393 * @param result set to a ^ b
394 */ 394 */
395void 395void
396GNUNET_CRYPTO_hash_xor (const GNUNET_HashCode * a, const GNUNET_HashCode * b, 396GNUNET_CRYPTO_hash_xor (const struct GNUNET_HashCode * a, const struct GNUNET_HashCode * b,
397 GNUNET_HashCode * result) 397 struct GNUNET_HashCode * result)
398{ 398{
399 int i; 399 int i;
400 400
401 for (i = (sizeof (GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0; i--) 401 for (i = (sizeof (struct GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0; i--)
402 result->bits[i] = a->bits[i] ^ b->bits[i]; 402 result->bits[i] = a->bits[i] ^ b->bits[i];
403} 403}
404 404
@@ -411,11 +411,11 @@ GNUNET_CRYPTO_hash_xor (const GNUNET_HashCode * a, const GNUNET_HashCode * b,
411 * @param iv set to a valid initialization vector 411 * @param iv set to a valid initialization vector
412 */ 412 */
413void 413void
414GNUNET_CRYPTO_hash_to_aes_key (const GNUNET_HashCode * hc, 414GNUNET_CRYPTO_hash_to_aes_key (const struct GNUNET_HashCode * hc,
415 struct GNUNET_CRYPTO_AesSessionKey *skey, 415 struct GNUNET_CRYPTO_AesSessionKey *skey,
416 struct GNUNET_CRYPTO_AesInitializationVector *iv) 416 struct GNUNET_CRYPTO_AesInitializationVector *iv)
417{ 417{
418 GNUNET_assert (sizeof (GNUNET_HashCode) >= 418 GNUNET_assert (sizeof (struct GNUNET_HashCode) >=
419 GNUNET_CRYPTO_AES_KEY_LENGTH + 419 GNUNET_CRYPTO_AES_KEY_LENGTH +
420 sizeof (struct GNUNET_CRYPTO_AesInitializationVector)); 420 sizeof (struct GNUNET_CRYPTO_AesInitializationVector));
421 memcpy (skey, hc, GNUNET_CRYPTO_AES_KEY_LENGTH); 421 memcpy (skey, hc, GNUNET_CRYPTO_AES_KEY_LENGTH);
@@ -433,16 +433,16 @@ GNUNET_CRYPTO_hash_to_aes_key (const GNUNET_HashCode * hc,
433 * @return Bit \a bit from hashcode \a code, -1 for invalid index 433 * @return Bit \a bit from hashcode \a code, -1 for invalid index
434 */ 434 */
435int 435int
436GNUNET_CRYPTO_hash_get_bit (const GNUNET_HashCode * code, unsigned int bit) 436GNUNET_CRYPTO_hash_get_bit (const struct GNUNET_HashCode * code, unsigned int bit)
437{ 437{
438 GNUNET_assert (bit < 8 * sizeof (GNUNET_HashCode)); 438 GNUNET_assert (bit < 8 * sizeof (struct GNUNET_HashCode));
439 return (((unsigned char *) code)[bit >> 3] & (1 << (bit & 7))) > 0; 439 return (((unsigned char *) code)[bit >> 3] & (1 << (bit & 7))) > 0;
440} 440}
441 441
442 442
443/** 443/**
444 * Determine how many low order bits match in two 444 * Determine how many low order bits match in two
445 * GNUNET_HashCodes. i.e. - 010011 and 011111 share 445 * struct GNUNET_HashCodes. i.e. - 010011 and 011111 share
446 * the first two lowest order bits, and therefore the 446 * the first two lowest order bits, and therefore the
447 * return value is two (NOT XOR distance, nor how many 447 * return value is two (NOT XOR distance, nor how many
448 * bits match absolutely!). 448 * bits match absolutely!).
@@ -453,16 +453,16 @@ GNUNET_CRYPTO_hash_get_bit (const GNUNET_HashCode * code, unsigned int bit)
453 * @return the number of bits that match 453 * @return the number of bits that match
454 */ 454 */
455unsigned int 455unsigned int
456GNUNET_CRYPTO_hash_matching_bits (const GNUNET_HashCode * first, 456GNUNET_CRYPTO_hash_matching_bits (const struct GNUNET_HashCode * first,
457 const GNUNET_HashCode * second) 457 const struct GNUNET_HashCode * second)
458{ 458{
459 unsigned int i; 459 unsigned int i;
460 460
461 for (i = 0; i < sizeof (GNUNET_HashCode) * 8; i++) 461 for (i = 0; i < sizeof (struct GNUNET_HashCode) * 8; i++)
462 if (GNUNET_CRYPTO_hash_get_bit (first, i) != 462 if (GNUNET_CRYPTO_hash_get_bit (first, i) !=
463 GNUNET_CRYPTO_hash_get_bit (second, i)) 463 GNUNET_CRYPTO_hash_get_bit (second, i))
464 return i; 464 return i;
465 return sizeof (GNUNET_HashCode) * 8; 465 return sizeof (struct GNUNET_HashCode) * 8;
466} 466}
467 467
468 468
@@ -475,7 +475,7 @@ GNUNET_CRYPTO_hash_matching_bits (const GNUNET_HashCode * first,
475 * @return 1 if h1 > h2, -1 if h1 < h2 and 0 if h1 == h2. 475 * @return 1 if h1 > h2, -1 if h1 < h2 and 0 if h1 == h2.
476 */ 476 */
477int 477int
478GNUNET_CRYPTO_hash_cmp (const GNUNET_HashCode * h1, const GNUNET_HashCode * h2) 478GNUNET_CRYPTO_hash_cmp (const struct GNUNET_HashCode * h1, const struct GNUNET_HashCode * h2)
479{ 479{
480 unsigned int *i1; 480 unsigned int *i1;
481 unsigned int *i2; 481 unsigned int *i2;
@@ -483,7 +483,7 @@ GNUNET_CRYPTO_hash_cmp (const GNUNET_HashCode * h1, const GNUNET_HashCode * h2)
483 483
484 i1 = (unsigned int *) h1; 484 i1 = (unsigned int *) h1;
485 i2 = (unsigned int *) h2; 485 i2 = (unsigned int *) h2;
486 for (i = (sizeof (GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0; i--) 486 for (i = (sizeof (struct GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0; i--)
487 { 487 {
488 if (i1[i] > i2[i]) 488 if (i1[i] > i2[i])
489 return 1; 489 return 1;
@@ -504,15 +504,15 @@ GNUNET_CRYPTO_hash_cmp (const GNUNET_HashCode * h1, const GNUNET_HashCode * h2)
504 * @return -1 if h1 is closer, 1 if h2 is closer and 0 if h1==h2. 504 * @return -1 if h1 is closer, 1 if h2 is closer and 0 if h1==h2.
505 */ 505 */
506int 506int
507GNUNET_CRYPTO_hash_xorcmp (const GNUNET_HashCode * h1, 507GNUNET_CRYPTO_hash_xorcmp (const struct GNUNET_HashCode * h1,
508 const GNUNET_HashCode * h2, 508 const struct GNUNET_HashCode * h2,
509 const GNUNET_HashCode * target) 509 const struct GNUNET_HashCode * target)
510{ 510{
511 int i; 511 int i;
512 unsigned int d1; 512 unsigned int d1;
513 unsigned int d2; 513 unsigned int d2;
514 514
515 for (i = sizeof (GNUNET_HashCode) / sizeof (unsigned int) - 1; i >= 0; i--) 515 for (i = sizeof (struct GNUNET_HashCode) / sizeof (unsigned int) - 1; i >= 0; i--)
516 { 516 {
517 d1 = ((unsigned int *) h1)[i] ^ ((unsigned int *) target)[i]; 517 d1 = ((unsigned int *) h1)[i] ^ ((unsigned int *) target)[i];
518 d2 = ((unsigned int *) h2)[i] ^ ((unsigned int *) target)[i]; 518 d2 = ((unsigned int *) h2)[i] ^ ((unsigned int *) target)[i];
@@ -576,7 +576,7 @@ GNUNET_CRYPTO_hmac_derive_key_v (struct GNUNET_CRYPTO_AuthKey *key,
576void 576void
577GNUNET_CRYPTO_hmac (const struct GNUNET_CRYPTO_AuthKey *key, 577GNUNET_CRYPTO_hmac (const struct GNUNET_CRYPTO_AuthKey *key,
578 const void *plaintext, size_t plaintext_len, 578 const void *plaintext, size_t plaintext_len,
579 GNUNET_HashCode * hmac) 579 struct GNUNET_HashCode * hmac)
580{ 580{
581 gcry_md_hd_t md; 581 gcry_md_hd_t md;
582 const unsigned char *mc; 582 const unsigned char *mc;
diff --git a/src/util/crypto_ksk.c b/src/util/crypto_ksk.c
index 274457b61..0c091099e 100644
--- a/src/util/crypto_ksk.c
+++ b/src/util/crypto_ksk.c
@@ -70,11 +70,11 @@ struct GNUNET_CRYPTO_RsaPrivateKey
70 70
71 71
72static void 72static void
73mpz_randomize (gcry_mpi_t n, unsigned int nbits, GNUNET_HashCode * rnd) 73mpz_randomize (gcry_mpi_t n, unsigned int nbits, struct GNUNET_HashCode * rnd)
74{ 74{
75 GNUNET_HashCode hc; 75 struct GNUNET_HashCode hc;
76 GNUNET_HashCode tmp; 76 struct GNUNET_HashCode tmp;
77 int bits_per_hc = sizeof (GNUNET_HashCode) * 8; 77 int bits_per_hc = sizeof (struct GNUNET_HashCode) * 8;
78 int cnt; 78 int cnt;
79 int i; 79 int i;
80 80
@@ -88,8 +88,8 @@ mpz_randomize (gcry_mpi_t n, unsigned int nbits, GNUNET_HashCode * rnd)
88 int j; 88 int j;
89 89
90 if (i > 0) 90 if (i > 0)
91 GNUNET_CRYPTO_hash (&hc, sizeof (GNUNET_HashCode), &tmp); 91 GNUNET_CRYPTO_hash (&hc, sizeof (struct GNUNET_HashCode), &tmp);
92 for (j = 0; j < sizeof (GNUNET_HashCode) / sizeof (uint32_t); j++) 92 for (j = 0; j < sizeof (struct GNUNET_HashCode) / sizeof (uint32_t); j++)
93 { 93 {
94#if HAVE_GCRY_MPI_LSHIFT 94#if HAVE_GCRY_MPI_LSHIFT
95 gcry_mpi_lshift (n, n, sizeof (uint32_t) * 8); 95 gcry_mpi_lshift (n, n, sizeof (uint32_t) * 8);
@@ -101,7 +101,7 @@ mpz_randomize (gcry_mpi_t n, unsigned int nbits, GNUNET_HashCode * rnd)
101 } 101 }
102 hc = tmp; 102 hc = tmp;
103 } 103 }
104 GNUNET_CRYPTO_hash (&hc, sizeof (GNUNET_HashCode), rnd); 104 GNUNET_CRYPTO_hash (&hc, sizeof (struct GNUNET_HashCode), rnd);
105 i = gcry_mpi_get_nbits (n); 105 i = gcry_mpi_get_nbits (n);
106 while (i > nbits) 106 while (i > nbits)
107 gcry_mpi_clear_bit (n, --i); 107 gcry_mpi_clear_bit (n, --i);
@@ -137,7 +137,7 @@ mpz_tdiv_q_2exp (gcry_mpi_t q, gcry_mpi_t n, unsigned int b)
137 * Return true if n is probably a prime 137 * Return true if n is probably a prime
138 */ 138 */
139static int 139static int
140is_prime (gcry_mpi_t n, int steps, GNUNET_HashCode * hc) 140is_prime (gcry_mpi_t n, int steps, struct GNUNET_HashCode * hc)
141{ 141{
142 gcry_mpi_t x; 142 gcry_mpi_t x;
143 gcry_mpi_t y; 143 gcry_mpi_t y;
@@ -218,7 +218,7 @@ adjust (unsigned char *buf, size_t size, size_t target)
218 218
219 219
220static void 220static void
221gen_prime (gcry_mpi_t * ptest, unsigned int nbits, GNUNET_HashCode * hc) 221gen_prime (gcry_mpi_t * ptest, unsigned int nbits, struct GNUNET_HashCode * hc)
222{ 222{
223 /* Note: 2 is not included because it can be tested more easily by 223 /* Note: 2 is not included because it can be tested more easily by
224 * looking at bit 0. The last entry in this list is marked by a zero */ 224 * looking at bit 0. The last entry in this list is marked by a zero */
@@ -400,7 +400,7 @@ gen_prime (gcry_mpi_t * ptest, unsigned int nbits, GNUNET_HashCode * hc)
400 */ 400 */
401static void 401static void
402generate_kblock_key (KBlock_secret_key *sk, unsigned int nbits, 402generate_kblock_key (KBlock_secret_key *sk, unsigned int nbits,
403 GNUNET_HashCode * hc) 403 struct GNUNET_HashCode * hc)
404{ 404{
405 gcry_mpi_t t1, t2; 405 gcry_mpi_t t1, t2;
406 gcry_mpi_t phi; /* helper: (p-1)(q-1) */ 406 gcry_mpi_t phi; /* helper: (p-1)(q-1) */
@@ -490,10 +490,10 @@ GNUNET_NETWORK_STRUCT_END
490 * given HashCode as input to the PRNG. 490 * given HashCode as input to the PRNG.
491 */ 491 */
492static struct KskRsaPrivateKeyBinaryEncoded * 492static struct KskRsaPrivateKeyBinaryEncoded *
493makeKblockKeyInternal (const GNUNET_HashCode * hc) 493makeKblockKeyInternal (const struct GNUNET_HashCode * hc)
494{ 494{
495 KBlock_secret_key sk; 495 KBlock_secret_key sk;
496 GNUNET_HashCode hx; 496 struct GNUNET_HashCode hx;
497 unsigned char *pbu[6]; 497 unsigned char *pbu[6];
498 gcry_mpi_t *pkv[6]; 498 gcry_mpi_t *pkv[6];
499 size_t sizes[6]; 499 size_t sizes[6];
@@ -564,7 +564,7 @@ struct KBlockKeyCacheLine
564 /** 564 /**
565 * Hash from which the key was generated. 565 * Hash from which the key was generated.
566 */ 566 */
567 GNUNET_HashCode hc; 567 struct GNUNET_HashCode hc;
568 568
569 /** 569 /**
570 * The encoded key. 570 * The encoded key.
@@ -594,13 +594,13 @@ static unsigned int cacheSize;
594 * @return corresponding private key; must not be freed! 594 * @return corresponding private key; must not be freed!
595 */ 595 */
596struct GNUNET_CRYPTO_RsaPrivateKey * 596struct GNUNET_CRYPTO_RsaPrivateKey *
597GNUNET_CRYPTO_rsa_key_create_from_hash (const GNUNET_HashCode * hc) 597GNUNET_CRYPTO_rsa_key_create_from_hash (const struct GNUNET_HashCode * hc)
598{ 598{
599 struct KBlockKeyCacheLine *line; 599 struct KBlockKeyCacheLine *line;
600 unsigned int i; 600 unsigned int i;
601 601
602 for (i = 0; i < cacheSize; i++) 602 for (i = 0; i < cacheSize; i++)
603 if (0 == memcmp (hc, &cache[i]->hc, sizeof (GNUNET_HashCode))) 603 if (0 == memcmp (hc, &cache[i]->hc, sizeof (struct GNUNET_HashCode)))
604 return GNUNET_CRYPTO_rsa_decode_key ((const char*) cache[i]->pke, 604 return GNUNET_CRYPTO_rsa_decode_key ((const char*) cache[i]->pke,
605 ntohs (cache[i]->pke->len)); 605 ntohs (cache[i]->pke->len));
606 line = GNUNET_malloc (sizeof (struct KBlockKeyCacheLine)); 606 line = GNUNET_malloc (sizeof (struct KBlockKeyCacheLine));
diff --git a/src/util/crypto_rsa.c b/src/util/crypto_rsa.c
index 0106f43be..bbd73083d 100644
--- a/src/util/crypto_rsa.c
+++ b/src/util/crypto_rsa.c
@@ -838,7 +838,7 @@ GNUNET_CRYPTO_rsa_encrypt (const void *block, size_t size,
838 size_t isize; 838 size_t isize;
839 size_t erroff; 839 size_t erroff;
840 840
841 GNUNET_assert (size <= sizeof (GNUNET_HashCode)); 841 GNUNET_assert (size <= sizeof (struct GNUNET_HashCode));
842 pubkey = public2PrivateKey (publicKey); 842 pubkey = public2PrivateKey (publicKey);
843 if (pubkey == NULL) 843 if (pubkey == NULL)
844 return GNUNET_SYSERR; 844 return GNUNET_SYSERR;
@@ -936,7 +936,7 @@ GNUNET_CRYPTO_rsa_sign (const struct GNUNET_CRYPTO_RsaPrivateKey *key,
936 gcry_sexp_t data; 936 gcry_sexp_t data;
937 size_t ssize; 937 size_t ssize;
938 gcry_mpi_t rval; 938 gcry_mpi_t rval;
939 GNUNET_HashCode hc; 939 struct GNUNET_HashCode hc;
940 char *buff; 940 char *buff;
941 int bufSize; 941 int bufSize;
942 942
@@ -949,7 +949,7 @@ GNUNET_CRYPTO_rsa_sign (const struct GNUNET_CRYPTO_RsaPrivateKey *key,
949 [bufSize - 949 [bufSize -
950 strlen 950 strlen
951 ("0123456789012345678901234567890123456789012345678901234567890123))") 951 ("0123456789012345678901234567890123456789012345678901234567890123))")
952 - 1], &hc, sizeof (GNUNET_HashCode)); 952 - 1], &hc, sizeof (struct GNUNET_HashCode));
953 GNUNET_assert (0 == gcry_sexp_new (&data, buff, bufSize, 0)); 953 GNUNET_assert (0 == gcry_sexp_new (&data, buff, bufSize, 0));
954 GNUNET_free (buff); 954 GNUNET_free (buff);
955 GNUNET_assert (0 == gcry_pk_sign (&result, data, key->sexp)); 955 GNUNET_assert (0 == gcry_pk_sign (&result, data, key->sexp));
@@ -988,7 +988,7 @@ GNUNET_CRYPTO_rsa_verify (uint32_t purpose,
988 size_t size; 988 size_t size;
989 gcry_mpi_t val; 989 gcry_mpi_t val;
990 struct GNUNET_CRYPTO_RsaPrivateKey *hostkey; 990 struct GNUNET_CRYPTO_RsaPrivateKey *hostkey;
991 GNUNET_HashCode hc; 991 struct GNUNET_HashCode hc;
992 char *buff; 992 char *buff;
993 int bufSize; 993 int bufSize;
994 size_t erroff; 994 size_t erroff;
@@ -1012,7 +1012,7 @@ GNUNET_CRYPTO_rsa_verify (uint32_t purpose,
1012 [strlen (FORMATSTRING) - 1012 [strlen (FORMATSTRING) -
1013 strlen 1013 strlen
1014 ("0123456789012345678901234567890123456789012345678901234567890123))")], 1014 ("0123456789012345678901234567890123456789012345678901234567890123))")],
1015 &hc, sizeof (GNUNET_HashCode)); 1015 &hc, sizeof (struct GNUNET_HashCode));
1016 GNUNET_assert (0 == gcry_sexp_new (&data, buff, bufSize, 0)); 1016 GNUNET_assert (0 == gcry_sexp_new (&data, buff, bufSize, 0));
1017 GNUNET_free (buff); 1017 GNUNET_free (buff);
1018 hostkey = public2PrivateKey (publicKey); 1018 hostkey = public2PrivateKey (publicKey);
diff --git a/src/util/perf_crypto_hash.c b/src/util/perf_crypto_hash.c
index d883776b4..d1f4c9dc1 100644
--- a/src/util/perf_crypto_hash.c
+++ b/src/util/perf_crypto_hash.c
@@ -32,9 +32,9 @@
32static void 32static void
33perfHash () 33perfHash ()
34{ 34{
35 GNUNET_HashCode hc1; 35 struct GNUNET_HashCode hc1;
36 GNUNET_HashCode hc2; 36 struct GNUNET_HashCode hc2;
37 GNUNET_HashCode hc3; 37 struct GNUNET_HashCode hc3;
38 int i; 38 int i;
39 char *buf; 39 char *buf;
40 40
@@ -43,8 +43,8 @@ perfHash ()
43 GNUNET_CRYPTO_hash ("foo", 3, &hc1); 43 GNUNET_CRYPTO_hash ("foo", 3, &hc1);
44 for (i = 0; i < 1024; i++) 44 for (i = 0; i < 1024; i++)
45 { 45 {
46 GNUNET_CRYPTO_hash (&hc1, sizeof (GNUNET_HashCode), &hc2); 46 GNUNET_CRYPTO_hash (&hc1, sizeof (struct GNUNET_HashCode), &hc2);
47 GNUNET_CRYPTO_hash (&hc2, sizeof (GNUNET_HashCode), &hc1); 47 GNUNET_CRYPTO_hash (&hc2, sizeof (struct GNUNET_HashCode), &hc1);
48 GNUNET_CRYPTO_hash (buf, 1024 * 64, &hc3); 48 GNUNET_CRYPTO_hash (buf, 1024 * 64, &hc3);
49 } 49 }
50 GNUNET_free (buf); 50 GNUNET_free (buf);
diff --git a/src/util/pseudonym.c b/src/util/pseudonym.c
index 016573845..c3964f296 100644
--- a/src/util/pseudonym.c
+++ b/src/util/pseudonym.c
@@ -88,7 +88,7 @@ static struct DiscoveryCallback *head;
88 * @param rating rating of pseudonym 88 * @param rating rating of pseudonym
89 */ 89 */
90static void 90static void
91internal_notify (const GNUNET_HashCode * id, 91internal_notify (const struct GNUNET_HashCode * id,
92 const struct GNUNET_CONTAINER_MetaData *md, int rating) 92 const struct GNUNET_CONTAINER_MetaData *md, int rating)
93{ 93{
94 struct DiscoveryCallback *pos; 94 struct DiscoveryCallback *pos;
@@ -169,7 +169,7 @@ GNUNET_PSEUDONYM_discovery_callback_unregister (GNUNET_PSEUDONYM_Iterator
169 */ 169 */
170static char * 170static char *
171get_data_filename (const struct GNUNET_CONFIGURATION_Handle *cfg, 171get_data_filename (const struct GNUNET_CONFIGURATION_Handle *cfg,
172 const char *prefix, const GNUNET_HashCode * psid) 172 const char *prefix, const struct GNUNET_HashCode * psid)
173{ 173{
174 struct GNUNET_CRYPTO_HashAsciiEncoded enc; 174 struct GNUNET_CRYPTO_HashAsciiEncoded enc;
175 175
@@ -192,7 +192,7 @@ get_data_filename (const struct GNUNET_CONFIGURATION_Handle *cfg,
192 */ 192 */
193static void 193static void
194write_pseudonym_info (const struct GNUNET_CONFIGURATION_Handle *cfg, 194write_pseudonym_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
195 const GNUNET_HashCode * nsid, 195 const struct GNUNET_HashCode * nsid,
196 const struct GNUNET_CONTAINER_MetaData *meta, 196 const struct GNUNET_CONTAINER_MetaData *meta,
197 int32_t ranking, const char *ns_name) 197 int32_t ranking, const char *ns_name)
198{ 198{
@@ -238,7 +238,7 @@ write_pseudonym_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
238 */ 238 */
239static int 239static int
240read_info (const struct GNUNET_CONFIGURATION_Handle *cfg, 240read_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
241 const GNUNET_HashCode * nsid, 241 const struct GNUNET_HashCode * nsid,
242 struct GNUNET_CONTAINER_MetaData **meta, int32_t * ranking, 242 struct GNUNET_CONTAINER_MetaData **meta, int32_t * ranking,
243 char **ns_name) 243 char **ns_name)
244{ 244{
@@ -303,9 +303,9 @@ read_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
303 */ 303 */
304char * 304char *
305GNUNET_PSEUDONYM_name_uniquify (const struct GNUNET_CONFIGURATION_Handle *cfg, 305GNUNET_PSEUDONYM_name_uniquify (const struct GNUNET_CONFIGURATION_Handle *cfg,
306 const GNUNET_HashCode * nsid, const char *name, unsigned int *suffix) 306 const struct GNUNET_HashCode * nsid, const char *name, unsigned int *suffix)
307{ 307{
308 GNUNET_HashCode nh; 308 struct GNUNET_HashCode nh;
309 uint64_t len; 309 uint64_t len;
310 char *fn; 310 char *fn;
311 struct GNUNET_DISK_FileHandle *fh; 311 struct GNUNET_DISK_FileHandle *fh;
@@ -328,23 +328,23 @@ GNUNET_PSEUDONYM_name_uniquify (const struct GNUNET_CONFIGURATION_Handle *cfg,
328 GNUNET_DISK_PERM_USER_WRITE); 328 GNUNET_DISK_PERM_USER_WRITE);
329 i = 0; 329 i = 0;
330 idx = -1; 330 idx = -1;
331 while ((len >= sizeof (GNUNET_HashCode)) && 331 while ((len >= sizeof (struct GNUNET_HashCode)) &&
332 (sizeof (GNUNET_HashCode) == 332 (sizeof (struct GNUNET_HashCode) ==
333 GNUNET_DISK_file_read (fh, &nh, sizeof (GNUNET_HashCode)))) 333 GNUNET_DISK_file_read (fh, &nh, sizeof (struct GNUNET_HashCode))))
334 { 334 {
335 if (0 == memcmp (&nh, nsid, sizeof (GNUNET_HashCode))) 335 if (0 == memcmp (&nh, nsid, sizeof (struct GNUNET_HashCode)))
336 { 336 {
337 idx = i; 337 idx = i;
338 break; 338 break;
339 } 339 }
340 i++; 340 i++;
341 len -= sizeof (GNUNET_HashCode); 341 len -= sizeof (struct GNUNET_HashCode);
342 } 342 }
343 if (idx == -1) 343 if (idx == -1)
344 { 344 {
345 idx = i; 345 idx = i;
346 if (sizeof (GNUNET_HashCode) != 346 if (sizeof (struct GNUNET_HashCode) !=
347 GNUNET_DISK_file_write (fh, nsid, sizeof (GNUNET_HashCode))) 347 GNUNET_DISK_file_write (fh, nsid, sizeof (struct GNUNET_HashCode)))
348 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "write", fn); 348 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "write", fn);
349 } 349 }
350 GNUNET_DISK_file_close (fh); 350 GNUNET_DISK_file_close (fh);
@@ -376,7 +376,7 @@ GNUNET_PSEUDONYM_name_uniquify (const struct GNUNET_CONFIGURATION_Handle *cfg,
376 */ 376 */
377int 377int
378GNUNET_PSEUDONYM_get_info (const struct GNUNET_CONFIGURATION_Handle *cfg, 378GNUNET_PSEUDONYM_get_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
379 const GNUNET_HashCode * nsid, struct GNUNET_CONTAINER_MetaData **ret_meta, 379 const struct GNUNET_HashCode * nsid, struct GNUNET_CONTAINER_MetaData **ret_meta,
380 int32_t *ret_rank, char **ret_name, int *name_is_a_dup) 380 int32_t *ret_rank, char **ret_name, int *name_is_a_dup)
381{ 381{
382 struct GNUNET_CONTAINER_MetaData *meta; 382 struct GNUNET_CONTAINER_MetaData *meta;
@@ -450,13 +450,13 @@ GNUNET_PSEUDONYM_get_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
450 */ 450 */
451int 451int
452GNUNET_PSEUDONYM_name_to_id (const struct GNUNET_CONFIGURATION_Handle *cfg, 452GNUNET_PSEUDONYM_name_to_id (const struct GNUNET_CONFIGURATION_Handle *cfg,
453 const char *ns_uname, GNUNET_HashCode * nsid) 453 const char *ns_uname, struct GNUNET_HashCode * nsid)
454{ 454{
455 size_t slen; 455 size_t slen;
456 uint64_t len; 456 uint64_t len;
457 unsigned int idx; 457 unsigned int idx;
458 char *name; 458 char *name;
459 GNUNET_HashCode nh; 459 struct GNUNET_HashCode nh;
460 char *fn; 460 char *fn;
461 struct GNUNET_DISK_FileHandle *fh; 461 struct GNUNET_DISK_FileHandle *fh;
462 462
@@ -476,7 +476,7 @@ GNUNET_PSEUDONYM_name_to_id (const struct GNUNET_CONFIGURATION_Handle *cfg,
476 476
477 if ((GNUNET_OK != GNUNET_DISK_file_test (fn) || 477 if ((GNUNET_OK != GNUNET_DISK_file_test (fn) ||
478 (GNUNET_OK != GNUNET_DISK_file_size (fn, &len, GNUNET_YES, GNUNET_YES))) || 478 (GNUNET_OK != GNUNET_DISK_file_size (fn, &len, GNUNET_YES, GNUNET_YES))) ||
479 ((idx + 1) * sizeof (GNUNET_HashCode) > len)) 479 ((idx + 1) * sizeof (struct GNUNET_HashCode) > len))
480 { 480 {
481 GNUNET_free (fn); 481 GNUNET_free (fn);
482 return GNUNET_SYSERR; 482 return GNUNET_SYSERR;
@@ -487,10 +487,10 @@ GNUNET_PSEUDONYM_name_to_id (const struct GNUNET_CONFIGURATION_Handle *cfg,
487 GNUNET_DISK_PERM_USER_READ | 487 GNUNET_DISK_PERM_USER_READ |
488 GNUNET_DISK_PERM_USER_WRITE); 488 GNUNET_DISK_PERM_USER_WRITE);
489 GNUNET_free (fn); 489 GNUNET_free (fn);
490 GNUNET_DISK_file_seek (fh, idx * sizeof (GNUNET_HashCode), 490 GNUNET_DISK_file_seek (fh, idx * sizeof (struct GNUNET_HashCode),
491 GNUNET_DISK_SEEK_SET); 491 GNUNET_DISK_SEEK_SET);
492 if (sizeof (GNUNET_HashCode) != 492 if (sizeof (struct GNUNET_HashCode) !=
493 GNUNET_DISK_file_read (fh, nsid, sizeof (GNUNET_HashCode))) 493 GNUNET_DISK_file_read (fh, nsid, sizeof (struct GNUNET_HashCode)))
494 { 494 {
495 GNUNET_DISK_file_close (fh); 495 GNUNET_DISK_file_close (fh);
496 return GNUNET_SYSERR; 496 return GNUNET_SYSERR;
@@ -535,7 +535,7 @@ list_pseudonym_helper (void *cls, const char *fullname)
535{ 535{
536 struct ListPseudonymClosure *c = cls; 536 struct ListPseudonymClosure *c = cls;
537 int ret; 537 int ret;
538 GNUNET_HashCode id; 538 struct GNUNET_HashCode id;
539 int32_t rating; 539 int32_t rating;
540 struct GNUNET_CONTAINER_MetaData *meta; 540 struct GNUNET_CONTAINER_MetaData *meta;
541 const char *fn; 541 const char *fn;
@@ -612,7 +612,7 @@ GNUNET_PSEUDONYM_list_all (const struct GNUNET_CONFIGURATION_Handle *cfg,
612 */ 612 */
613int 613int
614GNUNET_PSEUDONYM_rank (const struct GNUNET_CONFIGURATION_Handle *cfg, 614GNUNET_PSEUDONYM_rank (const struct GNUNET_CONFIGURATION_Handle *cfg,
615 const GNUNET_HashCode * nsid, int delta) 615 const struct GNUNET_HashCode * nsid, int delta)
616{ 616{
617 struct GNUNET_CONTAINER_MetaData *meta; 617 struct GNUNET_CONTAINER_MetaData *meta;
618 int ret; 618 int ret;
@@ -648,7 +648,7 @@ GNUNET_PSEUDONYM_rank (const struct GNUNET_CONFIGURATION_Handle *cfg,
648 */ 648 */
649int 649int
650GNUNET_PSEUDONYM_set_info (const struct GNUNET_CONFIGURATION_Handle *cfg, 650GNUNET_PSEUDONYM_set_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
651 const GNUNET_HashCode * nsid, const char *name, 651 const struct GNUNET_HashCode * nsid, const char *name,
652 const struct GNUNET_CONTAINER_MetaData *md, int rank) 652 const struct GNUNET_CONTAINER_MetaData *md, int rank)
653{ 653{
654 GNUNET_assert (cfg != NULL); 654 GNUNET_assert (cfg != NULL);
@@ -670,7 +670,7 @@ GNUNET_PSEUDONYM_set_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
670 */ 670 */
671void 671void
672GNUNET_PSEUDONYM_add (const struct GNUNET_CONFIGURATION_Handle *cfg, 672GNUNET_PSEUDONYM_add (const struct GNUNET_CONFIGURATION_Handle *cfg,
673 const GNUNET_HashCode * id, 673 const struct GNUNET_HashCode * id,
674 const struct GNUNET_CONTAINER_MetaData *meta) 674 const struct GNUNET_CONTAINER_MetaData *meta)
675{ 675{
676 char *name; 676 char *name;
diff --git a/src/util/test_container_bloomfilter.c b/src/util/test_container_bloomfilter.c
index f881bb367..f9743bdca 100644
--- a/src/util/test_container_bloomfilter.c
+++ b/src/util/test_container_bloomfilter.c
@@ -36,16 +36,16 @@
36 * Generate a random hashcode. 36 * Generate a random hashcode.
37 */ 37 */
38static void 38static void
39nextHC (GNUNET_HashCode * hc) 39nextHC (struct GNUNET_HashCode * hc)
40{ 40{
41 GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, hc); 41 GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, hc);
42} 42}
43 43
44static int 44static int
45add_iterator (void *cls, GNUNET_HashCode * next) 45add_iterator (void *cls, struct GNUNET_HashCode * next)
46{ 46{
47 int *ret = cls; 47 int *ret = cls;
48 GNUNET_HashCode pos; 48 struct GNUNET_HashCode pos;
49 49
50 if (0 == (*ret)--) 50 if (0 == (*ret)--)
51 return GNUNET_NO; 51 return GNUNET_NO;
@@ -59,7 +59,7 @@ main (int argc, char *argv[])
59{ 59{
60 struct GNUNET_CONTAINER_BloomFilter *bf; 60 struct GNUNET_CONTAINER_BloomFilter *bf;
61 struct GNUNET_CONTAINER_BloomFilter *bfi; 61 struct GNUNET_CONTAINER_BloomFilter *bfi;
62 GNUNET_HashCode tmp; 62 struct GNUNET_HashCode tmp;
63 int i; 63 int i;
64 int ok1; 64 int ok1;
65 int ok2; 65 int ok2;
diff --git a/src/util/test_container_multihashmap.c b/src/util/test_container_multihashmap.c
index ba621c17e..befd0ce46 100644
--- a/src/util/test_container_multihashmap.c
+++ b/src/util/test_container_multihashmap.c
@@ -35,8 +35,8 @@ static int
35testMap (int i) 35testMap (int i)
36{ 36{
37 struct GNUNET_CONTAINER_MultiHashMap *m; 37 struct GNUNET_CONTAINER_MultiHashMap *m;
38 GNUNET_HashCode k1; 38 struct GNUNET_HashCode k1;
39 GNUNET_HashCode k2; 39 struct GNUNET_HashCode k2;
40 const char *ret; 40 const char *ret;
41 int j; 41 int j;
42 42
diff --git a/src/util/test_crypto_hash.c b/src/util/test_crypto_hash.c
index bc0411482..a8ef39a38 100644
--- a/src/util/test_crypto_hash.c
+++ b/src/util/test_crypto_hash.c
@@ -35,18 +35,18 @@ static char block[65536];
35static int 35static int
36test (int number) 36test (int number)
37{ 37{
38 GNUNET_HashCode h1; 38 struct GNUNET_HashCode h1;
39 GNUNET_HashCode h2; 39 struct GNUNET_HashCode h2;
40 struct GNUNET_CRYPTO_HashAsciiEncoded enc; 40 struct GNUNET_CRYPTO_HashAsciiEncoded enc;
41 41
42 memset (&h1, number, sizeof (GNUNET_HashCode)); 42 memset (&h1, number, sizeof (struct GNUNET_HashCode));
43 GNUNET_CRYPTO_hash_to_enc (&h1, &enc); 43 GNUNET_CRYPTO_hash_to_enc (&h1, &enc);
44 if (GNUNET_OK != GNUNET_CRYPTO_hash_from_string ((char *) &enc, &h2)) 44 if (GNUNET_OK != GNUNET_CRYPTO_hash_from_string ((char *) &enc, &h2))
45 { 45 {
46 printf ("enc2hash failed!\n"); 46 printf ("enc2hash failed!\n");
47 return 1; 47 return 1;
48 } 48 }
49 if (0 != memcmp (&h1, &h2, sizeof (GNUNET_HashCode))) 49 if (0 != memcmp (&h1, &h2, sizeof (struct GNUNET_HashCode)))
50 return 1; 50 return 1;
51 return 0; 51 return 0;
52} 52}
@@ -67,10 +67,10 @@ testArithmetic ()
67{ 67{
68 static struct GNUNET_CRYPTO_AesSessionKey zskey; 68 static struct GNUNET_CRYPTO_AesSessionKey zskey;
69 static struct GNUNET_CRYPTO_AesInitializationVector ziv; 69 static struct GNUNET_CRYPTO_AesInitializationVector ziv;
70 GNUNET_HashCode h1; 70 struct GNUNET_HashCode h1;
71 GNUNET_HashCode h2; 71 struct GNUNET_HashCode h2;
72 GNUNET_HashCode d; 72 struct GNUNET_HashCode d;
73 GNUNET_HashCode s; 73 struct GNUNET_HashCode s;
74 struct GNUNET_CRYPTO_AesSessionKey skey; 74 struct GNUNET_CRYPTO_AesSessionKey skey;
75 struct GNUNET_CRYPTO_AesInitializationVector iv; 75 struct GNUNET_CRYPTO_AesInitializationVector iv;
76 76
@@ -107,10 +107,10 @@ testArithmetic ()
107} 107}
108 108
109static void 109static void
110finished_task (void *cls, const GNUNET_HashCode * res) 110finished_task (void *cls, const struct GNUNET_HashCode * res)
111{ 111{
112 int *ret = cls; 112 int *ret = cls;
113 GNUNET_HashCode want; 113 struct GNUNET_HashCode want;
114 114
115 GNUNET_CRYPTO_hash (block, sizeof (block), &want); 115 GNUNET_CRYPTO_hash (block, sizeof (block), &want);
116 if (0 != memcmp (res, &want, sizeof (want))) 116 if (0 != memcmp (res, &want, sizeof (want)))
diff --git a/src/util/test_crypto_ksk.c b/src/util/test_crypto_ksk.c
index 58c459547..f0e4337ef 100644
--- a/src/util/test_crypto_ksk.c
+++ b/src/util/test_crypto_ksk.c
@@ -40,7 +40,7 @@ testCorrectKey ()
40{ 40{
41 const char *want = 41 const char *want =
42 "010601000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b73c215f7a5e6b09bec55713c901786c09324a150980e014bdb0d04426934929c3b4971a9711af5455536cd6eeb8bfa004ee904972a737455f53c752987d8c82b755bc02882b44950c4acdc1672ba74c3b94d81a4c1ea3d74e7700ae5594c3a4f3c559e4bff2df6844fac302e4b66175e14dc8bad3ce44281d2fec1a1abef06301010000"; 42 "010601000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b73c215f7a5e6b09bec55713c901786c09324a150980e014bdb0d04426934929c3b4971a9711af5455536cd6eeb8bfa004ee904972a737455f53c752987d8c82b755bc02882b44950c4acdc1672ba74c3b94d81a4c1ea3d74e7700ae5594c3a4f3c559e4bff2df6844fac302e4b66175e14dc8bad3ce44281d2fec1a1abef06301010000";
43 GNUNET_HashCode in; 43 struct GNUNET_HashCode in;
44 struct GNUNET_CRYPTO_RsaPrivateKey *hostkey; 44 struct GNUNET_CRYPTO_RsaPrivateKey *hostkey;
45 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey; 45 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey;
46 int i; 46 int i;
@@ -79,7 +79,7 @@ testCorrectKey ()
79static int 79static int
80testMultiKey (const char *word) 80testMultiKey (const char *word)
81{ 81{
82 GNUNET_HashCode in; 82 struct GNUNET_HashCode in;
83 struct GNUNET_CRYPTO_RsaPrivateKey *hostkey; 83 struct GNUNET_CRYPTO_RsaPrivateKey *hostkey;
84 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey; 84 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey;
85 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey1; 85 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey1;
@@ -228,7 +228,7 @@ int
228main (int argc, char *argv[]) 228main (int argc, char *argv[])
229{ 229{
230 int failureCount = 0; 230 int failureCount = 0;
231 GNUNET_HashCode in; 231 struct GNUNET_HashCode in;
232 struct GNUNET_CRYPTO_RsaPrivateKey *hostkey; 232 struct GNUNET_CRYPTO_RsaPrivateKey *hostkey;
233 233
234 GNUNET_log_setup ("test-crypto-ksk", "WARNING", NULL); 234 GNUNET_log_setup ("test-crypto-ksk", "WARNING", NULL);
diff --git a/src/util/test_pseudonym.c b/src/util/test_pseudonym.c
index 4ce8b3853..f0233771a 100644
--- a/src/util/test_pseudonym.c
+++ b/src/util/test_pseudonym.c
@@ -35,16 +35,16 @@
35 35
36static struct GNUNET_CONTAINER_MetaData *meta; 36static struct GNUNET_CONTAINER_MetaData *meta;
37 37
38static GNUNET_HashCode id1; 38static struct GNUNET_HashCode id1;
39 39
40static int 40static int
41iter (void *cls, const GNUNET_HashCode * pseudonym, 41iter (void *cls, const struct GNUNET_HashCode * pseudonym,
42 const char *name, const char *unique_name, 42 const char *name, const char *unique_name,
43 const struct GNUNET_CONTAINER_MetaData *md, int rating) 43 const struct GNUNET_CONTAINER_MetaData *md, int rating)
44{ 44{
45 int *ok = cls; 45 int *ok = cls;
46 46
47 if ((0 == memcmp (pseudonym, &id1, sizeof (GNUNET_HashCode))) && 47 if ((0 == memcmp (pseudonym, &id1, sizeof (struct GNUNET_HashCode))) &&
48 (!GNUNET_CONTAINER_meta_data_test_equal (md, meta))) 48 (!GNUNET_CONTAINER_meta_data_test_equal (md, meta)))
49 { 49 {
50 *ok = GNUNET_NO; 50 *ok = GNUNET_NO;
@@ -54,7 +54,7 @@ iter (void *cls, const GNUNET_HashCode * pseudonym,
54} 54}
55 55
56static int 56static int
57noti_callback (void *cls, const GNUNET_HashCode * pseudonym, 57noti_callback (void *cls, const struct GNUNET_HashCode * pseudonym,
58 const char *name, const char *unique_name, 58 const char *name, const char *unique_name,
59 const struct GNUNET_CONTAINER_MetaData *md, int rating) 59 const struct GNUNET_CONTAINER_MetaData *md, int rating)
60{ 60{
@@ -65,7 +65,7 @@ noti_callback (void *cls, const GNUNET_HashCode * pseudonym,
65} 65}
66 66
67static int 67static int
68fake_noti_callback (void *cls, const GNUNET_HashCode * pseudonym, 68fake_noti_callback (void *cls, const struct GNUNET_HashCode * pseudonym,
69 const char *name, const char *unique_name, 69 const char *name, const char *unique_name,
70 const struct GNUNET_CONTAINER_MetaData *md, int rating) 70 const struct GNUNET_CONTAINER_MetaData *md, int rating)
71{ 71{
@@ -76,7 +76,7 @@ fake_noti_callback (void *cls, const GNUNET_HashCode * pseudonym,
76} 76}
77 77
78static int 78static int
79false_callback (void *cls, const GNUNET_HashCode * pseudonym, 79false_callback (void *cls, const struct GNUNET_HashCode * pseudonym,
80 const char *name, const char *unique_name, 80 const char *name, const char *unique_name,
81 const struct GNUNET_CONTAINER_MetaData *md, int rating) 81 const struct GNUNET_CONTAINER_MetaData *md, int rating)
82{ 82{
@@ -87,11 +87,11 @@ int
87main (int argc, char *argv[]) 87main (int argc, char *argv[])
88{ 88{
89 int ok; 89 int ok;
90 GNUNET_HashCode rid1; 90 struct GNUNET_HashCode rid1;
91 GNUNET_HashCode id2; 91 struct GNUNET_HashCode id2;
92 GNUNET_HashCode rid2; 92 struct GNUNET_HashCode rid2;
93 GNUNET_HashCode fid; 93 struct GNUNET_HashCode fid;
94 GNUNET_HashCode id3; 94 struct GNUNET_HashCode id3;
95 95
96 int old; 96 int old;
97 int newVal; 97 int newVal;
@@ -174,8 +174,8 @@ main (int argc, char *argv[])
174 CHECK (GNUNET_SYSERR == GNUNET_PSEUDONYM_name_to_id (cfg, name1, &rid1)); 174 CHECK (GNUNET_SYSERR == GNUNET_PSEUDONYM_name_to_id (cfg, name1, &rid1));
175 CHECK (GNUNET_OK == GNUNET_PSEUDONYM_name_to_id (cfg, name2_unique, &rid2)); 175 CHECK (GNUNET_OK == GNUNET_PSEUDONYM_name_to_id (cfg, name2_unique, &rid2));
176 CHECK (GNUNET_OK == GNUNET_PSEUDONYM_name_to_id (cfg, name1_unique, &rid1)); 176 CHECK (GNUNET_OK == GNUNET_PSEUDONYM_name_to_id (cfg, name1_unique, &rid1));
177 CHECK (0 == memcmp (&id1, &rid1, sizeof (GNUNET_HashCode))); 177 CHECK (0 == memcmp (&id1, &rid1, sizeof (struct GNUNET_HashCode)));
178 CHECK (0 == memcmp (&id2, &rid2, sizeof (GNUNET_HashCode))); 178 CHECK (0 == memcmp (&id2, &rid2, sizeof (struct GNUNET_HashCode)));
179 179
180 GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &fid); 180 GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &fid);
181 GNUNET_log_skip (1, GNUNET_NO); 181 GNUNET_log_skip (1, GNUNET_NO);