diff --git a/Makefile b/Makefile index c3e27c9..34e35df 100755 --- a/Makefile +++ b/Makefile @@ -1,3 +1,14 @@ +PRODUCTION := 1 +PRODUCTION_VERSION := 6.0.0 +PRODUCTION_YEAR := 2020 + +ifeq ($(PRODUCTION),1) +VERSION_TAG := $(PRODUCTION_VERSION) +else +VERSION_TAG := $(shell git describe --tags || echo $(PRODUCTION_VERSION)) +endif +VERSION_YEAR := $(shell echo $(PRODUCTION_YEAR)) + PREFIX ?=/usr/local INSTALLDIR = $(DESTDIR)$(PREFIX)/bin @@ -5,6 +16,7 @@ HOSTOS := $(shell uname -s) CC = gcc CFLAGS ?= -O3 -Wall -Wextra CFLAGS += -std=gnu99 +DEFS = -DVERSION_TAG=\"$(VERSION_TAG)\" -DVERSION_YEAR=\"$(VERSION_YEAR)\" INSTFLAGS = -m 0755 ifeq ($(HOSTOS), Linux) @@ -18,13 +30,13 @@ endif all: build build: - $(CC) $(CFLAGS) $(CPPFLAGS) -o wlangenpmk wlangenpmk.c -lcrypto $(LDFLAGS) + $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -o wlangenpmk wlangenpmk.c -lcrypto $(LDFLAGS) ifeq ($(HOSTOS), Darwin) - $(CC) $(CFLAGS) $(CPPFLAGS) -o wlangenpmkocl wlangenpmkocl.c -lcrypto -Wl,-framework,OpenCL -lm $(LDFLAGS) + $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -o wlangenpmkocl wlangenpmkocl.c -lcrypto -Wl,-framework,OpenCL -lm $(LDFLAGS) else - $(CC) $(CFLAGS) $(CPPFLAGS) -o wlangenpmkocl wlangenpmkocl.c -lcrypto -lOpenCL $(LDFLAGS) + $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -o wlangenpmkocl wlangenpmkocl.c -lcrypto -lOpenCL $(LDFLAGS) endif - $(CC) $(CFLAGS) $(CPPFLAGS) -o pwhash pwhash.c -lcrypto $(LDFLAGS) + $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -o pwhash pwhash.c -lcrypto $(LDFLAGS) install: build diff --git a/common.c b/include/common.c similarity index 100% rename from common.c rename to include/common.c diff --git a/common.h b/include/common.h similarity index 99% rename from common.h rename to include/common.h index a5a4f95..437c023 100644 --- a/common.h +++ b/include/common.h @@ -1,6 +1,3 @@ -#define VERSION "4.0.1" -#define VERSION_JAHR "2019" - #if !defined(FALSE) #define FALSE 0 #endif diff --git a/wlangenpmk.c b/wlangenpmk.c index 41294b9..0acf6fc 100644 --- a/wlangenpmk.c +++ b/wlangenpmk.c @@ -16,7 +16,7 @@ #include #endif #include -#include "common.h" +#include "include/common.h" #define COWPATTY_SIGNATURE 0x43575041L @@ -330,7 +330,7 @@ printf("%s %s (C) %s ZeroBeat\n" "-A : output plainmasterkeys:password as ASCII file\n" "-c : output cowpatty hashfile (existing file will be replaced)\n" "-h : this help\n" - "\n", eigenname, VERSION, VERSION_JAHR, eigenname); + "\n", eigenname, VERSION_TAG, VERSION_YEAR, eigenname); exit(EXIT_FAILURE); } /*===========================================================================*/ @@ -373,7 +373,7 @@ while ((auswahl = getopt(argc, argv, "p:e:i:I:a:A:c:h")) != -1) case 'p': pwname = optarg; pwlen = strlen(pwname); - if((pwlen < 8) || (pwlen > 63)) + if((pwlen < 1) || (pwlen > 63)) { fprintf(stderr, "error wrong password len\n"); exit(EXIT_FAILURE); diff --git a/wlangenpmkocl.c b/wlangenpmkocl.c index c0d09a5..c08e275 100644 --- a/wlangenpmkocl.c +++ b/wlangenpmkocl.c @@ -25,8 +25,8 @@ #else #include #endif -#include "common.h" -#include "common.c" +#include "include/common.h" +#include "include/common.c" #define MAX_SOURCE_SIZE (0x1000000) @@ -885,7 +885,7 @@ printf("%s %s (C) %s ZeroBeat\n" "%s -e -i -a \n" "or use mixed mode:\n" "%s -e -i > \n" - "\n", eigenname, VERSION, VERSION_JAHR, eigenname, eigenname, eigenname, eigenname, eigenname); + "\n", eigenname, VERSION_TAG, VERSION_YEAR, eigenname, eigenname, eigenname, eigenname, eigenname); exit(EXIT_FAILURE); } /*===========================================================================*/