Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [day] [month] [year] [list]
Date: Thu, 19 Jul 2012 11:02:23 +0200
From: Frank Dittrich <frank_dittrich@...mail.com>
To: john-dev@...ts.openwall.com
Subject: Fixes for --list=format-details and --list=format-all-details

The first patch re-introduces a fix that had already been committed to
bleeding-jumbo, magnum-jumbo and 1.7.9-jumbo-6-fixes (commit
a96222f03eb153ae56d8480ca243e4d5d07b7a5e), but got reverted by accident
with commit 61cea42f979eb07284afc099550f90ae50bb858a.

It fixes the output of salt size in --list=format-details for dynamic
formats.
Without this fix --list=format-details will print the size of a pointer
instead of the real salt size used by the dynamic format.

So, the first patch needs to be applied to all tries:
bleeding-jumbo, magnum-jumbo and 1.7.9-jumbo-6-fixes, as well as to the
contest edition.

The second patch is just for bleeding-jumbo, but it requires that the
first patch is applied.
It adds the binary_align and salt_align information (recently added to
bleeding-jumbo) to the --list=format-details and
--list=format-all-details output.

These patches are not very intrusive and rather trivial. That's why I
only tested them on linux-x86.

Frank

>From d6eff53a87c7324fb3cc7c365ba2fe830d438157 Mon Sep 17 00:00:00 2001
From: Frank Dittrich <frank_dittrich@...mail.com>
Date: Thu, 19 Jul 2012 09:37:52 +0200
Subject: [PATCH 1/2] Fix salt size of dynamic formats in
 --list=format-details

The change

    commit a96222f03eb153ae56d8480ca243e4d5d07b7a5e
    Author: Frank Dittrich <frank_dittrich@...mail.com>
    Date:   Sun Jul 8 18:49:14 2012 +0200

    Fix salt size of dynamic formats in --list=format-details

    For the new logic of dynamic formats, the --list=format-details
    output needed to be changed in a similar way as the output
    of --list=format-all-details has been changed

    The --list=format-all-details logic has also been changed to use
    one printf with ? : instead of if ... printf() else ... printf()

had accidentally been reverted by

    commit 61cea42f979eb07284afc099550f90ae50bb858a
    Author: JimF <jfoug@....net>
    Date:   Mon Jul 9 11:56:31 2012 +0200

    Jumbo-7RC-JimF-fixes.diff

These changes are needed for --list=format-details to show
the correct salt size for dynamic formats.
---
 src/john.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/john.c b/src/john.c
index d6ae92d..e756e3f 100644
--- a/src/john.c
+++ b/src/john.c
@@ -818,7 +818,10 @@ static void john_init(char *name, int argc, char **argv)
 			       format->params.benchmark_comment,
 			       format->params.benchmark_length,
 			       format->params.binary_size,
-			       format->params.salt_size);
+			       ((format->params.flags & FMT_DYNAMIC) && format->params.salt_size) ?
+			       // salts are handled internally within the format. We want to know the 'real' salt size
+			       // dynamic will alway set params.salt_size to 0 or sizeof a pointer.
+			       dynamic_real_salt_length(format) : format->params.salt_size);
 		} while ((format = format->next));
 		exit(0);
 	}
@@ -859,12 +862,11 @@ static void john_init(char *name, int argc, char **argv)
 			printf("Benchmark comment               \t%s\n", format->params.benchmark_comment);
 			printf("Benchmark length                \t%d\n", format->params.benchmark_length);
 			printf("Binary size                     \t%d\n", format->params.binary_size);
-			if ( (format->params.flags & FMT_DYNAMIC) && format->params.salt_size) {
-				// salts are handled internally within the format. We want to know the 'real' salt size/
-				// dynamic will alway set params.salt_size to 0 or sizeof a pointer.
-				printf("Salt size                       \t%d\n", dynamic_real_salt_length(format));
-			} else
-				printf("Salt size                       \t%d\n", format->params.salt_size);
+			printf("Salt size                       \t%d\n",
+			       ((format->params.flags & FMT_DYNAMIC) && format->params.salt_size) ?
+			       // salts are handled internally within the format. We want to know the 'real' salt size/
+			       // dynamic will alway set params.salt_size to 0 or sizeof a pointer.
+			       dynamic_real_salt_length(format) : format->params.salt_size);
 			printf("\n");
 		} while ((format = format->next));
 		exit(0);
-- 
1.7.7.6


>From ed0481e613c11f23f28a5857a9198259822b29bb Mon Sep 17 00:00:00 2001
From: Frank Dittrich <frank_dittrich@...mail.com>
Date: Thu, 19 Jul 2012 10:19:40 +0200
Subject: [PATCH 2/2] Add binary and salt alignment to
 --list=format-[all-]details

---
 src/john.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/john.c b/src/john.c
index e756e3f..c5ebcc7 100644
--- a/src/john.c
+++ b/src/john.c
@@ -806,7 +806,7 @@ static void john_init(char *name, int argc, char **argv)
 				while (format->params.tests[ntests++].ciphertext);
 				ntests--;
 			}
-			printf("%s\t%d\t%d\t%d\t%08x\t%d\t%s\t%s\t%s\t%d\t%d\t%d\n",
+			printf("%s\t%d\t%d\t%d\t%08x\t%d\t%s\t%s\t%s\t%d\t%d\t%d\t%d\t%d\n",
 			       format->params.label,
 			       format->params.plaintext_length,
 			       format->params.min_keys_per_crypt,
@@ -821,7 +821,9 @@ static void john_init(char *name, int argc, char **argv)
 			       ((format->params.flags & FMT_DYNAMIC) && format->params.salt_size) ?
 			       // salts are handled internally within the format. We want to know the 'real' salt size
 			       // dynamic will alway set params.salt_size to 0 or sizeof a pointer.
-			       dynamic_real_salt_length(format) : format->params.salt_size);
+			       dynamic_real_salt_length(format) : format->params.salt_size,
+			       format->params.binary_align,
+			       format->params.salt_align);
 		} while ((format = format->next));
 		exit(0);
 	}
@@ -867,6 +869,8 @@ static void john_init(char *name, int argc, char **argv)
 			       // salts are handled internally within the format. We want to know the 'real' salt size/
 			       // dynamic will alway set params.salt_size to 0 or sizeof a pointer.
 			       dynamic_real_salt_length(format) : format->params.salt_size);
+			printf("Alignment of binary ciphertext  \t%d\n", format->params.binary_align);
+			printf("Alignment of internal salt repr.\t%d\n", format->params.salt_align);
 			printf("\n");
 		} while ((format = format->next));
 		exit(0);
-- 
1.7.7.6


Powered by blists - more mailing lists

Your e-mail address:

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