>From 64de26a2a3f59dc3937f23538f19bc804a3bb3ec Mon Sep 17 00:00:00 2001 From: Frank Dittrich Date: Sun, 8 Jul 2012 07:41:08 +0200 Subject: [PATCH] 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 --- src/common.h | 2 +- src/john.c | 6 ++++-- src/memory.c | 4 +--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/common.h b/src/common.h index 67685d3..67e0309 100644 --- a/src/common.h +++ b/src/common.h @@ -23,7 +23,7 @@ typedef unsigned long long ARCH_WORD_64; /* ONLY use this to check alignments of even power of 2 (2, 4, 8, 16, etc) byte counts (CNT). the cast to void* MUST be done, due to C spec. http://stackoverflow.com/a/1898487 */ -#define is_aligned(PTR, CNT) (((uintptr_t)(const void *)(PTR))&(CNT-1)==0) +#define is_aligned(PTR, CNT) (((ARCH_WORD)(const void *)(PTR))&((CNT-1)==0)) #ifdef __GNUC__ #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) diff --git a/src/john.c b/src/john.c index fa74789..3dc3fcc 100644 --- a/src/john.c +++ b/src/john.c @@ -819,7 +819,9 @@ 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); } @@ -865,7 +867,7 @@ static void john_init(char *name, int argc, char **argv) // 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.salt_size); printf("\n"); } while ((format = format->next)); exit(0); diff --git a/src/memory.c b/src/memory.c index a5286b7..63a7d74 100644 --- a/src/memory.c +++ b/src/memory.c @@ -226,9 +226,7 @@ void alter_endianity_w(void *_x, unsigned int count) { } #else unsigned char *cpX, c; - long l; - l = (long)x; - if ( (l & (sizeof(ARCH_WORD_32)-1)) == 0) { + if (is_aligned(x,sizeof(ARCH_WORD_32))) { // we are in alignment. while (++i < count) { x[i] = JOHNSWAP(x[i]); -- 1.7.7.6