updates.
[silc.git] / lib / silccore / silcprivate.c
index c828a8f77facb87c5608fd4643b14710d2a0cf3f..60534f6be8735c332d7ca31d4bb943be5914dd4b 100644 (file)
@@ -29,6 +29,8 @@
 
 ******************************************************************************/
 
+#define SILC_PRIVATE_MESSAGE_PAD(__payloadlen) (16 - (__payloadlen) % 16)
+
 /* Private Message Payload structure. Contents of this structure is parsed
    from SILC packets. */
 struct SilcPrivateMessagePayloadStruct {
@@ -62,12 +64,12 @@ silc_private_message_payload_parse(SilcBuffer buffer, SilcCipher cipher)
                                                         &new->message_len),
                             SILC_STR_END);
   if (ret == -1) {
-    SILC_LOG_ERROR(("Incorrect private message payload"));
+    SILC_LOG_DEBUG(("Incorrect private message payload"));
     goto err;
   }
 
   if ((new->message_len < 1 || new->message_len > buffer->len)) {
-    SILC_LOG_ERROR(("Incorrect private message payload in packet, "
+    SILC_LOG_DEBUG(("Incorrect private message payload in packet, "
                    "packet dropped"));
     goto err;
   }
@@ -91,7 +93,7 @@ SilcBuffer silc_private_message_payload_encode(uint16 flags,
   int i;
   SilcBuffer buffer;
   uint32 len, pad_len = 0;
-  unsigned char pad[SILC_PACKET_MAX_PADLEN];
+  unsigned char pad[16];
 
   SILC_LOG_DEBUG(("Encoding private message payload"));
 
@@ -99,7 +101,7 @@ SilcBuffer silc_private_message_payload_encode(uint16 flags,
 
   if (cipher) {
     /* Calculate length of padding. */
-    pad_len = SILC_PACKET_PADLEN((len + 2));
+    pad_len = SILC_PRIVATE_MESSAGE_PAD(len);
     len += pad_len;
 
     /* Generate padding */