cannot be used. */
void silc_packet_encrypt(SilcCipher cipher, SilcHmac hmac,
- SilcBuffer buffer, unsigned int len)
+ SilcBuffer buffer, uint32 len)
{
unsigned char mac[32];
- unsigned int mac_len;
+ uint32 mac_len;
/* Compute HMAC. This assumes that HMAC is created from the entire
data area thus this uses the length found in buffer, not the length
outgoing buffer in SilcSocketConnection object. */
void silc_packet_send_prepare(SilcSocketConnection sock,
- unsigned int header_len,
- unsigned int padlen,
- unsigned int data_len)
+ uint32 header_len,
+ uint32 padlen,
+ uint32 data_len)
{
int totlen, oldlen;
SILC_LOG_DEBUG(("Could not read immediately, will do it later"));
return -2;
}
- SILC_LOG_ERROR(("Cannot read from socket: %d", strerror(errno)));
+ SILC_LOG_ERROR(("Cannot read from socket: %d:%s", sock, strerror(errno)));
return -1;
}
if (packetlen < SILC_PACKET_MIN_LEN) {
SILC_LOG_DEBUG(("Received invalid packet, dropped"));
+ silc_buffer_clear(sock->inbuf);
return;
}
silc_buffer_pull(sock->inbuf, mac_len);
}
+ SILC_LOG_DEBUG(("Clearing inbound buffer"));
silc_buffer_clear(sock->inbuf);
}
/* Check MAC */
if (hmac) {
unsigned char mac[32];
- unsigned int mac_len;
+ uint32 mac_len;
SILC_LOG_DEBUG(("Verifying MAC"));
{
/* Decrypt rest of the header plus padding */
if (cipher) {
- unsigned short truelen, len1, len2, padlen;
+ uint16 truelen, len1, len2, padlen;
/* Pull MAC from packet before decryption */
if (hmac) {