aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/test_namestore_api_lookup.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_lookup.c
parentb62eb443ee3af84f87030fad9fd11a948b1a2503 (diff)
downloadgnunet-022002438e4047d235a688cfd9da7b63ab990103.tar.gz
gnunet-022002438e4047d235a688cfd9da7b63ab990103.zip
-switching GNS from RSA to ECC
Diffstat (limited to 'src/namestore/test_namestore_api_lookup.c')
-rw-r--r--src/namestore/test_namestore_api_lookup.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/namestore/test_namestore_api_lookup.c b/src/namestore/test_namestore_api_lookup.c
index 7d2f86e86..fdd229b23 100644
--- a/src/namestore/test_namestore_api_lookup.c
+++ b/src/namestore/test_namestore_api_lookup.c
@@ -43,11 +43,11 @@ static struct GNUNET_NAMESTORE_Handle * nsh;
43 43
44static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; 44static GNUNET_SCHEDULER_TaskIdentifier endbadly_task;
45 45
46static struct GNUNET_CRYPTO_RsaPrivateKey * privkey; 46static struct GNUNET_CRYPTO_EccPrivateKey * privkey;
47 47
48static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; 48static struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pubkey;
49 49
50static struct GNUNET_CRYPTO_RsaSignature *s_signature; 50static struct GNUNET_CRYPTO_EccSignature *s_signature;
51 51
52static struct GNUNET_CRYPTO_ShortHashCode s_zone; 52static struct GNUNET_CRYPTO_ShortHashCode s_zone;
53 53
@@ -70,7 +70,7 @@ cleanup ()
70 } 70 }
71 if (NULL != privkey) 71 if (NULL != privkey)
72 { 72 {
73 GNUNET_CRYPTO_rsa_key_free (privkey); 73 GNUNET_CRYPTO_ecc_key_free (privkey);
74 privkey = NULL; 74 privkey = NULL;
75 } 75 }
76 GNUNET_SCHEDULER_shutdown (); 76 GNUNET_SCHEDULER_shutdown ();
@@ -105,12 +105,12 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
105 105
106static void 106static void
107name_lookup_proc (void *cls, 107name_lookup_proc (void *cls,
108 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, 108 const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key,
109 struct GNUNET_TIME_Absolute expire, 109 struct GNUNET_TIME_Absolute expire,
110 const char *n, 110 const char *n,
111 unsigned int rd_count, 111 unsigned int rd_count,
112 const struct GNUNET_NAMESTORE_RecordData *rd, 112 const struct GNUNET_NAMESTORE_RecordData *rd,
113 const struct GNUNET_CRYPTO_RsaSignature *signature) 113 const struct GNUNET_CRYPTO_EccSignature *signature)
114{ 114{
115 static int found = GNUNET_NO; 115 static int found = GNUNET_NO;
116 int c; 116 int c;
@@ -119,13 +119,13 @@ name_lookup_proc (void *cls,
119 { 119 {
120 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Checking returned results\n"); 120 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Checking returned results\n");
121 if (0 != memcmp (zone_key, &pubkey, 121 if (0 != memcmp (zone_key, &pubkey,
122 sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded))) 122 sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded)))
123 { 123 {
124 GNUNET_break (0); 124 GNUNET_break (0);
125 } 125 }
126 GNUNET_assert (NULL != signature); 126 GNUNET_assert (NULL != signature);
127 if (0 != memcmp (signature, s_signature, 127 if (0 != memcmp (signature, s_signature,
128 sizeof (struct GNUNET_CRYPTO_RsaSignature))) 128 sizeof (struct GNUNET_CRYPTO_EccSignature)))
129 { 129 {
130 GNUNET_break (0); 130 GNUNET_break (0);
131 } 131 }
@@ -222,10 +222,10 @@ run (void *cls,
222 &endbadly, NULL); 222 &endbadly, NULL);
223 223
224 /* load privat key from file not included in zonekey dir */ 224 /* load privat key from file not included in zonekey dir */
225 privkey = GNUNET_CRYPTO_rsa_key_create_from_file("test_hostkey"); 225 privkey = GNUNET_CRYPTO_ecc_key_create_from_file("test_hostkey");
226 GNUNET_assert (NULL != privkey); 226 GNUNET_assert (NULL != privkey);
227 /* get public key */ 227 /* get public key */
228 GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); 228 GNUNET_CRYPTO_ecc_key_get_public(privkey, &pubkey);
229 229
230 /* create record */ 230 /* create record */
231 s_name = GNUNET_NAMESTORE_normalize_string ("DUMMY.dummy.gnunet"); 231 s_name = GNUNET_NAMESTORE_normalize_string ("DUMMY.dummy.gnunet");
@@ -243,7 +243,7 @@ run (void *cls,
243 243
244 /* create random zone hash */ 244 /* create random zone hash */
245 GNUNET_CRYPTO_short_hash (&pubkey, 245 GNUNET_CRYPTO_short_hash (&pubkey,
246 sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), 246 sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded),
247 &s_zone); 247 &s_zone);
248 nsh = GNUNET_NAMESTORE_connect (cfg); 248 nsh = GNUNET_NAMESTORE_connect (cfg);
249 GNUNET_break (NULL != nsh); 249 GNUNET_break (NULL != nsh);