Skip to content

Commit

Permalink
better algo label. Fixed bug when MD5_X2 set
Browse files Browse the repository at this point in the history
  • Loading branch information
jfoug committed Dec 27, 2018
1 parent 89588ab commit 14fd1fb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/dynamic.h
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,9 @@ int dynamic_RESERVED_PRELOAD_SETUP(int cnt, struct fmt_main *pFmt);
char *dynamic_PRELOAD_SIGNATURE(int cnt);
int dynamic_IS_PARSER_VALID(int which, int single_lookup_only);

// when switching to the RDP format, there are a few things we need to correct in the format.
void dynamic_switch_compiled_format_to_RDP(struct fmt_main *pFmt);

// This one is called in the .pot writing. We 'fixup' salts which contain ':' chars, or other
// chars which cause problems (like the $ char).
char *dynamic_FIX_SALT_TO_HEX(char *ciphertext);
Expand Down
1 change: 1 addition & 0 deletions src/dynamic_compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@ int dynamic_assign_script_to_format(DC_HANDLE H, struct fmt_main *pFmt) {
if (failed) {
// Now replay, and make sure it does not fail again.
dynamic_compiler_failed = 1;
dynamic_switch_compiled_format_to_RDP(pFmt);
failed = 0;
for (j = 0; j < 5; ++j) {
pFmt->methods.clear_keys();
Expand Down
19 changes: 19 additions & 0 deletions src/dynamic_fmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1805,6 +1805,12 @@ static int crypt_all(int *pcount, struct db_salt *salt)
for (i = 0; i < m_count; ++i) {
dc.iPw = saved_key[i];
dc.nPw = saved_key_len[i];
#if MD5_X2
if (i & 1) {
dc.oBin = crypt_key_X86[i >> MD5_X2].x2.B2;
}
else
#endif
dc.oBin = crypt_key_X86[i >> MD5_X2].x1.B;
run_one_RDP_test(&dc);
}
Expand Down Expand Up @@ -8360,6 +8366,19 @@ int dynamic_real_salt_length(struct fmt_main *pFmt)
return -1;
}

void dynamic_switch_compiled_format_to_RDP(struct fmt_main *pFmt)
{
if (pFmt->params.flags & FMT_DYNAMIC) {
private_subformat_data *pPriv = pFmt->private.data;
if (pPriv == NULL || pPriv->pSetup == NULL)
return;
pPriv->dynamic_use_sse = 0;
dynamic_use_sse = 0;
curdat.dynamic_use_sse = 0;
pFmt->params.algorithm_name = "Dynamic RDP";

}
}
#else
#warning Notice: Dynamic format disabled from build.
#endif /* DYNAMIC_DISABLED */

0 comments on commit 14fd1fb

Please sign in to comment.