Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 13 May 2015 19:37:21 +0300
From: Aleksey Cherepanov <lyosha@...nwall.com>
To: john-dev@...ts.openwall.com
Subject: Re: get_binary_*() and get_hash_*() methods

On Thu, May 07, 2015 at 05:39:45PM +0300, Solar Designer wrote:
> Aleksey,
> 
> I'll skip commenting on things that I think you already figured out.
> 
> On Thu, May 07, 2015 at 12:50:33PM +0300, Aleksey Cherepanov wrote:
> > It looks like crypt_all() gets struct db_salt *salt? Is it the whole
> > db? The salt was set up by set_salt() so it should be the db, right?
> 
> It's the portion of db corresponding to the current salt.
> 
> > Is the db intended to be checked by crypt_all()?
> 
> For fast hashes and/or with delegation to another device (such as a
> GPU), it may be.
> 
> You can see a dirty hack like this here:
> 
> git show 9a6f4f6f69903763e664f03d2adee97486eca9de DES_bs_b.c

I tried to perform lookup in crypt_all() to exit earlier not finishing
the computations. I tried it against raw-sha512, scalar implementation
with 2 instructions reversed (endianity altering and addition of the
state), I compared h variable (it should be the closest result). Also
I replaced salt->index(index) with var & 0xfff (salt->hash_size == 2).

salt argument is 0 in self tests, so I tested it with
--skip-self-tests:
5g 0:00:01:27  3/3 0.05721g/s 1351Kp/s 1351Kc/s 20274KC/s gok3sb
5g 0:00:01:27  3/3 0.05747g/s 1295Kp/s 1295Kc/s 19426KC/s 159518*
#1 is with early exit, #2 without that additional check.

The difference (3%) may be a fluctuation.


Is there any solution to not skip self tests?


There is in opencl_rawmd4_fmt_plug.c :

	if (salt != NULL && num_loaded_hashes != salt->count)
		load_hash(salt);

How does it pass self tests?


Also there is

	pw = salt -> list;
	i = 0;
	do {
		bin = (unsigned int *)pw -> binary;
		// Potential segfault if removed
		if(bin != NULL) {
[...]
		}
	} while ((pw = pw -> next)) ;

I had such problem too. Why is there 0 in binary field? Should not
such entries be removed? Is it due to multithreading?


Thanks!

-- 
Regards,
Aleksey Cherepanov

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.