Protocol version 1.2 integrations
[silc.git] / lib / silccore / silcpacket.c
index c6cba515af1b558f8ad96060113a9c574fd56b5b..fe76866208d8dc32890bca3bee5092cc69c94e71 100644 (file)
@@ -141,9 +141,10 @@ bool silc_packet_assemble(SilcPacketContext *packet, SilcRng rng,
   /* Calculate the length of the padding. The padding is calculated from
      the data that will be encrypted. */
   if (!packet->padlen) {
-    packet->padlen = (packet->long_pad ?
-                     SILC_PACKET_PADLEN_MAX(packet->truelen) :
-                     SILC_PACKET_PADLEN(packet->truelen, block_len));
+    if (packet->long_pad)
+      SILC_PACKET_PADLEN_MAX(packet->truelen, block_len, packet->padlen);
+    else
+      SILC_PACKET_PADLEN(packet->truelen, block_len, packet->padlen);
   }
 
   /* Now prepare the outgoing data buffer for packet sending and start