diff options
Diffstat (limited to 'src/namestore/gnunet-service-namestore.c')
-rw-r--r-- | src/namestore/gnunet-service-namestore.c | 112 |
1 files changed, 57 insertions, 55 deletions
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index a14ad923d..02f33679b 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c | |||
@@ -143,7 +143,7 @@ struct GNUNET_NAMESTORE_CryptoContainer | |||
143 | /** | 143 | /** |
144 | * Zone's private key | 144 | * Zone's private key |
145 | */ | 145 | */ |
146 | struct GNUNET_CRYPTO_RsaPrivateKey *privkey; | 146 | struct GNUNET_CRYPTO_EccPrivateKey *privkey; |
147 | 147 | ||
148 | }; | 148 | }; |
149 | 149 | ||
@@ -205,7 +205,7 @@ struct KeyLoadContext | |||
205 | { | 205 | { |
206 | struct KeyLoadContext *next; | 206 | struct KeyLoadContext *next; |
207 | struct KeyLoadContext *prev; | 207 | struct KeyLoadContext *prev; |
208 | struct GNUNET_CRYPTO_RsaKeyGenerationContext *keygen; | 208 | struct GNUNET_CRYPTO_EccKeyGenerationContext *keygen; |
209 | char *filename; | 209 | char *filename; |
210 | unsigned int *counter; | 210 | unsigned int *counter; |
211 | }; | 211 | }; |
@@ -222,19 +222,19 @@ static int | |||
222 | write_key_to_file (const char *filename, | 222 | write_key_to_file (const char *filename, |
223 | struct GNUNET_NAMESTORE_CryptoContainer *c) | 223 | struct GNUNET_NAMESTORE_CryptoContainer *c) |
224 | { | 224 | { |
225 | struct GNUNET_CRYPTO_RsaPrivateKey *ret = c->privkey; | 225 | struct GNUNET_CRYPTO_EccPrivateKey *ret = c->privkey; |
226 | struct GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded *enc; | 226 | struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded *enc; |
227 | struct GNUNET_DISK_FileHandle *fd; | 227 | struct GNUNET_DISK_FileHandle *fd; |
228 | struct GNUNET_CRYPTO_ShortHashCode zone; | 228 | struct GNUNET_CRYPTO_ShortHashCode zone; |
229 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; | 229 | struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pubkey; |
230 | struct GNUNET_CRYPTO_RsaPrivateKey *privkey; | 230 | struct GNUNET_CRYPTO_EccPrivateKey *privkey; |
231 | 231 | ||
232 | fd = GNUNET_DISK_file_open (filename, | 232 | fd = GNUNET_DISK_file_open (filename, |
233 | GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_FAILIFEXISTS, | 233 | GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_FAILIFEXISTS, |
234 | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); | 234 | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); |
235 | if ( (NULL == fd) && (EEXIST == errno) ) | 235 | if ( (NULL == fd) && (EEXIST == errno) ) |
236 | { | 236 | { |
237 | privkey = GNUNET_CRYPTO_rsa_key_create_from_file (filename); | 237 | privkey = GNUNET_CRYPTO_ecc_key_create_from_file (filename); |
238 | if (NULL == privkey) | 238 | if (NULL == privkey) |
239 | { | 239 | { |
240 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 240 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
@@ -243,9 +243,9 @@ write_key_to_file (const char *filename, | |||
243 | _("file exists but reading key failed")); | 243 | _("file exists but reading key failed")); |
244 | return GNUNET_SYSERR; | 244 | return GNUNET_SYSERR; |
245 | } | 245 | } |
246 | GNUNET_CRYPTO_rsa_key_get_public (privkey, &pubkey); | 246 | GNUNET_CRYPTO_ecc_key_get_public (privkey, &pubkey); |
247 | GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone); | 247 | GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded), &zone); |
248 | GNUNET_CRYPTO_rsa_key_free (privkey); | 248 | GNUNET_CRYPTO_ecc_key_free (privkey); |
249 | if (0 == memcmp (&zone, &c->zone, sizeof(zone))) | 249 | if (0 == memcmp (&zone, &c->zone, sizeof(zone))) |
250 | { | 250 | { |
251 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 251 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -264,17 +264,17 @@ write_key_to_file (const char *filename, | |||
264 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "open", filename); | 264 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "open", filename); |
265 | return GNUNET_SYSERR; | 265 | return GNUNET_SYSERR; |
266 | } | 266 | } |
267 | if (GNUNET_YES != GNUNET_DISK_file_lock (fd, 0, sizeof (struct GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded), GNUNET_YES)) | 267 | if (GNUNET_YES != GNUNET_DISK_file_lock (fd, 0, sizeof (struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded), GNUNET_YES)) |
268 | { | 268 | { |
269 | GNUNET_break (GNUNET_YES == GNUNET_DISK_file_close (fd)); | 269 | GNUNET_break (GNUNET_YES == GNUNET_DISK_file_close (fd)); |
270 | return GNUNET_SYSERR; | 270 | return GNUNET_SYSERR; |
271 | } | 271 | } |
272 | enc = GNUNET_CRYPTO_rsa_encode_key (ret); | 272 | enc = GNUNET_CRYPTO_ecc_encode_key (ret); |
273 | GNUNET_assert (NULL != enc); | 273 | GNUNET_assert (NULL != enc); |
274 | GNUNET_assert (ntohs (enc->len) == GNUNET_DISK_file_write (fd, enc, ntohs (enc->len))); | 274 | GNUNET_assert (ntohs (enc->size) == GNUNET_DISK_file_write (fd, enc, ntohs (enc->size))); |
275 | GNUNET_free (enc); | 275 | GNUNET_free (enc); |
276 | GNUNET_DISK_file_sync (fd); | 276 | GNUNET_DISK_file_sync (fd); |
277 | if (GNUNET_YES != GNUNET_DISK_file_unlock (fd, 0, sizeof (struct GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded))) | 277 | if (GNUNET_YES != GNUNET_DISK_file_unlock (fd, 0, sizeof (struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded))) |
278 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fcntl", filename); | 278 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fcntl", filename); |
279 | GNUNET_assert (GNUNET_YES == GNUNET_DISK_file_close (fd)); | 279 | GNUNET_assert (GNUNET_YES == GNUNET_DISK_file_close (fd)); |
280 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 280 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -308,7 +308,7 @@ zone_to_disk_it (void *cls, | |||
308 | GNUNET_short_h2s (&c->zone)); | 308 | GNUNET_short_h2s (&c->zone)); |
309 | (void) write_key_to_file(c->filename, c); | 309 | (void) write_key_to_file(c->filename, c); |
310 | GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multihashmap_remove (zonekeys, key, value)); | 310 | GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multihashmap_remove (zonekeys, key, value)); |
311 | GNUNET_CRYPTO_rsa_key_free (c->privkey); | 311 | GNUNET_CRYPTO_ecc_key_free (c->privkey); |
312 | GNUNET_free (c->filename); | 312 | GNUNET_free (c->filename); |
313 | GNUNET_free (c); | 313 | GNUNET_free (c); |
314 | return GNUNET_OK; | 314 | return GNUNET_OK; |
@@ -323,22 +323,22 @@ zone_to_disk_it (void *cls, | |||
323 | * be taken over or freed and should not be used afterwards) | 323 | * be taken over or freed and should not be used afterwards) |
324 | */ | 324 | */ |
325 | static void | 325 | static void |
326 | learn_private_key (struct GNUNET_CRYPTO_RsaPrivateKey *pkey) | 326 | learn_private_key (struct GNUNET_CRYPTO_EccPrivateKey *pkey) |
327 | { | 327 | { |
328 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub; | 328 | struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pub; |
329 | struct GNUNET_HashCode long_hash; | 329 | struct GNUNET_HashCode long_hash; |
330 | struct GNUNET_CRYPTO_ShortHashCode pubkey_hash; | 330 | struct GNUNET_CRYPTO_ShortHashCode pubkey_hash; |
331 | struct GNUNET_NAMESTORE_CryptoContainer *cc; | 331 | struct GNUNET_NAMESTORE_CryptoContainer *cc; |
332 | 332 | ||
333 | GNUNET_CRYPTO_rsa_key_get_public (pkey, &pub); | 333 | GNUNET_CRYPTO_ecc_key_get_public (pkey, &pub); |
334 | GNUNET_CRYPTO_short_hash (&pub, | 334 | GNUNET_CRYPTO_short_hash (&pub, |
335 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), | 335 | sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded), |
336 | &pubkey_hash); | 336 | &pubkey_hash); |
337 | GNUNET_CRYPTO_short_hash_double (&pubkey_hash, &long_hash); | 337 | GNUNET_CRYPTO_short_hash_double (&pubkey_hash, &long_hash); |
338 | 338 | ||
339 | if (GNUNET_NO != GNUNET_CONTAINER_multihashmap_contains(zonekeys, &long_hash)) | 339 | if (GNUNET_NO != GNUNET_CONTAINER_multihashmap_contains(zonekeys, &long_hash)) |
340 | { | 340 | { |
341 | GNUNET_CRYPTO_rsa_key_free (pkey); | 341 | GNUNET_CRYPTO_ecc_key_free (pkey); |
342 | return; | 342 | return; |
343 | } | 343 | } |
344 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 344 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -414,7 +414,7 @@ cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
414 | { | 414 | { |
415 | GNUNET_CONTAINER_DLL_remove (kl_head, kl_tail, kl); | 415 | GNUNET_CONTAINER_DLL_remove (kl_head, kl_tail, kl); |
416 | if (NULL != kl->keygen) | 416 | if (NULL != kl->keygen) |
417 | GNUNET_CRYPTO_rsa_key_create_stop (kl->keygen); | 417 | GNUNET_CRYPTO_ecc_key_create_stop (kl->keygen); |
418 | GNUNET_free (kl->filename); | 418 | GNUNET_free (kl->filename); |
419 | GNUNET_free (kl); | 419 | GNUNET_free (kl); |
420 | } | 420 | } |
@@ -570,18 +570,18 @@ struct LookupNameContext | |||
570 | */ | 570 | */ |
571 | static void | 571 | static void |
572 | handle_lookup_name_it (void *cls, | 572 | handle_lookup_name_it (void *cls, |
573 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, | 573 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key, |
574 | struct GNUNET_TIME_Absolute expire, | 574 | struct GNUNET_TIME_Absolute expire, |
575 | const char *name, | 575 | const char *name, |
576 | unsigned int rd_count, | 576 | unsigned int rd_count, |
577 | const struct GNUNET_NAMESTORE_RecordData *rd, | 577 | const struct GNUNET_NAMESTORE_RecordData *rd, |
578 | const struct GNUNET_CRYPTO_RsaSignature *signature) | 578 | const struct GNUNET_CRYPTO_EccSignature *signature) |
579 | { | 579 | { |
580 | struct LookupNameContext *lnc = cls; | 580 | struct LookupNameContext *lnc = cls; |
581 | struct LookupNameResponseMessage *lnr_msg; | 581 | struct LookupNameResponseMessage *lnr_msg; |
582 | struct GNUNET_NAMESTORE_RecordData *rd_selected; | 582 | struct GNUNET_NAMESTORE_RecordData *rd_selected; |
583 | struct GNUNET_NAMESTORE_CryptoContainer *cc; | 583 | struct GNUNET_NAMESTORE_CryptoContainer *cc; |
584 | struct GNUNET_CRYPTO_RsaSignature *signature_new; | 584 | struct GNUNET_CRYPTO_EccSignature *signature_new; |
585 | struct GNUNET_TIME_Absolute e; | 585 | struct GNUNET_TIME_Absolute e; |
586 | struct GNUNET_TIME_Relative re; | 586 | struct GNUNET_TIME_Relative re; |
587 | struct GNUNET_CRYPTO_ShortHashCode zone_key_hash; | 587 | struct GNUNET_CRYPTO_ShortHashCode zone_key_hash; |
@@ -607,7 +607,7 @@ handle_lookup_name_it (void *cls, | |||
607 | if (NULL != zone_key) | 607 | if (NULL != zone_key) |
608 | { | 608 | { |
609 | GNUNET_CRYPTO_short_hash (zone_key, | 609 | GNUNET_CRYPTO_short_hash (zone_key, |
610 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), | 610 | sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded), |
611 | &zone_key_hash); | 611 | &zone_key_hash); |
612 | GNUNET_CRYPTO_short_hash_double (&zone_key_hash, &long_hash); | 612 | GNUNET_CRYPTO_short_hash_double (&zone_key_hash, &long_hash); |
613 | if (NULL != (cc = GNUNET_CONTAINER_multihashmap_get (zonekeys, &long_hash))) | 613 | if (NULL != (cc = GNUNET_CONTAINER_multihashmap_get (zonekeys, &long_hash))) |
@@ -728,7 +728,7 @@ handle_lookup_name_it (void *cls, | |||
728 | rd_ser_len = GNUNET_NAMESTORE_records_get_size (copied_elements, rd_selected); | 728 | rd_ser_len = GNUNET_NAMESTORE_records_get_size (copied_elements, rd_selected); |
729 | name_len = (NULL == name) ? 0 : strlen(name) + 1; | 729 | name_len = (NULL == name) ? 0 : strlen(name) + 1; |
730 | r_size = sizeof (struct LookupNameResponseMessage) + | 730 | r_size = sizeof (struct LookupNameResponseMessage) + |
731 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded) + | 731 | sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded) + |
732 | name_len + | 732 | name_len + |
733 | rd_ser_len; | 733 | rd_ser_len; |
734 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 734 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -885,7 +885,7 @@ handle_record_put (void *cls, | |||
885 | struct GNUNET_NAMESTORE_Client *nc; | 885 | struct GNUNET_NAMESTORE_Client *nc; |
886 | const struct RecordPutMessage *rp_msg; | 886 | const struct RecordPutMessage *rp_msg; |
887 | struct GNUNET_TIME_Absolute expire; | 887 | struct GNUNET_TIME_Absolute expire; |
888 | const struct GNUNET_CRYPTO_RsaSignature *signature; | 888 | const struct GNUNET_CRYPTO_EccSignature *signature; |
889 | struct RecordPutResponseMessage rpr_msg; | 889 | struct RecordPutResponseMessage rpr_msg; |
890 | struct GNUNET_CRYPTO_ShortHashCode zone_hash; | 890 | struct GNUNET_CRYPTO_ShortHashCode zone_hash; |
891 | size_t name_len; | 891 | size_t name_len; |
@@ -1008,7 +1008,7 @@ struct CreateRecordContext | |||
1008 | /** | 1008 | /** |
1009 | * Zone's public key | 1009 | * Zone's public key |
1010 | */ | 1010 | */ |
1011 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; | 1011 | struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pubkey; |
1012 | 1012 | ||
1013 | /** | 1013 | /** |
1014 | * Name for the record to create | 1014 | * Name for the record to create |
@@ -1044,14 +1044,14 @@ struct CreateRecordContext | |||
1044 | */ | 1044 | */ |
1045 | static void | 1045 | static void |
1046 | handle_create_record_it (void *cls, | 1046 | handle_create_record_it (void *cls, |
1047 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *pubkey, | 1047 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *pubkey, |
1048 | struct GNUNET_TIME_Absolute expire, | 1048 | struct GNUNET_TIME_Absolute expire, |
1049 | const char *name, | 1049 | const char *name, |
1050 | unsigned int rd_count, | 1050 | unsigned int rd_count, |
1051 | const struct GNUNET_NAMESTORE_RecordData *rd, | 1051 | const struct GNUNET_NAMESTORE_RecordData *rd, |
1052 | const struct GNUNET_CRYPTO_RsaSignature *signature) | 1052 | const struct GNUNET_CRYPTO_EccSignature *signature) |
1053 | { | 1053 | { |
1054 | static struct GNUNET_CRYPTO_RsaSignature dummy_signature; | 1054 | static struct GNUNET_CRYPTO_EccSignature dummy_signature; |
1055 | struct CreateRecordContext *crc = cls; | 1055 | struct CreateRecordContext *crc = cls; |
1056 | struct GNUNET_NAMESTORE_RecordData *rd_new; | 1056 | struct GNUNET_NAMESTORE_RecordData *rd_new; |
1057 | struct GNUNET_TIME_Absolute block_expiration; | 1057 | struct GNUNET_TIME_Absolute block_expiration; |
@@ -1159,7 +1159,7 @@ handle_record_create (void *cls, | |||
1159 | struct GNUNET_NAMESTORE_Client *nc; | 1159 | struct GNUNET_NAMESTORE_Client *nc; |
1160 | const struct RecordCreateMessage *rp_msg; | 1160 | const struct RecordCreateMessage *rp_msg; |
1161 | struct CreateRecordContext crc; | 1161 | struct CreateRecordContext crc; |
1162 | struct GNUNET_CRYPTO_RsaPrivateKey *pkey; | 1162 | struct GNUNET_CRYPTO_EccPrivateKey *pkey; |
1163 | struct RecordCreateResponseMessage rcr_msg; | 1163 | struct RecordCreateResponseMessage rcr_msg; |
1164 | size_t name_len; | 1164 | size_t name_len; |
1165 | size_t msg_size; | 1165 | size_t msg_size; |
@@ -1219,7 +1219,8 @@ handle_record_create (void *cls, | |||
1219 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 1219 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
1220 | return; | 1220 | return; |
1221 | } | 1221 | } |
1222 | if (NULL == (pkey = GNUNET_CRYPTO_rsa_decode_key (pkey_tmp, key_len))) | 1222 | if (NULL == (pkey = GNUNET_CRYPTO_ecc_decode_key (pkey_tmp, key_len, |
1223 | GNUNET_NO))) | ||
1223 | { | 1224 | { |
1224 | GNUNET_break (0); | 1225 | GNUNET_break (0); |
1225 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 1226 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
@@ -1229,15 +1230,15 @@ handle_record_create (void *cls, | |||
1229 | GNUNET_NAMESTORE_records_deserialize (rd_ser_len, rd_ser, rd_count, &rd)) | 1230 | GNUNET_NAMESTORE_records_deserialize (rd_ser_len, rd_ser, rd_count, &rd)) |
1230 | { | 1231 | { |
1231 | GNUNET_break (0); | 1232 | GNUNET_break (0); |
1232 | GNUNET_CRYPTO_rsa_key_free (pkey); | 1233 | GNUNET_CRYPTO_ecc_key_free (pkey); |
1233 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 1234 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
1234 | return; | 1235 | return; |
1235 | } | 1236 | } |
1236 | 1237 | ||
1237 | /* Extracting and converting private key */ | 1238 | /* Extracting and converting private key */ |
1238 | GNUNET_CRYPTO_rsa_key_get_public (pkey, &crc.pubkey); | 1239 | GNUNET_CRYPTO_ecc_key_get_public (pkey, &crc.pubkey); |
1239 | GNUNET_CRYPTO_short_hash (&crc.pubkey, | 1240 | GNUNET_CRYPTO_short_hash (&crc.pubkey, |
1240 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), | 1241 | sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded), |
1241 | &pubkey_hash); | 1242 | &pubkey_hash); |
1242 | learn_private_key (pkey); | 1243 | learn_private_key (pkey); |
1243 | 1244 | ||
@@ -1318,14 +1319,14 @@ struct RemoveRecordContext | |||
1318 | */ | 1319 | */ |
1319 | static void | 1320 | static void |
1320 | handle_record_remove_it (void *cls, | 1321 | handle_record_remove_it (void *cls, |
1321 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, | 1322 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key, |
1322 | struct GNUNET_TIME_Absolute expire, | 1323 | struct GNUNET_TIME_Absolute expire, |
1323 | const char *name, | 1324 | const char *name, |
1324 | unsigned int rd_count, | 1325 | unsigned int rd_count, |
1325 | const struct GNUNET_NAMESTORE_RecordData *rd, | 1326 | const struct GNUNET_NAMESTORE_RecordData *rd, |
1326 | const struct GNUNET_CRYPTO_RsaSignature *signature) | 1327 | const struct GNUNET_CRYPTO_EccSignature *signature) |
1327 | { | 1328 | { |
1328 | static struct GNUNET_CRYPTO_RsaSignature dummy_signature; | 1329 | static struct GNUNET_CRYPTO_EccSignature dummy_signature; |
1329 | struct RemoveRecordContext *rrc = cls; | 1330 | struct RemoveRecordContext *rrc = cls; |
1330 | unsigned int c; | 1331 | unsigned int c; |
1331 | int found; | 1332 | int found; |
@@ -1364,7 +1365,7 @@ handle_record_remove_it (void *cls, | |||
1364 | "No records left for name `%s', removing name\n", | 1365 | "No records left for name `%s', removing name\n", |
1365 | name); | 1366 | name); |
1366 | GNUNET_CRYPTO_short_hash (zone_key, | 1367 | GNUNET_CRYPTO_short_hash (zone_key, |
1367 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), | 1368 | sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded), |
1368 | &pubkey_hash); | 1369 | &pubkey_hash); |
1369 | if (GNUNET_OK != | 1370 | if (GNUNET_OK != |
1370 | GSN_database->remove_records (GSN_database->cls, | 1371 | GSN_database->remove_records (GSN_database->cls, |
@@ -1421,8 +1422,8 @@ handle_record_remove (void *cls, | |||
1421 | struct GNUNET_NAMESTORE_Client *nc; | 1422 | struct GNUNET_NAMESTORE_Client *nc; |
1422 | const struct RecordRemoveMessage *rr_msg; | 1423 | const struct RecordRemoveMessage *rr_msg; |
1423 | struct RecordRemoveResponseMessage rrr_msg; | 1424 | struct RecordRemoveResponseMessage rrr_msg; |
1424 | struct GNUNET_CRYPTO_RsaPrivateKey *pkey; | 1425 | struct GNUNET_CRYPTO_EccPrivateKey *pkey; |
1425 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub; | 1426 | struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pub; |
1426 | struct GNUNET_CRYPTO_ShortHashCode pubkey_hash; | 1427 | struct GNUNET_CRYPTO_ShortHashCode pubkey_hash; |
1427 | struct GNUNET_NAMESTORE_RecordData rd; | 1428 | struct GNUNET_NAMESTORE_RecordData rd; |
1428 | const char *pkey_tmp; | 1429 | const char *pkey_tmp; |
@@ -1484,15 +1485,16 @@ handle_record_remove (void *cls, | |||
1484 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 1485 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
1485 | return; | 1486 | return; |
1486 | } | 1487 | } |
1487 | if (NULL == (pkey = GNUNET_CRYPTO_rsa_decode_key (pkey_tmp, key_len))) | 1488 | if (NULL == (pkey = GNUNET_CRYPTO_ecc_decode_key (pkey_tmp, key_len, |
1489 | GNUNET_NO))) | ||
1488 | { | 1490 | { |
1489 | GNUNET_break (0); | 1491 | GNUNET_break (0); |
1490 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 1492 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
1491 | return; | 1493 | return; |
1492 | } | 1494 | } |
1493 | GNUNET_CRYPTO_rsa_key_get_public (pkey, &pub); | 1495 | GNUNET_CRYPTO_ecc_key_get_public (pkey, &pub); |
1494 | GNUNET_CRYPTO_short_hash (&pub, | 1496 | GNUNET_CRYPTO_short_hash (&pub, |
1495 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), | 1497 | sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded), |
1496 | &pubkey_hash); | 1498 | &pubkey_hash); |
1497 | learn_private_key (pkey); | 1499 | learn_private_key (pkey); |
1498 | if (GNUNET_OK != | 1500 | if (GNUNET_OK != |
@@ -1618,12 +1620,12 @@ struct ZoneToNameCtx | |||
1618 | */ | 1620 | */ |
1619 | static void | 1621 | static void |
1620 | handle_zone_to_name_it (void *cls, | 1622 | handle_zone_to_name_it (void *cls, |
1621 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, | 1623 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key, |
1622 | struct GNUNET_TIME_Absolute expire, | 1624 | struct GNUNET_TIME_Absolute expire, |
1623 | const char *name, | 1625 | const char *name, |
1624 | unsigned int rd_count, | 1626 | unsigned int rd_count, |
1625 | const struct GNUNET_NAMESTORE_RecordData *rd, | 1627 | const struct GNUNET_NAMESTORE_RecordData *rd, |
1626 | const struct GNUNET_CRYPTO_RsaSignature *signature) | 1628 | const struct GNUNET_CRYPTO_EccSignature *signature) |
1627 | { | 1629 | { |
1628 | struct ZoneToNameCtx *ztn_ctx = cls; | 1630 | struct ZoneToNameCtx *ztn_ctx = cls; |
1629 | struct ZoneToNameResponseMessage *ztnr_msg; | 1631 | struct ZoneToNameResponseMessage *ztnr_msg; |
@@ -1658,7 +1660,7 @@ handle_zone_to_name_it (void *cls, | |||
1658 | rd_ser_len = GNUNET_NAMESTORE_records_get_size (rd_count, rd); | 1660 | rd_ser_len = GNUNET_NAMESTORE_records_get_size (rd_count, rd); |
1659 | msg_size = sizeof (struct ZoneToNameResponseMessage) + name_len + rd_ser_len; | 1661 | msg_size = sizeof (struct ZoneToNameResponseMessage) + name_len + rd_ser_len; |
1660 | if (NULL != signature) | 1662 | if (NULL != signature) |
1661 | msg_size += sizeof (struct GNUNET_CRYPTO_RsaSignature); | 1663 | msg_size += sizeof (struct GNUNET_CRYPTO_EccSignature); |
1662 | if (msg_size >= GNUNET_SERVER_MAX_MESSAGE_SIZE) | 1664 | if (msg_size >= GNUNET_SERVER_MAX_MESSAGE_SIZE) |
1663 | { | 1665 | { |
1664 | GNUNET_break (0); | 1666 | GNUNET_break (0); |
@@ -1683,7 +1685,7 @@ handle_zone_to_name_it (void *cls, | |||
1683 | GNUNET_NAMESTORE_records_serialize (rd_count, rd, rd_ser_len, rd_tmp); | 1685 | GNUNET_NAMESTORE_records_serialize (rd_count, rd, rd_ser_len, rd_tmp); |
1684 | sig_tmp = &rd_tmp[rd_ser_len]; | 1686 | sig_tmp = &rd_tmp[rd_ser_len]; |
1685 | if (NULL != signature) | 1687 | if (NULL != signature) |
1686 | memcpy (sig_tmp, signature, sizeof (struct GNUNET_CRYPTO_RsaSignature)); | 1688 | memcpy (sig_tmp, signature, sizeof (struct GNUNET_CRYPTO_EccSignature)); |
1687 | ztn_ctx->success = GNUNET_OK; | 1689 | ztn_ctx->success = GNUNET_OK; |
1688 | GNUNET_SERVER_notification_context_unicast (snc, ztn_ctx->nc->client, | 1690 | GNUNET_SERVER_notification_context_unicast (snc, ztn_ctx->nc->client, |
1689 | &ztnr_msg->gns_header.header, | 1691 | &ztnr_msg->gns_header.header, |
@@ -1797,16 +1799,16 @@ struct ZoneIterationProcResult | |||
1797 | */ | 1799 | */ |
1798 | static void | 1800 | static void |
1799 | zone_iteraterate_proc (void *cls, | 1801 | zone_iteraterate_proc (void *cls, |
1800 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, | 1802 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key, |
1801 | struct GNUNET_TIME_Absolute expire, | 1803 | struct GNUNET_TIME_Absolute expire, |
1802 | const char *name, | 1804 | const char *name, |
1803 | unsigned int rd_count, | 1805 | unsigned int rd_count, |
1804 | const struct GNUNET_NAMESTORE_RecordData *rd, | 1806 | const struct GNUNET_NAMESTORE_RecordData *rd, |
1805 | const struct GNUNET_CRYPTO_RsaSignature *signature) | 1807 | const struct GNUNET_CRYPTO_EccSignature *signature) |
1806 | { | 1808 | { |
1807 | struct ZoneIterationProcResult *proc = cls; | 1809 | struct ZoneIterationProcResult *proc = cls; |
1808 | struct GNUNET_NAMESTORE_RecordData rd_filtered[rd_count]; | 1810 | struct GNUNET_NAMESTORE_RecordData rd_filtered[rd_count]; |
1809 | struct GNUNET_CRYPTO_RsaSignature *new_signature = NULL; | 1811 | struct GNUNET_CRYPTO_EccSignature *new_signature = NULL; |
1810 | struct GNUNET_NAMESTORE_CryptoContainer *cc; | 1812 | struct GNUNET_NAMESTORE_CryptoContainer *cc; |
1811 | struct GNUNET_HashCode long_hash; | 1813 | struct GNUNET_HashCode long_hash; |
1812 | struct GNUNET_CRYPTO_ShortHashCode zone_hash; | 1814 | struct GNUNET_CRYPTO_ShortHashCode zone_hash; |
@@ -1884,7 +1886,7 @@ zone_iteraterate_proc (void *cls, | |||
1884 | /* compute / obtain signature, but only if we (a) have records and (b) expiration times were | 1886 | /* compute / obtain signature, but only if we (a) have records and (b) expiration times were |
1885 | converted to absolute expiration times */ | 1887 | converted to absolute expiration times */ |
1886 | GNUNET_CRYPTO_short_hash (zone_key, | 1888 | GNUNET_CRYPTO_short_hash (zone_key, |
1887 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), | 1889 | sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded), |
1888 | &zone_hash); | 1890 | &zone_hash); |
1889 | GNUNET_CRYPTO_short_hash_double (&zone_hash, &long_hash); | 1891 | GNUNET_CRYPTO_short_hash_double (&zone_hash, &long_hash); |
1890 | if (NULL != (cc = GNUNET_CONTAINER_multihashmap_get(zonekeys, &long_hash))) | 1892 | if (NULL != (cc = GNUNET_CONTAINER_multihashmap_get(zonekeys, &long_hash))) |
@@ -2160,7 +2162,7 @@ handle_iteration_next (void *cls, | |||
2160 | 2162 | ||
2161 | static void | 2163 | static void |
2162 | zonekey_it_key_cb (void *cls, | 2164 | zonekey_it_key_cb (void *cls, |
2163 | struct GNUNET_CRYPTO_RsaPrivateKey *pk, | 2165 | struct GNUNET_CRYPTO_EccPrivateKey *pk, |
2164 | const char *emsg) | 2166 | const char *emsg) |
2165 | { | 2167 | { |
2166 | struct KeyLoadContext *kl = cls; | 2168 | struct KeyLoadContext *kl = cls; |
@@ -2201,7 +2203,7 @@ zonekey_file_it (void *cls, const char *filename) | |||
2201 | kl = GNUNET_malloc (sizeof (struct KeyLoadContext)); | 2203 | kl = GNUNET_malloc (sizeof (struct KeyLoadContext)); |
2202 | kl->filename = strdup (filename); | 2204 | kl->filename = strdup (filename); |
2203 | kl->counter = cls; | 2205 | kl->counter = cls; |
2204 | kl->keygen = GNUNET_CRYPTO_rsa_key_create_start (filename, zonekey_it_key_cb, kl); | 2206 | kl->keygen = GNUNET_CRYPTO_ecc_key_create_start (filename, zonekey_it_key_cb, kl); |
2205 | if (NULL == kl->keygen) | 2207 | if (NULL == kl->keygen) |
2206 | { | 2208 | { |
2207 | GNUNET_free (kl->filename); | 2209 | GNUNET_free (kl->filename); |