diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-19 17:11:46 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-19 17:11:46 +0000 |
commit | 5a943624e2634d632ee2bf3a78c25b0aeae3813e (patch) | |
tree | e1fb2539304003d54d0d1e6ea0fdfd3730eb697c /src | |
parent | 34243a1a0c04ef5723a327124f96e2571ac5fd2e (diff) | |
download | gnunet-5a943624e2634d632ee2bf3a78c25b0aeae3813e.tar.gz gnunet-5a943624e2634d632ee2bf3a78c25b0aeae3813e.zip |
- usage of short hashes
Diffstat (limited to 'src')
-rw-r--r-- | src/namestore/gnunet-namestore.c | 4 | ||||
-rw-r--r-- | src/namestore/gnunet-service-namestore.c | 132 | ||||
-rw-r--r-- | src/namestore/namestore.h | 19 | ||||
-rw-r--r-- | src/namestore/namestore_api.c | 20 | ||||
-rw-r--r-- | src/namestore/namestore_common.c | 19 | ||||
-rw-r--r-- | src/namestore/plugin_namestore_sqlite.c | 57 | ||||
-rw-r--r-- | src/namestore/test_namestore_api.c | 4 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_create.c | 6 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_create_update.c | 6 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_lookup.c | 4 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_lookup_specific_type.c | 4 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_remove.c | 6 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_zone_iteration_specific_zone.c | 12 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_zone_to_name.c | 8 | ||||
-rw-r--r-- | src/namestore/test_plugin_namestore.c | 7 |
15 files changed, 175 insertions, 133 deletions
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c index bd083470e..eb77913cc 100644 --- a/src/namestore/gnunet-namestore.c +++ b/src/namestore/gnunet-namestore.c | |||
@@ -41,7 +41,7 @@ static struct GNUNET_NAMESTORE_Handle *ns; | |||
41 | /** | 41 | /** |
42 | * Hash of the public key of our zone. | 42 | * Hash of the public key of our zone. |
43 | */ | 43 | */ |
44 | static GNUNET_HashCode zone; | 44 | static struct GNUNET_CRYPTO_ShortHashCode zone; |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * Private key for the our zone. | 47 | * Private key for the our zone. |
@@ -292,7 +292,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
292 | } | 292 | } |
293 | GNUNET_CRYPTO_rsa_key_get_public (zone_pkey, | 293 | GNUNET_CRYPTO_rsa_key_get_public (zone_pkey, |
294 | &pub); | 294 | &pub); |
295 | GNUNET_CRYPTO_hash (&pub, sizeof (pub), &zone); | 295 | GNUNET_CRYPTO_short_hash (&pub, sizeof (pub), &zone); |
296 | 296 | ||
297 | ns = GNUNET_NAMESTORE_connect (cfg); | 297 | ns = GNUNET_NAMESTORE_connect (cfg); |
298 | if (NULL == ns) | 298 | if (NULL == ns) |
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index 6b4250d38..f45492fc8 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c | |||
@@ -45,7 +45,7 @@ struct GNUNET_NAMESTORE_ZoneIteration | |||
45 | 45 | ||
46 | int has_zone; | 46 | int has_zone; |
47 | 47 | ||
48 | GNUNET_HashCode zone; | 48 | struct GNUNET_CRYPTO_ShortHashCode zone; |
49 | 49 | ||
50 | uint64_t request_id; | 50 | uint64_t request_id; |
51 | uint32_t offset; | 51 | uint32_t offset; |
@@ -73,7 +73,7 @@ struct GNUNET_NAMESTORE_CryptoContainer | |||
73 | { | 73 | { |
74 | char * filename; | 74 | char * filename; |
75 | 75 | ||
76 | GNUNET_HashCode zone; | 76 | struct GNUNET_CRYPTO_ShortHashCode zone; |
77 | struct GNUNET_CRYPTO_RsaPrivateKey *privkey; | 77 | struct GNUNET_CRYPTO_RsaPrivateKey *privkey; |
78 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *pubkey; | 78 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *pubkey; |
79 | }; | 79 | }; |
@@ -125,7 +125,7 @@ write_key_to_file (const char *filename, struct GNUNET_NAMESTORE_CryptoContainer | |||
125 | 125 | ||
126 | if (GNUNET_YES == GNUNET_DISK_file_test (filename)) | 126 | if (GNUNET_YES == GNUNET_DISK_file_test (filename)) |
127 | { | 127 | { |
128 | GNUNET_HashCode zone; | 128 | struct GNUNET_CRYPTO_ShortHashCode zone; |
129 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; | 129 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; |
130 | struct GNUNET_CRYPTO_RsaPrivateKey * privkey; | 130 | struct GNUNET_CRYPTO_RsaPrivateKey * privkey; |
131 | 131 | ||
@@ -133,24 +133,24 @@ write_key_to_file (const char *filename, struct GNUNET_NAMESTORE_CryptoContainer | |||
133 | if (privkey == NULL) | 133 | if (privkey == NULL) |
134 | { | 134 | { |
135 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 135 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
136 | _("File zone `%s' but corrupt content already exists, failed to write! \n"), GNUNET_h2s (&zone)); | 136 | _("File zone `%s' but corrupt content already exists, failed to write! \n"), GNUNET_short_h2s (&zone)); |
137 | return GNUNET_SYSERR; | 137 | return GNUNET_SYSERR; |
138 | } | 138 | } |
139 | 139 | ||
140 | GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); | 140 | GNUNET_CRYPTO_rsa_key_get_public (privkey, &pubkey); |
141 | GNUNET_CRYPTO_hash(&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone); | 141 | GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone); |
142 | GNUNET_CRYPTO_rsa_key_free(privkey); | 142 | GNUNET_CRYPTO_rsa_key_free (privkey); |
143 | 143 | ||
144 | if (0 == memcmp (&zone, &c->zone, sizeof(zone))) | 144 | if (0 == memcmp (&zone, &c->zone, sizeof(zone))) |
145 | { | 145 | { |
146 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 146 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
147 | _("File zone `%s' containing this key already exists\n"), GNUNET_h2s (&zone)); | 147 | _("File zone `%s' containing this key already exists\n"), GNUNET_short_h2s (&zone)); |
148 | return GNUNET_OK; | 148 | return GNUNET_OK; |
149 | } | 149 | } |
150 | else | 150 | else |
151 | { | 151 | { |
152 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 152 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
153 | _("File zone `%s' but different zone key already exists, failed to write! \n"), GNUNET_h2s (&zone)); | 153 | _("File zone `%s' but different zone key already exists, failed to write! \n"), GNUNET_short_h2s (&zone)); |
154 | return GNUNET_OK; | 154 | return GNUNET_OK; |
155 | } | 155 | } |
156 | } | 156 | } |
@@ -185,12 +185,12 @@ write_key_to_file (const char *filename, struct GNUNET_NAMESTORE_CryptoContainer | |||
185 | GNUNET_assert (GNUNET_YES == GNUNET_DISK_file_close (fd)); | 185 | GNUNET_assert (GNUNET_YES == GNUNET_DISK_file_close (fd)); |
186 | 186 | ||
187 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 187 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
188 | _("Stored zonekey for zone `%s' in file `%s'\n"), GNUNET_h2s(&c->zone), c->filename); | 188 | _("Stored zonekey for zone `%s' in file `%s'\n"), GNUNET_short_h2s(&c->zone), c->filename); |
189 | return GNUNET_OK; | 189 | return GNUNET_OK; |
190 | } | 190 | } |
191 | 191 | ||
192 | int zone_to_disk_it (void *cls, | 192 | int zone_to_disk_it (void *cls, |
193 | const GNUNET_HashCode * key, | 193 | const GNUNET_HashCode *key, |
194 | void *value) | 194 | void *value) |
195 | { | 195 | { |
196 | struct GNUNET_NAMESTORE_CryptoContainer * c = value; | 196 | struct GNUNET_NAMESTORE_CryptoContainer * c = value; |
@@ -199,11 +199,12 @@ int zone_to_disk_it (void *cls, | |||
199 | write_key_to_file(c->filename, c); | 199 | write_key_to_file(c->filename, c); |
200 | else | 200 | else |
201 | { | 201 | { |
202 | GNUNET_asprintf(&c->filename, "%s/%s.zkey", zonefile_directory, GNUNET_h2s_full (&c->zone)); | 202 | GNUNET_asprintf(&c->filename, "%s/%s.zkey", zonefile_directory, GNUNET_short_h2s (&c->zone)); |
203 | write_key_to_file(c->filename, c); | 203 | write_key_to_file(c->filename, c); |
204 | } | 204 | } |
205 | 205 | ||
206 | GNUNET_CONTAINER_multihashmap_remove (zonekeys, key, value);; | 206 | |
207 | GNUNET_CONTAINER_multihashmap_remove (zonekeys, key, value); | ||
207 | GNUNET_CRYPTO_rsa_key_free(c->privkey); | 208 | GNUNET_CRYPTO_rsa_key_free(c->privkey); |
208 | GNUNET_free (c->pubkey); | 209 | GNUNET_free (c->pubkey); |
209 | GNUNET_free(c->filename); | 210 | GNUNET_free(c->filename); |
@@ -340,7 +341,7 @@ struct LookupNameContext | |||
340 | struct GNUNET_NAMESTORE_Client *nc; | 341 | struct GNUNET_NAMESTORE_Client *nc; |
341 | uint32_t request_id; | 342 | uint32_t request_id; |
342 | uint32_t record_type; | 343 | uint32_t record_type; |
343 | GNUNET_HashCode *zone; | 344 | struct GNUNET_CRYPTO_ShortHashCode *zone; |
344 | char * name; | 345 | char * name; |
345 | }; | 346 | }; |
346 | 347 | ||
@@ -352,12 +353,12 @@ void drop_iterator (void *cls, | |||
352 | const struct GNUNET_NAMESTORE_RecordData *rd, | 353 | const struct GNUNET_NAMESTORE_RecordData *rd, |
353 | const struct GNUNET_CRYPTO_RsaSignature *signature) | 354 | const struct GNUNET_CRYPTO_RsaSignature *signature) |
354 | { | 355 | { |
355 | GNUNET_HashCode zone_hash; | 356 | struct GNUNET_CRYPTO_ShortHashCode zone_hash; |
356 | int * stop = cls; | 357 | int * stop = cls; |
357 | if (NULL != zone_key) | 358 | if (NULL != zone_key) |
358 | { | 359 | { |
359 | GNUNET_CRYPTO_hash(zone_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone_hash); | 360 | GNUNET_CRYPTO_short_hash(zone_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone_hash); |
360 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleting zone `%s'\n", GNUNET_h2s (&zone_hash)); | 361 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleting zone `%s'\n", GNUNET_short_h2s (&zone_hash)); |
361 | GSN_database->delete_zone (GSN_database->cls, &zone_hash); | 362 | GSN_database->delete_zone (GSN_database->cls, &zone_hash); |
362 | } | 363 | } |
363 | else | 364 | else |
@@ -383,7 +384,8 @@ handle_lookup_name_it (void *cls, | |||
383 | struct GNUNET_NAMESTORE_CryptoContainer *cc; | 384 | struct GNUNET_NAMESTORE_CryptoContainer *cc; |
384 | struct GNUNET_CRYPTO_RsaSignature *signature_new = NULL; | 385 | struct GNUNET_CRYPTO_RsaSignature *signature_new = NULL; |
385 | struct GNUNET_TIME_Absolute e; | 386 | struct GNUNET_TIME_Absolute e; |
386 | GNUNET_HashCode zone_key_hash; | 387 | struct GNUNET_CRYPTO_ShortHashCode zone_key_hash; |
388 | GNUNET_HashCode long_hash; | ||
387 | char *rd_tmp; | 389 | char *rd_tmp; |
388 | char *name_tmp; | 390 | char *name_tmp; |
389 | size_t rd_ser_len; | 391 | size_t rd_ser_len; |
@@ -408,7 +410,7 @@ handle_lookup_name_it (void *cls, | |||
408 | if (rd[c].record_type == lnc->record_type) | 410 | if (rd[c].record_type == lnc->record_type) |
409 | copied_elements++; /* found matching record */ | 411 | copied_elements++; /* found matching record */ |
410 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found %u records with type %u for name `%s' in zone `%s'\n", | 412 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found %u records with type %u for name `%s' in zone `%s'\n", |
411 | copied_elements, lnc->record_type, lnc->name, GNUNET_h2s(lnc->zone)); | 413 | copied_elements, lnc->record_type, lnc->name, GNUNET_short_h2s(lnc->zone)); |
412 | rd_selected = GNUNET_malloc (copied_elements * sizeof (struct GNUNET_NAMESTORE_RecordData)); | 414 | rd_selected = GNUNET_malloc (copied_elements * sizeof (struct GNUNET_NAMESTORE_RecordData)); |
413 | copied_elements = 0; | 415 | copied_elements = 0; |
414 | for (c = 0; c < rd_count; c ++) | 416 | for (c = 0; c < rd_count; c ++) |
@@ -440,7 +442,7 @@ handle_lookup_name_it (void *cls, | |||
440 | GNUNET_NAMESTORE_records_serialize(copied_elements, rd_selected, rd_ser_len, rd_ser); | 442 | GNUNET_NAMESTORE_records_serialize(copied_elements, rd_selected, rd_ser_len, rd_ser); |
441 | 443 | ||
442 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found %u records for name `%s' in zone `%s'\n", | 444 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found %u records for name `%s' in zone `%s'\n", |
443 | copied_elements, lnc->name, GNUNET_h2s(lnc->zone)); | 445 | copied_elements, lnc->name, GNUNET_short_h2s(lnc->zone)); |
444 | 446 | ||
445 | if ((copied_elements == rd_count) && (NULL != signature)) | 447 | if ((copied_elements == rd_count) && (NULL != signature)) |
446 | contains_signature = GNUNET_YES; /* returning all records, so include signature */ | 448 | contains_signature = GNUNET_YES; /* returning all records, so include signature */ |
@@ -450,18 +452,19 @@ handle_lookup_name_it (void *cls, | |||
450 | 452 | ||
451 | if ((NULL != zone_key) && (copied_elements == rd_count)) | 453 | if ((NULL != zone_key) && (copied_elements == rd_count)) |
452 | { | 454 | { |
453 | GNUNET_CRYPTO_hash(zone_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone_key_hash); | 455 | GNUNET_CRYPTO_short_hash(zone_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone_key_hash); |
454 | if (GNUNET_CONTAINER_multihashmap_contains(zonekeys, &zone_key_hash)) | 456 | GNUNET_CRYPTO_short_hash_double (&zone_key_hash, &long_hash); |
457 | if (GNUNET_CONTAINER_multihashmap_contains(zonekeys, &long_hash)) | ||
455 | { | 458 | { |
456 | cc = GNUNET_CONTAINER_multihashmap_get(zonekeys, &zone_key_hash); | 459 | cc = GNUNET_CONTAINER_multihashmap_get(zonekeys, &long_hash); |
457 | e = get_block_expiration_time(rd_count, rd); | 460 | e = get_block_expiration_time(rd_count, rd); |
458 | signature_new = GNUNET_NAMESTORE_create_signature(cc->privkey, e, name, rd, rd_count); | 461 | signature_new = GNUNET_NAMESTORE_create_signature(cc->privkey, e, name, rd, rd_count); |
459 | GNUNET_assert (signature_new != NULL); | 462 | GNUNET_assert (signature_new != NULL); |
460 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating signature for name `%s' with %u records in zone `%s'\n",name, copied_elements, GNUNET_h2s(&zone_key_hash)); | 463 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating signature for name `%s' with %u records in zone `%s'\n",name, copied_elements, GNUNET_short_h2s(&zone_key_hash)); |
461 | authoritative = GNUNET_YES; | 464 | authoritative = GNUNET_YES; |
462 | } | 465 | } |
463 | else | 466 | else |
464 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "I am not authoritative for name `%s' in zone `%s'\n",name, GNUNET_h2s(&zone_key_hash)); | 467 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "I am not authoritative for name `%s' in zone `%s'\n",name, GNUNET_short_h2s(&zone_key_hash)); |
465 | } | 468 | } |
466 | 469 | ||
467 | r_size = sizeof (struct LookupNameResponseMessage) + | 470 | r_size = sizeof (struct LookupNameResponseMessage) + |
@@ -565,9 +568,9 @@ static void handle_lookup_name (void *cls, | |||
565 | } | 568 | } |
566 | 569 | ||
567 | if (0 == type) | 570 | if (0 == type) |
568 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking up all records for name `%s' in zone `%s'\n", name, GNUNET_h2s(&ln_msg->zone)); | 571 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking up all records for name `%s' in zone `%s'\n", name, GNUNET_short_h2s(&ln_msg->zone)); |
569 | else | 572 | else |
570 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking up records with type %u for name `%s' in zone `%s'\n", type, name, GNUNET_h2s(&ln_msg->zone)); | 573 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking up records with type %u for name `%s' in zone `%s'\n", type, name, GNUNET_short_h2s(&ln_msg->zone)); |
571 | 574 | ||
572 | /* do the actual lookup */ | 575 | /* do the actual lookup */ |
573 | lnc.request_id = rid; | 576 | lnc.request_id = rid; |
@@ -672,10 +675,10 @@ static void handle_record_put (void *cls, | |||
672 | goto send; | 675 | goto send; |
673 | } | 676 | } |
674 | 677 | ||
675 | GNUNET_HashCode zone_hash; | 678 | struct GNUNET_CRYPTO_ShortHashCode zone_hash; |
676 | GNUNET_CRYPTO_hash (&rp_msg->public_key, sizeof (rp_msg->public_key), &zone_hash); | 679 | GNUNET_CRYPTO_short_hash (&rp_msg->public_key, sizeof (rp_msg->public_key), &zone_hash); |
677 | 680 | ||
678 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Putting %u record for name `%s' in zone `%s'\n", rd_count, name, GNUNET_h2s(&zone_hash)); | 681 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Putting %u record for name `%s' in zone `%s'\n", rd_count, name, GNUNET_short_h2s(&zone_hash)); |
679 | 682 | ||
680 | /* Database operation */ | 683 | /* Database operation */ |
681 | res = GSN_database->put_records(GSN_database->cls, | 684 | res = GSN_database->put_records(GSN_database->cls, |
@@ -836,7 +839,8 @@ static void handle_record_create (void *cls, | |||
836 | struct GNUNET_CRYPTO_RsaPrivateKey *pkey; | 839 | struct GNUNET_CRYPTO_RsaPrivateKey *pkey; |
837 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub; | 840 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub; |
838 | struct RecordCreateResponseMessage rcr_msg; | 841 | struct RecordCreateResponseMessage rcr_msg; |
839 | GNUNET_HashCode pubkey_hash; | 842 | struct GNUNET_CRYPTO_ShortHashCode pubkey_hash; |
843 | GNUNET_HashCode long_hash; | ||
840 | size_t name_len; | 844 | size_t name_len; |
841 | size_t msg_size; | 845 | size_t msg_size; |
842 | size_t msg_size_exp; | 846 | size_t msg_size_exp; |
@@ -914,19 +918,19 @@ static void handle_record_create (void *cls, | |||
914 | pkey = GNUNET_CRYPTO_rsa_decode_key((char *) pkey_tmp, key_len); | 918 | pkey = GNUNET_CRYPTO_rsa_decode_key((char *) pkey_tmp, key_len); |
915 | GNUNET_assert (pkey != NULL); | 919 | GNUNET_assert (pkey != NULL); |
916 | GNUNET_CRYPTO_rsa_key_get_public(pkey, &pub); | 920 | GNUNET_CRYPTO_rsa_key_get_public(pkey, &pub); |
917 | GNUNET_CRYPTO_hash (&pub, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &pubkey_hash); | 921 | GNUNET_CRYPTO_short_hash (&pub, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &pubkey_hash); |
922 | GNUNET_CRYPTO_short_hash_double (&pubkey_hash, &long_hash); | ||
918 | 923 | ||
919 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains(zonekeys, &pubkey_hash)) | 924 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains(zonekeys, &long_hash)) |
920 | { | 925 | { |
921 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received new private key for zone `%s'\n",GNUNET_h2s(&pubkey_hash)); | 926 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received new private key for zone `%s'\n",GNUNET_short_h2s(&pubkey_hash)); |
922 | 927 | ||
923 | cc = GNUNET_malloc (sizeof (struct GNUNET_NAMESTORE_CryptoContainer)); | 928 | cc = GNUNET_malloc (sizeof (struct GNUNET_NAMESTORE_CryptoContainer)); |
924 | cc->privkey = GNUNET_CRYPTO_rsa_decode_key((char *) pkey_tmp, key_len); | 929 | cc->privkey = GNUNET_CRYPTO_rsa_decode_key((char *) pkey_tmp, key_len); |
925 | cc->pubkey = GNUNET_malloc(sizeof (pub)); | 930 | cc->pubkey = GNUNET_malloc(sizeof (pub)); |
926 | memcpy (cc->pubkey, &pub, sizeof(pub)); | 931 | memcpy (cc->pubkey, &pub, sizeof(pub)); |
927 | cc->zone = pubkey_hash; | 932 | cc->zone = pubkey_hash; |
928 | 933 | GNUNET_CONTAINER_multihashmap_put(zonekeys, &long_hash, cc, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | |
929 | GNUNET_CONTAINER_multihashmap_put(zonekeys, &pubkey_hash, cc, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | ||
930 | } | 934 | } |
931 | 935 | ||
932 | crc.expire = GNUNET_TIME_absolute_ntoh(rp_msg->expire); | 936 | crc.expire = GNUNET_TIME_absolute_ntoh(rp_msg->expire); |
@@ -936,7 +940,7 @@ static void handle_record_create (void *cls, | |||
936 | crc.rd = rd; | 940 | crc.rd = rd; |
937 | crc.name = name_tmp; | 941 | crc.name = name_tmp; |
938 | 942 | ||
939 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating record for name `%s' in zone `%s'\n", name_tmp, GNUNET_h2s(&pubkey_hash)); | 943 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating record for name `%s' in zone `%s'\n", name_tmp, GNUNET_short_h2s(&pubkey_hash)); |
940 | 944 | ||
941 | /* Get existing records for name */ | 945 | /* Get existing records for name */ |
942 | res = GSN_database->iterate_records(GSN_database->cls, &pubkey_hash, name_tmp, 0, &handle_create_record_it, &crc); | 946 | res = GSN_database->iterate_records(GSN_database->cls, &pubkey_hash, name_tmp, 0, &handle_create_record_it, &crc); |
@@ -1064,7 +1068,8 @@ static void handle_record_remove (void *cls, | |||
1064 | struct GNUNET_CRYPTO_RsaPrivateKey *pkey; | 1068 | struct GNUNET_CRYPTO_RsaPrivateKey *pkey; |
1065 | struct GNUNET_NAMESTORE_CryptoContainer *cc = NULL; | 1069 | struct GNUNET_NAMESTORE_CryptoContainer *cc = NULL; |
1066 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub; | 1070 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub; |
1067 | GNUNET_HashCode pubkey_hash; | 1071 | struct GNUNET_CRYPTO_ShortHashCode pubkey_hash; |
1072 | GNUNET_HashCode long_hash; | ||
1068 | char * pkey_tmp = NULL; | 1073 | char * pkey_tmp = NULL; |
1069 | char * name_tmp = NULL; | 1074 | char * name_tmp = NULL; |
1070 | char * rd_ser = NULL; | 1075 | char * rd_ser = NULL; |
@@ -1154,18 +1159,19 @@ static void handle_record_remove (void *cls, | |||
1154 | pkey = GNUNET_CRYPTO_rsa_decode_key((char *) pkey_tmp, key_len); | 1159 | pkey = GNUNET_CRYPTO_rsa_decode_key((char *) pkey_tmp, key_len); |
1155 | GNUNET_assert (pkey != NULL); | 1160 | GNUNET_assert (pkey != NULL); |
1156 | GNUNET_CRYPTO_rsa_key_get_public(pkey, &pub); | 1161 | GNUNET_CRYPTO_rsa_key_get_public(pkey, &pub); |
1157 | GNUNET_CRYPTO_hash (&pub, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &pubkey_hash); | 1162 | GNUNET_CRYPTO_short_hash (&pub, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &pubkey_hash); |
1163 | GNUNET_CRYPTO_short_hash_double (&pubkey_hash, &long_hash); | ||
1158 | 1164 | ||
1159 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains(zonekeys, &pubkey_hash)) | 1165 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains(zonekeys, &long_hash)) |
1160 | { | 1166 | { |
1161 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received new private key for zone `%s'\n",GNUNET_h2s(&pubkey_hash)); | 1167 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received new private key for zone `%s'\n",GNUNET_short_h2s(&pubkey_hash)); |
1162 | cc = GNUNET_malloc (sizeof (struct GNUNET_NAMESTORE_CryptoContainer)); | 1168 | cc = GNUNET_malloc (sizeof (struct GNUNET_NAMESTORE_CryptoContainer)); |
1163 | cc->privkey = GNUNET_CRYPTO_rsa_decode_key((char *) pkey_tmp, key_len); | 1169 | cc->privkey = GNUNET_CRYPTO_rsa_decode_key((char *) pkey_tmp, key_len); |
1164 | cc->pubkey = GNUNET_malloc(sizeof (pub)); | 1170 | cc->pubkey = GNUNET_malloc(sizeof (pub)); |
1165 | memcpy (cc->pubkey, &pub, sizeof(pub)); | 1171 | memcpy (cc->pubkey, &pub, sizeof(pub)); |
1166 | cc->zone = pubkey_hash; | 1172 | cc->zone = pubkey_hash; |
1167 | 1173 | ||
1168 | GNUNET_CONTAINER_multihashmap_put(zonekeys, &pubkey_hash, cc, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | 1174 | GNUNET_CONTAINER_multihashmap_put(zonekeys, &long_hash, cc, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); |
1169 | } | 1175 | } |
1170 | 1176 | ||
1171 | struct GNUNET_NAMESTORE_RecordData rd[rd_count]; | 1177 | struct GNUNET_NAMESTORE_RecordData rd[rd_count]; |
@@ -1180,7 +1186,7 @@ static void handle_record_remove (void *cls, | |||
1180 | rrc.rd = rd; | 1186 | rrc.rd = rd; |
1181 | rrc.pkey = pkey; | 1187 | rrc.pkey = pkey; |
1182 | 1188 | ||
1183 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Removing record for name `%s' in zone `%s'\n", name_tmp, GNUNET_h2s(&pubkey_hash)); | 1189 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Removing record for name `%s' in zone `%s'\n", name_tmp, GNUNET_short_h2s(&pubkey_hash)); |
1184 | 1190 | ||
1185 | /* Database operation */ | 1191 | /* Database operation */ |
1186 | res = GSN_database->iterate_records (GSN_database->cls, | 1192 | res = GSN_database->iterate_records (GSN_database->cls, |
@@ -1342,10 +1348,10 @@ static void handle_zone_to_name (void *cls, | |||
1342 | ztn_ctx.rid = rid; | 1348 | ztn_ctx.rid = rid; |
1343 | ztn_ctx.nc = nc; | 1349 | ztn_ctx.nc = nc; |
1344 | 1350 | ||
1345 | char * z_tmp = strdup (GNUNET_h2s (&ztn_msg->zone)); | 1351 | char * z_tmp = strdup (GNUNET_short_h2s (&ztn_msg->zone)); |
1346 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking up name for zone `%s' in zone `%s'\n", | 1352 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking up name for zone `%s' in zone `%s'\n", |
1347 | z_tmp, | 1353 | z_tmp, |
1348 | GNUNET_h2s (&ztn_msg->value_zone)); | 1354 | GNUNET_short_h2s (&ztn_msg->value_zone)); |
1349 | GNUNET_free (z_tmp); | 1355 | GNUNET_free (z_tmp); |
1350 | 1356 | ||
1351 | GSN_database->zone_to_name (GSN_database->cls, &ztn_msg->zone, &ztn_msg->value_zone, &handle_zone_to_name_it, &ztn_ctx); | 1357 | GSN_database->zone_to_name (GSN_database->cls, &ztn_msg->zone, &ztn_msg->value_zone, &handle_zone_to_name_it, &ztn_ctx); |
@@ -1383,14 +1389,15 @@ void zone_iteration_proc (void *cls, | |||
1383 | struct GNUNET_NAMESTORE_CryptoContainer * cc; | 1389 | struct GNUNET_NAMESTORE_CryptoContainer * cc; |
1384 | struct GNUNET_CRYPTO_RsaSignature *signature_new = NULL; | 1390 | struct GNUNET_CRYPTO_RsaSignature *signature_new = NULL; |
1385 | struct GNUNET_TIME_Absolute e; | 1391 | struct GNUNET_TIME_Absolute e; |
1386 | GNUNET_HashCode zone_key_hash; | 1392 | struct GNUNET_CRYPTO_ShortHashCode zone_key_hash; |
1393 | GNUNET_HashCode long_hash; | ||
1387 | int authoritative = GNUNET_NO; | 1394 | int authoritative = GNUNET_NO; |
1388 | 1395 | ||
1389 | if ((zone_key == NULL) && (name == NULL)) | 1396 | if ((zone_key == NULL) && (name == NULL)) |
1390 | { | 1397 | { |
1391 | struct ZoneIterationResponseMessage zir_msg; | 1398 | struct ZoneIterationResponseMessage zir_msg; |
1392 | if (zi->has_zone == GNUNET_YES) | 1399 | if (zi->has_zone == GNUNET_YES) |
1393 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No more results for zone `%s'\n", GNUNET_h2s(&zi->zone)); | 1400 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No more results for zone `%s'\n", GNUNET_short_h2s(&zi->zone)); |
1394 | else | 1401 | else |
1395 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No more results for all zones\n"); | 1402 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No more results for all zones\n"); |
1396 | 1403 | ||
@@ -1417,7 +1424,7 @@ void zone_iteration_proc (void *cls, | |||
1417 | struct ZoneIterationResponseMessage *zir_msg; | 1424 | struct ZoneIterationResponseMessage *zir_msg; |
1418 | if (zi->has_zone == GNUNET_YES) | 1425 | if (zi->has_zone == GNUNET_YES) |
1419 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending name `%s' for iteration over zone `%s'\n", | 1426 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending name `%s' for iteration over zone `%s'\n", |
1420 | name, GNUNET_h2s(&zi->zone)); | 1427 | name, GNUNET_short_h2s(&zi->zone)); |
1421 | if (zi->has_zone == GNUNET_NO) | 1428 | if (zi->has_zone == GNUNET_NO) |
1422 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending name `%s' for iteration over all zones\n", | 1429 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending name `%s' for iteration over all zones\n", |
1423 | name); | 1430 | name); |
@@ -1438,15 +1445,16 @@ void zone_iteration_proc (void *cls, | |||
1438 | name_tmp = (char *) &zir_msg[1]; | 1445 | name_tmp = (char *) &zir_msg[1]; |
1439 | rd_tmp = &name_tmp[name_len]; | 1446 | rd_tmp = &name_tmp[name_len]; |
1440 | 1447 | ||
1441 | GNUNET_CRYPTO_hash(zone_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone_key_hash); | 1448 | GNUNET_CRYPTO_short_hash(zone_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone_key_hash); |
1442 | if (GNUNET_CONTAINER_multihashmap_contains(zonekeys, &zone_key_hash)) | 1449 | GNUNET_CRYPTO_short_hash_double(&zone_key_hash, &long_hash); |
1450 | if (GNUNET_CONTAINER_multihashmap_contains(zonekeys, &long_hash)) | ||
1443 | { | 1451 | { |
1444 | cc = GNUNET_CONTAINER_multihashmap_get(zonekeys, &zone_key_hash); | 1452 | cc = GNUNET_CONTAINER_multihashmap_get(zonekeys, &long_hash); |
1445 | e = get_block_expiration_time(rd_count, rd); | 1453 | e = get_block_expiration_time(rd_count, rd); |
1446 | expire = e; | 1454 | expire = e; |
1447 | signature_new = GNUNET_NAMESTORE_create_signature(cc->privkey, e, name, rd, rd_count); | 1455 | signature_new = GNUNET_NAMESTORE_create_signature(cc->privkey, e, name, rd, rd_count); |
1448 | GNUNET_assert (signature_new != NULL); | 1456 | GNUNET_assert (signature_new != NULL); |
1449 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating signature for `%s' in zone `%s' with %u records and expiration %llu\n", name, GNUNET_h2s(&zone_key_hash), rd_count, e.abs_value); | 1457 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating signature for `%s' in zone `%s' with %u records and expiration %llu\n", name, GNUNET_short_h2s(&zone_key_hash), rd_count, e.abs_value); |
1450 | authoritative = GNUNET_YES; | 1458 | authoritative = GNUNET_YES; |
1451 | } | 1459 | } |
1452 | 1460 | ||
@@ -1502,8 +1510,8 @@ static void handle_iteration_start (void *cls, | |||
1502 | zi->client = nc; | 1510 | zi->client = nc; |
1503 | zi->zone = zis_msg->zone; | 1511 | zi->zone = zis_msg->zone; |
1504 | 1512 | ||
1505 | GNUNET_HashCode dummy; | 1513 | struct GNUNET_CRYPTO_ShortHashCode dummy; |
1506 | GNUNET_HashCode *zone_tmp; | 1514 | struct GNUNET_CRYPTO_ShortHashCode *zone_tmp; |
1507 | memset (&dummy, '\0', sizeof (dummy)); | 1515 | memset (&dummy, '\0', sizeof (dummy)); |
1508 | if (0 == memcmp (&dummy, &zis_msg->zone, sizeof (dummy))) | 1516 | if (0 == memcmp (&dummy, &zis_msg->zone, sizeof (dummy))) |
1509 | { | 1517 | { |
@@ -1513,7 +1521,7 @@ static void handle_iteration_start (void *cls, | |||
1513 | } | 1521 | } |
1514 | else | 1522 | else |
1515 | { | 1523 | { |
1516 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting to iterate over zone `%s'\n", GNUNET_h2s (&zis_msg->zone)); | 1524 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting to iterate over zone `%s'\n", GNUNET_short_h2s (&zis_msg->zone)); |
1517 | zi->has_zone = GNUNET_YES; | 1525 | zi->has_zone = GNUNET_YES; |
1518 | zone_tmp = &zis_msg->zone; | 1526 | zone_tmp = &zis_msg->zone; |
1519 | } | 1527 | } |
@@ -1558,7 +1566,7 @@ static void handle_iteration_stop (void *cls, | |||
1558 | 1566 | ||
1559 | GNUNET_CONTAINER_DLL_remove(nc->op_head, nc->op_tail, zi); | 1567 | GNUNET_CONTAINER_DLL_remove(nc->op_head, nc->op_tail, zi); |
1560 | if (GNUNET_YES == zi->has_zone) | 1568 | if (GNUNET_YES == zi->has_zone) |
1561 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopped zone iteration for zone `%s'\n", GNUNET_h2s (&zi->zone)); | 1569 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopped zone iteration for zone `%s'\n", GNUNET_short_h2s (&zi->zone)); |
1562 | else | 1570 | else |
1563 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopped zone iteration all zones\n"); | 1571 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopped zone iteration all zones\n"); |
1564 | GNUNET_free (zi); | 1572 | GNUNET_free (zi); |
@@ -1574,7 +1582,7 @@ static void handle_iteration_next (void *cls, | |||
1574 | 1582 | ||
1575 | struct GNUNET_NAMESTORE_Client *nc; | 1583 | struct GNUNET_NAMESTORE_Client *nc; |
1576 | struct GNUNET_NAMESTORE_ZoneIteration *zi; | 1584 | struct GNUNET_NAMESTORE_ZoneIteration *zi; |
1577 | GNUNET_HashCode *zone_tmp; | 1585 | struct GNUNET_CRYPTO_ShortHashCode *zone_tmp; |
1578 | struct ZoneIterationStopMessage * zis_msg = (struct ZoneIterationStopMessage *) message; | 1586 | struct ZoneIterationStopMessage * zis_msg = (struct ZoneIterationStopMessage *) message; |
1579 | uint32_t rid; | 1587 | uint32_t rid; |
1580 | 1588 | ||
@@ -1611,6 +1619,7 @@ static void handle_iteration_next (void *cls, | |||
1611 | 1619 | ||
1612 | int zonekey_file_it (void *cls, const char *filename) | 1620 | int zonekey_file_it (void *cls, const char *filename) |
1613 | { | 1621 | { |
1622 | GNUNET_HashCode long_hash; | ||
1614 | int *counter = cls; | 1623 | int *counter = cls; |
1615 | if ((filename != NULL) && (NULL != strstr(filename, ".zkey"))) | 1624 | if ((filename != NULL) && (NULL != strstr(filename, ".zkey"))) |
1616 | { | 1625 | { |
@@ -1624,11 +1633,12 @@ int zonekey_file_it (void *cls, const char *filename) | |||
1624 | c->pubkey = GNUNET_malloc(sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded)); | 1633 | c->pubkey = GNUNET_malloc(sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded)); |
1625 | c->privkey = privkey; | 1634 | c->privkey = privkey; |
1626 | GNUNET_CRYPTO_rsa_key_get_public(privkey, c->pubkey); | 1635 | GNUNET_CRYPTO_rsa_key_get_public(privkey, c->pubkey); |
1627 | GNUNET_CRYPTO_hash(c->pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &c->zone); | 1636 | GNUNET_CRYPTO_short_hash(c->pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &c->zone); |
1628 | |||
1629 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found zonefile for zone `%s'\n", GNUNET_h2s (&c->zone)); | ||
1630 | 1637 | ||
1631 | GNUNET_CONTAINER_multihashmap_put(zonekeys, &c->zone, c, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | 1638 | //GNUNET_CRYPTO_short_hash_to_enc (&name_hase, &name_enc); |
1639 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found zonefile for zone `%s'\n", GNUNET_short_h2s (&c->zone)); | ||
1640 | GNUNET_CRYPTO_short_hash_double (&c->zone, &long_hash); | ||
1641 | GNUNET_CONTAINER_multihashmap_put(zonekeys, &long_hash, c, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | ||
1632 | (*counter) ++; | 1642 | (*counter) ++; |
1633 | } | 1643 | } |
1634 | return GNUNET_OK; | 1644 | return GNUNET_OK; |
diff --git a/src/namestore/namestore.h b/src/namestore/namestore.h index 48e021f6d..c7af82dc3 100644 --- a/src/namestore/namestore.h +++ b/src/namestore/namestore.h | |||
@@ -47,6 +47,17 @@ | |||
47 | #define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP 448 | 47 | #define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP 448 |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * Convert a short hash to a string (for printing debug messages). | ||
51 | * This is one of the very few calls in the entire API that is | ||
52 | * NOT reentrant! | ||
53 | * | ||
54 | * @param hc the short hash code | ||
55 | * @return string form; will be overwritten by next call to GNUNET_h2s. | ||
56 | */ | ||
57 | const char * | ||
58 | GNUNET_short_h2s (const struct GNUNET_CRYPTO_ShortHashCode * hc); | ||
59 | |||
60 | /** | ||
50 | * Sign name and records | 61 | * Sign name and records |
51 | * | 62 | * |
52 | * @param key the private key | 63 | * @param key the private key |
@@ -150,7 +161,7 @@ struct LookupNameMessage | |||
150 | /** | 161 | /** |
151 | * The zone | 162 | * The zone |
152 | */ | 163 | */ |
153 | GNUNET_HashCode zone; | 164 | struct GNUNET_CRYPTO_ShortHashCode zone; |
154 | 165 | ||
155 | /** | 166 | /** |
156 | * Requested record type | 167 | * Requested record type |
@@ -419,12 +430,12 @@ struct ZoneToNameMessage | |||
419 | /** | 430 | /** |
420 | * The hash of public key of the zone to look up in | 431 | * The hash of public key of the zone to look up in |
421 | */ | 432 | */ |
422 | GNUNET_HashCode zone; | 433 | struct GNUNET_CRYPTO_ShortHashCode zone; |
423 | 434 | ||
424 | /** | 435 | /** |
425 | * The hash of the public key of the target zone | 436 | * The hash of the public key of the target zone |
426 | */ | 437 | */ |
427 | GNUNET_HashCode value_zone; | 438 | struct GNUNET_CRYPTO_ShortHashCode value_zone; |
428 | }; | 439 | }; |
429 | 440 | ||
430 | /** | 441 | /** |
@@ -487,7 +498,7 @@ struct ZoneIterationStartMessage | |||
487 | /** | 498 | /** |
488 | * Zone hash | 499 | * Zone hash |
489 | */ | 500 | */ |
490 | GNUNET_HashCode zone; | 501 | struct GNUNET_CRYPTO_ShortHashCode zone; |
491 | 502 | ||
492 | /** | 503 | /** |
493 | * Which flags must be included | 504 | * Which flags must be included |
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c index 4abad4d1c..be80e2091 100644 --- a/src/namestore/namestore_api.c +++ b/src/namestore/namestore_api.c | |||
@@ -90,7 +90,7 @@ struct GNUNET_NAMESTORE_ZoneIterator | |||
90 | struct GNUNET_NAMESTORE_Handle *h; | 90 | struct GNUNET_NAMESTORE_Handle *h; |
91 | GNUNET_NAMESTORE_RecordProcessor proc; | 91 | GNUNET_NAMESTORE_RecordProcessor proc; |
92 | void* proc_cls; | 92 | void* proc_cls; |
93 | GNUNET_HashCode zone; | 93 | struct GNUNET_CRYPTO_ShortHashCode zone; |
94 | uint32_t no_flags; | 94 | uint32_t no_flags; |
95 | uint32_t flags; | 95 | uint32_t flags; |
96 | int has_zone; | 96 | int has_zone; |
@@ -193,7 +193,7 @@ struct GNUNET_NAMESTORE_SimpleRecord | |||
193 | struct GNUNET_NAMESTORE_SimpleRecord *prev; | 193 | struct GNUNET_NAMESTORE_SimpleRecord *prev; |
194 | 194 | ||
195 | const char *name; | 195 | const char *name; |
196 | const GNUNET_HashCode *zone; | 196 | const struct GNUNET_CRYPTO_ShortHashCode *zone; |
197 | uint32_t record_type; | 197 | uint32_t record_type; |
198 | struct GNUNET_TIME_Absolute expiration; | 198 | struct GNUNET_TIME_Absolute expiration; |
199 | enum GNUNET_NAMESTORE_RecordFlags flags; | 199 | enum GNUNET_NAMESTORE_RecordFlags flags; |
@@ -1316,7 +1316,7 @@ GNUNET_NAMESTORE_record_remove (struct GNUNET_NAMESTORE_Handle *h, | |||
1316 | */ | 1316 | */ |
1317 | struct GNUNET_NAMESTORE_QueueEntry * | 1317 | struct GNUNET_NAMESTORE_QueueEntry * |
1318 | GNUNET_NAMESTORE_lookup_record (struct GNUNET_NAMESTORE_Handle *h, | 1318 | GNUNET_NAMESTORE_lookup_record (struct GNUNET_NAMESTORE_Handle *h, |
1319 | const GNUNET_HashCode *zone, | 1319 | const struct GNUNET_CRYPTO_ShortHashCode *zone, |
1320 | const char *name, | 1320 | const char *name, |
1321 | uint32_t record_type, | 1321 | uint32_t record_type, |
1322 | GNUNET_NAMESTORE_RecordProcessor proc, void *proc_cls) | 1322 | GNUNET_NAMESTORE_RecordProcessor proc, void *proc_cls) |
@@ -1388,8 +1388,8 @@ GNUNET_NAMESTORE_lookup_record (struct GNUNET_NAMESTORE_Handle *h, | |||
1388 | */ | 1388 | */ |
1389 | struct GNUNET_NAMESTORE_QueueEntry * | 1389 | struct GNUNET_NAMESTORE_QueueEntry * |
1390 | GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h, | 1390 | GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h, |
1391 | const GNUNET_HashCode *zone, | 1391 | const struct GNUNET_CRYPTO_ShortHashCode *zone, |
1392 | const GNUNET_HashCode *value_zone, | 1392 | const struct GNUNET_CRYPTO_ShortHashCode *value_zone, |
1393 | GNUNET_NAMESTORE_RecordProcessor proc, void *proc_cls) | 1393 | GNUNET_NAMESTORE_RecordProcessor proc, void *proc_cls) |
1394 | { | 1394 | { |
1395 | struct GNUNET_NAMESTORE_QueueEntry *qe; | 1395 | struct GNUNET_NAMESTORE_QueueEntry *qe; |
@@ -1424,11 +1424,11 @@ GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h, | |||
1424 | msg->zone = *zone; | 1424 | msg->zone = *zone; |
1425 | msg->value_zone = *value_zone; | 1425 | msg->value_zone = *value_zone; |
1426 | 1426 | ||
1427 | char * z_tmp = strdup (GNUNET_h2s (zone)); | 1427 | char * z_tmp = strdup (GNUNET_short_h2s (zone)); |
1428 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message for zone `%s' in zone `%s'\n", | 1428 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message for zone `%s' in zone `%s'\n", |
1429 | "NAMESTORE_ZONE_TO_NAME", | 1429 | "NAMESTORE_ZONE_TO_NAME", |
1430 | z_tmp, | 1430 | z_tmp, |
1431 | GNUNET_h2s (value_zone)); | 1431 | GNUNET_short_h2s (value_zone)); |
1432 | GNUNET_free (z_tmp); | 1432 | GNUNET_free (z_tmp); |
1433 | 1433 | ||
1434 | /* transmit message */ | 1434 | /* transmit message */ |
@@ -1460,7 +1460,7 @@ GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h, | |||
1460 | */ | 1460 | */ |
1461 | struct GNUNET_NAMESTORE_ZoneIterator * | 1461 | struct GNUNET_NAMESTORE_ZoneIterator * |
1462 | GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h, | 1462 | GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h, |
1463 | const GNUNET_HashCode *zone, | 1463 | const struct GNUNET_CRYPTO_ShortHashCode *zone, |
1464 | enum GNUNET_NAMESTORE_RecordFlags must_have_flags, | 1464 | enum GNUNET_NAMESTORE_RecordFlags must_have_flags, |
1465 | enum GNUNET_NAMESTORE_RecordFlags must_not_have_flags, | 1465 | enum GNUNET_NAMESTORE_RecordFlags must_not_have_flags, |
1466 | GNUNET_NAMESTORE_RecordProcessor proc, | 1466 | GNUNET_NAMESTORE_RecordProcessor proc, |
@@ -1507,7 +1507,7 @@ GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h, | |||
1507 | msg->gns_header.r_id = htonl (rid); | 1507 | msg->gns_header.r_id = htonl (rid); |
1508 | if (NULL != zone) | 1508 | if (NULL != zone) |
1509 | { | 1509 | { |
1510 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message for zone `%s'\n", "ZONE_ITERATION_START", GNUNET_h2s(zone)); | 1510 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message for zone `%s'\n", "ZONE_ITERATION_START", GNUNET_short_h2s(zone)); |
1511 | msg->zone = *zone; | 1511 | msg->zone = *zone; |
1512 | } | 1512 | } |
1513 | else | 1513 | else |
@@ -1610,7 +1610,7 @@ GNUNET_NAMESTORE_zone_iteration_stop (struct GNUNET_NAMESTORE_ZoneIterator *it) | |||
1610 | msg->gns_header.r_id = htonl (it->op_id); | 1610 | msg->gns_header.r_id = htonl (it->op_id); |
1611 | 1611 | ||
1612 | if (GNUNET_YES == it->has_zone) | 1612 | if (GNUNET_YES == it->has_zone) |
1613 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message for zone `%s'\n", "ZONE_ITERATION_STOP", GNUNET_h2s(&it->zone)); | 1613 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message for zone `%s'\n", "ZONE_ITERATION_STOP", GNUNET_short_h2s(&it->zone)); |
1614 | else | 1614 | else |
1615 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message for all zones\n", "ZONE_ITERATION_STOP"); | 1615 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message for all zones\n", "ZONE_ITERATION_STOP"); |
1616 | 1616 | ||
diff --git a/src/namestore/namestore_common.c b/src/namestore/namestore_common.c index 45fccbb18..403f75ea8 100644 --- a/src/namestore/namestore_common.c +++ b/src/namestore/namestore_common.c | |||
@@ -66,6 +66,25 @@ struct NetworkRecord | |||
66 | 66 | ||
67 | }; | 67 | }; |
68 | 68 | ||
69 | |||
70 | /** | ||
71 | * Convert a short hash to a string (for printing debug messages). | ||
72 | * This is one of the very few calls in the entire API that is | ||
73 | * NOT reentrant! | ||
74 | * | ||
75 | * @param hc the short hash code | ||
76 | * @return string form; will be overwritten by next call to GNUNET_h2s. | ||
77 | */ | ||
78 | const char * | ||
79 | GNUNET_short_h2s (const struct GNUNET_CRYPTO_ShortHashCode * hc) | ||
80 | { | ||
81 | static struct GNUNET_CRYPTO_ShortHashAsciiEncoded ret; | ||
82 | |||
83 | GNUNET_CRYPTO_short_hash_to_enc (hc, &ret); | ||
84 | return (const char *) &ret; | ||
85 | } | ||
86 | |||
87 | |||
69 | /** | 88 | /** |
70 | * Calculate how many bytes we will need to serialize the given | 89 | * Calculate how many bytes we will need to serialize the given |
71 | * records. | 90 | * records. |
diff --git a/src/namestore/plugin_namestore_sqlite.c b/src/namestore/plugin_namestore_sqlite.c index 39cd185fc..45fad545c 100644 --- a/src/namestore/plugin_namestore_sqlite.c +++ b/src/namestore/plugin_namestore_sqlite.c | |||
@@ -397,19 +397,18 @@ database_shutdown (struct Plugin *plugin) | |||
397 | */ | 397 | */ |
398 | static int | 398 | static int |
399 | namestore_sqlite_remove_records (void *cls, | 399 | namestore_sqlite_remove_records (void *cls, |
400 | const GNUNET_HashCode *zone, | 400 | const struct GNUNET_CRYPTO_ShortHashCode *zone, |
401 | const char *name) | 401 | const char *name) |
402 | { | 402 | { |
403 | struct Plugin *plugin = cls; | 403 | struct Plugin *plugin = cls; |
404 | GNUNET_HashCode nh; | 404 | struct GNUNET_CRYPTO_ShortHashCode nh; |
405 | size_t name_len; | 405 | size_t name_len; |
406 | int n; | 406 | int n; |
407 | |||
408 | name_len = strlen (name); | 407 | name_len = strlen (name); |
409 | GNUNET_CRYPTO_hash (name, name_len, &nh); | 408 | GNUNET_CRYPTO_short_hash (name, name_len, &nh); |
410 | 409 | ||
411 | if ((SQLITE_OK != sqlite3_bind_blob (plugin->remove_records, 1, zone, sizeof (GNUNET_HashCode), SQLITE_STATIC)) || | 410 | if ((SQLITE_OK != sqlite3_bind_blob (plugin->remove_records, 1, zone, sizeof (struct GNUNET_CRYPTO_ShortHashCode), SQLITE_STATIC)) || |
412 | (SQLITE_OK != sqlite3_bind_blob (plugin->remove_records, 2, &nh, sizeof (GNUNET_HashCode), SQLITE_STATIC))) | 411 | (SQLITE_OK != sqlite3_bind_blob (plugin->remove_records, 2, &nh, sizeof (struct GNUNET_CRYPTO_ShortHashCode), SQLITE_STATIC))) |
413 | { | 412 | { |
414 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 413 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
415 | "sqlite3_bind_XXXX"); | 414 | "sqlite3_bind_XXXX"); |
@@ -466,26 +465,26 @@ namestore_sqlite_put_records (void *cls, | |||
466 | { | 465 | { |
467 | struct Plugin *plugin = cls; | 466 | struct Plugin *plugin = cls; |
468 | int n; | 467 | int n; |
469 | GNUNET_HashCode zone; | 468 | struct GNUNET_CRYPTO_ShortHashCode zone; |
470 | GNUNET_HashCode zone_delegation; | 469 | struct GNUNET_CRYPTO_ShortHashCode zone_delegation; |
471 | GNUNET_HashCode nh; | 470 | struct GNUNET_CRYPTO_ShortHashCode nh; |
472 | size_t name_len; | 471 | size_t name_len; |
473 | uint64_t rvalue; | 472 | uint64_t rvalue; |
474 | size_t data_size; | 473 | size_t data_size; |
475 | unsigned int i; | 474 | unsigned int i; |
476 | 475 | ||
477 | GNUNET_CRYPTO_hash (zone_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone); | 476 | GNUNET_CRYPTO_short_hash (zone_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone); |
478 | (void) namestore_sqlite_remove_records (plugin, &zone, name); | 477 | (void) namestore_sqlite_remove_records (plugin, &zone, name); |
479 | name_len = strlen (name); | 478 | name_len = strlen (name); |
480 | GNUNET_CRYPTO_hash (name, name_len, &nh); | 479 | GNUNET_CRYPTO_short_hash (name, name_len, &nh); |
481 | memset (&zone_delegation, 0, sizeof (zone_delegation)); | 480 | memset (&zone_delegation, 0, sizeof (zone_delegation)); |
482 | for (i=0;i<rd_count;i++) | 481 | for (i=0;i<rd_count;i++) |
483 | if (rd[i].record_type == GNUNET_NAMESTORE_TYPE_PKEY) | 482 | if (rd[i].record_type == GNUNET_NAMESTORE_TYPE_PKEY) |
484 | { | 483 | { |
485 | GNUNET_assert (sizeof (GNUNET_HashCode) == rd[i].data_size); | 484 | GNUNET_assert (sizeof (struct GNUNET_CRYPTO_ShortHashCode) == rd[i].data_size); |
486 | memcpy (&zone_delegation, | 485 | memcpy (&zone_delegation, |
487 | rd[i].data, | 486 | rd[i].data, |
488 | sizeof (GNUNET_HashCode)); | 487 | sizeof (struct GNUNET_CRYPTO_ShortHashCode)); |
489 | break; | 488 | break; |
490 | } | 489 | } |
491 | rvalue = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX); | 490 | rvalue = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX); |
@@ -510,9 +509,9 @@ namestore_sqlite_put_records (void *cls, | |||
510 | (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 4, data, data_size, SQLITE_STATIC)) || | 509 | (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 4, data, data_size, SQLITE_STATIC)) || |
511 | (SQLITE_OK != sqlite3_bind_int64 (plugin->put_records, 5, expire.abs_value)) || | 510 | (SQLITE_OK != sqlite3_bind_int64 (plugin->put_records, 5, expire.abs_value)) || |
512 | (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 6, signature, sizeof (struct GNUNET_CRYPTO_RsaSignature), SQLITE_STATIC)) || | 511 | (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 6, signature, sizeof (struct GNUNET_CRYPTO_RsaSignature), SQLITE_STATIC)) || |
513 | (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 7, &zone_delegation, sizeof (GNUNET_HashCode), SQLITE_STATIC)) || | 512 | (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 7, &zone_delegation, sizeof (struct GNUNET_CRYPTO_ShortHashCode), SQLITE_STATIC)) || |
514 | (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 8, &zone, sizeof (GNUNET_HashCode), SQLITE_STATIC)) || | 513 | (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 8, &zone, sizeof (struct GNUNET_CRYPTO_ShortHashCode), SQLITE_STATIC)) || |
515 | (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 9, &nh, sizeof (GNUNET_HashCode), SQLITE_STATIC)) || | 514 | (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 9, &nh, sizeof (struct GNUNET_CRYPTO_ShortHashCode), SQLITE_STATIC)) || |
516 | (SQLITE_OK != sqlite3_bind_int64 (plugin->put_records, 10, rvalue)) ) | 515 | (SQLITE_OK != sqlite3_bind_int64 (plugin->put_records, 10, rvalue)) ) |
517 | { | 516 | { |
518 | LOG_SQLITE (plugin, | 517 | LOG_SQLITE (plugin, |
@@ -638,14 +637,14 @@ get_record_and_call_iterator (struct Plugin *plugin, | |||
638 | */ | 637 | */ |
639 | static int | 638 | static int |
640 | namestore_sqlite_iterate_records (void *cls, | 639 | namestore_sqlite_iterate_records (void *cls, |
641 | const GNUNET_HashCode *zone, | 640 | const struct GNUNET_CRYPTO_ShortHashCode *zone, |
642 | const char *name, | 641 | const char *name, |
643 | uint64_t offset, | 642 | uint64_t offset, |
644 | GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) | 643 | GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) |
645 | { | 644 | { |
646 | struct Plugin *plugin = cls; | 645 | struct Plugin *plugin = cls; |
647 | sqlite3_stmt *stmt; | 646 | sqlite3_stmt *stmt; |
648 | GNUNET_HashCode name_hase; | 647 | struct GNUNET_CRYPTO_ShortHashCode name_hase; |
649 | unsigned int boff; | 648 | unsigned int boff; |
650 | 649 | ||
651 | if (NULL == zone) | 650 | if (NULL == zone) |
@@ -653,7 +652,7 @@ namestore_sqlite_iterate_records (void *cls, | |||
653 | stmt = plugin->iterate_all; | 652 | stmt = plugin->iterate_all; |
654 | else | 653 | else |
655 | { | 654 | { |
656 | GNUNET_CRYPTO_hash (name, strlen(name), &name_hase); | 655 | GNUNET_CRYPTO_short_hash (name, strlen(name), &name_hase); |
657 | stmt = plugin->iterate_by_name; | 656 | stmt = plugin->iterate_by_name; |
658 | } | 657 | } |
659 | else | 658 | else |
@@ -661,14 +660,14 @@ namestore_sqlite_iterate_records (void *cls, | |||
661 | stmt = plugin->iterate_by_zone; | 660 | stmt = plugin->iterate_by_zone; |
662 | else | 661 | else |
663 | { | 662 | { |
664 | GNUNET_CRYPTO_hash (name, strlen(name), &name_hase); | 663 | GNUNET_CRYPTO_short_hash (name, strlen(name), &name_hase); |
665 | stmt = plugin->iterate_records; | 664 | stmt = plugin->iterate_records; |
666 | } | 665 | } |
667 | 666 | ||
668 | boff = 0; | 667 | boff = 0; |
669 | if ( (NULL != zone) && | 668 | if ( (NULL != zone) && |
670 | (SQLITE_OK != sqlite3_bind_blob (stmt, ++boff, | 669 | (SQLITE_OK != sqlite3_bind_blob (stmt, ++boff, |
671 | zone, sizeof (GNUNET_HashCode), | 670 | zone, sizeof (struct GNUNET_CRYPTO_ShortHashCode), |
672 | SQLITE_STATIC)) ) | 671 | SQLITE_STATIC)) ) |
673 | { | 672 | { |
674 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 673 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
@@ -681,10 +680,10 @@ namestore_sqlite_iterate_records (void *cls, | |||
681 | } | 680 | } |
682 | if ( (NULL != name) && | 681 | if ( (NULL != name) && |
683 | (SQLITE_OK != sqlite3_bind_blob (stmt, ++boff, | 682 | (SQLITE_OK != sqlite3_bind_blob (stmt, ++boff, |
684 | &name_hase, sizeof (GNUNET_HashCode), | 683 | &name_hase, sizeof (struct GNUNET_CRYPTO_ShortHashCode), |
685 | SQLITE_STATIC)) ) | 684 | SQLITE_STATIC)) ) |
686 | { | 685 | { |
687 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "ITERATE NAME HASH: `%s'", GNUNET_h2s_full(&name_hase)); | 686 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "ITERATE NAME HASH: `%8s'", GNUNET_short_h2s(&name_hase)); |
688 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 687 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
689 | "sqlite3_bind_XXXX"); | 688 | "sqlite3_bind_XXXX"); |
690 | if (SQLITE_OK != sqlite3_reset (stmt)) | 689 | if (SQLITE_OK != sqlite3_reset (stmt)) |
@@ -723,8 +722,8 @@ namestore_sqlite_iterate_records (void *cls, | |||
723 | */ | 722 | */ |
724 | static int | 723 | static int |
725 | namestore_sqlite_zone_to_name (void *cls, | 724 | namestore_sqlite_zone_to_name (void *cls, |
726 | const GNUNET_HashCode *zone, | 725 | const struct GNUNET_CRYPTO_ShortHashCode *zone, |
727 | const GNUNET_HashCode *value_zone, | 726 | const struct GNUNET_CRYPTO_ShortHashCode *value_zone, |
728 | GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) | 727 | GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) |
729 | { | 728 | { |
730 | struct Plugin *plugin = cls; | 729 | struct Plugin *plugin = cls; |
@@ -732,10 +731,10 @@ namestore_sqlite_zone_to_name (void *cls, | |||
732 | 731 | ||
733 | stmt = plugin->zone_to_name; | 732 | stmt = plugin->zone_to_name; |
734 | if ( (SQLITE_OK != sqlite3_bind_blob (stmt, 1, | 733 | if ( (SQLITE_OK != sqlite3_bind_blob (stmt, 1, |
735 | zone, sizeof (GNUNET_HashCode), | 734 | zone, sizeof (struct GNUNET_CRYPTO_ShortHashCode), |
736 | SQLITE_STATIC)) || | 735 | SQLITE_STATIC)) || |
737 | (SQLITE_OK != sqlite3_bind_blob (stmt, 2, | 736 | (SQLITE_OK != sqlite3_bind_blob (stmt, 2, |
738 | value_zone, sizeof (GNUNET_HashCode), | 737 | value_zone, sizeof (struct GNUNET_CRYPTO_ShortHashCode), |
739 | SQLITE_STATIC)) ) | 738 | SQLITE_STATIC)) ) |
740 | { | 739 | { |
741 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 740 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
@@ -759,13 +758,13 @@ namestore_sqlite_zone_to_name (void *cls, | |||
759 | */ | 758 | */ |
760 | static void | 759 | static void |
761 | namestore_sqlite_delete_zone (void *cls, | 760 | namestore_sqlite_delete_zone (void *cls, |
762 | const GNUNET_HashCode *zone) | 761 | const struct GNUNET_CRYPTO_ShortHashCode *zone) |
763 | { | 762 | { |
764 | struct Plugin *plugin = cls; | 763 | struct Plugin *plugin = cls; |
765 | sqlite3_stmt *stmt = plugin->delete_zone; | 764 | sqlite3_stmt *stmt = plugin->delete_zone; |
766 | int n; | 765 | int n; |
767 | 766 | ||
768 | if (SQLITE_OK != sqlite3_bind_blob (stmt, 1, zone, sizeof (GNUNET_HashCode), SQLITE_STATIC)) | 767 | if (SQLITE_OK != sqlite3_bind_blob (stmt, 1, zone, sizeof (struct GNUNET_CRYPTO_ShortHashCode), SQLITE_STATIC)) |
769 | { | 768 | { |
770 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 769 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
771 | "sqlite3_bind_XXXX"); | 770 | "sqlite3_bind_XXXX"); |
diff --git a/src/namestore/test_namestore_api.c b/src/namestore/test_namestore_api.c index 74c344c0a..4c654ecf4 100644 --- a/src/namestore/test_namestore_api.c +++ b/src/namestore/test_namestore_api.c | |||
@@ -36,7 +36,7 @@ static struct GNUNET_OS_Process *arm; | |||
36 | 36 | ||
37 | static struct GNUNET_CRYPTO_RsaPrivateKey * privkey; | 37 | static struct GNUNET_CRYPTO_RsaPrivateKey * privkey; |
38 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; | 38 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; |
39 | static GNUNET_HashCode zone; | 39 | static struct GNUNET_CRYPTO_ShortHashCode zone; |
40 | 40 | ||
41 | static int res; | 41 | static int res; |
42 | 42 | ||
@@ -175,7 +175,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
175 | GNUNET_assert (privkey != NULL); | 175 | GNUNET_assert (privkey != NULL); |
176 | GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); | 176 | GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); |
177 | 177 | ||
178 | GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &zone); | 178 | GNUNET_CRYPTO_short_hash (&pubkey, sizeof (pubkey), &zone); |
179 | 179 | ||
180 | 180 | ||
181 | struct GNUNET_CRYPTO_RsaSignature signature; | 181 | struct GNUNET_CRYPTO_RsaSignature signature; |
diff --git a/src/namestore/test_namestore_api_create.c b/src/namestore/test_namestore_api_create.c index 5117ba9e8..4490b85c6 100644 --- a/src/namestore/test_namestore_api_create.c +++ b/src/namestore/test_namestore_api_create.c | |||
@@ -49,7 +49,7 @@ static struct GNUNET_CRYPTO_RsaPrivateKey * privkey; | |||
49 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; | 49 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; |
50 | struct GNUNET_CRYPTO_RsaSignature *s_signature; | 50 | struct GNUNET_CRYPTO_RsaSignature *s_signature; |
51 | struct GNUNET_CRYPTO_RsaSignature *s_signature_updated; | 51 | struct GNUNET_CRYPTO_RsaSignature *s_signature_updated; |
52 | static GNUNET_HashCode s_zone; | 52 | static struct GNUNET_CRYPTO_ShortHashCode s_zone; |
53 | struct GNUNET_NAMESTORE_RecordData *s_first_record; | 53 | struct GNUNET_NAMESTORE_RecordData *s_first_record; |
54 | struct GNUNET_NAMESTORE_RecordData *s_second_record; | 54 | struct GNUNET_NAMESTORE_RecordData *s_second_record; |
55 | static char *s_name; | 55 | static char *s_name; |
@@ -426,9 +426,9 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
426 | s_signature = GNUNET_NAMESTORE_create_signature(privkey, s_first_record->expiration, s_name, s_first_record, 1); | 426 | s_signature = GNUNET_NAMESTORE_create_signature(privkey, s_first_record->expiration, s_name, s_first_record, 1); |
427 | 427 | ||
428 | /* create random zone hash */ | 428 | /* create random zone hash */ |
429 | GNUNET_CRYPTO_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone); | 429 | GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone); |
430 | 430 | ||
431 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Name: `%s' Zone: `%s' \n", s_name, GNUNET_h2s_full(&s_zone)); | 431 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Name: `%s' Zone: `%s' \n", s_name, GNUNET_short_h2s (&s_zone)); |
432 | 432 | ||
433 | start_arm (cfgfile); | 433 | start_arm (cfgfile); |
434 | GNUNET_assert (arm != NULL); | 434 | GNUNET_assert (arm != NULL); |
diff --git a/src/namestore/test_namestore_api_create_update.c b/src/namestore/test_namestore_api_create_update.c index 2eb078d5a..6deb03bf0 100644 --- a/src/namestore/test_namestore_api_create_update.c +++ b/src/namestore/test_namestore_api_create_update.c | |||
@@ -49,7 +49,7 @@ static struct GNUNET_CRYPTO_RsaPrivateKey * privkey; | |||
49 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; | 49 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; |
50 | struct GNUNET_CRYPTO_RsaSignature *s_signature; | 50 | struct GNUNET_CRYPTO_RsaSignature *s_signature; |
51 | struct GNUNET_CRYPTO_RsaSignature *s_signature_updated; | 51 | struct GNUNET_CRYPTO_RsaSignature *s_signature_updated; |
52 | static GNUNET_HashCode s_zone; | 52 | static struct GNUNET_CRYPTO_ShortHashCode s_zone; |
53 | struct GNUNET_NAMESTORE_RecordData *s_first_record; | 53 | struct GNUNET_NAMESTORE_RecordData *s_first_record; |
54 | struct GNUNET_NAMESTORE_RecordData *s_second_record; | 54 | struct GNUNET_NAMESTORE_RecordData *s_second_record; |
55 | static char *s_name; | 55 | static char *s_name; |
@@ -465,9 +465,9 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
465 | s_signature = GNUNET_NAMESTORE_create_signature(privkey, s_first_record->expiration, s_name, s_first_record, 1); | 465 | s_signature = GNUNET_NAMESTORE_create_signature(privkey, s_first_record->expiration, s_name, s_first_record, 1); |
466 | 466 | ||
467 | /* create random zone hash */ | 467 | /* create random zone hash */ |
468 | GNUNET_CRYPTO_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone); | 468 | GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone); |
469 | 469 | ||
470 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Name: `%s' Zone: `%s' \n", s_name, GNUNET_h2s_full(&s_zone)); | 470 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Name: `%s' Zone: `%s' \n", s_name, GNUNET_short_h2s (&s_zone)); |
471 | 471 | ||
472 | start_arm (cfgfile); | 472 | start_arm (cfgfile); |
473 | GNUNET_assert (arm != NULL); | 473 | GNUNET_assert (arm != NULL); |
diff --git a/src/namestore/test_namestore_api_lookup.c b/src/namestore/test_namestore_api_lookup.c index 4a33c6467..5be939a89 100644 --- a/src/namestore/test_namestore_api_lookup.c +++ b/src/namestore/test_namestore_api_lookup.c | |||
@@ -44,7 +44,7 @@ static struct GNUNET_OS_Process *arm; | |||
44 | static struct GNUNET_CRYPTO_RsaPrivateKey * privkey; | 44 | static struct GNUNET_CRYPTO_RsaPrivateKey * privkey; |
45 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; | 45 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; |
46 | struct GNUNET_CRYPTO_RsaSignature *s_signature; | 46 | struct GNUNET_CRYPTO_RsaSignature *s_signature; |
47 | static GNUNET_HashCode s_zone; | 47 | static struct GNUNET_CRYPTO_ShortHashCode s_zone; |
48 | struct GNUNET_NAMESTORE_RecordData *s_rd; | 48 | struct GNUNET_NAMESTORE_RecordData *s_rd; |
49 | static char *s_name; | 49 | static char *s_name; |
50 | 50 | ||
@@ -273,7 +273,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
273 | s_signature = GNUNET_NAMESTORE_create_signature(privkey, s_rd[0].expiration, s_name, s_rd, RECORDS); | 273 | s_signature = GNUNET_NAMESTORE_create_signature(privkey, s_rd[0].expiration, s_name, s_rd, RECORDS); |
274 | 274 | ||
275 | /* create random zone hash */ | 275 | /* create random zone hash */ |
276 | GNUNET_CRYPTO_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone); | 276 | GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone); |
277 | 277 | ||
278 | start_arm (cfgfile); | 278 | start_arm (cfgfile); |
279 | GNUNET_assert (arm != NULL); | 279 | GNUNET_assert (arm != NULL); |
diff --git a/src/namestore/test_namestore_api_lookup_specific_type.c b/src/namestore/test_namestore_api_lookup_specific_type.c index 1a1dca2ff..ec5ca8b78 100644 --- a/src/namestore/test_namestore_api_lookup_specific_type.c +++ b/src/namestore/test_namestore_api_lookup_specific_type.c | |||
@@ -47,7 +47,7 @@ static struct GNUNET_OS_Process *arm; | |||
47 | static struct GNUNET_CRYPTO_RsaPrivateKey * privkey; | 47 | static struct GNUNET_CRYPTO_RsaPrivateKey * privkey; |
48 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; | 48 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; |
49 | struct GNUNET_CRYPTO_RsaSignature *s_signature; | 49 | struct GNUNET_CRYPTO_RsaSignature *s_signature; |
50 | static GNUNET_HashCode s_zone; | 50 | static struct GNUNET_CRYPTO_ShortHashCode s_zone; |
51 | struct GNUNET_NAMESTORE_RecordData *s_rd; | 51 | struct GNUNET_NAMESTORE_RecordData *s_rd; |
52 | static char *s_name; | 52 | static char *s_name; |
53 | 53 | ||
@@ -345,7 +345,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
345 | s_signature = GNUNET_NAMESTORE_create_signature(privkey, s_rd[RECORDS -1].expiration, s_name, s_rd, RECORDS); | 345 | s_signature = GNUNET_NAMESTORE_create_signature(privkey, s_rd[RECORDS -1].expiration, s_name, s_rd, RECORDS); |
346 | 346 | ||
347 | /* create random zone hash */ | 347 | /* create random zone hash */ |
348 | GNUNET_CRYPTO_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone); | 348 | GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone); |
349 | 349 | ||
350 | start_arm (cfgfile); | 350 | start_arm (cfgfile); |
351 | GNUNET_assert (arm != NULL); | 351 | GNUNET_assert (arm != NULL); |
diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c index 398f21ba6..83e6529b8 100644 --- a/src/namestore/test_namestore_api_remove.c +++ b/src/namestore/test_namestore_api_remove.c | |||
@@ -48,7 +48,7 @@ static struct GNUNET_OS_Process *arm; | |||
48 | static struct GNUNET_CRYPTO_RsaPrivateKey * privkey; | 48 | static struct GNUNET_CRYPTO_RsaPrivateKey * privkey; |
49 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; | 49 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; |
50 | struct GNUNET_CRYPTO_RsaSignature *s_signature; | 50 | struct GNUNET_CRYPTO_RsaSignature *s_signature; |
51 | static GNUNET_HashCode s_zone; | 51 | static struct GNUNET_CRYPTO_ShortHashCode s_zone; |
52 | struct GNUNET_NAMESTORE_RecordData *s_rd; | 52 | struct GNUNET_NAMESTORE_RecordData *s_rd; |
53 | static char *s_name; | 53 | static char *s_name; |
54 | 54 | ||
@@ -309,9 +309,9 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
309 | s_signature = GNUNET_NAMESTORE_create_signature(privkey, s_rd[0].expiration, s_name, s_rd, RECORDS); | 309 | s_signature = GNUNET_NAMESTORE_create_signature(privkey, s_rd[0].expiration, s_name, s_rd, RECORDS); |
310 | 310 | ||
311 | /* create random zone hash */ | 311 | /* create random zone hash */ |
312 | GNUNET_CRYPTO_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone); | 312 | GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone); |
313 | 313 | ||
314 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Name: `%s' Zone: `%s' \n", s_name, GNUNET_h2s_full(&s_zone)); | 314 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Name: `%s' Zone: `%s' \n", s_name, GNUNET_short_h2s (&s_zone)); |
315 | 315 | ||
316 | 316 | ||
317 | start_arm (cfgfile); | 317 | start_arm (cfgfile); |
diff --git a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c index 2c03c82d6..550662e1f 100644 --- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c +++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c | |||
@@ -38,11 +38,11 @@ static struct GNUNET_OS_Process *arm; | |||
38 | 38 | ||
39 | static struct GNUNET_CRYPTO_RsaPrivateKey * privkey; | 39 | static struct GNUNET_CRYPTO_RsaPrivateKey * privkey; |
40 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; | 40 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; |
41 | static GNUNET_HashCode zone; | 41 | static struct GNUNET_CRYPTO_ShortHashCode zone; |
42 | 42 | ||
43 | static struct GNUNET_CRYPTO_RsaPrivateKey * privkey2; | 43 | static struct GNUNET_CRYPTO_RsaPrivateKey * privkey2; |
44 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey2; | 44 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey2; |
45 | static GNUNET_HashCode zone2; | 45 | static struct GNUNET_CRYPTO_ShortHashCode zone2; |
46 | 46 | ||
47 | static struct GNUNET_NAMESTORE_ZoneIterator *zi; | 47 | static struct GNUNET_NAMESTORE_ZoneIterator *zi; |
48 | static int res; | 48 | static int res; |
@@ -206,7 +206,7 @@ void zone_proc (void *cls, | |||
206 | const struct GNUNET_CRYPTO_RsaSignature *signature) | 206 | const struct GNUNET_CRYPTO_RsaSignature *signature) |
207 | { | 207 | { |
208 | int failed = GNUNET_NO; | 208 | int failed = GNUNET_NO; |
209 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Callback for zone `%s'\n", GNUNET_h2s (&zone)); | 209 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Callback for zone `%s'\n", GNUNET_short_h2s (&zone)); |
210 | if ((zone_key == NULL) && (name == NULL)) | 210 | if ((zone_key == NULL) && (name == NULL)) |
211 | { | 211 | { |
212 | GNUNET_break (2 == returned_records); | 212 | GNUNET_break (2 == returned_records); |
@@ -326,7 +326,7 @@ put_cont (void *cls, int32_t success, const char *emsg) | |||
326 | res = 1; | 326 | res = 1; |
327 | returned_records = 0; | 327 | returned_records = 0; |
328 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All records created, starting iteration over zone `%s'\n", | 328 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All records created, starting iteration over zone `%s'\n", |
329 | GNUNET_h2s(&zone)); | 329 | GNUNET_short_h2s(&zone)); |
330 | zi = GNUNET_NAMESTORE_zone_iteration_start(nsh, | 330 | zi = GNUNET_NAMESTORE_zone_iteration_start(nsh, |
331 | &zone, | 331 | &zone, |
332 | GNUNET_NAMESTORE_RF_NONE, | 332 | GNUNET_NAMESTORE_RF_NONE, |
@@ -375,7 +375,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
375 | GNUNET_free (hostkey_file); | 375 | GNUNET_free (hostkey_file); |
376 | GNUNET_assert (privkey != NULL); | 376 | GNUNET_assert (privkey != NULL); |
377 | GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); | 377 | GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); |
378 | GNUNET_CRYPTO_hash(&pubkey, sizeof (pubkey), &zone); | 378 | GNUNET_CRYPTO_short_hash (&pubkey, sizeof (pubkey), &zone); |
379 | 379 | ||
380 | GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "KJI3AL00K91EDPFJF58DAJM7H61D189TLP70N56JL8SVDCJE1SJ3SNNBOQPPONTL37FMHPS39SMK2NMVC0GQMGA6QCMHITT78O8GF80.zkey"); | 380 | GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "KJI3AL00K91EDPFJF58DAJM7H61D189TLP70N56JL8SVDCJE1SJ3SNNBOQPPONTL37FMHPS39SMK2NMVC0GQMGA6QCMHITT78O8GF80.zkey"); |
381 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); | 381 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); |
@@ -383,7 +383,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
383 | GNUNET_free (hostkey_file); | 383 | GNUNET_free (hostkey_file); |
384 | GNUNET_assert (privkey2 != NULL); | 384 | GNUNET_assert (privkey2 != NULL); |
385 | GNUNET_CRYPTO_rsa_key_get_public(privkey2, &pubkey2); | 385 | GNUNET_CRYPTO_rsa_key_get_public(privkey2, &pubkey2); |
386 | GNUNET_CRYPTO_hash(&pubkey2, sizeof (pubkey), &zone2); | 386 | GNUNET_CRYPTO_short_hash (&pubkey2, sizeof (pubkey), &zone2); |
387 | 387 | ||
388 | 388 | ||
389 | start_arm (cfgfile); | 389 | start_arm (cfgfile); |
diff --git a/src/namestore/test_namestore_api_zone_to_name.c b/src/namestore/test_namestore_api_zone_to_name.c index ad9acc890..5fb984dc1 100644 --- a/src/namestore/test_namestore_api_zone_to_name.c +++ b/src/namestore/test_namestore_api_zone_to_name.c | |||
@@ -46,8 +46,8 @@ static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; | |||
46 | 46 | ||
47 | struct GNUNET_TIME_Absolute expire; | 47 | struct GNUNET_TIME_Absolute expire; |
48 | 48 | ||
49 | static GNUNET_HashCode s_zone; | 49 | static struct GNUNET_CRYPTO_ShortHashCode s_zone; |
50 | static GNUNET_HashCode s_zone_value; | 50 | static struct GNUNET_CRYPTO_ShortHashCode s_zone_value; |
51 | 51 | ||
52 | char * s_name; | 52 | char * s_name; |
53 | 53 | ||
@@ -230,8 +230,8 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
230 | GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); | 230 | GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); |
231 | 231 | ||
232 | /* zone hash */ | 232 | /* zone hash */ |
233 | GNUNET_CRYPTO_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone); | 233 | GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone); |
234 | GNUNET_CRYPTO_hash (s_name, strlen (s_name) + 1, &s_zone_value); | 234 | GNUNET_CRYPTO_short_hash (s_name, strlen (s_name) + 1, &s_zone_value); |
235 | 235 | ||
236 | struct GNUNET_NAMESTORE_RecordData rd; | 236 | struct GNUNET_NAMESTORE_RecordData rd; |
237 | rd.expiration = GNUNET_TIME_absolute_get(); | 237 | rd.expiration = GNUNET_TIME_absolute_get(); |
diff --git a/src/namestore/test_plugin_namestore.c b/src/namestore/test_plugin_namestore.c index dcf3505c3..3e93d73b2 100644 --- a/src/namestore/test_plugin_namestore.c +++ b/src/namestore/test_plugin_namestore.c | |||
@@ -176,7 +176,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
176 | { | 176 | { |
177 | struct GNUNET_NAMESTORE_PluginFunctions *nsp; | 177 | struct GNUNET_NAMESTORE_PluginFunctions *nsp; |
178 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded zone_key; | 178 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded zone_key; |
179 | GNUNET_HashCode zone; | 179 | struct GNUNET_CRYPTO_ShortHashCode zone; |
180 | 180 | ||
181 | ok = 0; | 181 | ok = 0; |
182 | nsp = load_plugin (cfg); | 182 | nsp = load_plugin (cfg); |
@@ -187,13 +187,16 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
187 | "Failed to initialize namestore. Database likely not setup, skipping test.\n"); | 187 | "Failed to initialize namestore. Database likely not setup, skipping test.\n"); |
188 | return; | 188 | return; |
189 | } | 189 | } |
190 | |||
190 | put_record (nsp, 1); | 191 | put_record (nsp, 1); |
192 | |||
191 | get_record (nsp, 1); | 193 | get_record (nsp, 1); |
192 | 194 | ||
193 | memset (&zone_key, 1, sizeof (zone_key)); | 195 | memset (&zone_key, 1, sizeof (zone_key)); |
194 | GNUNET_CRYPTO_hash (&zone_key, sizeof (zone_key), &zone); | 196 | GNUNET_CRYPTO_short_hash (&zone_key, sizeof (zone_key), &zone); |
195 | nsp->delete_zone (nsp->cls, &zone); | 197 | nsp->delete_zone (nsp->cls, &zone); |
196 | unload_plugin (nsp); | 198 | unload_plugin (nsp); |
199 | |||
197 | } | 200 | } |
198 | 201 | ||
199 | 202 | ||