Blob Blame History Raw
diff -Naur claws-mail-3.16.0-orig/configure claws-mail-3.16.0/configure
--- claws-mail-3.16.0-orig/configure	2017-12-17 12:49:41.000000000 +0100
+++ claws-mail-3.16.0/configure	2018-03-12 22:01:23.786031893 +0100
@@ -18648,135 +18648,6 @@
 
 fi
 
-OLDLIBS=$LIBS
-LIBS=
-case $host_os in
-	*dragonfly*)
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing encrypt" >&5
-$as_echo_n "checking for library containing encrypt... " >&6; }
-if ${ac_cv_search_encrypt+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char encrypt ();
-int
-main ()
-{
-return encrypt ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' cipher; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_encrypt=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_encrypt+:} false; then :
-  break
-fi
-done
-if ${ac_cv_search_encrypt+:} false; then :
-
-else
-  ac_cv_search_encrypt=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_encrypt" >&5
-$as_echo "$ac_cv_search_encrypt" >&6; }
-ac_res=$ac_cv_search_encrypt
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-else
-  as_fn_error $? "'encrypt'-function not found." "$LINENO" 5
-fi
-
-	;;
-	freebsd*)
-	;; # not used
-	*)
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing encrypt" >&5
-$as_echo_n "checking for library containing encrypt... " >&6; }
-if ${ac_cv_search_encrypt+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char encrypt ();
-int
-main ()
-{
-return encrypt ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' crypt; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_encrypt=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_encrypt+:} false; then :
-  break
-fi
-done
-if ${ac_cv_search_encrypt+:} false; then :
-
-else
-  ac_cv_search_encrypt=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_encrypt" >&5
-$as_echo "$ac_cv_search_encrypt" >&6; }
-ac_res=$ac_cv_search_encrypt
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-else
-  as_fn_error $? "'encrypt'-function not found." "$LINENO" 5
-fi
-
-	;;
-esac
-CRYPT_LIBS=$LIBS
-
-LIBS=$OLDLIBS
 
 
 # Check whether --with-passcrypt-key was given.
diff -Naur claws-mail-3.16.0-orig/configure.ac claws-mail-3.16.0/configure.ac
--- claws-mail-3.16.0-orig/configure.ac	2017-12-17 12:49:16.000000000 +0100
+++ claws-mail-3.16.0/configure.ac	2018-03-12 22:01:23.786031893 +0100
@@ -493,23 +493,6 @@
         AC_SUBST(GNUTLS_CFLAGS)
 fi
 
-dnl password encryption
-OLDLIBS=$LIBS
-LIBS=
-case $host_os in
-	*dragonfly*)
-		AC_SEARCH_LIBS(encrypt, cipher, [], AC_MSG_ERROR(['encrypt'-function not found.]))
-	;;
-	freebsd*)
-	;; # not used
-	*)
-		AC_SEARCH_LIBS(encrypt, crypt, [], AC_MSG_ERROR(['encrypt'-function not found.]))
-	;;
-esac
-CRYPT_LIBS=$LIBS
-AC_SUBST(CRYPT_LIBS)
-LIBS=$OLDLIBS
-
 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)
diff -Naur claws-mail-3.16.0-orig/src/common/passcrypt.c claws-mail-3.16.0/src/common/passcrypt.c
--- claws-mail-3.16.0-orig/src/common/passcrypt.c	2017-12-17 12:48:41.000000000 +0100
+++ claws-mail-3.16.0/src/common/passcrypt.c	2018-03-12 22:01:03.307488363 +0100
@@ -29,6 +29,7 @@
 #include <ctype.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <nettle/des.h>
 
 #if defined (__FreeBSD__)
 #include <rpc/des_crypt.h>
@@ -82,11 +83,10 @@
 crypt_cfb_buf(const char key[8], unsigned char *buf, unsigned len,
 	      unsigned chunksize, int decrypt)
 {
+	struct des_ctx ctx;
 	unsigned char temp[64];
 
-	memcpy(temp, key, 8);
-	crypt_unpack(temp);
-	setkey((const char *) temp);
+	des_set_key(&ctx,(const uint8_t*) key);
 	memset(temp, 0, sizeof(temp));
 
 	memset(crypt_cfb_iv, 0, sizeof(crypt_cfb_iv));
@@ -96,7 +96,14 @@
 
 	while (len) {
 		memcpy(temp, crypt_cfb_iv, sizeof(temp));
-		encrypt((char *) temp, 0);
+		/* 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)
diff -Naur claws-mail-3.16.0-orig/src/Makefile.am claws-mail-3.16.0/src/Makefile.am
--- claws-mail-3.16.0-orig/src/Makefile.am	2017-12-17 12:48:40.000000000 +0100
+++ claws-mail-3.16.0/src/Makefile.am	2018-03-12 22:02:18.112822043 +0100
@@ -595,7 +595,7 @@
 	$(INTLLIBS) \
 	$(GTK_LIBS) \
 	$(LDAP_LIBS) \
-	$(GNUTLS_LIBS) \
+	$(GNUTLS_LIBS) -lnettle \
 	$(COMPFACE_LIBS) \
 	$(JPILOT_LIBS) \
 	$(PTHREAD_LIBS) \
diff -Naur claws-mail-3.16.0-orig/src/Makefile.in claws-mail-3.16.0/src/Makefile.in
--- claws-mail-3.16.0-orig/src/Makefile.in	2017-12-17 12:49:38.000000000 +0100
+++ claws-mail-3.16.0/src/Makefile.in	2018-03-12 22:01:28.801920068 +0100
@@ -475,7 +475,7 @@
 LIBINTL = @LIBINTL@
 LIBOBJS = @LIBOBJS@
 LIBRESOLV = @LIBRESOLV@
-LIBS = @LIBS@
+LIBS = @LIBS@ -lnettle
 LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@
 LIBSOUP_GNOME_CFLAGS = @LIBSOUP_GNOME_CFLAGS@
 LIBSOUP_GNOME_LIBS = @LIBSOUP_GNOME_LIBS@