0.9.4claws42
[claws.git] / src / common / passcrypt.c
index 74a8f068d4de4eeca16554a2d0075deea4850e32..3d37cfe1b3b1c9d46ca537e8adda9dbb3c630779 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+#define _XOPEN_SOURCE
+
 #include <sys/types.h>
 #include <stdio.h>
 #include <memory.h>
 #include <ctype.h>
+#include <stdlib.h>
 #include <unistd.h>
-#include "crypt.h"
 
 #include <glib.h>
 
 #include "passcrypt.h"
 
-void crypt_cfb_buf(const char key[8], void *buf, unsigned len,
+void crypt_cfb_buf(const char key[8], unsigned char *buf, unsigned len,
                   unsigned chunksize, int decrypt);
 static void crypt_cfb_shift(unsigned char *to,
                            const unsigned char *from, unsigned len);
@@ -53,7 +55,7 @@ unsigned char crypt_cfb_iv[64];
 int crypt_cfb_blocksize = 8;   /* 8 for DES */
 
 void
-crypt_cfb_buf(const char key[8], void *buf, unsigned len,
+crypt_cfb_buf(const char key[8], unsigned char *buf, unsigned len,
              unsigned chunksize, int decrypt)
 {
        unsigned char temp[64];
@@ -74,12 +76,10 @@ crypt_cfb_buf(const char key[8], void *buf, unsigned len,
                if (chunksize > len)
                        chunksize = len;
                if (decrypt)
-                       crypt_cfb_shift(crypt_cfb_iv,
-                                       (unsigned char *) buf, chunksize);
+                       crypt_cfb_shift(crypt_cfb_iv, buf, chunksize);
                crypt_cfb_xor((unsigned char *) buf, temp, chunksize);
                if (!decrypt)
-                       crypt_cfb_shift(crypt_cfb_iv,
-                                       (unsigned char *) buf, chunksize);
+                       crypt_cfb_shift(crypt_cfb_iv, buf, chunksize);
                len -= chunksize;
                buf += chunksize;
        }