SilcPacketContext packetdata;
SilcCipher cipher;
SilcHmac hmac;
+ int block_len;
SILC_LOG_DEBUG(("Sending private message"));
/* Get data used in the encryption */
cipher = client_entry->send_key;
hmac = conn->hmac_send;
+ block_len = silc_cipher_get_block_len(cipher);
/* Set the packet context pointers. */
packetdata.flags = SILC_PACKET_FLAG_PRIVMSG_KEY;
packetdata.src_id_len + packetdata.dst_id_len;
packetdata.padlen = SILC_PACKET_PADLEN((SILC_PACKET_HEADER_LEN +
packetdata.src_id_len +
- packetdata.dst_id_len));
+ packetdata.dst_id_len), block_len);
/* Prepare outgoing data buffer for packet sending */
silc_packet_send_prepare(sock,
silc_buffer_put(sock->outbuf, buffer->data, buffer->len);
/* Create the outgoing packet */
- silc_packet_assemble(&packetdata);
+ silc_packet_assemble(&packetdata, cipher);
/* Encrypt the header and padding of the packet. */
cipher = conn->send_key;
- silc_packet_encrypt(cipher, hmac, sock->outbuf, SILC_PACKET_HEADER_LEN +
+ silc_packet_encrypt(cipher, hmac, conn->psn_send++,
+ sock->outbuf, SILC_PACKET_HEADER_LEN +
packetdata.src_id_len + packetdata.dst_id_len +
packetdata.padlen);