From: Jochen Eisinger Date: Sat, 7 Dec 2002 08:55:30 +0000 (+0000) Subject: verify_message_signature returned FAILED when the public key was not locally X-Git-Tag: silc.client.0.9.10.2~5 X-Git-Url: http://git.silcnet.org/gitweb/?a=commitdiff_plain;h=7c5f7e01e35ee10368adb603a24fb3dae7c5ddf2;p=silc.git verify_message_signature returned FAILED when the public key was not locally available... fixed this. --- diff --git a/apps/irssi/src/silc/core/client_ops.c b/apps/irssi/src/silc/core/client_ops.c index ca5326bd..6ab51dc2 100644 --- a/apps/irssi/src/silc/core/client_ops.c +++ b/apps/irssi/src/silc/core/client_ops.c @@ -209,7 +209,7 @@ int verify_message_signature(SilcClientEntry sender, /* we don't have the public key cached ... use the one from the sig */ ret = SILC_MSG_SIGNED_UNKNOWN; else { - SilcPublicKey cached_pk; + SilcPublicKey cached_pk=NULL; /* try to load the file */ if (!silc_pkcs_load_public_key(filename, &cached_pk, SILC_PKCS_FILE_PEM) && @@ -223,14 +223,16 @@ int verify_message_signature(SilcClientEntry sender, ret = SILC_MSG_SIGNED_UNKNOWN; } - if (pk) - silc_pkcs_public_key_free(pk); - pk = cached_pk; + if (cached_pk) { + if (pk) + silc_pkcs_public_key_free(pk); + pk = cached_pk; + } } /* the public key is now in pk, our "level of trust" in ret */ - if (silc_message_signed_verify(sig, message, pk, silc_client->sha1hash) - != SILC_AUTH_OK) + if ((pk) && silc_message_signed_verify(sig, message, pk, + silc_client->sha1hash)!= SILC_AUTH_OK) ret = SILC_MSG_SIGNED_FAILED; if (pk)