commit - d2754705178a0be211c1185d8b659cd903b20a91
commit + 425dbb6554835694af498b06491634c96b73f3ab
blob - 388ecc0b128e692966ddd338a6022a414671242a
blob + 08e81c7ec7cd417867a39d64a9e34a0ba8f0ea3f
--- .gitignore
+++ .gitignore
/.settings
/src/claws-mail
/src/client-bindings.h
-/src/common/passcrypt.h
/src/common/version.h
/src/gtk/claws-marshal.c
/src/gtk/claws-marshal.h
blob - aac7779482d82550a77a18f34c221b4fa9e15da7
blob + 2fb77e64397a7d036031f65412159ac6cccc499b
--- configure.ac
+++ configure.ac
AC_SUBST(GNUTLS_CFLAGS)
fi
-PKG_CHECK_MODULES(NETTLE, nettle)
-AC_SUBST(NETTLE_LIBS)
-AC_SUBST(NETTLE_CFLAGS)
-
-AC_ARG_WITH(passcrypt-key, [ --with-passcrypt-key=KEY Key used to encode passwords (8 byte string)],
- with_passcrypt_key="$withval", with_passcrypt_key="passkey0")
-AC_SUBST(PASSCRYPT_KEY, $with_passcrypt_key)
-
dnl RC dir (will be default at a certain point in time)
AC_ARG_WITH(config-dir, [ --with-config-dir=RCDIR Local configuration dir (default: .claws-mail)],
ac_cv_with_config_dir="$withval", ac_cv_with_config_dir="")
src/common/version.h
src/Makefile
src/common/Makefile
-src/common/passcrypt.h
src/common/tests/Makefile
src/gtk/Makefile
src/etpan/Makefile
blob - e19807437a19630f155a24cb6c33ef7716bb16a1
blob + e49db2ce2acdba3900517d41df344609bf1d194c
--- src/Makefile.am
+++ src/Makefile.am
$(INTLLIBS) \
$(GTK_LIBS) \
$(GNUTLS_LIBS) \
- $(NETTLE_LIBS) \
-lpthread \
$(LIBICONV) \
$(LIBETPAN_LIBS) \
$(IFLAGS) \
$(GTK_CFLAGS) \
$(GNUTLS_CFLAGS) \
- $(NETTLE_CFLAGS) \
- $(GPGME_CFLAGS) \
$(LIBETPAN_CPPFLAGS) \
$(VALGRIND_CFLAGS) \
-Ifence/zig-out/include
blob - 1c1d113f4740f01189134a7391f0b9fef6fd8e7b
blob + 50c6984173753743147a1588db8b926f53fcaa89
--- src/common/Makefile.am
+++ src/common/Makefile.am
hooks.c \
log.c \
mgutils.c \
- passcrypt.c \
prefs.c \
progressindicator.c \
quoted-printable.c \
hooks.h \
log.h \
mgutils.h \
- passcrypt.h \
prefs.h \
progressindicator.h \
quoted-printable.h \
blob - 5236fa5a94c3cb5aaab127edeef28bd1af25386a (mode 644)
blob + /dev/null
--- src/common/passcrypt.c
+++ /dev/null
-/*
- * Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "config.h"
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <memory.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <nettle/des.h>
-
-#if defined (__FreeBSD__)
-#include <rpc/des_crypt.h>
-#endif
-
-#include <glib.h>
-
-#include "passcrypt.h"
-
-static void crypt_cfb_buf(const char key[8], unsigned char *buf, unsigned len,
- unsigned chunksize, int decrypt);
-
-void passcrypt_encrypt(gchar *password, guint len)
-{
- crypt_cfb_buf(PASSCRYPT_KEY, password, len, 1, 0 );
-}
-
-void passcrypt_decrypt(gchar *password, guint len)
-{
- crypt_cfb_buf(PASSCRYPT_KEY, password, len, 1, 1 );
-}
-
-/*
-* crypt_cfb_iv is the intermediate vector used for cypher feedback encryption
-*/
-unsigned char crypt_cfb_iv[64];
-int crypt_cfb_blocksize = 8; /* 8 for DES */
-
-#if defined (__FreeBSD__)
-static void
-crypt_cfb_buf(const char key[8], unsigned char *buf, unsigned len,
- unsigned chunksize, int decrypt)
-{
- char des_key[8];
-
- memcpy(des_key, PASSCRYPT_KEY, 8);
- des_setparity(des_key);
- if (decrypt)
- ecb_crypt(des_key, buf, len, DES_DECRYPT);
- else
- ecb_crypt(des_key, buf, len, DES_ENCRYPT);
-}
-#else
-static void crypt_cfb_shift(unsigned char *to,
- const unsigned char *from, unsigned len);
-static void crypt_cfb_xor(unsigned char *to, const unsigned char *from,
- unsigned len);
-static void crypt_unpack(unsigned char *a);
-
-static void
-crypt_cfb_buf(const char key[8], unsigned char *buf, unsigned len,
- unsigned chunksize, int decrypt)
-{
- struct des_ctx ctx;
- unsigned char temp[64];
-
- des_set_key(&ctx,(const uint8_t*) key);
- memset(temp, 0, sizeof(temp));
-
- memset(crypt_cfb_iv, 0, sizeof(crypt_cfb_iv));
-
- if (chunksize > crypt_cfb_blocksize)
- chunksize = crypt_cfb_blocksize;
-
- while (len) {
- memcpy(temp, crypt_cfb_iv, sizeof(temp));
- /* simulate encrypt() via Nettle */
- char temp2[8];
- memset(temp2,0,sizeof(temp2));
- crypt_cfb_xor(temp2,temp,sizeof(temp)/sizeof(temp2));
- des_encrypt(&ctx,sizeof(temp2),(uint8_t*)temp2,(uint8_t*)temp2);
- memcpy(temp,temp2,sizeof(temp2));
- crypt_unpack(temp);
- /* */
- if (chunksize > len)
- chunksize = len;
- if (decrypt)
- crypt_cfb_shift(crypt_cfb_iv, buf, chunksize);
- crypt_cfb_xor((unsigned char *) buf, temp, chunksize);
- if (!decrypt)
- crypt_cfb_shift(crypt_cfb_iv, buf, chunksize);
- len -= chunksize;
- buf += chunksize;
- }
-}
-
-/*
-* Shift len bytes from end of to buffer to beginning, then put len
-* bytes from from at the end. Caution: the to buffer is unpacked,
-* but the from buffer is not.
-*/
-static void
-crypt_cfb_shift(unsigned char *to, const unsigned char *from, unsigned len)
-{
- unsigned i;
- unsigned j;
- unsigned k;
-
- if (len < crypt_cfb_blocksize) {
- i = len * 8;
- j = crypt_cfb_blocksize * 8;
- for (k = i; k < j; k++) {
- to[0] = to[i];
- ++to;
- }
- }
-
- for (i = 0; i < len; i++) {
- j = *from++;
- for (k = 0x80; k; k >>= 1)
- *to++ = ((j & k) != 0);
- }
-}
-
-/*
-* XOR len bytes from from into the data at to. Caution: the from buffer
-* is unpacked, but the to buffer is not.
-*/
-static void
-crypt_cfb_xor(unsigned char *to, const unsigned char *from, unsigned len)
-{
- unsigned i;
- unsigned j;
- unsigned char c;
-
- for (i = 0; i < len; i++) {
- c = 0;
- for (j = 0; j < 8; j++)
- c = (c << 1) | *from++;
- *to++ ^= c;
- }
-}
-
-/*
-* Take the 8-byte array at *a (must be able to hold 64 bytes!) and unpack
-* each bit into its own byte.
-*/
-static void crypt_unpack(unsigned char *a)
-{
- int i, j;
-
- for (i = 7; i >= 0; --i)
- for (j = 7; j >= 0; --j)
- a[(i << 3) + j] = (a[i] & (0x80 >> j)) != 0;
-}
-#endif
blob - 4118295aa61ba8cccc2e6b0fc96b57be8e0ff793 (mode 644)
blob + /dev/null
--- src/common/passcrypt.h.in
+++ /dev/null
-/*
- * Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2007 Hiroyuki Yamamoto and the Claws Mail Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#define PASSCRYPT_KEY "@PASSCRYPT_KEY@"
-
-#include <glib.h>
-
-void passcrypt_encrypt(gchar *password, guint len);
-void passcrypt_decrypt(gchar *password, guint len);
blob - 297db36d82b8cd688c5bbcad6cacb9a0769d7e78
blob + 196ca1caca4f0ca8710e2d10952880bca9eaac1d
--- src/oauth2.c
+++ src/oauth2.c
#include "utils.h"
#include "log.h"
#include "time.h"
-#include "common/passcrypt.h"
#include "common/version.h"
#include "file-utils.h"
#include "prefs_common.h"
blob - 72b4d919e2b44659661156a64033786478d9a634
blob + 1997328b8f1e513f468d9a24c34a7d32b4887c2c
--- src/password.c
+++ src/password.c
#include <fcntl.h>
#include <unistd.h>
-#include "common/passcrypt.h"
#include "common/pkcs5_pbkdf2.h"
#include "common/utils.h"
#include "account.h"
#undef BUFSIZE
+#define PASSCRYPT_KEY "passkey0"
+
gchar *password_encrypt(const gchar *password,
const gchar *encryption_passphrase)
{