Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Tue, 31 Jul 2012 15:10:55 -0500
From: "jfoug" <jfoug@....net>
To: <john-dev@...ts.openwall.com>
Subject: RE: *problem* PDF format OMP support

The currPW field is NOT being treated as a const.  Anything shared among the
threads will have to be done so in a constant matter.

If that field has to be used, and it looks like it does, then simply create
a buffer on the stack, within the runCrack function, and copy the contents
of the currPW to it, and use that local stack variable from that point on.

To me, it looks like switching the pointer around and doing other
destructive stuff to that currPW is likely what is causing problems.

So do something like:

int runCrack(char *password, struct custom_salt *cs)
{
	//printf("called with %s! %p\n", password, cs->currPW);
	//printf("add  %p\n", cs->encKeyWorkSpace);
	bool found = false;
	uint8_t cpw[32];
	static unsigned char buf[128];
	//cs->currPW = buf;

	if (strlen(password) < 32)
-		strcpy((char*)cs->currPW, password);
+		strcpy(cpw, password);
	else {
-		strncpy((char*)cs->currPW, password, 32);
+		strncpy(cpw, password, 32);
	}

	if (!cs->workWithUser && !cs->knownPassword) {
		memcpy(cpw, pad, 32);
-		cs->currPW = cpw;
		if (cs->e.revision == 2)
-			found = runCrackRev2_o(cs, cs->currPW);
+			found = runCrackRev2_o(cs, cpw);
		else

There are many other calls to the other runCrackRevX which need cs->currPW
changed to cpw

Jim.

>-----Original Message-----
>From: Dhiru Kholia [mailto:dhiru.kholia@...il.com]
>Sent: Tuesday, July 31, 2012 11:44 AM
>To: john-dev@...ts.openwall.com
>Subject: [john-dev] *problem* PDF format OMP support
>
>Hi,
>
>Today, I worked on implementing OMP support in PDF format. No luck :(.
>The self-tests fail at random locations because of unknown reason. I
>have spent hours debugging the problem by failed.
>
>struct custom_salt {
>        struct EncData e;
>        unsigned char *userpassword;
>        /* load and restore following fields */
>        unsigned int ekwlen;
>        uint8_t encKeyWorkSpace[128];
>        uint8_t password_user[33];
>        uint8_t rev3TestKey[16];
>        unsigned char *currPW;
>        unsigned int currPWLen;
>        bool knownPassword;
>        bool workWithUser;
>};
>
>I *think* the problem is due to shared encKeyWorkSpace which the threads
>are modifying.
>
>The code is at http://dl.dropbox.com/u/1522424/problem_opdf.tar.bz2
>
>Jim, magnum,
>
>Can you take a please take a look? It would be great to have multi-core
>PDF cracking support in JtR.
>
>--
>Cheers,
>Dhiru

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.