aboutsummaryrefslogtreecommitdiff
path: root/src/identity
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2020-05-18 08:52:32 +0200
committerMartin Schanzenbach <mschanzenbach@posteo.de>2020-05-18 08:52:32 +0200
commit3be730446ba439170a67798dca8c634625c82cea (patch)
tree7507895cab33c0fedbaef6f265a1a41482ce8bb8 /src/identity
parentd89a4c1ee6f00924233c799e50777ea985d5b213 (diff)
downloadgnunet-3be730446ba439170a67798dca8c634625c82cea.tar.gz
gnunet-3be730446ba439170a67798dca8c634625c82cea.zip
fix api for lazy pubkey loading
Diffstat (limited to 'src/identity')
-rw-r--r--src/identity/identity_api.c5
-rw-r--r--src/identity/identity_api_lookup.c1
2 files changed, 4 insertions, 2 deletions
diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c
index 693d4392e..c2fcc5075 100644
--- a/src/identity/identity_api.c
+++ b/src/identity/identity_api.c
@@ -392,6 +392,7 @@ handle_identity_update (void *cls,
392 return; 392 return;
393 } 393 }
394 ego = GNUNET_new (struct GNUNET_IDENTITY_Ego); 394 ego = GNUNET_new (struct GNUNET_IDENTITY_Ego);
395 ego->pub_initialized = GNUNET_NO;
395 ego->pk = um->private_key; 396 ego->pk = um->private_key;
396 ego->name = GNUNET_strdup (str); 397 ego->name = GNUNET_strdup (str);
397 ego->id = id; 398 ego->id = id;
@@ -607,11 +608,11 @@ void
607GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego, 608GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego,
608 struct GNUNET_CRYPTO_EcdsaPublicKey *pk) 609 struct GNUNET_CRYPTO_EcdsaPublicKey *pk)
609{ 610{
610 if (! ego->pub_initialized) 611 if (GNUNET_NO == ego->pub_initialized)
611 { 612 {
612 GNUNET_CRYPTO_ecdsa_key_get_public (&ego->pk, 613 GNUNET_CRYPTO_ecdsa_key_get_public (&ego->pk,
613 &ego->pub); 614 &ego->pub);
614 ego->pub_initialized = true; 615 ego->pub_initialized = GNUNET_YES;
615 } 616 }
616 *pk = ego->pub; 617 *pk = ego->pub;
617} 618}
diff --git a/src/identity/identity_api_lookup.c b/src/identity/identity_api_lookup.c
index 6c61d3977..26b1eacd7 100644
--- a/src/identity/identity_api_lookup.c
+++ b/src/identity/identity_api_lookup.c
@@ -130,6 +130,7 @@ handle_identity_update (void *cls, const struct UpdateMessage *um)
130 struct GNUNET_CRYPTO_EcdsaPublicKey pub; 130 struct GNUNET_CRYPTO_EcdsaPublicKey pub;
131 struct GNUNET_HashCode id; 131 struct GNUNET_HashCode id;
132 struct GNUNET_IDENTITY_Ego ego; 132 struct GNUNET_IDENTITY_Ego ego;
133 memset (&ego, 0, sizeof (ego));
133 134
134 GNUNET_break (GNUNET_YES != ntohs (um->end_of_list)); 135 GNUNET_break (GNUNET_YES != ntohs (um->end_of_list));
135 GNUNET_CRYPTO_ecdsa_key_get_public (&um->private_key, &pub); 136 GNUNET_CRYPTO_ecdsa_key_get_public (&um->private_key, &pub);