diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-05-29 08:18:55 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-05-29 08:18:55 +0000 |
commit | 022002438e4047d235a688cfd9da7b63ab990103 (patch) | |
tree | 8d0cb444a3ab376b5a8f614fb87bdeb31e7b3327 /src/namestore/test_namestore_api_remove.c | |
parent | b62eb443ee3af84f87030fad9fd11a948b1a2503 (diff) | |
download | gnunet-022002438e4047d235a688cfd9da7b63ab990103.tar.gz gnunet-022002438e4047d235a688cfd9da7b63ab990103.zip |
-switching GNS from RSA to ECC
Diffstat (limited to 'src/namestore/test_namestore_api_remove.c')
-rw-r--r-- | src/namestore/test_namestore_api_remove.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c index 8583e69c9..265a93b81 100644 --- a/src/namestore/test_namestore_api_remove.c +++ b/src/namestore/test_namestore_api_remove.c | |||
@@ -49,11 +49,11 @@ static struct GNUNET_NAMESTORE_Handle * nsh; | |||
49 | 49 | ||
50 | static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; | 50 | static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; |
51 | 51 | ||
52 | static struct GNUNET_CRYPTO_RsaPrivateKey * privkey; | 52 | static struct GNUNET_CRYPTO_EccPrivateKey * privkey; |
53 | 53 | ||
54 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; | 54 | static struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pubkey; |
55 | 55 | ||
56 | static struct GNUNET_CRYPTO_RsaSignature *s_signature; | 56 | static struct GNUNET_CRYPTO_EccSignature *s_signature; |
57 | 57 | ||
58 | static struct GNUNET_CRYPTO_ShortHashCode s_zone; | 58 | static struct GNUNET_CRYPTO_ShortHashCode s_zone; |
59 | 59 | ||
@@ -77,7 +77,7 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
77 | GNUNET_NAMESTORE_disconnect (nsh); | 77 | GNUNET_NAMESTORE_disconnect (nsh); |
78 | nsh = NULL; | 78 | nsh = NULL; |
79 | if (privkey != NULL) | 79 | if (privkey != NULL) |
80 | GNUNET_CRYPTO_rsa_key_free (privkey); | 80 | GNUNET_CRYPTO_ecc_key_free (privkey); |
81 | privkey = NULL; | 81 | privkey = NULL; |
82 | GNUNET_free_non_null (s_name); | 82 | GNUNET_free_non_null (s_name); |
83 | res = 1; | 83 | res = 1; |
@@ -98,7 +98,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
98 | GNUNET_free_non_null((void *) s_rd[c].data); | 98 | GNUNET_free_non_null((void *) s_rd[c].data); |
99 | GNUNET_free (s_rd); | 99 | GNUNET_free (s_rd); |
100 | if (privkey != NULL) | 100 | if (privkey != NULL) |
101 | GNUNET_CRYPTO_rsa_key_free (privkey); | 101 | GNUNET_CRYPTO_ecc_key_free (privkey); |
102 | privkey = NULL; | 102 | privkey = NULL; |
103 | if (nsh != NULL) | 103 | if (nsh != NULL) |
104 | GNUNET_NAMESTORE_disconnect (nsh); | 104 | GNUNET_NAMESTORE_disconnect (nsh); |
@@ -109,12 +109,12 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
109 | 109 | ||
110 | static void | 110 | static void |
111 | name_lookup_proc (void *cls, | 111 | name_lookup_proc (void *cls, |
112 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, | 112 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key, |
113 | struct GNUNET_TIME_Absolute expire, | 113 | struct GNUNET_TIME_Absolute expire, |
114 | const char *n, | 114 | const char *n, |
115 | unsigned int rd_count, | 115 | unsigned int rd_count, |
116 | const struct GNUNET_NAMESTORE_RecordData *rd, | 116 | const struct GNUNET_NAMESTORE_RecordData *rd, |
117 | const struct GNUNET_CRYPTO_RsaSignature *signature) | 117 | const struct GNUNET_CRYPTO_EccSignature *signature) |
118 | { | 118 | { |
119 | static int found = GNUNET_NO; | 119 | static int found = GNUNET_NO; |
120 | int failed = GNUNET_NO; | 120 | int failed = GNUNET_NO; |
@@ -123,7 +123,7 @@ name_lookup_proc (void *cls, | |||
123 | if (n != NULL) | 123 | if (n != NULL) |
124 | { | 124 | { |
125 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Lookup for name `%s' returned %u records\n", n, rd_count); | 125 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Lookup for name `%s' returned %u records\n", n, rd_count); |
126 | if (0 != memcmp (zone_key, &pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded))) | 126 | if (0 != memcmp (zone_key, &pubkey, sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded))) |
127 | { | 127 | { |
128 | GNUNET_break (0); | 128 | GNUNET_break (0); |
129 | failed = GNUNET_YES; | 129 | failed = GNUNET_YES; |
@@ -254,11 +254,11 @@ run (void *cls, | |||
254 | GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, | 254 | GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, |
255 | "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); | 255 | "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); |
256 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); | 256 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); |
257 | privkey = GNUNET_CRYPTO_rsa_key_create_from_file(hostkey_file); | 257 | privkey = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file); |
258 | GNUNET_free (hostkey_file); | 258 | GNUNET_free (hostkey_file); |
259 | GNUNET_assert (privkey != NULL); | 259 | GNUNET_assert (privkey != NULL); |
260 | /* get public key */ | 260 | /* get public key */ |
261 | GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); | 261 | GNUNET_CRYPTO_ecc_key_get_public(privkey, &pubkey); |
262 | 262 | ||
263 | /* create record */ | 263 | /* create record */ |
264 | s_name = GNUNET_NAMESTORE_normalize_string ("DUMMY.dummy.gnunet"); | 264 | s_name = GNUNET_NAMESTORE_normalize_string ("DUMMY.dummy.gnunet"); |
@@ -273,7 +273,7 @@ run (void *cls, | |||
273 | s_signature = GNUNET_NAMESTORE_create_signature(privkey, et, s_name, s_rd, RECORDS); | 273 | s_signature = GNUNET_NAMESTORE_create_signature(privkey, et, s_name, s_rd, RECORDS); |
274 | 274 | ||
275 | /* create random zone hash */ | 275 | /* create random zone hash */ |
276 | GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone); | 276 | GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded), &s_zone); |
277 | 277 | ||
278 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Name: `%s' Zone: `%s' \n", s_name, GNUNET_short_h2s (&s_zone)); | 278 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Name: `%s' Zone: `%s' \n", s_name, GNUNET_short_h2s (&s_zone)); |
279 | nsh = GNUNET_NAMESTORE_connect (cfg); | 279 | nsh = GNUNET_NAMESTORE_connect (cfg); |