aboutsummaryrefslogtreecommitdiff
path: root/src/identity/identity_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/identity/identity_api.c')
-rw-r--r--src/identity/identity_api.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c
index 2062ddc63..84ecb8765 100644
--- a/src/identity/identity_api.c
+++ b/src/identity/identity_api.c
@@ -175,6 +175,24 @@ struct GNUNET_IDENTITY_Handle
175}; 175};
176 176
177 177
178/**
179 * Obtain the ego representing 'anonymous' users.
180 */
181const struct GNUNET_IDENTITY_Ego *
182GNUNET_IDENTITY_ego_get_anonymous ()
183{
184 static struct GNUNET_IDENTITY_Ego anon;
185 struct GNUNET_CRYPTO_EccPublicKey pub;
186
187 if (NULL != anon.pk)
188 return &anon;
189 anon.pk = GNUNET_CRYPTO_ecc_key_get_anonymous ();
190 GNUNET_CRYPTO_ecc_key_get_public (anon.pk,
191 &pub);
192 GNUNET_CRYPTO_hash (&pub, sizeof (pub), &anon.id);
193 return &anon;
194}
195
178 196
179/** 197/**
180 * Try again to connect to network size estimation service. 198 * Try again to connect to network size estimation service.
@@ -566,7 +584,7 @@ GNUNET_IDENTITY_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
566 * @return associated ECC key, valid as long as the ego is valid 584 * @return associated ECC key, valid as long as the ego is valid
567 */ 585 */
568const struct GNUNET_CRYPTO_EccPrivateKey * 586const struct GNUNET_CRYPTO_EccPrivateKey *
569GNUNET_IDENTITY_ego_get_private_key (struct GNUNET_IDENTITY_Ego *ego) 587GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego)
570{ 588{
571 return ego->pk; 589 return ego->pk;
572} 590}
@@ -579,10 +597,11 @@ GNUNET_IDENTITY_ego_get_private_key (struct GNUNET_IDENTITY_Ego *ego)
579 * @param pk set to ego's public key 597 * @param pk set to ego's public key
580 */ 598 */
581void 599void
582GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego, 600GNUNET_IDENTITY_ego_get_public_key (const struct GNUNET_IDENTITY_Ego *ego,
583 struct GNUNET_CRYPTO_EccPublicKey *pk) 601 struct GNUNET_CRYPTO_EccPublicKey *pk)
584{ 602{
585 GNUNET_assert (0); 603 GNUNET_CRYPTO_ecc_key_get_public (ego->pk,
604 pk);
586} 605}
587 606
588 607