diff options
Diffstat (limited to 'src/gns/test_gns_pseu_shorten.c')
-rw-r--r-- | src/gns/test_gns_pseu_shorten.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/gns/test_gns_pseu_shorten.c b/src/gns/test_gns_pseu_shorten.c index 8610179b2..a4c337067 100644 --- a/src/gns/test_gns_pseu_shorten.c +++ b/src/gns/test_gns_pseu_shorten.c | |||
@@ -127,7 +127,7 @@ end_badly_now () | |||
127 | } | 127 | } |
128 | 128 | ||
129 | 129 | ||
130 | static void | 130 | static void |
131 | shutdown_task (void *cls, | 131 | shutdown_task (void *cls, |
132 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 132 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
133 | { | 133 | { |
@@ -186,7 +186,7 @@ on_lookup_result (void *cls, uint32_t rd_count, | |||
186 | struct in_addr a; | 186 | struct in_addr a; |
187 | int i; | 187 | int i; |
188 | char* addr; | 188 | char* addr; |
189 | 189 | ||
190 | if (rd_count == 0) | 190 | if (rd_count == 0) |
191 | { | 191 | { |
192 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 192 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
@@ -267,7 +267,7 @@ put_pseu_dht (void *cls, int success) | |||
267 | char* nrb_data = NULL; | 267 | char* nrb_data = NULL; |
268 | struct GNUNET_CRYPTO_EccSignature *sig; | 268 | struct GNUNET_CRYPTO_EccSignature *sig; |
269 | struct GNUNET_NAMESTORE_RecordData rd; | 269 | struct GNUNET_NAMESTORE_RecordData rd; |
270 | 270 | ||
271 | memset (&rd, 0, sizeof (struct GNUNET_NAMESTORE_RecordData)); | 271 | memset (&rd, 0, sizeof (struct GNUNET_NAMESTORE_RecordData)); |
272 | rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; | 272 | rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; |
273 | rd.data_size = strlen(TEST_PSEU_ALICE)+1; | 273 | rd.data_size = strlen(TEST_PSEU_ALICE)+1; |
@@ -336,7 +336,7 @@ put_pseu_dht (void *cls, int success) | |||
336 | DHT_OPERATION_TIMEOUT, | 336 | DHT_OPERATION_TIMEOUT, |
337 | &commence_testing, | 337 | &commence_testing, |
338 | NULL); | 338 | NULL); |
339 | 339 | ||
340 | GNUNET_free(sig); | 340 | GNUNET_free(sig); |
341 | GNUNET_free (nrb); | 341 | GNUNET_free (nrb); |
342 | } | 342 | } |
@@ -357,19 +357,19 @@ put_www_dht (void *cls, int success) | |||
357 | struct GNUNET_NAMESTORE_RecordData rd; | 357 | struct GNUNET_NAMESTORE_RecordData rd; |
358 | char* ip = TEST_IP; | 358 | char* ip = TEST_IP; |
359 | struct in_addr *web = GNUNET_malloc(sizeof(struct in_addr)); | 359 | struct in_addr *web = GNUNET_malloc(sizeof(struct in_addr)); |
360 | 360 | ||
361 | rd.expiration_time = UINT64_MAX; | 361 | rd.expiration_time = UINT64_MAX; |
362 | GNUNET_assert(1 == inet_pton (AF_INET, ip, web)); | 362 | GNUNET_assert(1 == inet_pton (AF_INET, ip, web)); |
363 | rd.data_size = sizeof(struct in_addr); | 363 | rd.data_size = sizeof(struct in_addr); |
364 | rd.data = web; | 364 | rd.data = web; |
365 | rd.record_type = GNUNET_DNSPARSER_TYPE_A; | 365 | rd.record_type = GNUNET_DNSPARSER_TYPE_A; |
366 | rd.flags = GNUNET_NAMESTORE_RF_NONE; | 366 | rd.flags = GNUNET_NAMESTORE_RF_NONE; |
367 | 367 | ||
368 | sig = GNUNET_NAMESTORE_create_signature(alice_key, | 368 | sig = GNUNET_NAMESTORE_create_signature(alice_key, |
369 | GNUNET_TIME_UNIT_FOREVER_ABS, | 369 | GNUNET_TIME_UNIT_FOREVER_ABS, |
370 | TEST_RECORD_NAME, | 370 | TEST_RECORD_NAME, |
371 | &rd, 1); | 371 | &rd, 1); |
372 | 372 | ||
373 | GNUNET_break (GNUNET_OK == GNUNET_NAMESTORE_verify_signature (&alice_pkey, | 373 | GNUNET_break (GNUNET_OK == GNUNET_NAMESTORE_verify_signature (&alice_pkey, |
374 | GNUNET_TIME_UNIT_FOREVER_ABS, | 374 | GNUNET_TIME_UNIT_FOREVER_ABS, |
375 | TEST_RECORD_NAME, | 375 | TEST_RECORD_NAME, |
@@ -443,13 +443,13 @@ put_pkey_dht (void *cls, int32_t success, const char *emsg) | |||
443 | char* nrb_data = NULL; | 443 | char* nrb_data = NULL; |
444 | struct GNUNET_CRYPTO_EccSignature *sig; | 444 | struct GNUNET_CRYPTO_EccSignature *sig; |
445 | struct GNUNET_NAMESTORE_RecordData rd; | 445 | struct GNUNET_NAMESTORE_RecordData rd; |
446 | 446 | ||
447 | rd.expiration_time = UINT64_MAX; | 447 | rd.expiration_time = UINT64_MAX; |
448 | rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode); | 448 | rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode); |
449 | rd.data = &alice_hash; | 449 | rd.data = &alice_hash; |
450 | rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY; | 450 | rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY; |
451 | rd.flags = GNUNET_NAMESTORE_RF_NONE; | 451 | rd.flags = GNUNET_NAMESTORE_RF_NONE; |
452 | 452 | ||
453 | sig = GNUNET_NAMESTORE_create_signature (bob_key, | 453 | sig = GNUNET_NAMESTORE_create_signature (bob_key, |
454 | GNUNET_TIME_UNIT_FOREVER_ABS, | 454 | GNUNET_TIME_UNIT_FOREVER_ABS, |
455 | TEST_AUTHORITY_ALICE, | 455 | TEST_AUTHORITY_ALICE, |
@@ -474,7 +474,7 @@ put_pkey_dht (void *cls, int32_t success, const char *emsg) | |||
474 | { | 474 | { |
475 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Record serialization failed!\n"); | 475 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Record serialization failed!\n"); |
476 | ok = 3; | 476 | ok = 3; |
477 | 477 | ||
478 | GNUNET_free (our_key); | 478 | GNUNET_free (our_key); |
479 | GNUNET_free (bob_key); | 479 | GNUNET_free (bob_key); |
480 | GNUNET_free (alice_key); | 480 | GNUNET_free (alice_key); |
@@ -492,7 +492,7 @@ put_pkey_dht (void *cls, int32_t success, const char *emsg) | |||
492 | &zone_hash); | 492 | &zone_hash); |
493 | GNUNET_CRYPTO_short_hash_double(&zone_hash, &zone_hash_double); | 493 | GNUNET_CRYPTO_short_hash_double(&zone_hash, &zone_hash_double); |
494 | GNUNET_CRYPTO_short_hash_double(&name_hash, &name_hash_double); | 494 | GNUNET_CRYPTO_short_hash_double(&name_hash, &name_hash_double); |
495 | GNUNET_CRYPTO_hash_xor(&zone_hash_double, &name_hash_double, &xor_hash); | 495 | GNUNET_CRYPTO_hash_xor(&zone_hash_double, &name_hash_double, &xor_hash); |
496 | 496 | ||
497 | rd_payload_length += sizeof(struct GNSNameRecordBlock) + | 497 | rd_payload_length += sizeof(struct GNSNameRecordBlock) + |
498 | strlen(TEST_AUTHORITY_ALICE) + 1; | 498 | strlen(TEST_AUTHORITY_ALICE) + 1; |
@@ -520,7 +520,7 @@ fin_init_zone (void *cls, int32_t success, const char *emsg) | |||
520 | rd.data = &bob_hash; | 520 | rd.data = &bob_hash; |
521 | rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY; | 521 | rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY; |
522 | rd.flags = GNUNET_NAMESTORE_RF_NONE; | 522 | rd.flags = GNUNET_NAMESTORE_RF_NONE; |
523 | 523 | ||
524 | GNUNET_NAMESTORE_record_put_by_authority (namestore_handle, | 524 | GNUNET_NAMESTORE_record_put_by_authority (namestore_handle, |
525 | our_key, | 525 | our_key, |
526 | TEST_AUTHORITY_BOB, | 526 | TEST_AUTHORITY_BOB, |
@@ -560,7 +560,7 @@ do_check (void *cls, | |||
560 | char *shorten_keyfile; | 560 | char *shorten_keyfile; |
561 | char *our_keyfile; | 561 | char *our_keyfile; |
562 | struct GNUNET_NAMESTORE_RecordData rd; | 562 | struct GNUNET_NAMESTORE_RecordData rd; |
563 | 563 | ||
564 | cfg = ccfg; | 564 | cfg = ccfg; |
565 | die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); | 565 | die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL); |
566 | 566 | ||
@@ -572,7 +572,7 @@ do_check (void *cls, | |||
572 | end_badly_now(); | 572 | end_badly_now(); |
573 | return; | 573 | return; |
574 | } | 574 | } |
575 | 575 | ||
576 | /* dht */ | 576 | /* dht */ |
577 | dht_handle = GNUNET_DHT_connect(cfg, 1); | 577 | dht_handle = GNUNET_DHT_connect(cfg, 1); |
578 | if (NULL == dht_handle) | 578 | if (NULL == dht_handle) |
@@ -591,7 +591,7 @@ do_check (void *cls, | |||
591 | GNUNET_free (our_keyfile); | 591 | GNUNET_free (our_keyfile); |
592 | return; | 592 | return; |
593 | } | 593 | } |
594 | 594 | ||
595 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns", | 595 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns", |
596 | "SHORTEN_ZONEKEY", | 596 | "SHORTEN_ZONEKEY", |
597 | &shorten_keyfile)) | 597 | &shorten_keyfile)) |
@@ -603,7 +603,7 @@ do_check (void *cls, | |||
603 | GNUNET_free (shorten_keyfile); | 603 | GNUNET_free (shorten_keyfile); |
604 | return; | 604 | return; |
605 | } | 605 | } |
606 | 606 | ||
607 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns", | 607 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns", |
608 | "PRIVATE_ZONEKEY", | 608 | "PRIVATE_ZONEKEY", |
609 | &private_keyfile)) | 609 | &private_keyfile)) |
@@ -621,7 +621,7 @@ do_check (void *cls, | |||
621 | short_key = GNUNET_CRYPTO_ecc_key_create_from_file (shorten_keyfile); | 621 | short_key = GNUNET_CRYPTO_ecc_key_create_from_file (shorten_keyfile); |
622 | bob_key = GNUNET_CRYPTO_ecc_key_create (); | 622 | bob_key = GNUNET_CRYPTO_ecc_key_create (); |
623 | alice_key = GNUNET_CRYPTO_ecc_key_create (); | 623 | alice_key = GNUNET_CRYPTO_ecc_key_create (); |
624 | 624 | ||
625 | GNUNET_free (our_keyfile); | 625 | GNUNET_free (our_keyfile); |
626 | GNUNET_free (shorten_keyfile); | 626 | GNUNET_free (shorten_keyfile); |
627 | GNUNET_free (private_keyfile); | 627 | GNUNET_free (private_keyfile); |
@@ -636,7 +636,7 @@ do_check (void *cls, | |||
636 | GNUNET_CRYPTO_short_hash (&our_pkey, sizeof(our_pkey), &our_zone); | 636 | GNUNET_CRYPTO_short_hash (&our_pkey, sizeof(our_pkey), &our_zone); |
637 | GNUNET_CRYPTO_short_hash (&priv_pkey, sizeof(priv_pkey), &priv_zone); | 637 | GNUNET_CRYPTO_short_hash (&priv_pkey, sizeof(priv_pkey), &priv_zone); |
638 | GNUNET_CRYPTO_short_hash (&short_pkey, sizeof(short_pkey), &short_zone); | 638 | GNUNET_CRYPTO_short_hash (&short_pkey, sizeof(short_pkey), &short_zone); |
639 | 639 | ||
640 | rd.expiration_time = UINT64_MAX; | 640 | rd.expiration_time = UINT64_MAX; |
641 | rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode); | 641 | rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode); |
642 | rd.data = &priv_zone; | 642 | rd.data = &priv_zone; |