X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilccore%2Fsilcpacket.c;h=d05c0bd104196fd37b6217ed7b9ef27d6cfc8b4e;hb=b3c198997d2adb79fb3c2e48cba9d0511badd9f0;hp=68cb566c884fe99a6e3857416d97698ce84eff02;hpb=044263b77b2a2bf97011e7d100dd5ccccf8ca873;p=silc.git diff --git a/lib/silccore/silcpacket.c b/lib/silccore/silcpacket.c index 68cb566c..d05c0bd1 100644 --- a/lib/silccore/silcpacket.c +++ b/lib/silccore/silcpacket.c @@ -187,7 +187,8 @@ void silc_packet_assemble(SilcPacketContext *ctx, SilcCipher cipher) /* Get random padding */ #if 1 - for (i = 0; i < ctx->padlen; i++) tmppad[i] = silc_rng_global_get_byte(); + for (i = 0; i < ctx->padlen; i++) tmppad[i] = + silc_rng_global_get_byte_fast(); #else /* XXX: For testing - to be removed */ memset(tmppad, 65, sizeof(tmppad)); @@ -402,8 +403,16 @@ void silc_packet_receive_process(SilcSocketConnection sock, /* Decrypt rest of the packet */ if (cipher) - silc_packet_decrypt(cipher, hmac, parse_ctx->packet->sequence, - parse_ctx->packet->buffer, parse_ctx->normal); + if (silc_packet_decrypt(cipher, hmac, parse_ctx->packet->sequence, + parse_ctx->packet->buffer, + parse_ctx->normal) == -1) { + SILC_LOG_WARNING(("Packet decryption failed %s:%d [%s]", + sock->hostname, sock->port, + (sock->type == SILC_SOCKET_TYPE_UNKNOWN ? "Unknown" : + sock->type == SILC_SOCKET_TYPE_CLIENT ? "Client" : + sock->type == SILC_SOCKET_TYPE_SERVER ? "Server" : + "Router"))); + } /* Pull the packet from inbuf thus we'll get the next one in the inbuf. */ @@ -445,9 +454,6 @@ static int silc_packet_check_mac(SilcHmac hmac, SilcBuffer buffer, /* Compare the HMAC's (buffer->tail has the packet's HMAC) */ if (memcmp(mac, buffer->tail, mac_len)) { SILC_LOG_ERROR(("MAC failed")); - - /* XXX Remove */ - assert(FALSE); return FALSE; }