SilcBuffer buffer;
SilcBool ret;
- if (!client || !conn || !client_entry)
+ if (silc_unlikely(!client || !conn || !client_entry))
return FALSE;
- if (flags & SILC_MESSAGE_FLAG_SIGNED && !hash)
+ if (silc_unlikely(flags & SILC_MESSAGE_FLAG_SIGNED && !hash))
return FALSE;
- if (conn->internal->disconnected)
+ if (silc_unlikely(conn->internal->disconnected))
return FALSE;
SILC_LOG_DEBUG(("Sending private message"));
client_entry->internal.hmac_send,
client->rng, NULL, conn->private_key,
hash, NULL);
- if (!buffer) {
+ if (silc_unlikely(!buffer)) {
SILC_LOG_ERROR(("Error encoding private message"));
return FALSE;
}
SILC_LOG_DEBUG(("Received private message"));
- if (packet->src_id_type != SILC_ID_CLIENT) {
+ if (silc_unlikely(packet->src_id_type != SILC_ID_CLIENT)) {
/** Invalid packet */
silc_fsm_next(fsm, silc_client_private_message_error);
return SILC_FSM_CONTINUE;
}
- if (!silc_id_str2id(packet->src_id, packet->src_id_len, SILC_ID_CLIENT,
- &remote_id, sizeof(remote_id))) {
+ if (silc_unlikely(!silc_id_str2id(packet->src_id, packet->src_id_len,
+ SILC_ID_CLIENT, &remote_id,
+ sizeof(remote_id)))) {
/** Invalid source ID */
silc_fsm_next(fsm, silc_client_private_message_error);
return SILC_FSM_CONTINUE;
/* NOT REACHED */
}
- if (packet->flags & SILC_PACKET_FLAG_PRIVMSG_KEY &&
- !remote_client->internal.receive_key &&
- !remote_client->internal.hmac_receive)
+ if (silc_unlikely(packet->flags & SILC_PACKET_FLAG_PRIVMSG_KEY &&
+ !remote_client->internal.receive_key &&
+ !remote_client->internal.hmac_receive))
goto out;
/* Parse the payload and decrypt it also if private message key is set */
remote_client->internal.receive_key,
remote_client->internal.hmac_receive,
NULL, FALSE, NULL);
- if (!payload)
+ if (silc_unlikely(!payload))
goto out;
#if 0 /* We need to rethink this. This doesn't work with multiple
if (client_entry->internal.prv_resp) {
silc_cipher_set_key(client_entry->internal.send_key,
keymat->receive_enc_key,
- keymat->enc_key_len);
+ keymat->enc_key_len, TRUE);
silc_cipher_set_iv(client_entry->internal.send_key,
keymat->receive_iv);
silc_cipher_set_key(client_entry->internal.receive_key,
keymat->send_enc_key,
- keymat->enc_key_len);
+ keymat->enc_key_len, FALSE);
silc_cipher_set_iv(client_entry->internal.receive_key, keymat->send_iv);
silc_hmac_set_key(client_entry->internal.hmac_send,
keymat->receive_hmac_key,
} else {
silc_cipher_set_key(client_entry->internal.send_key,
keymat->send_enc_key,
- keymat->enc_key_len);
+ keymat->enc_key_len, TRUE);
silc_cipher_set_iv(client_entry->internal.send_key,
keymat->send_iv);
silc_cipher_set_key(client_entry->internal.receive_key,
keymat->receive_enc_key,
- keymat->enc_key_len);
+ keymat->enc_key_len, FALSE);
silc_cipher_set_iv(client_entry->internal.receive_key, keymat->receive_iv);
silc_hmac_set_key(client_entry->internal.hmac_send,
keymat->send_hmac_key,