1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-21 23:58:07 +00:00

Switch from libiconv to win-iconv

This commit is contained in:
Jens Steube 2017-04-19 12:58:25 +02:00
parent 79609e8a54
commit 086a07264a
4 changed files with 77 additions and 9 deletions

View File

@ -16,6 +16,11 @@
#include <sys/stat.h>
#include <sys/time.h>
#include <unistd.h>
#if defined (_WIN)
#define WINICONV_CONST
#endif
#include <iconv.h>
#if defined (_WIN)

View File

@ -108,14 +108,13 @@ CC_LINUX_64 := gcc
CC_WIN_32 := i686-w64-mingw32-gcc
CC_WIN_64 := x86_64-w64-mingw32-gcc
## To compile mingw iconv:
## To compile win-iconv with mingw clone from here: https://github.com/win-iconv/win-iconv
##
## ./configure --host=i686-w64-mingw32 --prefix=/opt/iconv-w32 --enable-static --disable-shared && make install
## ./configure --host=x86_64-w64-mingw32 --prefix=/opt/iconv-w64 --enable-static --disable-shared && make install
## Then patch the makefile withe the patches from tools/win-iconv-*.diff and run make install
##
ICONV_WIN_32 := /opt/iconv-w32
ICONV_WIN_64 := /opt/iconv-w64
WIN_ICONV_32 := /opt/win-iconv-32
WIN_ICONV_64 := /opt/win-iconv-64
##
## Misc stuff
@ -249,12 +248,12 @@ CFLAGS_CROSS_LINUX64 += -m64
CFLAGS_CROSS_LINUX64 += -DWITH_HWMON
CFLAGS_CROSS_WIN32 := $(CFLAGS)
CFLAGS_CROSS_WIN32 += -I$(OPENCL_HEADERS_KHRONOS)/
CFLAGS_CROSS_WIN32 += -I$(ICONV_WIN_32)/include/
CFLAGS_CROSS_WIN32 += -I$(WIN_ICONV_32)/include/
CFLAGS_CROSS_WIN32 += -m32
CFLAGS_CROSS_WIN32 += -DWITH_HWMON
CFLAGS_CROSS_WIN64 := $(CFLAGS)
CFLAGS_CROSS_WIN64 += -I$(OPENCL_HEADERS_KHRONOS)/
CFLAGS_CROSS_WIN64 += -I$(ICONV_WIN_64)/include/
CFLAGS_CROSS_WIN64 += -I$(WIN_ICONV_64)/include/
CFLAGS_CROSS_WIN64 += -m64
CFLAGS_CROSS_WIN64 += -DWITH_HWMON
@ -420,10 +419,10 @@ hashcat32.bin: src/main.c $(LINUX_32_OBJS)
hashcat64.bin: src/main.c $(LINUX_64_OBJS)
$(CC_LINUX_64) $(CFLAGS_CROSS_LINUX64) -o $@ $^ $(LFLAGS_CROSS_LINUX64) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\"
hashcat32.exe: src/main.c $(WIN_32_OBJS) $(ICONV_WIN_32)/lib/libiconv.a
hashcat32.exe: src/main.c $(WIN_32_OBJS) $(WIN_ICONV_32)/lib/libiconv.a
$(CC_WIN_32) $(CFLAGS_CROSS_WIN32) -o $@ $^ $(LFLAGS_CROSS_WIN32) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\"
hashcat64.exe: src/main.c $(WIN_64_OBJS) $(ICONV_WIN_64)/lib/libiconv.a
hashcat64.exe: src/main.c $(WIN_64_OBJS) $(WIN_ICONV_64)/lib/libiconv.a
$(CC_WIN_64) $(CFLAGS_CROSS_WIN64) -o $@ $^ $(LFLAGS_CROSS_WIN64) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\"
hashcat32.dll: src/main.c $(WIN_32_OBJS)

32
tools/win-iconv-32.diff Normal file
View File

@ -0,0 +1,32 @@
diff --git a/Makefile b/Makefile
index 5937584..8777fad 100644
--- a/Makefile
+++ b/Makefile
@@ -6,10 +6,10 @@
# MKDIR_P, INSTALL, RM
# prefix, BINARY_PATH, INCLUDE_PATH, LIBRARY_PATH
-CC ?= gcc
-AR ?= ar
-RANLIB ?= ranlib
-DLLTOOL ?= dlltool
+CC := i686-w64-mingw32-gcc
+AR := i686-w64-mingw32-ar
+RANLIB := i686-w64-mingw32-ranlib
+DLLTOOL := i686-w64-mingw32-dlltool
MKDIR_P = mkdir -p
INSTALL = install -c
@@ -19,10 +19,10 @@ RM = rm -f
DEFAULT_LIBICONV_DLL ?= \"\"
CFLAGS += -pedantic -Wall
-CFLAGS += -DUSE_LIBICONV_DLL
+#CFLAGS += -DUSE_LIBICONV_DLL
CFLAGS += -DDEFAULT_LIBICONV_DLL=$(DEFAULT_LIBICONV_DLL)
-prefix ?= /usr/local
+prefix ?= /opt/win-iconv-32
BINARY_PATH = $(prefix)/bin
INCLUDE_PATH = $(prefix)/include
LIBRARY_PATH = $(prefix)/lib

32
tools/win-iconv-64.diff Normal file
View File

@ -0,0 +1,32 @@
diff --git a/Makefile b/Makefile
index 5937584..c4742a3 100644
--- a/Makefile
+++ b/Makefile
@@ -6,10 +6,10 @@
# MKDIR_P, INSTALL, RM
# prefix, BINARY_PATH, INCLUDE_PATH, LIBRARY_PATH
-CC ?= gcc
-AR ?= ar
-RANLIB ?= ranlib
-DLLTOOL ?= dlltool
+CC := x86_64-w64-mingw32-gcc
+AR := x86_64-w64-mingw32-ar
+RANLIB := x86_64-w64-mingw32-ranlib
+DLLTOOL := x86_64-w64-mingw32-dlltool
MKDIR_P = mkdir -p
INSTALL = install -c
@@ -19,10 +19,10 @@ RM = rm -f
DEFAULT_LIBICONV_DLL ?= \"\"
CFLAGS += -pedantic -Wall
-CFLAGS += -DUSE_LIBICONV_DLL
+#CFLAGS += -DUSE_LIBICONV_DLL
CFLAGS += -DDEFAULT_LIBICONV_DLL=$(DEFAULT_LIBICONV_DLL)
-prefix ?= /usr/local
+prefix ?= /opt/win-iconv-64
BINARY_PATH = $(prefix)/bin
INCLUDE_PATH = $(prefix)/include
LIBRARY_PATH = $(prefix)/lib