[epiphany/wip/sync: 50/52] sync-crypto: Pad even if the input is multiple of the block size



commit c5fadbade7ac0de80dec6b13cfbdc92060a9b069
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date:   Tue Jun 27 16:34:51 2017 +0300

    sync-crypto: Pad even if the input is multiple of the block size

 lib/sync/ephy-sync-crypto.c |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)
---
diff --git a/lib/sync/ephy-sync-crypto.c b/lib/sync/ephy-sync-crypto.c
index 7ea7ebe..c5d6ddb 100644
--- a/lib/sync/ephy-sync-crypto.c
+++ b/lib/sync/ephy-sync-crypto.c
@@ -970,16 +970,9 @@ ephy_sync_crypto_pad (const char *text,
   g_assert (text);
   g_assert (out_len);
 
-  if (text_len % block_len == 0)
-    *out_len = text_len;
-  else
-    *out_len = text_len + block_len - text_len % block_len;
-
+  *out_len = text_len + block_len - text_len % block_len;
   out = g_malloc (*out_len);
-
-  if (text_len % block_len != 0)
-    memset (out, block_len - text_len % block_len, *out_len);
-
+  memset (out, block_len - text_len % block_len, *out_len);
   memcpy (out, text, text_len);
 
   return out;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]