diff -urpN jumbo-bleed3/src/dynamic.h jumbo-bleed2/src/dynamic.h --- jumbo-bleed3/src/dynamic.h 2012-07-15 13:06:24.140625000 +0000 +++ jumbo-bleed2/src/dynamic.h 2012-07-15 12:20:05.000000000 +0000 @@ -116,21 +116,21 @@ typedef struct DYNAMIC_Setup_t int SaltLenX86; // if zero, then use salt len of SSE } DYNAMIC_Setup; -int dynamic_SETUP(DYNAMIC_Setup *, struct fmt_main *self); +int dynamic_SETUP(DYNAMIC_Setup *, struct fmt_main *pFmt); int dynamic_IS_VALID(int i); -int dynamic_real_salt_length(struct fmt_main *self); +int dynamic_real_salt_length(struct fmt_main *pFmt); void dynamic_RESET(struct fmt_main *); void dynamic_DISPLAY_ALL_FORMATS(); // Function used to 'link' a thin format into dynamic. See PHPS_fmt.c for an example. -struct fmt_main *dynamic_THIN_FORMAT_LINK(struct fmt_main *self, char *ciphertext, char *orig_sig, int bInitAlso); -int text_in_dynamic_format_already(struct fmt_main *self, char *ciphertext); +struct fmt_main *dynamic_THIN_FORMAT_LINK(struct fmt_main *pFmt, char *ciphertext, char *orig_sig, int bInitAlso); +int text_in_dynamic_format_already(struct fmt_main *pFmt, char *ciphertext); // We need access to this global to get functions and data which we 'link' to //extern struct fmt_main fmt_MD5gen; int dynamic_Register_formats(struct fmt_main **ptr); -int dynamic_RESERVED_PRELOAD_SETUP(int cnt, struct fmt_main *self); +int dynamic_RESERVED_PRELOAD_SETUP(int cnt, struct fmt_main *pFmt); char *dynamic_PRELOAD_SIGNATURE(int cnt); int dynamic_IS_PARSER_VALID(int which); @@ -139,7 +139,7 @@ int dynamic_IS_PARSER_VALID(int which); char *dynamic_FIX_SALT_TO_HEX(char *ciphertext); // Here are the 'parser' functions (i.e. user built stuff in john.conf) -int dynamic_LOAD_PARSER_FUNCTIONS(int which, struct fmt_main *self); +int dynamic_LOAD_PARSER_FUNCTIONS(int which, struct fmt_main *pFmt); char *dynamic_LOAD_PARSER_SIGNATURE(int which); // extern demange. Turns \xF7 into 1 char. Turns \x1BCA into "esc C A" string (3 bytes). Turns abc\\123 into abc\123, etc. diff -urpN jumbo-bleed3/src/dynamic_fmt.c jumbo-bleed2/src/dynamic_fmt.c --- jumbo-bleed3/src/dynamic_fmt.c 2012-07-15 13:06:24.156250000 +0000 +++ jumbo-bleed2/src/dynamic_fmt.c 2012-07-15 12:53:43.093750000 +0000 @@ -66,7 +66,6 @@ ahead of time. #include "gost.h" #include "memory.h" #include "unicode.h" -#undef CPU_IA32 #include "johnswap.h" #include "pkzip.h" @@ -919,9 +918,10 @@ static char *prepare(char *split_fields[ return cpBuilding; } -static char *split(char *ciphertext, int index, struct fmt_main *self) +static char *split(char *ciphertext, int index, struct fmt_main *pFmt) { static char out[1024]; + private_subformat_data *pPriv = pFmt->private.data; if (!strncmp(ciphertext, "$dynamic", 8)) return ciphertext; @@ -931,15 +931,16 @@ static char *split(char *ciphertext, int do ++ciphertext; while (*ciphertext != ')') ; ++ciphertext; } - sprintf(out, "%s%s", curdat.dynamic_WHICH_TYPE_SIG, ciphertext); + sprintf(out, "%s%s", pPriv->dynamic_WHICH_TYPE_SIG, ciphertext); return out; } // This split unifies case. -static char *split_UC(char *ciphertext, int index, struct fmt_main *self) +static char *split_UC(char *ciphertext, int index, struct fmt_main *pFmt) { static char out[1024]; + private_subformat_data *pPriv = pFmt->private.data; if (!strncmp(ciphertext, "$dynamic", 8)) { strcpy(out, ciphertext); @@ -949,7 +950,7 @@ static char *split_UC(char *ciphertext, do ++ciphertext; while (*ciphertext != ')') ; ++ciphertext; } - sprintf(out, "%s%s", curdat.dynamic_WHICH_TYPE_SIG, ciphertext); + sprintf(out, "%s%s", pPriv->dynamic_WHICH_TYPE_SIG, ciphertext); } ciphertext = strchr(&out[8], '$')+1; while (*ciphertext && *ciphertext != '$') { @@ -2135,12 +2136,12 @@ static void *binary(char *_ciphertext) // NOTE NOTE NOTE, we have currently ONLY implemented a non-salted function!!! static char *source(char *source, void *binary) { - static char Buf[32 + 8 + 6 + 1]; + static char Buf[256]; + unsigned char *cpi= (unsigned char*)(binary); char *cpo = Buf; - unsigned char *cpi; int i; + cpo += sprintf(Buf, "%s", curdat.dynamic_WHICH_TYPE_SIG); - cpi = (unsigned char*)(binary); for (i = 0; i < 16; ++i) { *cpo++ = itoa16[(*cpi)>>4]; *cpo++ = itoa16[*cpi&0xF]; @@ -2152,12 +2153,12 @@ static char *source(char *source, void * static char *source_sha(char *source, void *binary) { - static char Buf[40 + 8 + 6 + 1]; + static char Buf[256]; + unsigned char *cpi= (unsigned char*)(binary); char *cpo = Buf; - unsigned char *cpi; int i; + cpo += sprintf(Buf, "%s", curdat.dynamic_WHICH_TYPE_SIG); - cpi = (unsigned char*)(binary); for (i = 0; i < 20; ++i) { *cpo++ = itoa16[(*cpi)>>4]; *cpo++ = itoa16[*cpi&0xF]; @@ -2168,12 +2169,12 @@ static char *source_sha(char *source, vo } static char *source_sha224(char *source, void *binary) { - static char Buf[(224/8*2) + 8 + 6 + 1]; + static char Buf[256]; + unsigned char *cpi= (unsigned char*)(binary); char *cpo = Buf; - unsigned char *cpi; int i; + cpo += sprintf(Buf, "%s", curdat.dynamic_WHICH_TYPE_SIG); - cpi = (unsigned char*)(binary); for (i = 0; i < 28; ++i) { *cpo++ = itoa16[(*cpi)>>4]; *cpo++ = itoa16[*cpi&0xF]; @@ -2184,12 +2185,12 @@ static char *source_sha224(char *source, } static char *source_sha256(char *source, void *binary) { - static char Buf[(256/8*2) + 8 + 6 + 1]; + static char Buf[256]; + unsigned char *cpi= (unsigned char*)(binary); char *cpo = Buf; - unsigned char *cpi; int i; + cpo += sprintf(Buf, "%s", curdat.dynamic_WHICH_TYPE_SIG); - cpi = (unsigned char*)(binary); for (i = 0; i < 32; ++i) { *cpo++ = itoa16[(*cpi)>>4]; *cpo++ = itoa16[*cpi&0xF]; @@ -2200,12 +2201,12 @@ static char *source_sha256(char *source, } static char *source_sha384(char *source, void *binary) { - static char Buf[(384/8*2) + 8 + 6 + 1]; + static char Buf[256]; + unsigned char *cpi= (unsigned char*)(binary); char *cpo = Buf; - unsigned char *cpi; int i; + cpo += sprintf(Buf, "%s", curdat.dynamic_WHICH_TYPE_SIG); - cpi = (unsigned char*)(binary); for (i = 0; i < 48; ++i) { *cpo++ = itoa16[(*cpi)>>4]; *cpo++ = itoa16[*cpi&0xF]; @@ -2216,12 +2217,12 @@ static char *source_sha384(char *source, } static char *source_sha512(char *source, void *binary) { - static char Buf[(512/8*2) + 8 + 6 + 1]; + static char Buf[256]; + unsigned char *cpi= (unsigned char*)(binary); char *cpo = Buf; - unsigned char *cpi; int i; + cpo += sprintf(Buf, "%s", curdat.dynamic_WHICH_TYPE_SIG); - cpi = (unsigned char*)(binary); for (i = 0; i < 64; ++i) { *cpo++ = itoa16[(*cpi)>>4]; *cpo++ = itoa16[*cpi&0xF]; @@ -2232,12 +2233,12 @@ static char *source_sha512(char *source, } static char *source_gost(char *source, void *binary) { - static char Buf[32 * 2 + 8 + 6 + 1]; + static char Buf[256]; + unsigned char *cpi= (unsigned char*)(binary); char *cpo = Buf; - unsigned char *cpi; int i; + cpo += sprintf(Buf, "%s", curdat.dynamic_WHICH_TYPE_SIG); - cpi = (unsigned char*)(binary); for (i = 0; i < 32; ++i) { *cpo++ = itoa16[(*cpi)>>4]; *cpo++ = itoa16[*cpi&0xF]; @@ -8591,8 +8592,8 @@ int dynamic_SETUP(DYNAMIC_Setup *Setup, curdat.store_keys_in_input = !!(Setup->startFlags&MGF_KEYS_INPUT ); curdat.input2_set_len32 = !!(Setup->startFlags&MGF_SET_INP2LEN32); - if (Setup->startFlags&MGF_SOURCE) pFmt->methods.source = source; - if (Setup->startFlags&MGF_SOURCE_SHA) pFmt->methods.source = source_sha; + if (Setup->startFlags&MGF_SOURCE) pFmt->methods.source = source; + if (Setup->startFlags&MGF_SOURCE_SHA) pFmt->methods.source = source_sha; if (Setup->startFlags&MGF_SOURCE_SHA224) pFmt->methods.source = source_sha224; if (Setup->startFlags&MGF_SOURCE_SHA256) pFmt->methods.source = source_sha256; if (Setup->startFlags&MGF_SOURCE_SHA384) pFmt->methods.source = source_sha384; @@ -8891,7 +8892,9 @@ int dynamic_SETUP(DYNAMIC_Setup *Setup, else pfx[cnt].ciphertext = str_alloc_copy(Setup->pPreloads[i].ciphertext); pfx[cnt].plaintext = str_alloc_copy(Setup->pPreloads[i].plaintext); - for (j = 0; j < 10; ++j) + pfx[cnt].fields[0] = Setup->pPreloads[i].fields[0] ? str_alloc_copy(Setup->pPreloads[i].fields[0]) : ""; + pfx[cnt].fields[1] = pfx[cnt].ciphertext; + for (j = 2; j < 10; ++j) pfx[cnt].fields[j] = Setup->pPreloads[i].fields[j] ? str_alloc_copy(Setup->pPreloads[i].fields[j]) : ""; } pfx[cnt].ciphertext = NULL; diff -urpN jumbo-bleed3/src/gost.h jumbo-bleed2/src/gost.h --- jumbo-bleed3/src/gost.h 2012-07-15 13:06:24.171875000 +0000 +++ jumbo-bleed2/src/gost.h 2012-07-15 12:30:15.671875000 +0000 @@ -12,6 +12,9 @@ extern "C" { #endif /* if x86 compatible cpu */ + // NOTE, we should get this from johnswap.h, but I have not done so 'yet' + // A lot (all??) of the swapping code should also come from johnswap.h +#if !defined (CPU_X64) && !defined (CPU_IA32) #if defined(i386) || defined(__i386__) || defined(__i486__) || \ defined(__i586__) || defined(__i686__) || defined(__pentium__) || \ defined(__pentiumpro__) || defined(__pentium4__) || \ @@ -28,6 +31,7 @@ extern "C" { # define CPU_IA32 # endif #endif +#endif #if defined(__GNUC__) && defined(CPU_IA32) && !defined(RHASH_NO_ASM) # define USE_GCC_ASM_IA32 diff -urpN jumbo-bleed3/src/johnswap.h jumbo-bleed2/src/johnswap.h --- jumbo-bleed3/src/johnswap.h 2012-07-15 13:06:24.203125000 +0000 +++ jumbo-bleed2/src/johnswap.h 2012-07-15 12:29:00.265625000 +0000 @@ -16,10 +16,13 @@ /* detect if x86-64 instruction set is supported */ # if defined(_LP64) || defined(__LP64__) || defined(__x86_64) || \ defined(__x86_64__) || defined(_M_AMD64) || defined(_M_X64) +# undef CPU_X64 # define CPU_X64 1 # else +# undef CPU_IA32 # define CPU_IA32 1 # endif +# undef CPU_INTEL_LE # define CPU_INTEL_LE 1 #endif