Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Sun, 10 Nov 2013 19:17:45 +0100
From: Lukas Odzioba <lukas.odzioba@...il.com>
To: john-dev@...ts.openwall.com
Subject: Fix broken formats (#420)

magnum,all
Here is a patch with trivial fixes for some formats that are in broken
directory.
Since we're on it, shouldn't we add "Raw" prefix to each of them, or
this is just for popular ones?

If you ask me I don't like this prefix, but at least we should be consistent.
I guess this is something to think off before jumbo release, changing
format names back and forth is never a good idea.

At the moment I renamed only MD2 and snefru, maybe unnecessarily.

Lukas

diff -urpN JohnTheRipper-bleeding-jumbo.orig//src/broken/haval_fmt_plug.c JohnTheRipper-bleeding-jumbo/src/broken/haval_fmt_plug.c
--- JohnTheRipper-bleeding-jumbo.orig//src/broken/haval_fmt_plug.c	2013-11-08 12:06:06.000000000 +0000
+++ JohnTheRipper-bleeding-jumbo/src/broken/haval_fmt_plug.c	2013-11-10 16:58:58.000000000 +0000
@@ -22,8 +22,6 @@ static int omp_t = 1;
 #define OMP_SCALE               1 // tuned on core i7
 #endif
 
-#define FORMAT_LABEL		"HAVAL"
-#define FORMAT_NAME		""
 #define FORMAT_TAG		"$haval$"
 #define TAG_LENGTH		7
 #define ALGORITHM_NAME		"32/" ARCH_BITS_STR
@@ -65,7 +63,6 @@ static void init(struct fmt_main *self)
 	crypt_out = mem_calloc_tiny(sizeof(*crypt_out) * self->params.max_keys_per_crypt, MEM_ALIGN_WORD);
 }
 
-// XXX fix me
 static int valid(char *ciphertext, struct fmt_main *self)
 {
 	char *p;
@@ -77,6 +74,9 @@ static int valid(char *ciphertext, struc
 	if (strlen(p) != 32 && strlen(p) != 64)
 		return 0;
 
+	while(*p)
+		if(atoi16[ARCH_INDEX(*p++)]==0x7f)
+			return 0;
 	return 1;
 }
 
diff -urpN JohnTheRipper-bleeding-jumbo.orig//src/broken/md2_fmt_plug.c JohnTheRipper-bleeding-jumbo/src/broken/md2_fmt_plug.c
--- JohnTheRipper-bleeding-jumbo.orig//src/broken/md2_fmt_plug.c	2013-11-08 12:06:06.000000000 +0000
+++ JohnTheRipper-bleeding-jumbo/src/broken/md2_fmt_plug.c	2013-11-10 14:24:08.000000000 +0000
@@ -22,7 +22,7 @@ static int omp_t = 1;
 #define OMP_SCALE               1 // FIXME
 #endif
 
-#define FORMAT_LABEL		"MD2"
+#define FORMAT_LABEL		"Raw-MD2"
 #define FORMAT_NAME		""
 #define FORMAT_TAG		"$md2$"
 #define TAG_LENGTH		5
@@ -39,6 +39,8 @@ static int omp_t = 1;
 
 static struct fmt_tests md2__tests[] = {
 	{"$md2$ab4f496bfb2a530b219ff33031fe06b0", "message digest"},
+	{"ab4f496bfb2a530b219ff33031fe06b0", "message digest"},
+	{"921adc047dad311394d2b8553002042d","len=125_____________________________________________________________________________________________________________________x"},
 	{NULL}
 };
 
@@ -69,6 +71,9 @@ static int valid(char *ciphertext, struc
 		p += TAG_LENGTH;
 	if (strlen(p) != 32)
 		return 0;
+	while(*p)
+		if(atoi16[ARCH_INDEX(*p++)]==0x7f)
+			return 0;
 
 	return 1;
 }
diff -urpN JohnTheRipper-bleeding-jumbo.orig//src/broken/panama_fmt_plug.c JohnTheRipper-bleeding-jumbo/src/broken/panama_fmt_plug.c
--- JohnTheRipper-bleeding-jumbo.orig//src/broken/panama_fmt_plug.c	2013-11-08 12:06:06.000000000 +0000
+++ JohnTheRipper-bleeding-jumbo/src/broken/panama_fmt_plug.c	2013-11-10 17:02:19.000000000 +0000
@@ -58,7 +58,7 @@ static void init(struct fmt_main *self)
 	crypt_out = mem_calloc_tiny(sizeof(*crypt_out) * self->params.max_keys_per_crypt, MEM_ALIGN_WORD);
 }
 
-// XXX fix me
+
 static int valid(char *ciphertext, struct fmt_main *self)
 {
 	char *p;
@@ -69,6 +69,9 @@ static int valid(char *ciphertext, struc
 		p += TAG_LENGTH;
 	if (strlen(p) != 64)
 		return 0;
+	while(*p)
+		if(atoi16[ARCH_INDEX(*p++)]==0x7f)
+			return 0;
 
 	return 1;
 }
diff -urpN JohnTheRipper-bleeding-jumbo.orig//src/broken/ripemd_fmt_plug.c JohnTheRipper-bleeding-jumbo/src/broken/ripemd_fmt_plug.c
--- JohnTheRipper-bleeding-jumbo.orig//src/broken/ripemd_fmt_plug.c	2013-11-08 12:06:06.000000000 +0000
+++ JohnTheRipper-bleeding-jumbo/src/broken/ripemd_fmt_plug.c	2013-11-10 14:27:04.000000000 +0000
@@ -22,8 +22,6 @@ static int omp_t = 1;
 #define OMP_SCALE               1 // XXX
 #endif
 
-#define FORMAT_LABEL		"RIPEMD"
-#define FORMAT_NAME		""
 #define FORMAT_TAG		"$ripemd$"
 #define TAG_LENGTH		8
 #define ALGORITHM_NAME		"32/" ARCH_BITS_STR
@@ -40,6 +38,7 @@ static int omp_t = 1;
 
 static struct fmt_tests ripemd_160_tests[] = {
 	{"$ripemd$9c1185a5c5e9fc54612808977ee8f548b2258d31", ""},
+	{"9c1185a5c5e9fc54612808977ee8f548b2258d31", ""},
 	{NULL}
 };
 
@@ -65,7 +64,6 @@ static void init(struct fmt_main *self)
 	crypt_out = mem_calloc_tiny(sizeof(*crypt_out) * self->params.max_keys_per_crypt, MEM_ALIGN_WORD);
 }
 
-// XXX implement robust validator
 static int valid(char *ciphertext, struct fmt_main *self)
 {
 	char *p;
@@ -77,6 +75,10 @@ static int valid(char *ciphertext, struc
 	if (strlen(p) != 32 && strlen(p) != 40)
 		return 0;
 
+	while(*p)
+		if(atoi16[ARCH_INDEX(*p++)]==0x7f)
+			return 0;
+
 	return 1;
 }
 
@@ -211,7 +213,7 @@ static char *get_key(int index)
 
 struct fmt_main fmt_ripemd_160 = {
 	{
-		"ripemd-160",
+		"Raw-RIPEMD-160",
 		"RIPEMD 160",
 		ALGORITHM_NAME,
 		BENCHMARK_COMMENT,
@@ -269,7 +271,7 @@ struct fmt_main fmt_ripemd_160 = {
 
 struct fmt_main fmt_ripemd_128 = {
 	{
-		"ripemd-128",
+		"Raw-RIPEMD-128",
 		"RIPEMD 128",
 		ALGORITHM_NAME,
 		BENCHMARK_COMMENT,
diff -urpN JohnTheRipper-bleeding-jumbo.orig//src/broken/skein_fmt_plug.c JohnTheRipper-bleeding-jumbo/src/broken/skein_fmt_plug.c
--- JohnTheRipper-bleeding-jumbo.orig//src/broken/skein_fmt_plug.c	2013-11-08 12:06:06.000000000 +0000
+++ JohnTheRipper-bleeding-jumbo/src/broken/skein_fmt_plug.c	2013-11-10 16:53:36.000000000 +0000
@@ -65,7 +65,6 @@ static void init(struct fmt_main *self)
 	crypt_out = mem_calloc_tiny(sizeof(*crypt_out) * self->params.max_keys_per_crypt, MEM_ALIGN_WORD);
 }
 
-// XXX fix me
 static int valid(char *ciphertext, struct fmt_main *self)
 {
 	char *p;
@@ -77,6 +76,9 @@ static int valid(char *ciphertext, struc
 	if (strlen(p) != 64 && strlen(p) != 128)
 		return 0;
 
+	while(*p)
+		if(atoi16[ARCH_INDEX(*p++)]==0x7f)
+			return 0;
 	return 1;
 }
 
diff -urpN JohnTheRipper-bleeding-jumbo.orig//src/broken/snefru_fmt_plug.c JohnTheRipper-bleeding-jumbo/src/broken/snefru_fmt_plug.c
--- JohnTheRipper-bleeding-jumbo.orig//src/broken/snefru_fmt_plug.c	2013-11-08 12:06:06.000000000 +0000
+++ JohnTheRipper-bleeding-jumbo/src/broken/snefru_fmt_plug.c	2013-11-10 16:49:16.000000000 +0000
@@ -74,6 +74,10 @@ static int valid(char *ciphertext, struc
 	if (strlen(p) != 32 && strlen(p) != 64)
 		return 0;
 
+	while(*p)
+		if(atoi16[ARCH_INDEX(*p++)]==0x7f)
+			return 0;
+
 	return 1;
 }
 
diff -urpN JohnTheRipper-bleeding-jumbo.orig//src/broken/tiger_fmt_plug.c JohnTheRipper-bleeding-jumbo/src/broken/tiger_fmt_plug.c
--- JohnTheRipper-bleeding-jumbo.orig//src/broken/tiger_fmt_plug.c	2013-11-08 12:06:06.000000000 +0000
+++ JohnTheRipper-bleeding-jumbo/src/broken/tiger_fmt_plug.c	2013-11-10 16:55:51.000000000 +0000
@@ -60,7 +60,6 @@ static void init(struct fmt_main *self)
 	crypt_out = mem_calloc_tiny(sizeof(*crypt_out) * self->params.max_keys_per_crypt, MEM_ALIGN_WORD);
 }
 
-// XXX implement proper checks
 static int valid(char *ciphertext, struct fmt_main *self)
 {
 	char *p;
@@ -72,6 +71,9 @@ static int valid(char *ciphertext, struc
 	if (strlen(p) != BINARY_SIZE * 2)
 		return 0;
 
+	while(*p)
+		if(atoi16[ARCH_INDEX(*p++)]==0x7f)
+			return 0;
 	return 1;
 }
 

Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ