diff options
Diffstat (limited to 'src/hello')
-rw-r--r-- | src/hello/hello-ng.c | 9 | ||||
-rw-r--r-- | src/hello/test_hello-ng.c | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/hello/hello-ng.c b/src/hello/hello-ng.c index 85b304e18..96856a692 100644 --- a/src/hello/hello-ng.c +++ b/src/hello/hello-ng.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include "gnunet_util_lib.h" | 30 | #include "gnunet_util_lib.h" |
31 | #include "gnunet_ats_service.h" | 31 | #include "gnunet_ats_service.h" |
32 | 32 | ||
33 | GNUNET_NETWORK_STRUCT_BEGIN | ||
33 | /** | 34 | /** |
34 | * Binary block we sign when we sign an address. | 35 | * Binary block we sign when we sign an address. |
35 | */ | 36 | */ |
@@ -48,9 +49,9 @@ struct SignedAddress | |||
48 | /** | 49 | /** |
49 | * Hash of the address. | 50 | * Hash of the address. |
50 | */ | 51 | */ |
51 | struct GNUNET_HashCode h_addr; | 52 | struct GNUNET_HashCode addr_hash GNUNET_PACKED; |
52 | }; | 53 | }; |
53 | 54 | GNUNET_NETWORK_STRUCT_END | |
54 | 55 | ||
55 | /** | 56 | /** |
56 | * Build address record by signing raw information with private key. | 57 | * Build address record by signing raw information with private key. |
@@ -78,7 +79,7 @@ GNUNET_HELLO_sign_address ( | |||
78 | sa.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_ADDRESS); | 79 | sa.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_ADDRESS); |
79 | sa.purpose.size = htonl (sizeof(sa)); | 80 | sa.purpose.size = htonl (sizeof(sa)); |
80 | sa.mono_time = GNUNET_TIME_absolute_hton (mono_time); | 81 | sa.mono_time = GNUNET_TIME_absolute_hton (mono_time); |
81 | GNUNET_CRYPTO_hash (address, strlen (address), &sa.h_addr); | 82 | GNUNET_CRYPTO_hash (address, strlen (address), &sa.addr_hash); |
82 | GNUNET_CRYPTO_eddsa_sign (private_key, &sa, &sig); | 83 | GNUNET_CRYPTO_eddsa_sign (private_key, &sa, &sig); |
83 | sig_str = NULL; | 84 | sig_str = NULL; |
84 | (void) GNUNET_STRINGS_base64_encode (&sig, sizeof(sig), &sig_str); | 85 | (void) GNUNET_STRINGS_base64_encode (&sig, sizeof(sig), &sig_str); |
@@ -161,7 +162,7 @@ GNUNET_HELLO_extract_address (const void *raw, | |||
161 | sa.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_ADDRESS); | 162 | sa.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_ADDRESS); |
162 | sa.purpose.size = htonl (sizeof(sa)); | 163 | sa.purpose.size = htonl (sizeof(sa)); |
163 | sa.mono_time = GNUNET_TIME_absolute_hton (raw_mono_time); | 164 | sa.mono_time = GNUNET_TIME_absolute_hton (raw_mono_time); |
164 | GNUNET_CRYPTO_hash (raw_addr, strlen (raw_addr), &sa.h_addr); | 165 | GNUNET_CRYPTO_hash (raw_addr, strlen (raw_addr), &sa.addr_hash); |
165 | if (GNUNET_YES != | 166 | if (GNUNET_YES != |
166 | GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_ADDRESS, | 167 | GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_ADDRESS, |
167 | &sa, | 168 | &sa, |
diff --git a/src/hello/test_hello-ng.c b/src/hello/test_hello-ng.c index 82b1ab6c6..e6b1d42a0 100644 --- a/src/hello/test_hello-ng.c +++ b/src/hello/test_hello-ng.c | |||
@@ -26,7 +26,7 @@ main (int argc, | |||
26 | (void**)&res, | 26 | (void**)&res, |
27 | &res_len); | 27 | &res_len); |
28 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | 28 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
29 | "%s", res); | 29 | "%s\n", res); |
30 | GNUNET_assert (NULL != | 30 | GNUNET_assert (NULL != |
31 | GNUNET_HELLO_extract_address ((void**)res, | 31 | GNUNET_HELLO_extract_address ((void**)res, |
32 | res_len, | 32 | res_len, |