+Sat Nov 3 17:48:55 EET 2001 Pekka Riikonen <priikone@silcnet.org>
+
+ * Added silc_pkcs_public_key_compare to compare two
+ public keys. Affected file lib/silccrypt/silcpkcs.[ch].
+
+ * Check that the client who set the founder mode on the
+ channel is the same client that is giving the founder
+ mode to itself. It is done by comparing the saved public
+ key (it is saved even in the authentication is passphrase).
+ Affected file silcd/command.c.
+
Fri Nov 2 18:52:08 EST 2001 Pekka Riikonen <priikone@silcnet.org>
* Do not process packet for disconnected socket connection.
}
if (!(channel->mode & SILC_CHANNEL_MODE_FOUNDER_AUTH) ||
- !channel->founder_key) {
+ !channel->founder_key || !idata->public_key ||
+ !silc_pkcs_public_key_compare(channel->founder_key,
+ idata->public_key)) {
silc_server_command_send_status_reply(cmd, SILC_COMMAND_CUMODE,
SILC_STATUS_ERR_NOT_YOU);
goto out;
SILC_STATUS_ERR_NOT_ENOUGH_PARAMS);
goto out;
}
-
+
auth = (channel->founder_method == SILC_AUTH_PASSWORD ?
(void *)channel->founder_passwd : (void *)channel->founder_key);
auth_len = (channel->founder_method == SILC_AUTH_PASSWORD ?
return FALSE;
}
+/* Compares two public keys and returns TRUE if they are same key, and
+ FALSE if they are not same. */
+
+bool silc_pkcs_public_key_compare(SilcPublicKey key1, SilcPublicKey key2)
+{
+ if (key1 == key2)
+ return TRUE;
+
+ if (key1->len == key2->len &&
+ key1->name && key2->name && key1->identifier && key2->identifier &&
+ !strcmp(key1->name, key2->name) &&
+ !strcmp(key1->identifier, key2->identifier) &&
+ !memcmp(key1->pk, key2->pk, key1->pk_len) &&
+ key1->pk_len == key2->pk_len)
+ return TRUE;
+
+ return FALSE;
+}
+
/* Encodes SILC private key from SilcPrivateKey. Returns the encoded data. */
unsigned char *
uint32 *len);
int silc_pkcs_public_key_decode(unsigned char *data, uint32 data_len,
SilcPublicKey *public_key);
+bool silc_pkcs_public_key_compare(SilcPublicKey key1, SilcPublicKey key2);
unsigned char *
silc_pkcs_private_key_encode(SilcPrivateKey private_key, uint32 *len);
unsigned char *