aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-05-29 08:18:55 +0000
committerChristian Grothoff <christian@grothoff.org>2013-05-29 08:18:55 +0000
commit022002438e4047d235a688cfd9da7b63ab990103 (patch)
tree8d0cb444a3ab376b5a8f614fb87bdeb31e7b3327 /src/namestore/test_namestore_api_zone_iteration_specific_zone.c
parentb62eb443ee3af84f87030fad9fd11a948b1a2503 (diff)
downloadgnunet-022002438e4047d235a688cfd9da7b63ab990103.tar.gz
gnunet-022002438e4047d235a688cfd9da7b63ab990103.zip
-switching GNS from RSA to ECC
Diffstat (limited to 'src/namestore/test_namestore_api_zone_iteration_specific_zone.c')
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_specific_zone.c38
1 files changed, 19 insertions, 19 deletions
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 7adf3fe2a..53457cdaa 100644
--- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
+++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
@@ -37,15 +37,15 @@ static GNUNET_SCHEDULER_TaskIdentifier endbadly_task;
37 37
38static GNUNET_SCHEDULER_TaskIdentifier stopiteration_task; 38static GNUNET_SCHEDULER_TaskIdentifier stopiteration_task;
39 39
40static struct GNUNET_CRYPTO_RsaPrivateKey * privkey; 40static struct GNUNET_CRYPTO_EccPrivateKey * privkey;
41 41
42static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; 42static struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pubkey;
43 43
44static struct GNUNET_CRYPTO_ShortHashCode zone; 44static struct GNUNET_CRYPTO_ShortHashCode zone;
45 45
46static struct GNUNET_CRYPTO_RsaPrivateKey * privkey2; 46static struct GNUNET_CRYPTO_EccPrivateKey * privkey2;
47 47
48static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey2; 48static struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pubkey2;
49 49
50static struct GNUNET_CRYPTO_ShortHashCode zone2; 50static struct GNUNET_CRYPTO_ShortHashCode zone2;
51 51
@@ -55,19 +55,19 @@ static int res;
55 55
56static int returned_records; 56static int returned_records;
57 57
58static struct GNUNET_CRYPTO_RsaSignature *sig_1; 58static struct GNUNET_CRYPTO_EccSignature *sig_1;
59 59
60static char * s_name_1; 60static char * s_name_1;
61 61
62static struct GNUNET_NAMESTORE_RecordData *s_rd_1; 62static struct GNUNET_NAMESTORE_RecordData *s_rd_1;
63 63
64static struct GNUNET_CRYPTO_RsaSignature *sig_2; 64static struct GNUNET_CRYPTO_EccSignature *sig_2;
65 65
66static char * s_name_2; 66static char * s_name_2;
67 67
68static struct GNUNET_NAMESTORE_RecordData *s_rd_2; 68static struct GNUNET_NAMESTORE_RecordData *s_rd_2;
69 69
70static struct GNUNET_CRYPTO_RsaSignature *sig_3; 70static struct GNUNET_CRYPTO_EccSignature *sig_3;
71 71
72static char * s_name_3; 72static char * s_name_3;
73 73
@@ -115,11 +115,11 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
115 } 115 }
116 116
117 if (privkey != NULL) 117 if (privkey != NULL)
118 GNUNET_CRYPTO_rsa_key_free (privkey); 118 GNUNET_CRYPTO_ecc_key_free (privkey);
119 privkey = NULL; 119 privkey = NULL;
120 120
121 if (privkey2 != NULL) 121 if (privkey2 != NULL)
122 GNUNET_CRYPTO_rsa_key_free (privkey2); 122 GNUNET_CRYPTO_ecc_key_free (privkey2);
123 privkey2 = NULL; 123 privkey2 = NULL;
124 res = 1; 124 res = 1;
125} 125}
@@ -139,10 +139,10 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
139 endbadly_task = GNUNET_SCHEDULER_NO_TASK; 139 endbadly_task = GNUNET_SCHEDULER_NO_TASK;
140 } 140 }
141 if (privkey != NULL) 141 if (privkey != NULL)
142 GNUNET_CRYPTO_rsa_key_free (privkey); 142 GNUNET_CRYPTO_ecc_key_free (privkey);
143 privkey = NULL; 143 privkey = NULL;
144 if (privkey2 != NULL) 144 if (privkey2 != NULL)
145 GNUNET_CRYPTO_rsa_key_free (privkey2); 145 GNUNET_CRYPTO_ecc_key_free (privkey2);
146 privkey2 = NULL; 146 privkey2 = NULL;
147 147
148 GNUNET_free (sig_1); 148 GNUNET_free (sig_1);
@@ -174,12 +174,12 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
174 174
175static void 175static void
176zone_proc (void *cls, 176zone_proc (void *cls,
177 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, 177 const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key,
178 struct GNUNET_TIME_Absolute expire, 178 struct GNUNET_TIME_Absolute expire,
179 const char *name, 179 const char *name,
180 unsigned int rd_count, 180 unsigned int rd_count,
181 const struct GNUNET_NAMESTORE_RecordData *rd, 181 const struct GNUNET_NAMESTORE_RecordData *rd,
182 const struct GNUNET_CRYPTO_RsaSignature *signature) 182 const struct GNUNET_CRYPTO_EccSignature *signature)
183{ 183{
184 int failed = GNUNET_NO; 184 int failed = GNUNET_NO;
185 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Callback for zone `%s'\n", GNUNET_short_h2s (&zone)); 185 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Callback for zone `%s'\n", GNUNET_short_h2s (&zone));
@@ -212,7 +212,7 @@ zone_proc (void *cls,
212 failed = GNUNET_YES; 212 failed = GNUNET_YES;
213 GNUNET_break (0); 213 GNUNET_break (0);
214 } 214 }
215 if (0 != memcmp (signature, sig_1, sizeof (struct GNUNET_CRYPTO_RsaSignature))) 215 if (0 != memcmp (signature, sig_1, sizeof (struct GNUNET_CRYPTO_EccSignature)))
216 { 216 {
217 failed = GNUNET_YES; 217 failed = GNUNET_YES;
218 GNUNET_break (0); 218 GNUNET_break (0);
@@ -233,7 +233,7 @@ zone_proc (void *cls,
233 failed = GNUNET_YES; 233 failed = GNUNET_YES;
234 GNUNET_break (0); 234 GNUNET_break (0);
235 } 235 }
236 if (0 != memcmp (signature, sig_2, sizeof (struct GNUNET_CRYPTO_RsaSignature))) 236 if (0 != memcmp (signature, sig_2, sizeof (struct GNUNET_CRYPTO_EccSignature)))
237 { 237 {
238 failed = GNUNET_YES; 238 failed = GNUNET_YES;
239 GNUNET_break (0); 239 GNUNET_break (0);
@@ -334,19 +334,19 @@ run (void *cls,
334 GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, 334 GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR,
335 "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); 335 "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey");
336 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); 336 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file);
337 privkey = GNUNET_CRYPTO_rsa_key_create_from_file(hostkey_file); 337 privkey = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file);
338 GNUNET_free (hostkey_file); 338 GNUNET_free (hostkey_file);
339 GNUNET_assert (privkey != NULL); 339 GNUNET_assert (privkey != NULL);
340 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); 340 GNUNET_CRYPTO_ecc_key_get_public(privkey, &pubkey);
341 GNUNET_CRYPTO_short_hash (&pubkey, sizeof (pubkey), &zone); 341 GNUNET_CRYPTO_short_hash (&pubkey, sizeof (pubkey), &zone);
342 342
343 GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, 343 GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR,
344 "HGU0A0VCU334DN7F2I9UIUMVQMM7JMSD142LIMNUGTTV9R0CF4EG.zkey"); 344 "HGU0A0VCU334DN7F2I9UIUMVQMM7JMSD142LIMNUGTTV9R0CF4EG.zkey");
345 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); 345 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file);
346 privkey2 = GNUNET_CRYPTO_rsa_key_create_from_file(hostkey_file); 346 privkey2 = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file);
347 GNUNET_free (hostkey_file); 347 GNUNET_free (hostkey_file);
348 GNUNET_assert (privkey2 != NULL); 348 GNUNET_assert (privkey2 != NULL);
349 GNUNET_CRYPTO_rsa_key_get_public(privkey2, &pubkey2); 349 GNUNET_CRYPTO_ecc_key_get_public(privkey2, &pubkey2);
350 GNUNET_CRYPTO_short_hash (&pubkey2, sizeof (pubkey), &zone2); 350 GNUNET_CRYPTO_short_hash (&pubkey2, sizeof (pubkey), &zone2);
351 nsh = GNUNET_NAMESTORE_connect (cfg); 351 nsh = GNUNET_NAMESTORE_connect (cfg);
352 GNUNET_break (NULL != nsh); 352 GNUNET_break (NULL != nsh);