aboutsummaryrefslogtreecommitdiff
path: root/src/identity/identity_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-08-06 14:18:31 +0000
committerChristian Grothoff <christian@grothoff.org>2013-08-06 14:18:31 +0000
commitfe76c075e315c0351e2fe465434ae39087daf014 (patch)
tree436887ccaf331932a3c13a8b9d2a2a710dad4be6 /src/identity/identity_api.c
parent7eb2835d8a494c83aedb720a2ac6f6e5ba23f22f (diff)
downloadgnunet-fe76c075e315c0351e2fe465434ae39087daf014.tar.gz
gnunet-fe76c075e315c0351e2fe465434ae39087daf014.zip
moving to new, fixed-size encoding of public and private ECC keys everywhere, also improving ECC API to better support ECRS/GADS operations
Diffstat (limited to 'src/identity/identity_api.c')
-rw-r--r--src/identity/identity_api.c158
1 files changed, 68 insertions, 90 deletions
diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c
index 54144c5bc..2062ddc63 100644
--- a/src/identity/identity_api.c
+++ b/src/identity/identity_api.c
@@ -48,9 +48,9 @@ struct GNUNET_IDENTITY_Ego
48 struct GNUNET_CRYPTO_EccPrivateKey *pk; 48 struct GNUNET_CRYPTO_EccPrivateKey *pk;
49 49
50 /** 50 /**
51 * Current identifier (name) associated with this ego. 51 * Current name associated with this ego.
52 */ 52 */
53 char *identifier; 53 char *name;
54 54
55 /** 55 /**
56 * Client context associated with this ego. 56 * Client context associated with this ego.
@@ -234,12 +234,10 @@ message_handler (void *cls,
234 const struct GNUNET_IDENTITY_ResultCodeMessage *rcm; 234 const struct GNUNET_IDENTITY_ResultCodeMessage *rcm;
235 const struct GNUNET_IDENTITY_UpdateMessage *um; 235 const struct GNUNET_IDENTITY_UpdateMessage *um;
236 const struct GNUNET_IDENTITY_SetDefaultMessage *sdm; 236 const struct GNUNET_IDENTITY_SetDefaultMessage *sdm;
237 struct GNUNET_CRYPTO_EccPrivateKey *priv; 237 struct GNUNET_CRYPTO_EccPublicKey pub;
238 struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pub;
239 struct GNUNET_HashCode id; 238 struct GNUNET_HashCode id;
240 const char *str; 239 const char *str;
241 uint16_t size; 240 uint16_t size;
242 uint16_t pk_len;
243 uint16_t name_len; 241 uint16_t name_len;
244 242
245 if (NULL == msg) 243 if (NULL == msg)
@@ -291,39 +289,31 @@ message_handler (void *cls,
291 return; 289 return;
292 } 290 }
293 um = (const struct GNUNET_IDENTITY_UpdateMessage *) msg; 291 um = (const struct GNUNET_IDENTITY_UpdateMessage *) msg;
294 pk_len = ntohs (um->pk_len); 292 name_len = ntohs (um->name_len);
295 name_len = ntohs (um->name_len); 293
296 str = (const char *) &um[1]; 294 str = (const char *) &um[1];
297 if ( (size != pk_len + name_len + sizeof (struct GNUNET_IDENTITY_UpdateMessage)) || 295 if ( (size != name_len + sizeof (struct GNUNET_IDENTITY_UpdateMessage)) ||
298 ( (0 != name_len) && 296 ( (0 != name_len) &&
299 ('\0' != str[pk_len + name_len - 1])) ) 297 ('\0' != str[name_len - 1])) )
300 { 298 {
301 GNUNET_break (0); 299 GNUNET_break (0);
302 reschedule_connect (h); 300 reschedule_connect (h);
303 return; 301 return;
304 } 302 }
305 if ( (0 == pk_len) && 303 if (GNUNET_YES == ntohs (um->end_of_list))
306 (0 == name_len) )
307 { 304 {
308 /* end of initial list of data */ 305 /* end of initial list of data */
309 if (NULL != h->cb) 306 if (NULL != h->cb)
310 h->cb (h->cb_cls, NULL, NULL, NULL); 307 h->cb (h->cb_cls, NULL, NULL, NULL);
311 break; 308 break;
312 } 309 }
313 priv = GNUNET_CRYPTO_ecc_decode_key (str, pk_len, GNUNET_YES); 310 GNUNET_CRYPTO_ecc_key_get_public (&um->private_key,
314 if (NULL == priv)
315 {
316 GNUNET_break (0);
317 reschedule_connect (h);
318 return;
319 }
320 GNUNET_CRYPTO_ecc_key_get_public (priv,
321 &pub); 311 &pub);
322 GNUNET_CRYPTO_hash (&pub, sizeof (pub), &id); 312 GNUNET_CRYPTO_hash (&pub, sizeof (pub), &id);
323 if (0 == name_len) 313 if (0 == name_len)
324 str = NULL; 314 str = NULL;
325 else 315 else
326 str = &str[pk_len]; 316 str = (const char *) &um[1];
327 ego = GNUNET_CONTAINER_multihashmap_get (h->egos, 317 ego = GNUNET_CONTAINER_multihashmap_get (h->egos,
328 &id); 318 &id);
329 if (NULL == ego) 319 if (NULL == ego)
@@ -333,13 +323,13 @@ message_handler (void *cls,
333 { 323 {
334 /* deletion of unknown ego? not allowed */ 324 /* deletion of unknown ego? not allowed */
335 GNUNET_break (0); 325 GNUNET_break (0);
336 GNUNET_CRYPTO_ecc_key_free (priv);
337 reschedule_connect (h); 326 reschedule_connect (h);
338 return; 327 return;
339 } 328 }
340 ego = GNUNET_new (struct GNUNET_IDENTITY_Ego); 329 ego = GNUNET_new (struct GNUNET_IDENTITY_Ego);
341 ego->pk = priv; 330 ego->pk = GNUNET_new (struct GNUNET_CRYPTO_EccPrivateKey);
342 ego->identifier = GNUNET_strdup (str); 331 *ego->pk = um->private_key;
332 ego->name = GNUNET_strdup (str);
343 ego->id = id; 333 ego->id = id;
344 GNUNET_assert (GNUNET_YES == 334 GNUNET_assert (GNUNET_YES ==
345 GNUNET_CONTAINER_multihashmap_put (h->egos, 335 GNUNET_CONTAINER_multihashmap_put (h->egos,
@@ -347,10 +337,6 @@ message_handler (void *cls,
347 ego, 337 ego,
348 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); 338 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
349 } 339 }
350 else
351 {
352 GNUNET_CRYPTO_ecc_key_free (priv);
353 }
354 /* inform application about change */ 340 /* inform application about change */
355 if (NULL != h->cb) 341 if (NULL != h->cb)
356 h->cb (h->cb_cls, 342 h->cb (h->cb_cls,
@@ -365,14 +351,14 @@ message_handler (void *cls,
365 &ego->id, 351 &ego->id,
366 ego)); 352 ego));
367 GNUNET_CRYPTO_ecc_key_free (ego->pk); 353 GNUNET_CRYPTO_ecc_key_free (ego->pk);
368 GNUNET_free (ego->identifier); 354 GNUNET_free (ego->name);
369 GNUNET_free (ego); 355 GNUNET_free (ego);
370 } 356 }
371 else 357 else
372 { 358 {
373 /* ego changed name */ 359 /* ego changed name */
374 GNUNET_free (ego->identifier); 360 GNUNET_free (ego->name);
375 ego->identifier = GNUNET_strdup (str); 361 ego->name = GNUNET_strdup (str);
376 } 362 }
377 break; 363 break;
378 case GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT: 364 case GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT:
@@ -383,32 +369,24 @@ message_handler (void *cls,
383 return; 369 return;
384 } 370 }
385 sdm = (const struct GNUNET_IDENTITY_SetDefaultMessage *) msg; 371 sdm = (const struct GNUNET_IDENTITY_SetDefaultMessage *) msg;
386 pk_len = ntohs (sdm->pk_len); 372 GNUNET_break (0 == ntohs (sdm->reserved));
387 name_len = ntohs (sdm->name_len); 373 name_len = ntohs (sdm->name_len);
388 str = (const char *) &sdm[1]; 374 str = (const char *) &sdm[1];
389 if ( (size != pk_len + name_len + sizeof (struct GNUNET_IDENTITY_SetDefaultMessage)) || 375 if ( (size != name_len + sizeof (struct GNUNET_IDENTITY_SetDefaultMessage)) ||
390 ( (0 != name_len) && 376 ( (0 != name_len) &&
391 ('\0' != str[pk_len + name_len - 1]) ) ) 377 ('\0' != str[name_len - 1]) ) )
392 { 378 {
393 GNUNET_break (0); 379 GNUNET_break (0);
394 reschedule_connect (h); 380 reschedule_connect (h);
395 return; 381 return;
396 } 382 }
397 priv = GNUNET_CRYPTO_ecc_decode_key (str, pk_len, GNUNET_YES); 383 GNUNET_CRYPTO_ecc_key_get_public (&sdm->private_key,
398 if (NULL == priv)
399 {
400 GNUNET_break (0);
401 reschedule_connect (h);
402 return;
403 }
404 GNUNET_CRYPTO_ecc_key_get_public (priv,
405 &pub); 384 &pub);
406 GNUNET_CRYPTO_ecc_key_free (priv);
407 GNUNET_CRYPTO_hash (&pub, sizeof (pub), &id); 385 GNUNET_CRYPTO_hash (&pub, sizeof (pub), &id);
408 if (0 == name_len) 386 if (0 == name_len)
409 str = NULL; 387 str = NULL;
410 else 388 else
411 str = &str[pk_len]; 389 str = (const char *) &sdm[1];
412 ego = GNUNET_CONTAINER_multihashmap_get (h->egos, 390 ego = GNUNET_CONTAINER_multihashmap_get (h->egos,
413 &id); 391 &id);
414 if (NULL == ego) 392 if (NULL == ego)
@@ -425,7 +403,7 @@ message_handler (void *cls,
425 op->cb (op->cls, 403 op->cb (op->cls,
426 ego, 404 ego,
427 &ego->ctx, 405 &ego->ctx,
428 ego->identifier); 406 ego->name);
429 GNUNET_free (op); 407 GNUNET_free (op);
430 break; 408 break;
431 default: 409 default:
@@ -588,13 +566,27 @@ GNUNET_IDENTITY_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
588 * @return associated ECC key, valid as long as the ego is valid 566 * @return associated ECC key, valid as long as the ego is valid
589 */ 567 */
590const struct GNUNET_CRYPTO_EccPrivateKey * 568const struct GNUNET_CRYPTO_EccPrivateKey *
591GNUNET_IDENTITY_ego_get_key (struct GNUNET_IDENTITY_Ego *ego) 569GNUNET_IDENTITY_ego_get_private_key (struct GNUNET_IDENTITY_Ego *ego)
592{ 570{
593 return ego->pk; 571 return ego->pk;
594} 572}
595 573
596 574
597/** 575/**
576 * Get the identifier (public key) of an ego.
577 *
578 * @param ego identity handle with the private key
579 * @param pk set to ego's public key
580 */
581void
582GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego,
583 struct GNUNET_CRYPTO_EccPublicKey *pk)
584{
585 GNUNET_assert (0);
586}
587
588
589/**
598 * Obtain the identity that is currently preferred/default 590 * Obtain the identity that is currently preferred/default
599 * for a service. 591 * for a service.
600 * 592 *
@@ -660,38 +652,30 @@ GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *id,
660 GNUNET_IDENTITY_Continuation cont, 652 GNUNET_IDENTITY_Continuation cont,
661 void *cont_cls) 653 void *cont_cls)
662{ 654{
663 struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded *enc;
664 struct GNUNET_IDENTITY_Operation *op; 655 struct GNUNET_IDENTITY_Operation *op;
665 struct GNUNET_IDENTITY_SetDefaultMessage *sdm; 656 struct GNUNET_IDENTITY_SetDefaultMessage *sdm;
666 char *str;
667 uint16_t enc_len;
668 size_t slen; 657 size_t slen;
669 658
670 slen = strlen (service_name) + 1; 659 slen = strlen (service_name) + 1;
671 enc = GNUNET_CRYPTO_ecc_encode_key (ego->pk); 660 if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_IDENTITY_SetDefaultMessage))
672 enc_len = ntohs (enc->size);
673
674 if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_IDENTITY_SetDefaultMessage) - enc_len)
675 { 661 {
676 GNUNET_break (0); 662 GNUNET_break (0);
677 GNUNET_free (enc);
678 return NULL; 663 return NULL;
679 } 664 }
680 op = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_Operation) + 665 op = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_Operation) +
681 sizeof (struct GNUNET_IDENTITY_SetDefaultMessage) + 666 sizeof (struct GNUNET_IDENTITY_SetDefaultMessage) +
682 enc_len + slen); 667 slen);
683 op->h = id; 668 op->h = id;
684 op->cont = cont; 669 op->cont = cont;
685 op->cls = cont_cls; 670 op->cls = cont_cls;
686 sdm = (struct GNUNET_IDENTITY_SetDefaultMessage *) &op[1]; 671 sdm = (struct GNUNET_IDENTITY_SetDefaultMessage *) &op[1];
687 sdm->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT); 672 sdm->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT);
688 sdm->header.size = htons (sizeof (struct GNUNET_IDENTITY_SetDefaultMessage) + 673 sdm->header.size = htons (sizeof (struct GNUNET_IDENTITY_SetDefaultMessage) +
689 slen + enc_len); 674 slen);
690 sdm->name_len = htons (slen); 675 sdm->name_len = htons (slen);
691 sdm->pk_len = htons (enc_len); 676 sdm->reserved = htons (0);
692 str = (char *) &sdm[1]; 677 sdm->private_key = *ego->pk;
693 memcpy (str, enc, enc_len); 678 memcpy (&sdm[1], service_name, slen);
694 memcpy (&str[enc_len], service_name, slen);
695 op->msg = &sdm->header; 679 op->msg = &sdm->header;
696 GNUNET_CONTAINER_DLL_insert_tail (id->op_head, 680 GNUNET_CONTAINER_DLL_insert_tail (id->op_head,
697 id->op_tail, 681 id->op_tail,
@@ -703,61 +687,55 @@ GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *id,
703 687
704 688
705/** 689/**
706 * Create a new identity with the given identifier. 690 * Create a new identity with the given name.
707 * 691 *
708 * @param id identity service to use 692 * @param id identity service to use
709 * @param identifier desired identifier 693 * @param name desired name
710 * @param cont function to call with the result (will only be called once) 694 * @param cont function to call with the result (will only be called once)
711 * @param cont_cls closure for cont 695 * @param cont_cls closure for cont
712 * @return handle to abort the operation 696 * @return handle to abort the operation
713 */ 697 */
714struct GNUNET_IDENTITY_Operation * 698struct GNUNET_IDENTITY_Operation *
715GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id, 699GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id,
716 const char *identifier, 700 const char *name,
717 GNUNET_IDENTITY_Continuation cont, 701 GNUNET_IDENTITY_Continuation cont,
718 void *cont_cls) 702 void *cont_cls)
719{ 703{
720 struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded *enc;
721 struct GNUNET_IDENTITY_Operation *op; 704 struct GNUNET_IDENTITY_Operation *op;
722 struct GNUNET_IDENTITY_CreateRequestMessage *crm; 705 struct GNUNET_IDENTITY_CreateRequestMessage *crm;
723 struct GNUNET_CRYPTO_EccPrivateKey *pk; 706 struct GNUNET_CRYPTO_EccPrivateKey *pk;
724 char *str;
725 uint16_t enc_len;
726 size_t slen; 707 size_t slen;
727 708
728 slen = strlen (identifier) + 1; 709 slen = strlen (name) + 1;
729 pk = GNUNET_CRYPTO_ecc_key_create (); 710 pk = GNUNET_CRYPTO_ecc_key_create ();
730 enc = GNUNET_CRYPTO_ecc_encode_key (pk);
731 GNUNET_CRYPTO_ecc_key_free (pk);
732 enc_len = ntohs (enc->size);
733 711
734 if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_IDENTITY_CreateRequestMessage) - enc_len) 712 if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_IDENTITY_CreateRequestMessage))
735 { 713 {
736 GNUNET_break (0); 714 GNUNET_break (0);
737 GNUNET_free (enc); 715 GNUNET_CRYPTO_ecc_key_free (pk);
738 return NULL; 716 return NULL;
739 } 717 }
740 op = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_Operation) + 718 op = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_Operation) +
741 sizeof (struct GNUNET_IDENTITY_CreateRequestMessage) + 719 sizeof (struct GNUNET_IDENTITY_CreateRequestMessage) +
742 enc_len + slen); 720 slen);
743 op->h = id; 721 op->h = id;
744 op->cont = cont; 722 op->cont = cont;
745 op->cls = cont_cls; 723 op->cls = cont_cls;
746 crm = (struct GNUNET_IDENTITY_CreateRequestMessage *) &op[1]; 724 crm = (struct GNUNET_IDENTITY_CreateRequestMessage *) &op[1];
747 crm->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_CREATE); 725 crm->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_CREATE);
748 crm->header.size = htons (sizeof (struct GNUNET_IDENTITY_CreateRequestMessage) + 726 crm->header.size = htons (sizeof (struct GNUNET_IDENTITY_CreateRequestMessage) +
749 slen + enc_len); 727 slen);
750 crm->name_len = htons (slen); 728 crm->name_len = htons (slen);
751 crm->pk_len = htons (enc_len); 729 crm->reserved = htons (0);
752 str = (char *) &crm[1]; 730 crm->private_key = *pk;
753 memcpy (str, enc, enc_len); 731 memcpy (&crm[1], name, slen);
754 memcpy (&str[enc_len], identifier, slen);
755 op->msg = &crm->header; 732 op->msg = &crm->header;
756 GNUNET_CONTAINER_DLL_insert_tail (id->op_head, 733 GNUNET_CONTAINER_DLL_insert_tail (id->op_head,
757 id->op_tail, 734 id->op_tail,
758 op); 735 op);
759 if (NULL == id->th) 736 if (NULL == id->th)
760 transmit_next (id); 737 transmit_next (id);
738 GNUNET_CRYPTO_ecc_key_free (pk);
761 return op; 739 return op;
762} 740}
763 741
@@ -766,16 +744,16 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id,
766 * Renames an existing identity. 744 * Renames an existing identity.
767 * 745 *
768 * @param id identity service to use 746 * @param id identity service to use
769 * @param old_identifier old identifier 747 * @param old_name old name
770 * @param new_identifier desired new identifier 748 * @param new_name desired new name
771 * @param cb function to call with the result (will only be called once) 749 * @param cb function to call with the result (will only be called once)
772 * @param cb_cls closure for cb 750 * @param cb_cls closure for cb
773 * @return handle to abort the operation 751 * @return handle to abort the operation
774 */ 752 */
775struct GNUNET_IDENTITY_Operation * 753struct GNUNET_IDENTITY_Operation *
776GNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *id, 754GNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *id,
777 const char *old_identifier, 755 const char *old_name,
778 const char *new_identifier, 756 const char *new_name,
779 GNUNET_IDENTITY_Continuation cb, 757 GNUNET_IDENTITY_Continuation cb,
780 void *cb_cls) 758 void *cb_cls)
781{ 759{
@@ -785,8 +763,8 @@ GNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *id,
785 size_t slen_new; 763 size_t slen_new;
786 char *dst; 764 char *dst;
787 765
788 slen_old = strlen (old_identifier) + 1; 766 slen_old = strlen (old_name) + 1;
789 slen_new = strlen (new_identifier) + 1; 767 slen_new = strlen (new_name) + 1;
790 if ( (slen_old >= GNUNET_SERVER_MAX_MESSAGE_SIZE) || 768 if ( (slen_old >= GNUNET_SERVER_MAX_MESSAGE_SIZE) ||
791 (slen_new >= GNUNET_SERVER_MAX_MESSAGE_SIZE) || 769 (slen_new >= GNUNET_SERVER_MAX_MESSAGE_SIZE) ||
792 (slen_old + slen_new >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_IDENTITY_RenameMessage)) ) 770 (slen_old + slen_new >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_IDENTITY_RenameMessage)) )
@@ -807,8 +785,8 @@ GNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *id,
807 grm->old_name_len = htons (slen_old); 785 grm->old_name_len = htons (slen_old);
808 grm->new_name_len = htons (slen_new); 786 grm->new_name_len = htons (slen_new);
809 dst = (char *) &grm[1]; 787 dst = (char *) &grm[1];
810 memcpy (dst, old_identifier, slen_old); 788 memcpy (dst, old_name, slen_old);
811 memcpy (&dst[slen_old], new_identifier, slen_new); 789 memcpy (&dst[slen_old], new_name, slen_new);
812 op->msg = &grm->header; 790 op->msg = &grm->header;
813 GNUNET_CONTAINER_DLL_insert_tail (id->op_head, 791 GNUNET_CONTAINER_DLL_insert_tail (id->op_head,
814 id->op_tail, 792 id->op_tail,
@@ -823,14 +801,14 @@ GNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *id,
823 * Delete an existing identity. 801 * Delete an existing identity.
824 * 802 *
825 * @param id identity service to use 803 * @param id identity service to use
826 * @param identifier identifier of the identity to delete 804 * @param name name of the identity to delete
827 * @param cb function to call with the result (will only be called once) 805 * @param cb function to call with the result (will only be called once)
828 * @param cb_cls closure for cb 806 * @param cb_cls closure for cb
829 * @return handle to abort the operation 807 * @return handle to abort the operation
830 */ 808 */
831struct GNUNET_IDENTITY_Operation * 809struct GNUNET_IDENTITY_Operation *
832GNUNET_IDENTITY_delete (struct GNUNET_IDENTITY_Handle *id, 810GNUNET_IDENTITY_delete (struct GNUNET_IDENTITY_Handle *id,
833 const char *identifier, 811 const char *name,
834 GNUNET_IDENTITY_Continuation cb, 812 GNUNET_IDENTITY_Continuation cb,
835 void *cb_cls) 813 void *cb_cls)
836{ 814{
@@ -838,7 +816,7 @@ GNUNET_IDENTITY_delete (struct GNUNET_IDENTITY_Handle *id,
838 struct GNUNET_IDENTITY_DeleteMessage *gdm; 816 struct GNUNET_IDENTITY_DeleteMessage *gdm;
839 size_t slen; 817 size_t slen;
840 818
841 slen = strlen (identifier) + 1; 819 slen = strlen (name) + 1;
842 if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_IDENTITY_DeleteMessage)) 820 if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_IDENTITY_DeleteMessage))
843 { 821 {
844 GNUNET_break (0); 822 GNUNET_break (0);
@@ -856,7 +834,7 @@ GNUNET_IDENTITY_delete (struct GNUNET_IDENTITY_Handle *id,
856 slen); 834 slen);
857 gdm->name_len = htons (slen); 835 gdm->name_len = htons (slen);
858 gdm->reserved = htons (0); 836 gdm->reserved = htons (0);
859 memcpy (&gdm[1], identifier, slen); 837 memcpy (&gdm[1], name, slen);
860 op->msg = &gdm->header; 838 op->msg = &gdm->header;
861 GNUNET_CONTAINER_DLL_insert_tail (id->op_head, 839 GNUNET_CONTAINER_DLL_insert_tail (id->op_head,
862 id->op_tail, 840 id->op_tail,
@@ -929,7 +907,7 @@ free_ego (void *cls,
929 &ego->ctx, 907 &ego->ctx,
930 NULL); 908 NULL);
931 GNUNET_CRYPTO_ecc_key_free (ego->pk); 909 GNUNET_CRYPTO_ecc_key_free (ego->pk);
932 GNUNET_free (ego->identifier); 910 GNUNET_free (ego->name);
933 GNUNET_free (ego); 911 GNUNET_free (ego);
934 return GNUNET_OK; 912 return GNUNET_OK;
935} 913}