GNUnet  0.19.3
identity_api.c
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2013, 2016, 2021 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 
26 #include "platform.h"
27 #include "gnunet_util_lib.h"
28 #include "gnunet_constants.h"
29 #include "gnunet_error_codes.h"
30 #include "gnunet_protocols.h"
32 #include "identity.h"
33 
34 #define LOG(kind, ...) GNUNET_log_from (kind, "identity-api", __VA_ARGS__)
35 
36 
41 {
46 
51 
56 
61  const struct GNUNET_MessageHeader *msg;
62 
68 
74 
79 
85 
89  void *cls;
90 };
91 
92 
97 {
102 
107 
113 
118 
122  void *cb_cls;
123 
128 
133 
138 
143 
148 };
149 
150 
156 struct GNUNET_IDENTITY_Ego *
158 {
159  static struct GNUNET_IDENTITY_Ego anon;
160  static int setup;
161  ssize_t key_len;
162 
163  if (setup)
164  return &anon;
165  anon.pk.type = htonl (GNUNET_IDENTITY_TYPE_ECDSA);
166  anon.pub.type = htonl (GNUNET_IDENTITY_TYPE_ECDSA);
168  key_len = GNUNET_IDENTITY_private_key_get_length (&anon.pk);
169  GNUNET_assert (0 < key_len);
170  GNUNET_CRYPTO_hash (&anon.pk,
171  key_len,
172  &anon.id);
173  setup = 1;
174  return &anon;
175 }
176 
177 
179 GNUNET_IDENTITY_key_get_public (const struct
182 {
183  key->type = privkey->type;
184  switch (ntohl (privkey->type))
185  {
188  &key->ecdsa_key);
189  break;
192  &key->eddsa_key);
193  break;
194  default:
195  GNUNET_break (0);
196  return GNUNET_SYSERR;
197  }
198  return GNUNET_OK;
199 }
200 
201 
202 static enum GNUNET_GenericReturnValue
205 {
206  key->type = htonl (ktype);
207  switch (ktype)
208  {
210  GNUNET_CRYPTO_ecdsa_key_create (&key->ecdsa_key);
211  break;
213  GNUNET_CRYPTO_eddsa_key_create (&key->eddsa_key);
214  break;
215  default:
216  GNUNET_break (0);
217  return GNUNET_SYSERR;
218  }
219  return GNUNET_OK;
220 }
221 
222 
228 static void
229 reconnect (void *cls);
230 
231 
240 static int
241 free_ego (void *cls,
242  const struct GNUNET_HashCode *key,
243  void *value)
244 {
245  struct GNUNET_IDENTITY_Handle *h = cls;
246  struct GNUNET_IDENTITY_Ego *ego = value;
247 
248  if (NULL != h->cb)
249  h->cb (h->cb_cls, ego,
250  &ego->ctx,
251  NULL);
252  GNUNET_free (ego->name);
255  key,
256  value));
257  GNUNET_free (ego);
258  return GNUNET_OK;
259 }
260 
261 
267 static void
269 {
271 
272  GNUNET_assert (NULL == h->reconnect_task);
273 
274  if (NULL != h->mq)
275  {
277  h->mq = NULL;
278  }
279  while (NULL != (op = h->op_head))
280  {
281  GNUNET_CONTAINER_DLL_remove (h->op_head,
282  h->op_tail,
283  op);
284  if (NULL != op->cont)
285  op->cont (op->cls,
287  else if (NULL != op->cb)
288  op->cb (op->cls, NULL, NULL, NULL);
289  else if (NULL != op->create_cont)
290  op->create_cont (op->cls,
291  NULL,
293  GNUNET_free (op);
294  }
296  &free_ego,
297  h);
299  "Scheduling task to reconnect to identity service in %s.\n",
300  GNUNET_STRINGS_relative_time_to_string (h->reconnect_delay,
301  GNUNET_YES));
302  h->reconnect_task =
303  GNUNET_SCHEDULER_add_delayed (h->reconnect_delay,
304  &reconnect,
305  h);
306  h->reconnect_delay = GNUNET_TIME_STD_BACKOFF (h->reconnect_delay);
307 }
308 
309 
318 static void
320  enum GNUNET_MQ_Error error)
321 {
322  struct GNUNET_IDENTITY_Handle *h = cls;
323 
325 }
326 
327 
334 static void
336  const struct ResultCodeMessage *rcm)
337 {
338  struct GNUNET_IDENTITY_Handle *h = cls;
340  enum GNUNET_ErrorCode ec = ntohl (rcm->result_code);
341 
342  op = h->op_head;
343  if (NULL == op)
344  {
345  GNUNET_break (0);
347  return;
348  }
349  GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
350  if (NULL != op->cont)
351  op->cont (op->cls, ec);
352  else if (NULL != op->cb)
353  op->cb (op->cls, NULL, NULL, NULL);
354  else if (NULL != op->create_cont)
355  op->create_cont (op->cls, (GNUNET_EC_NONE == ec) ? &op->pk : NULL, ec);
356  GNUNET_free (op);
357 }
358 
359 
367 static int
369  const struct UpdateMessage *um)
370 {
371  uint16_t size = ntohs (um->header.size);
372  uint16_t name_len = ntohs (um->name_len);
373  const char *str = (const char *) &um[1];
374 
375  if ((size < name_len + sizeof(struct UpdateMessage)) ||
376  ((0 != name_len) && ('\0' != str[name_len - 1])))
377  {
378  GNUNET_break (0);
379  return GNUNET_SYSERR;
380  }
381  return GNUNET_OK;
382 }
383 
384 
391 static void
393  const struct UpdateMessage *um)
394 {
395  struct GNUNET_IDENTITY_Handle *h = cls;
396  uint16_t name_len = ntohs (um->name_len);
397  const char *str;
398  size_t key_len;
399  size_t kb_read;
400  struct GNUNET_HashCode id;
401  struct GNUNET_IDENTITY_Ego *ego;
402  struct GNUNET_IDENTITY_PrivateKey private_key;
403  const char *tmp;
404 
405  if (GNUNET_YES == ntohs (um->end_of_list))
406  {
407  /* end of initial list of data */
408  if (NULL != h->cb)
409  h->cb (h->cb_cls, NULL, NULL, NULL);
410  return;
411  }
412  tmp = (const char*) &um[1];
413  str = (0 == name_len) ? NULL : tmp;
414  memset (&private_key, 0, sizeof (private_key));
415  key_len = ntohs (um->key_len);
418  key_len,
419  &private_key,
420  &kb_read));
422  GNUNET_CRYPTO_hash (&private_key,
424  &id);
426  &id);
427  if (NULL == ego)
428  {
429  /* ego was created */
430  if (NULL == str)
431  {
432  /* deletion of unknown ego? not allowed */
433  GNUNET_break (0);
435  return;
436  }
437  ego = GNUNET_new (struct GNUNET_IDENTITY_Ego);
438  ego->pub_initialized = GNUNET_NO;
439  ego->pk = private_key;
440  ego->name = GNUNET_strdup (str);
441  ego->id = id;
444  h->egos,
445  &ego->id,
446  ego,
448  }
449  if (NULL == str)
450  {
451  /* ego was deleted */
454  &ego->id,
455  ego));
456  }
457  else
458  {
459  /* ego changed name */
460  GNUNET_free (ego->name);
461  ego->name = GNUNET_strdup (str);
462  }
463  /* inform application about change */
464  if (NULL != h->cb)
465  h->cb (h->cb_cls,
466  ego,
467  &ego->ctx,
468  str);
469  /* complete deletion */
470  if (NULL == str)
471  {
472  GNUNET_free (ego->name);
473  GNUNET_free (ego);
474  }
475 }
476 
477 
483 static void
484 reconnect (void *cls)
485 {
486  struct GNUNET_IDENTITY_Handle *h = cls;
488  GNUNET_MQ_hd_fixed_size (identity_result_code,
490  struct ResultCodeMessage,
491  h),
492  GNUNET_MQ_hd_var_size (identity_update,
494  struct UpdateMessage,
495  h),
497  };
498  struct GNUNET_MQ_Envelope *env;
499  struct GNUNET_MessageHeader *msg;
500 
501  h->reconnect_task = NULL;
503  "Connecting to identity service.\n");
504  GNUNET_assert (NULL == h->mq);
506  "identity",
507  handlers,
509  h);
510  if (NULL == h->mq)
511  return;
512  if (NULL != h->cb)
513  {
514  env = GNUNET_MQ_msg (msg,
516  GNUNET_MQ_send (h->mq,
517  env);
518  }
519 }
520 
521 
530 struct GNUNET_IDENTITY_Handle *
533  void *cb_cls)
534 {
535  struct GNUNET_IDENTITY_Handle *h;
536 
538  h->cfg = cfg;
539  h->cb = cb;
540  h->cb_cls = cb_cls;
542  GNUNET_YES);
543  reconnect (h);
544  if (NULL == h->mq)
545  {
546  GNUNET_free (h);
547  return NULL;
548  }
549  return h;
550 }
551 
552 
559 const struct GNUNET_IDENTITY_PrivateKey *
561 {
562  return &ego->pk;
563 }
564 
565 
572 void
575 {
576  if (GNUNET_NO == ego->pub_initialized)
577  {
578  GNUNET_IDENTITY_key_get_public (&ego->pk, &ego->pub);
580  }
581  *pk = ego->pub;
582 }
583 
584 
587  const char *name,
588  const struct GNUNET_IDENTITY_PrivateKey *privkey,
589  enum GNUNET_IDENTITY_KeyType ktype,
591  void *cont_cls)
592 {
593  struct GNUNET_IDENTITY_PrivateKey private_key;
595  struct GNUNET_MQ_Envelope *env;
596  struct CreateRequestMessage *crm;
597  size_t slen;
598  size_t key_len;
599 
600  if (NULL == h->mq)
601  return NULL;
602  slen = strlen (name) + 1;
603  if (slen >= GNUNET_MAX_MESSAGE_SIZE - sizeof(struct CreateRequestMessage))
604  {
605  GNUNET_break (0);
606  return NULL;
607  }
609  op->h = h;
610  op->create_cont = cont;
611  op->cls = cont_cls;
612  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
613  if (NULL == privkey)
614  {
616  private_key_create (ktype, &private_key));
617  }
618  else
619  private_key = *privkey;
621  env = GNUNET_MQ_msg_extra (crm, slen + key_len,
623  crm->name_len = htons (slen);
625  &crm[1],
626  key_len);
627  crm->key_len = htons (key_len);
628  op->pk = private_key;
629  GNUNET_memcpy ((char*) &crm[1] + key_len, name, slen);
630  GNUNET_MQ_send (h->mq, env);
631  return op;
632 }
633 
634 
647  const char *old_name,
648  const char *new_name,
650  void *cb_cls)
651 {
653  struct GNUNET_MQ_Envelope *env;
654  struct RenameMessage *grm;
655  size_t slen_old;
656  size_t slen_new;
657  char *dst;
658 
659  if (NULL == h->mq)
660  return NULL;
661  slen_old = strlen (old_name) + 1;
662  slen_new = strlen (new_name) + 1;
663  if ((slen_old >= GNUNET_MAX_MESSAGE_SIZE) ||
664  (slen_new >= GNUNET_MAX_MESSAGE_SIZE) ||
665  (slen_old + slen_new >=
666  GNUNET_MAX_MESSAGE_SIZE - sizeof(struct RenameMessage)))
667  {
668  GNUNET_break (0);
669  return NULL;
670  }
672  op->h = h;
673  op->cont = cb;
674  op->cls = cb_cls;
675  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
676  env = GNUNET_MQ_msg_extra (grm,
677  slen_old + slen_new,
679  grm->old_name_len = htons (slen_old);
680  grm->new_name_len = htons (slen_new);
681  dst = (char *) &grm[1];
682  GNUNET_memcpy (dst, old_name, slen_old);
683  GNUNET_memcpy (&dst[slen_old], new_name, slen_new);
684  GNUNET_MQ_send (h->mq, env);
685  return op;
686 }
687 
688 
700  const char *name,
702  void *cb_cls)
703 {
705  struct GNUNET_MQ_Envelope *env;
706  struct DeleteMessage *gdm;
707  size_t slen;
708 
709  if (NULL == h->mq)
710  return NULL;
711  slen = strlen (name) + 1;
712  if (slen >= GNUNET_MAX_MESSAGE_SIZE - sizeof(struct DeleteMessage))
713  {
714  GNUNET_break (0);
715  return NULL;
716  }
718  op->h = h;
719  op->cont = cb;
720  op->cls = cb_cls;
721  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
723  gdm->name_len = htons (slen);
724  gdm->reserved = htons (0);
725  GNUNET_memcpy (&gdm[1], name, slen);
726  GNUNET_MQ_send (h->mq, env);
727  return op;
728 }
729 
730 
739 void
741 {
742  op->cont = NULL;
743  op->cb = NULL;
744  op->create_cont = NULL;
745  memset (&op->pk,
746  0,
747  sizeof (op->pk));
748 }
749 
750 
756 void
758 {
760 
761  GNUNET_assert (NULL != h);
762  if (h->reconnect_task != NULL)
763  {
765  h->reconnect_task = NULL;
766  }
767  if (NULL != h->egos)
768  {
770  &free_ego,
771  h);
773  h->egos = NULL;
774  }
775  while (NULL != (op = h->op_head))
776  {
777  GNUNET_break (NULL == op->cont);
778  GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
779  memset (&op->pk,
780  0,
781  sizeof (op->pk));
782  GNUNET_free (op);
783  }
784  if (NULL != h->mq)
785  {
787  h->mq = NULL;
788  }
789  GNUNET_free (h);
790 }
791 
792 
793 static enum GNUNET_GenericReturnValue
794 check_key_type (uint32_t type)
795 {
796  switch (type)
797  {
800  return GNUNET_OK;
801  default:
802  return GNUNET_SYSERR;
803  }
804  return GNUNET_SYSERR;
805 }
806 
807 
808 ssize_t
811 {
812  switch (ntohl (key->type))
813  {
815  return sizeof (key->type) + sizeof (key->ecdsa_key);
816  break;
818  return sizeof (key->type) + sizeof (key->eddsa_key);
819  break;
820  default:
822  "Got key type %u\n", ntohl (key->type));
823  GNUNET_break (0);
824  }
825  return -1;
826 }
827 
828 
829 ssize_t
832 {
833  switch (ntohl (key->type))
834  {
836  return sizeof (key->type) + sizeof (key->ecdsa_key);
838  return sizeof (key->type) + sizeof (key->eddsa_key);
839  default:
840  GNUNET_break (0);
841  }
842  return -1;
843 }
844 
845 
846 ssize_t
848 {
849  switch (kt)
850  {
852  return sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey);
853  break;
855  return sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey);
856  break;
857  default:
858  GNUNET_break (0);
859  }
860  return -1;
861 }
862 
863 
866  size_t len,
868  key,
869  size_t *kb_read)
870 {
871  if (len < sizeof (key->type))
872  return GNUNET_SYSERR;
873  GNUNET_memcpy (&key->type,
874  buffer,
875  sizeof (key->type));
876  ssize_t length = GNUNET_IDENTITY_public_key_get_length (key);
877  if (len < length)
878  return GNUNET_SYSERR;
879  if (length < 0)
880  return GNUNET_SYSERR;
881  GNUNET_memcpy (&key->ecdsa_key,
882  buffer + sizeof (key->type),
883  length - sizeof (key->type));
884  *kb_read = length;
885  return GNUNET_OK;
886 }
887 
888 
889 ssize_t
892  void*buffer,
893  size_t len)
894 {
895  const ssize_t length = GNUNET_IDENTITY_public_key_get_length (key);
896  if (len < length)
897  return -1;
898  if (length < 0)
899  return -2;
900  GNUNET_memcpy (buffer, &(key->type), sizeof (key->type));
901  GNUNET_memcpy (buffer + sizeof (key->type), &(key->ecdsa_key), length
902  - sizeof (key->type));
903  return length;
904 }
905 
906 
909  size_t len,
910  struct
912  size_t *kb_read)
913 {
914  if (len < sizeof (key->type))
915  return GNUNET_SYSERR;
916  GNUNET_memcpy (&key->type,
917  buffer,
918  sizeof (key->type));
919  ssize_t length = GNUNET_IDENTITY_private_key_get_length (key);
920  if (len < length)
921  return GNUNET_SYSERR;
922  if (length < 0)
923  return GNUNET_SYSERR;
924  GNUNET_memcpy (&key->ecdsa_key,
925  buffer + sizeof (key->type),
926  length - sizeof (key->type));
927  *kb_read = length;
928  return GNUNET_OK;
929 }
930 
931 
932 ssize_t
935  void *buffer,
936  size_t len)
937 {
938  const ssize_t length = GNUNET_IDENTITY_private_key_get_length (key);
939  if (len < length)
940  return -1;
941  if (length < 0)
942  return -2;
943  GNUNET_memcpy (buffer, &(key->type), sizeof (key->type));
944  GNUNET_memcpy (buffer + sizeof (key->type), &(key->ecdsa_key), length
945  - sizeof (key->type));
946  return length;
947 }
948 
949 
950 ssize_t
953 {
954  switch (ntohl (sig->type))
955  {
957  return sizeof (sig->type) + sizeof (sig->ecdsa_signature);
958  break;
960  return sizeof (sig->type) + sizeof (sig->eddsa_signature);
961  break;
962  default:
963  GNUNET_break (0);
964  }
965  return -1;
966 }
967 
968 
969 ssize_t
971 {
972  switch (ntohl (type))
973  {
975  return sizeof (struct GNUNET_CRYPTO_EcdsaSignature);
976  break;
978  return sizeof (struct GNUNET_CRYPTO_EddsaSignature);
979  break;
980  default:
981  GNUNET_break (0);
982  }
983  return -1;
984 }
985 
986 
987 ssize_t
990  const void*buffer,
991  size_t len)
992 {
993  if (len < sizeof (sig->type))
994  return -1;
995  GNUNET_memcpy (&(sig->type), buffer, sizeof (sig->type));
996  const ssize_t length = GNUNET_IDENTITY_signature_get_length (sig);
997  if (len < length)
998  return -1;
999  if (length < 0)
1000  return -2;
1001  GNUNET_memcpy (&(sig->ecdsa_signature), buffer + sizeof (sig->type), length
1002  - sizeof (sig->type));
1003  return length;
1004 }
1005 
1006 
1007 ssize_t
1010  void*buffer,
1011  size_t len)
1012 {
1013  const ssize_t length = GNUNET_IDENTITY_signature_get_length (sig);
1014  if (len < length)
1015  return -1;
1016  if (length < 0)
1017  return -2;
1018  GNUNET_memcpy (buffer, &(sig->type), sizeof (sig->type));
1019  GNUNET_memcpy (buffer + sizeof (sig->type), &(sig->ecdsa_signature), length
1020  - sizeof (sig->type));
1021  return length;
1022 }
1023 
1024 
1026 GNUNET_IDENTITY_sign_raw_ (const struct
1028  const struct
1030  unsigned char *sig)
1031 {
1032  switch (ntohl (priv->type))
1033  {
1035  return GNUNET_CRYPTO_ecdsa_sign_ (&(priv->ecdsa_key), purpose,
1036  (struct
1038  break;
1040  return GNUNET_CRYPTO_eddsa_sign_ (&(priv->eddsa_key), purpose,
1041  (struct
1043  break;
1044  default:
1045  GNUNET_break (0);
1046  }
1047 
1048  return GNUNET_SYSERR;
1049 }
1050 
1051 
1053 GNUNET_IDENTITY_sign_ (const struct
1055  const struct
1057  struct GNUNET_IDENTITY_Signature *sig)
1058 {
1059  sig->type = priv->type;
1060  switch (ntohl (priv->type))
1061  {
1063  return GNUNET_CRYPTO_ecdsa_sign_ (&(priv->ecdsa_key), purpose,
1064  &(sig->ecdsa_signature));
1065  break;
1067  return GNUNET_CRYPTO_eddsa_sign_ (&(priv->eddsa_key), purpose,
1068  &(sig->eddsa_signature));
1069  break;
1070  default:
1071  GNUNET_break (0);
1072  }
1073 
1074  return GNUNET_SYSERR;
1075 }
1076 
1077 
1079 GNUNET_IDENTITY_signature_verify_ (uint32_t purpose,
1080  const struct
1082  const struct GNUNET_IDENTITY_Signature *sig,
1083  const struct GNUNET_IDENTITY_PublicKey *pub)
1084 {
1085  /* check type matching of 'sig' and 'pub' */
1086  GNUNET_assert (ntohl (pub->type) == ntohl (sig->type));
1087  switch (ntohl (pub->type))
1088  {
1090  return GNUNET_CRYPTO_ecdsa_verify_ (purpose, validate,
1091  &(sig->ecdsa_signature),
1092  &(pub->ecdsa_key));
1093  break;
1095  return GNUNET_CRYPTO_eddsa_verify_ (purpose, validate,
1096  &(sig->eddsa_signature),
1097  &(pub->eddsa_key));
1098  break;
1099  default:
1100  GNUNET_break (0);
1101  }
1102 
1103  return GNUNET_SYSERR;
1104 }
1105 
1106 
1108 GNUNET_IDENTITY_signature_verify_raw_ (uint32_t purpose,
1109  const struct
1111  validate,
1112  const unsigned char *sig,
1113  const struct
1115 {
1116  switch (ntohl (pub->type))
1117  {
1119  return GNUNET_CRYPTO_ecdsa_verify_ (purpose, validate,
1120  (struct
1122  &(pub->ecdsa_key));
1123  break;
1125  return GNUNET_CRYPTO_eddsa_verify_ (purpose, validate,
1126  (struct
1128  &(pub->eddsa_key));
1129  break;
1130  default:
1131  GNUNET_break (0);
1132  }
1133 
1134  return GNUNET_SYSERR;
1135 }
1136 
1137 
1138 ssize_t
1139 GNUNET_IDENTITY_encrypt (const void *block,
1140  size_t size,
1141  const struct GNUNET_IDENTITY_PublicKey *pub,
1142  struct GNUNET_CRYPTO_EcdhePublicKey *ecc,
1143  void *result)
1144 {
1147  struct GNUNET_HashCode hash;
1148  switch (ntohl (pub->type))
1149  {
1151  if (GNUNET_SYSERR == GNUNET_CRYPTO_ecdh_ecdsa (&pk, &(pub->ecdsa_key),
1152  &hash))
1153  return -1;
1154  break;
1156  if (GNUNET_SYSERR == GNUNET_CRYPTO_ecdh_eddsa (&pk, &(pub->eddsa_key),
1157  &hash))
1158  return -1;
1159  break;
1160  default:
1161  return -1;
1162  }
1167  GNUNET_CRYPTO_hash_to_aes_key (&hash, &key, &iv);
1168  GNUNET_CRYPTO_zero_keys (&hash, sizeof(hash));
1169  const ssize_t encrypted = GNUNET_CRYPTO_symmetric_encrypt (block, size, &key,
1170  &iv, result);
1171  GNUNET_CRYPTO_zero_keys (&key, sizeof(key));
1172  GNUNET_CRYPTO_zero_keys (&iv, sizeof(iv));
1173  return encrypted;
1174 }
1175 
1176 
1177 ssize_t
1178 GNUNET_IDENTITY_decrypt (const void *block,
1179  size_t size,
1180  const struct GNUNET_IDENTITY_PrivateKey *priv,
1181  const struct GNUNET_CRYPTO_EcdhePublicKey *ecc,
1182  void *result)
1183 {
1184  struct GNUNET_HashCode hash;
1185  switch (ntohl (priv->type))
1186  {
1188  if (GNUNET_SYSERR == GNUNET_CRYPTO_ecdsa_ecdh (&(priv->ecdsa_key), ecc,
1189  &hash))
1190  return -1;
1191  break;
1193  if (GNUNET_SYSERR == GNUNET_CRYPTO_eddsa_ecdh (&(priv->eddsa_key), ecc,
1194  &hash))
1195  return -1;
1196  break;
1197  default:
1198  return -1;
1199  }
1202  GNUNET_CRYPTO_hash_to_aes_key (&hash, &key, &iv);
1203  GNUNET_CRYPTO_zero_keys (&hash, sizeof(hash));
1204  const ssize_t decrypted = GNUNET_CRYPTO_symmetric_decrypt (block, size, &key,
1205  &iv, result);
1206  GNUNET_CRYPTO_zero_keys (&key, sizeof(key));
1207  GNUNET_CRYPTO_zero_keys (&iv, sizeof(iv));
1208  return decrypted;
1209 }
1210 
1211 
1212 char *
1215 {
1218  size);
1219 }
1220 
1221 
1222 char *
1225 {
1228  size);
1229 }
1230 
1231 
1235 {
1238  strlen (str),
1239  key,
1240  sizeof (*key));
1241  if (GNUNET_OK != ret)
1242  return GNUNET_SYSERR;
1243  return check_key_type (ntohl (key->type));
1244 
1245 }
1246 
1247 
1251 {
1254  strlen (str),
1255  key,
1256  sizeof (*key));
1257  if (GNUNET_OK != ret)
1258  return GNUNET_SYSERR;
1259  return check_key_type (ntohl (key->type));
1260 }
1261 
1262 
1263 /* end of identity_api.c */
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
GNUNET_ErrorCode
Taler error codes.
@ GNUNET_EC_NONE
No error (success).
@ GNUNET_EC_SERVICE_COMMUNICATION_FAILED
Communication with service failed.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:144
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
static struct GNUNET_CADET_MessageHandler handlers[]
Handlers, for diverse services.
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
struct GNUNET_HashCode key
The key used in the DHT.
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...
struct GNUNET_IDENTITY_PrivateKey pk
Private key from command line option, or NULL.
static char * value
Value of the record to add/remove.
static int result
Global testing status.
static struct GNUNET_CRYPTO_EddsaPublicKey pub
Definition: gnunet-scrypt.c:47
Identity service; implements identity management for GNUnet.
Constants for network protocols.
#define GNUNET_MAX_MESSAGE_SIZE
Largest supported message (to be precise, one byte more than the largest possible message,...
struct GNUNET_MQ_Handle * GNUNET_CLIENT_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *service_name, const struct GNUNET_MQ_MessageHandler *handlers, GNUNET_MQ_ErrorHandler error_handler, void *error_handler_cls)
Create a message queue to connect to a GNUnet service.
Definition: client.c:1057
void GNUNET_CRYPTO_ecdhe_key_create(struct GNUNET_CRYPTO_EcdhePrivateKey *pk)
Create a new private key.
Definition: crypto_ecc.c:435
void GNUNET_CRYPTO_eddsa_key_get_public(const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, struct GNUNET_CRYPTO_EddsaPublicKey *pub)
Extract the public key for the given private key.
Definition: crypto_ecc.c:197
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdsa_ecdh(const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, const struct GNUNET_CRYPTO_EcdhePublicKey *pub, struct GNUNET_HashCode *key_material)
Derive key material from a ECDH public key and a private ECDSA key.
Definition: crypto_ecc.c:761
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdsa_sign_(const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, struct GNUNET_CRYPTO_EcdsaSignature *sig)
ECDSA Sign a given block.
Definition: crypto_ecc.c:549
ssize_t GNUNET_CRYPTO_symmetric_encrypt(const void *block, size_t size, const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, void *result)
Encrypt a block using a symmetric sessionkey.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_ecdh(const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, const struct GNUNET_CRYPTO_EcdhePublicKey *pub, struct GNUNET_HashCode *key_material)
Derive key material from a ECDH public key and a private EdDSA key.
Definition: crypto_ecc.c:739
const struct GNUNET_CRYPTO_EcdsaPrivateKey * GNUNET_CRYPTO_ecdsa_key_get_anonymous(void)
Get the shared private key we use for anonymous users.
Definition: crypto_ecc.c:481
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdh_ecdsa(const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, struct GNUNET_HashCode *key_material)
Derive key material from a EcDSA public key and a private ECDH key.
Definition: crypto_ecc.c:796
void GNUNET_CRYPTO_eddsa_key_create(struct GNUNET_CRYPTO_EddsaPrivateKey *pk)
Create a new private key.
Definition: crypto_ecc.c:461
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdh_eddsa(const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, const struct GNUNET_CRYPTO_EddsaPublicKey *pub, struct GNUNET_HashCode *key_material)
Derive key material from a EdDSA public key and a private ECDH key.
Definition: crypto_ecc.c:779
void GNUNET_CRYPTO_ecdsa_key_create(struct GNUNET_CRYPTO_EcdsaPrivateKey *pk)
Create a new private key.
Definition: crypto_ecc.c:446
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_sign_(const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, struct GNUNET_CRYPTO_EddsaSignature *sig)
EdDSA sign a given block.
Definition: crypto_ecc.c:619
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdsa_verify_(uint32_t purpose, const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, const struct GNUNET_CRYPTO_EcdsaSignature *sig, const struct GNUNET_CRYPTO_EcdsaPublicKey *pub)
Verify ECDSA signature.
Definition: crypto_ecc.c:643
void GNUNET_CRYPTO_ecdsa_key_get_public(const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, struct GNUNET_CRYPTO_EcdsaPublicKey *pub)
Extract the public key for the given private key.
Definition: crypto_ecc.c:186
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_verify_(uint32_t purpose, const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, const struct GNUNET_CRYPTO_EddsaSignature *sig, const struct GNUNET_CRYPTO_EddsaPublicKey *pub)
Verify EdDSA signature.
Definition: crypto_ecc.c:702
void GNUNET_CRYPTO_zero_keys(void *buffer, size_t length)
Zero out buffer, securely against compiler optimizations.
void GNUNET_CRYPTO_ecdhe_key_clear(struct GNUNET_CRYPTO_EcdhePrivateKey *pk)
Clear memory that was used to store a private key.
Definition: crypto_ecc.c:414
void GNUNET_CRYPTO_ecdhe_key_get_public(const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, struct GNUNET_CRYPTO_EcdhePublicKey *pub)
Extract the public key for the given private key.
Definition: crypto_ecc.c:213
ssize_t GNUNET_CRYPTO_symmetric_decrypt(const void *block, size_t size, const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, void *result)
Decrypt a given block using a symmetric sessionkey.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
Definition: crypto_hash.c:41
void GNUNET_CRYPTO_hash_to_aes_key(const struct GNUNET_HashCode *hc, struct GNUNET_CRYPTO_SymmetricSessionKey *skey, struct GNUNET_CRYPTO_SymmetricInitializationVector *iv)
Convert a hashcode into a key.
Definition: crypto_hash.c:151
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MultiHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_remove(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, const void *value)
Remove the given key-value pair from the map.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_put(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
void * GNUNET_CONTAINER_multihashmap_get(const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Given a key find a value in the map matching the key.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY
There must only be one value per key; storing a value should fail if a value under the same key alrea...
const struct GNUNET_IDENTITY_PrivateKey * GNUNET_IDENTITY_ego_get_private_key(const struct GNUNET_IDENTITY_Ego *ego)
Obtain the ECC key associated with a ego.
Definition: identity_api.c:560
enum GNUNET_GenericReturnValue GNUNET_IDENTITY_sign_(const struct GNUNET_IDENTITY_PrivateKey *priv, const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, struct GNUNET_IDENTITY_Signature *sig)
Sign a given block.
enum GNUNET_GenericReturnValue GNUNET_IDENTITY_public_key_from_string(const char *str, struct GNUNET_IDENTITY_PublicKey *key)
Parses a (Base32) string representation of the public key.
enum GNUNET_GenericReturnValue GNUNET_IDENTITY_private_key_from_string(const char *str, struct GNUNET_IDENTITY_PrivateKey *key)
Parses a (Base32) string representation of the private key.
GNUNET_IDENTITY_KeyType
void(* GNUNET_IDENTITY_CreateContinuation)(void *cls, const struct GNUNET_IDENTITY_PrivateKey *pk, enum GNUNET_ErrorCode ec)
Function called once the requested operation has been completed.
struct GNUNET_IDENTITY_Operation * GNUNET_IDENTITY_rename(struct GNUNET_IDENTITY_Handle *h, const char *old_name, const char *new_name, GNUNET_IDENTITY_Continuation cb, void *cb_cls)
Renames an existing identity.
Definition: identity_api.c:646
ssize_t GNUNET_IDENTITY_decrypt(const void *block, size_t size, const struct GNUNET_IDENTITY_PrivateKey *priv, const struct GNUNET_CRYPTO_EcdhePublicKey *ecc, void *result)
Decrypt a given block with GNUNET_IDENTITY_PrivateKey and a given GNUNET_CRYPTO_EcdhePublicKey using ...
enum GNUNET_GenericReturnValue GNUNET_IDENTITY_key_get_public(const struct GNUNET_IDENTITY_PrivateKey *privkey, struct GNUNET_IDENTITY_PublicKey *key)
Retrieves the public key representation of a private key.
Definition: identity_api.c:179
ssize_t GNUNET_IDENTITY_encrypt(const void *block, size_t size, const struct GNUNET_IDENTITY_PublicKey *pub, struct GNUNET_CRYPTO_EcdhePublicKey *ecc, void *result)
Encrypt a block with GNUNET_IDENTITY_PublicKey and derives a GNUNET_CRYPTO_EcdhePublicKey which is re...
ssize_t GNUNET_IDENTITY_write_signature_to_buffer(const struct GNUNET_IDENTITY_Signature *sig, void *buffer, size_t len)
Writes a GNUNET_IDENTITY_Signature to a compact buffer.
ssize_t GNUNET_IDENTITY_write_public_key_to_buffer(const struct GNUNET_IDENTITY_PublicKey *key, void *buffer, size_t len)
Writes a GNUNET_IDENTITY_PublicKey to a compact buffer.
Definition: identity_api.c:890
ssize_t GNUNET_IDENTITY_public_key_get_length(const struct GNUNET_IDENTITY_PublicKey *key)
Get the compacted length of a GNUNET_IDENTITY_PublicKey.
Definition: identity_api.c:830
char * GNUNET_IDENTITY_private_key_to_string(const struct GNUNET_IDENTITY_PrivateKey *key)
Creates a (Base32) string representation of the private key.
struct GNUNET_IDENTITY_Operation * GNUNET_IDENTITY_create(struct GNUNET_IDENTITY_Handle *h, const char *name, const struct GNUNET_IDENTITY_PrivateKey *privkey, enum GNUNET_IDENTITY_KeyType ktype, GNUNET_IDENTITY_CreateContinuation cont, void *cont_cls)
Create a new ego with the given name.
Definition: identity_api.c:586
enum GNUNET_GenericReturnValue GNUNET_IDENTITY_signature_verify_(uint32_t purpose, const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, const struct GNUNET_IDENTITY_Signature *sig, const struct GNUNET_IDENTITY_PublicKey *pub)
Verify a given signature.
ssize_t GNUNET_IDENTITY_write_private_key_to_buffer(const struct GNUNET_IDENTITY_PrivateKey *key, void *buffer, size_t len)
Writes a GNUNET_IDENTITY_PrivateKey to a compact buffer.
Definition: identity_api.c:933
void GNUNET_IDENTITY_ego_get_public_key(struct GNUNET_IDENTITY_Ego *ego, struct GNUNET_IDENTITY_PublicKey *pk)
Get the identifier (public key) of an ego.
Definition: identity_api.c:573
void(* GNUNET_IDENTITY_Callback)(void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *name)
Method called to inform about the egos of this peer.
ssize_t GNUNET_IDENTITY_read_signature_from_buffer(struct GNUNET_IDENTITY_Signature *sig, const void *buffer, size_t len)
Reads a GNUNET_IDENTITY_Signature from a compact buffer.
Definition: identity_api.c:988
enum GNUNET_GenericReturnValue GNUNET_IDENTITY_sign_raw_(const struct GNUNET_IDENTITY_PrivateKey *priv, const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, unsigned char *sig)
Sign a given block.
ssize_t GNUNET_IDENTITY_private_key_get_length(const struct GNUNET_IDENTITY_PrivateKey *key)
Get the compacted length of a GNUNET_IDENTITY_PrivateKey.
Definition: identity_api.c:809
char * GNUNET_IDENTITY_public_key_to_string(const struct GNUNET_IDENTITY_PublicKey *key)
Creates a (Base32) string representation of the public key.
enum GNUNET_GenericReturnValue GNUNET_IDENTITY_signature_verify_raw_(uint32_t purpose, const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, const unsigned char *sig, const struct GNUNET_IDENTITY_PublicKey *pub)
Verify a given signature.
enum GNUNET_GenericReturnValue GNUNET_IDENTITY_read_public_key_from_buffer(const void *buffer, size_t len, struct GNUNET_IDENTITY_PublicKey *key, size_t *kb_read)
Reads a GNUNET_IDENTITY_PublicKey from a compact buffer.
Definition: identity_api.c:865
ssize_t GNUNET_IDENTITY_signature_get_raw_length_by_type(uint32_t type)
Get the compacted length of a signature by type.
Definition: identity_api.c:970
enum GNUNET_GenericReturnValue GNUNET_IDENTITY_read_private_key_from_buffer(const void *buffer, size_t len, struct GNUNET_IDENTITY_PrivateKey *key, size_t *kb_read)
Reads a GNUNET_IDENTITY_PrivateKey from a compact buffer.
Definition: identity_api.c:908
void GNUNET_IDENTITY_cancel(struct GNUNET_IDENTITY_Operation *op)
Cancel an identity operation.
Definition: identity_api.c:740
struct GNUNET_IDENTITY_Handle * GNUNET_IDENTITY_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_IDENTITY_Callback cb, void *cb_cls)
Connect to the identity service.
Definition: identity_api.c:531
void GNUNET_IDENTITY_disconnect(struct GNUNET_IDENTITY_Handle *h)
Disconnect from identity service.
Definition: identity_api.c:757
struct GNUNET_IDENTITY_Ego * GNUNET_IDENTITY_ego_get_anonymous()
Obtain the ego representing 'anonymous' users.
Definition: identity_api.c:157
struct GNUNET_IDENTITY_Operation * GNUNET_IDENTITY_delete(struct GNUNET_IDENTITY_Handle *h, const char *name, GNUNET_IDENTITY_Continuation cb, void *cb_cls)
Delete an existing identity.
Definition: identity_api.c:699
void(* GNUNET_IDENTITY_Continuation)(void *cls, enum GNUNET_ErrorCode ec)
Function called once the requested operation has been completed.
ssize_t GNUNET_IDENTITY_signature_get_length(const struct GNUNET_IDENTITY_Signature *sig)
Get the compacted length of a GNUNET_IDENTITY_Signature.
Definition: identity_api.c:951
@ GNUNET_IDENTITY_TYPE_ECDSA
The identity type.
@ GNUNET_IDENTITY_TYPE_EDDSA
EDDSA identity.
#define GNUNET_log(kind,...)
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
GNUNET_GenericReturnValue
Named constants for return values.
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_NO
@ GNUNET_SYSERR
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
GNUNET_MQ_Error
Error codes for the queue.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:304
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct.
Definition: gnunet_mq_lib.h:62
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:77
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
Definition: mq.c:683
#define GNUNET_MESSAGE_TYPE_IDENTITY_CREATE
Create new identity (client->service).
#define GNUNET_MESSAGE_TYPE_IDENTITY_START
First message send from identity client to service (to subscribe to updates).
#define GNUNET_MESSAGE_TYPE_IDENTITY_DELETE
Delete identity (client->service).
#define GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE
Generic response from identity service with success and/or error message.
#define GNUNET_MESSAGE_TYPE_IDENTITY_RENAME
Rename existing identity (client->service).
#define GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE
Update about identity status from service to clients.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:944
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1241
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:763
enum GNUNET_GenericReturnValue GNUNET_STRINGS_string_to_data(const char *enc, size_t enclen, void *out, size_t out_size)
Convert CrockfordBase32 encoding back to data.
Definition: strings.c:788
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
Definition: strings.c:569
#define GNUNET_TIME_STD_BACKOFF(r)
Perform our standard exponential back-off calculation, starting at 1 ms and then going by a factor of...
Common type definitions for the identity service and API.
ssize_t GNUNET_IDENTITY_private_key_length_by_type(enum GNUNET_IDENTITY_KeyType kt)
Definition: identity_api.c:847
static void handle_identity_result_code(void *cls, const struct ResultCodeMessage *rcm)
We received a result code from the service.
Definition: identity_api.c:335
static int check_identity_update(void *cls, const struct UpdateMessage *um)
Check validity of identity update message.
Definition: identity_api.c:368
static void mq_error_handler(void *cls, enum GNUNET_MQ_Error error)
Generic error handler, called with the appropriate error code and the same closure specified at the c...
Definition: identity_api.c:319
static void reconnect(void *cls)
Try again to connect to the identity service.
Definition: identity_api.c:484
static void handle_identity_update(void *cls, const struct UpdateMessage *um)
Handle identity update message.
Definition: identity_api.c:392
static int free_ego(void *cls, const struct GNUNET_HashCode *key, void *value)
Free ego from hash map.
Definition: identity_api.c:241
#define LOG(kind,...)
Definition: identity_api.c:34
static void reschedule_connect(struct GNUNET_IDENTITY_Handle *h)
Reschedule a connect attempt to the service.
Definition: identity_api.c:268
static enum GNUNET_GenericReturnValue check_key_type(uint32_t type)
Definition: identity_api.c:794
static enum GNUNET_GenericReturnValue private_key_create(enum GNUNET_IDENTITY_KeyType ktype, struct GNUNET_IDENTITY_PrivateKey *key)
Definition: identity_api.c:203
static unsigned int size
Size of the "table".
Definition: peer.c:68
const char * name
Client requests creation of an identity.
Definition: identity.h:151
uint16_t name_len
Number of bytes in identity name string including 0-termination, in NBO.
Definition: identity.h:160
uint16_t key_len
Key length.
Definition: identity.h:165
Client requests deletion of an identity.
Definition: identity.h:204
uint16_t name_len
Number of characters in the name including 0-termination, in NBO.
Definition: identity.h:213
uint16_t reserved
Always zero.
Definition: identity.h:218
struct GNUNET_MQ_Handle * mq
Our connection to the ARM service.
Definition: arm_api.c:107
const struct GNUNET_CONFIGURATION_Handle * cfg
The configuration that we are using.
Definition: arm_api.c:112
struct GNUNET_SCHEDULER_Task * reconnect_task
ID of the reconnect task (if any).
Definition: arm_api.c:147
struct GNUNET_ARM_Handle * h
ARM handle.
Definition: arm_api.c:55
Internal representation of the hash map.
header of what an ECC signature signs this must be followed by "size - 8" bytes of the actual signed ...
Private ECC key encoded for transmission.
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and encr...
Private ECC key encoded for transmission.
an ECC signature using ECDSA
an ECC signature using EdDSA.
A 512-bit hashcode.
Handle for an ego.
Definition: identity.h:37
void * ctx
Client context associated with this ego.
Definition: identity.h:61
bool pub_initialized
Set to true once pub was initialized.
Definition: identity.h:66
char * name
Current name associated with this ego.
Definition: identity.h:56
struct GNUNET_IDENTITY_PrivateKey pk
The identity key pair.
Definition: identity.h:51
struct GNUNET_IDENTITY_PublicKey pub
The identity key pair.
Definition: identity.h:46
struct GNUNET_HashCode id
Hash of the private key of this ego.
Definition: identity.h:41
Handle for the service.
Definition: identity_api.c:97
struct GNUNET_MQ_Handle * mq
Connection to service.
Definition: identity_api.c:106
struct GNUNET_IDENTITY_Operation * op_head
Head of active operations.
Definition: identity_api.c:127
GNUNET_IDENTITY_Callback cb
Function to call when we receive updates.
Definition: identity_api.c:117
struct GNUNET_IDENTITY_Operation * op_tail
Tail of active operations.
Definition: identity_api.c:132
struct GNUNET_CONTAINER_MultiHashMap * egos
Hash map from the hash of the private key to the respective GNUNET_IDENTITY_Ego handle.
Definition: identity_api.c:112
struct GNUNET_SCHEDULER_Task * reconnect_task
Task doing exponential back-off trying to reconnect.
Definition: identity_api.c:137
int in_receive
Are we polling for incoming messages right now?
Definition: identity_api.c:147
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration to use.
Definition: identity_api.c:101
void * cb_cls
Closure for cb.
Definition: identity_api.c:122
struct GNUNET_TIME_Relative reconnect_delay
Time for next connect retry.
Definition: identity_api.c:142
Handle for an operation with the identity service.
Definition: identity_api.c:41
struct GNUNET_IDENTITY_PrivateKey pk
Private key to return to create_cont, or NULL.
Definition: identity_api.c:78
GNUNET_IDENTITY_CreateContinuation create_cont
Continuation to invoke with the result of the transmission; cb and cb will be NULL in this case.
Definition: identity_api.c:73
GNUNET_IDENTITY_Continuation cont
Continuation to invoke with the result of the transmission; cb and create_cont will be NULL in this c...
Definition: identity_api.c:67
struct GNUNET_IDENTITY_Operation * prev
We keep operations in a DLL.
Definition: identity_api.c:55
struct GNUNET_IDENTITY_Operation * next
We keep operations in a DLL.
Definition: identity_api.c:50
struct GNUNET_IDENTITY_Handle * h
Main identity handle.
Definition: identity_api.c:45
void * cls
Closure for cont or cb.
Definition: identity_api.c:89
const struct GNUNET_MessageHeader * msg
Message to send to the identity service.
Definition: identity_api.c:61
GNUNET_IDENTITY_Callback cb
Continuation to invoke with the result of the transmission for 'get' operations (cont and create_cont...
Definition: identity_api.c:84
A private key for an identity as per LSD0001.
uint32_t type
Type of public key.
struct GNUNET_CRYPTO_EcdsaPrivateKey ecdsa_key
An ECDSA identity key.
struct GNUNET_CRYPTO_EddsaPrivateKey eddsa_key
AN EdDSA identtiy key.
An identity key as per LSD0001.
uint32_t type
Type of public key.
An identity signature as per LSD0001.
struct GNUNET_CRYPTO_EddsaSignature eddsa_signature
AN EdDSA signature.
struct GNUNET_CRYPTO_EcdsaSignature ecdsa_signature
An ECDSA signature.
uint32_t type
Type of signature.
Handle to a message queue.
Definition: mq.c:87
Message handler for a specific message type.
Header for all communications.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.
Entry in list of pending tasks.
Definition: scheduler.c:136
Time for relative time used by GNUnet, in microseconds.
Client requests renaming of an identity.
Definition: identity.h:178
uint16_t old_name_len
Number of characters in the old name including 0-termination, in NBO.
Definition: identity.h:187
uint16_t new_name_len
Number of characters in the new name including 0-termination, in NBO.
Definition: identity.h:192
Answer from service to client about last operation; GET_DEFAULT maybe answered with this message on f...
Definition: identity.h:81
uint32_t result_code
Status code for the last operation, in NBO.
Definition: identity.h:91
Service informs client about status of a pseudonym.
Definition: identity.h:114
uint16_t end_of_list
Usually GNUNET_NO, GNUNET_YES to signal end of list.
Definition: identity.h:129
uint16_t key_len
Key length.
Definition: identity.h:134
uint16_t name_len
Number of bytes in ego name string including 0-termination, in NBO; 0 if the ego was deleted.
Definition: identity.h:124
struct GNUNET_MessageHeader header
Type: GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE.
Definition: identity.h:118
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model