From: Martin Schanzenbach Date: Mon, 18 May 2020 06:52:32 +0000 (+0200) Subject: fix api for lazy pubkey loading X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=3be730446ba439170a67798dca8c634625c82cea;p=oweals%2Fgnunet.git fix api for lazy pubkey loading --- 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, return; } ego = GNUNET_new (struct GNUNET_IDENTITY_Ego); + ego->pub_initialized = GNUNET_NO; ego->pk = um->private_key; ego->name = GNUNET_strdup (str); ego->id = id; @@ -607,11 +608,11 @@ void GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego, struct GNUNET_CRYPTO_EcdsaPublicKey *pk) { - if (! ego->pub_initialized) + if (GNUNET_NO == ego->pub_initialized) { GNUNET_CRYPTO_ecdsa_key_get_public (&ego->pk, &ego->pub); - ego->pub_initialized = true; + ego->pub_initialized = GNUNET_YES; } *pk = ego->pub; } 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) struct GNUNET_CRYPTO_EcdsaPublicKey pub; struct GNUNET_HashCode id; struct GNUNET_IDENTITY_Ego ego; + memset (&ego, 0, sizeof (ego)); GNUNET_break (GNUNET_YES != ntohs (um->end_of_list)); GNUNET_CRYPTO_ecdsa_key_get_public (&um->private_key, &pub);