aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/test_namestore_api_create.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/namestore/test_namestore_api_create.c')
-rw-r--r--src/namestore/test_namestore_api_create.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/namestore/test_namestore_api_create.c b/src/namestore/test_namestore_api_create.c
index 8bdf1338d..6db832149 100644
--- a/src/namestore/test_namestore_api_create.c
+++ b/src/namestore/test_namestore_api_create.c
@@ -50,13 +50,13 @@ static struct GNUNET_NAMESTORE_Handle * nsh;
50 50
51static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; 51static GNUNET_SCHEDULER_TaskIdentifier endbadly_task;
52 52
53static struct GNUNET_CRYPTO_RsaPrivateKey * privkey; 53static struct GNUNET_CRYPTO_EccPrivateKey * privkey;
54 54
55static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; 55static struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pubkey;
56 56
57static struct GNUNET_CRYPTO_RsaSignature *s_signature; 57static struct GNUNET_CRYPTO_EccSignature *s_signature;
58 58
59static struct GNUNET_CRYPTO_RsaSignature *s_signature_updated; 59static struct GNUNET_CRYPTO_EccSignature *s_signature_updated;
60 60
61static struct GNUNET_CRYPTO_ShortHashCode s_zone; 61static struct GNUNET_CRYPTO_ShortHashCode s_zone;
62 62
@@ -82,7 +82,7 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
82 GNUNET_NAMESTORE_disconnect (nsh); 82 GNUNET_NAMESTORE_disconnect (nsh);
83 nsh = NULL; 83 nsh = NULL;
84 if (privkey != NULL) 84 if (privkey != NULL)
85 GNUNET_CRYPTO_rsa_key_free (privkey); 85 GNUNET_CRYPTO_ecc_key_free (privkey);
86 privkey = NULL; 86 privkey = NULL;
87 GNUNET_free_non_null (s_name); 87 GNUNET_free_non_null (s_name);
88 res = 1; 88 res = 1;
@@ -102,7 +102,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
102 GNUNET_free_non_null (s_second_record); 102 GNUNET_free_non_null (s_second_record);
103 GNUNET_free_non_null (s_name); 103 GNUNET_free_non_null (s_name);
104 if (privkey != NULL) 104 if (privkey != NULL)
105 GNUNET_CRYPTO_rsa_key_free (privkey); 105 GNUNET_CRYPTO_ecc_key_free (privkey);
106 privkey = NULL; 106 privkey = NULL;
107 if (nsh != NULL) 107 if (nsh != NULL)
108 GNUNET_NAMESTORE_disconnect (nsh); 108 GNUNET_NAMESTORE_disconnect (nsh);
@@ -112,12 +112,12 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
112 112
113static void 113static void
114name_lookup_second_proc (void *cls, 114name_lookup_second_proc (void *cls,
115 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, 115 const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key,
116 struct GNUNET_TIME_Absolute expire, 116 struct GNUNET_TIME_Absolute expire,
117 const char *n, 117 const char *n,
118 unsigned int rd_count, 118 unsigned int rd_count,
119 const struct GNUNET_NAMESTORE_RecordData *rd, 119 const struct GNUNET_NAMESTORE_RecordData *rd,
120 const struct GNUNET_CRYPTO_RsaSignature *signature) 120 const struct GNUNET_CRYPTO_EccSignature *signature)
121{ 121{
122 static int found = GNUNET_NO; 122 static int found = GNUNET_NO;
123 int failed = GNUNET_NO; 123 int failed = GNUNET_NO;
@@ -126,7 +126,7 @@ name_lookup_second_proc (void *cls,
126 if (n != NULL) 126 if (n != NULL)
127 { 127 {
128 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Checking returned results\n"); 128 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Checking returned results\n");
129 if (0 != memcmp (zone_key, &pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded))) 129 if (0 != memcmp (zone_key, &pubkey, sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded)))
130 { 130 {
131 GNUNET_break (0); 131 GNUNET_break (0);
132 failed = GNUNET_YES; 132 failed = GNUNET_YES;
@@ -172,7 +172,7 @@ name_lookup_second_proc (void *cls,
172 rd_new[1].flags = 0; /* unset GNUNET_NAMESTORE_RF_AUTHORITY */ 172 rd_new[1].flags = 0; /* unset GNUNET_NAMESTORE_RF_AUTHORITY */
173 s_signature_updated = GNUNET_NAMESTORE_create_signature (privkey, expire, s_name, rd_new, 2); 173 s_signature_updated = GNUNET_NAMESTORE_create_signature (privkey, expire, s_name, rd_new, 2);
174 174
175 if (0 != memcmp (s_signature_updated, signature, sizeof (struct GNUNET_CRYPTO_RsaSignature))) 175 if (0 != memcmp (s_signature_updated, signature, sizeof (struct GNUNET_CRYPTO_EccSignature)))
176 { 176 {
177 GNUNET_break (0); 177 GNUNET_break (0);
178 failed = GNUNET_YES; 178 failed = GNUNET_YES;
@@ -219,12 +219,12 @@ create_second_cont (void *cls, int32_t success, const char *emsg)
219 219
220static void 220static void
221name_lookup_initial_proc (void *cls, 221name_lookup_initial_proc (void *cls,
222 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, 222 const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key,
223 struct GNUNET_TIME_Absolute expire, 223 struct GNUNET_TIME_Absolute expire,
224 const char *n, 224 const char *n,
225 unsigned int rd_count, 225 unsigned int rd_count,
226 const struct GNUNET_NAMESTORE_RecordData *rd, 226 const struct GNUNET_NAMESTORE_RecordData *rd,
227 const struct GNUNET_CRYPTO_RsaSignature *signature) 227 const struct GNUNET_CRYPTO_EccSignature *signature)
228{ 228{
229 char * name = cls; 229 char * name = cls;
230 static int found = GNUNET_NO; 230 static int found = GNUNET_NO;
@@ -234,7 +234,7 @@ name_lookup_initial_proc (void *cls,
234 if (n != NULL) 234 if (n != NULL)
235 { 235 {
236 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Checking returned results\n"); 236 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Checking returned results\n");
237 if (0 != memcmp (zone_key, &pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded))) 237 if (0 != memcmp (zone_key, &pubkey, sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded)))
238 { 238 {
239 GNUNET_break (0); 239 GNUNET_break (0);
240 failed = GNUNET_YES; 240 failed = GNUNET_YES;
@@ -267,7 +267,7 @@ name_lookup_initial_proc (void *cls,
267 failed = GNUNET_YES; 267 failed = GNUNET_YES;
268 } 268 }
269 269
270 if (0 != memcmp (s_signature, signature, sizeof (struct GNUNET_CRYPTO_RsaSignature))) 270 if (0 != memcmp (s_signature, signature, sizeof (struct GNUNET_CRYPTO_EccSignature)))
271 { 271 {
272 GNUNET_break (0); 272 GNUNET_break (0);
273 failed = GNUNET_YES; 273 failed = GNUNET_YES;
@@ -357,10 +357,10 @@ run (void *cls,
357 GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, 357 GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR,
358 "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); 358 "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey");
359 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); 359 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file);
360 privkey = GNUNET_CRYPTO_rsa_key_create_from_file(hostkey_file); 360 privkey = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file);
361 GNUNET_free (hostkey_file); 361 GNUNET_free (hostkey_file);
362 /* get public key */ 362 /* get public key */
363 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); 363 GNUNET_CRYPTO_ecc_key_get_public(privkey, &pubkey);
364 364
365 /* create record */ 365 /* create record */
366 s_name = GNUNET_NAMESTORE_normalize_string ("DUMMY.dummy.gnunet"); 366 s_name = GNUNET_NAMESTORE_normalize_string ("DUMMY.dummy.gnunet");
@@ -373,7 +373,7 @@ run (void *cls,
373 s_signature = GNUNET_NAMESTORE_create_signature(privkey, et, s_name, s_first_record, 1); 373 s_signature = GNUNET_NAMESTORE_create_signature(privkey, et, s_name, s_first_record, 1);
374 374
375 /* create random zone hash */ 375 /* create random zone hash */
376 GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone); 376 GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded), &s_zone);
377 377
378 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Name: `%s' Zone: `%s' \n", s_name, GNUNET_short_h2s (&s_zone)); 378 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Name: `%s' Zone: `%s' \n", s_name, GNUNET_short_h2s (&s_zone));
379 nsh = GNUNET_NAMESTORE_connect (cfg); 379 nsh = GNUNET_NAMESTORE_connect (cfg);