Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 6 May 2015 19:41:09 +0300
From: Aleksey Cherepanov <lyosha@...nwall.com>
To: john-dev@...ts.openwall.com
Subject: bare tag test works only if the first test hash contains format tag
 (was: Generic parsing functions -- prototype)

On Mon, May 04, 2015 at 11:04:35PM +0300, Aleksey Cherepanov wrote:
> The code works for good bare hashes. But it will work wrong for
> shorter hashes. It fails self tests because $SHA512$ without hex
> part is tried:
> FAILED (promiscuous valid ($SHA512$))
> 
> Interestingly format tag is not part of fmt_main, the tag is extracted
> from self tests matching $ (so the test will not be applied if the tag
> is not in $).

I think the check of bare format tag is performed only if the first
test hash has the tag. So current raw-sha512 does not get the check.

I added
    printf(" valid(): %s\n", ciphertext);
to sha512_common_valid() in rawSHA512_common_plug.c .

With the following test vector:

static struct fmt_tests tests[] = {
	{"f342aae82952db35b8e02c30115e3deed3d80fdfdadacab336f0ba51ac54e297291fa1d6b201d69a2bd77e2535280f17a54fa1e527abc6e2eddba79ad3be11c0", "epixoip"},
	{FORMAT_TAG "f342aae82952db35b8e02c30115e3deed3d80fdfdadacab336f0ba51ac54e297291fa1d6b201d69a2bd77e2535280f17a54fa1e527abc6e2eddba79ad3be11c0", "epixoip"},
	{NULL}
};

in rawSHA512_common.h , I don't get the test of bare format tag:

Benchmarking: Raw-SHA512 [SHA512 128/128 SSE4.1 2x]...  valid(): f342aae82952db35b8e02c30115e3deed3d80fdfdadacab336f0ba51ac54e297291fa1d6b201d69a2bd77e2535280f17a54fa1e527abc6e2eddba79ad3be11c0
 valid(): *
 valid(): f342aae82952db35b8e02c30115e3deed3d80fdfdadacab336f0ba51ac54e297291fa1d6b201d69a2bd77e2535280f17a54fa1e527abc6e2eddba79ad3be11c0
 valid(): $SHA512$f342aae82952db35b8e02c30115e3deed3d80fdfdadacab336f0ba51ac54e297291fa1d6b201d69a2bd77e2535280f17a54fa1e527abc6e2eddba79ad3be11c0


With other order of tests

static struct fmt_tests sha512_common_tests[] = {
	{FORMAT_TAG "f342aae82952db35b8e02c30115e3deed3d80fdfdadacab336f0ba51ac54e297291fa1d6b201d69a2bd77e2535280f17a54fa1e527abc6e2eddba79ad3be11c0", "epixoip"},
	{"f342aae82952db35b8e02c30115e3deed3d80fdfdadacab336f0ba51ac54e297291fa1d6b201d69a2bd77e2535280f17a54fa1e527abc6e2eddba79ad3be11c0", "epixoip"},
	{NULL}
};

I get the check

Benchmarking: Raw-SHA512 [SHA512 128/128 SSE4.1 2x]...  valid(): $SHA512$f342aae82952db35b8e02c30115e3deed3d80fdfdadacab336f0ba51ac54e297291fa1d6b201d69a2bd77e2535280f17a54fa1e527abc6e2eddba79ad3be11c0
 valid(): *
 valid(): $SHA512$f342aae82952db35b8e02c30115e3deed3d80fdfdadacab336f0ba51ac54e297291fa1d6b201d69a2bd77e2535280f17a54fa1e527abc6e2eddba79ad3be11c0
 valid(): $SHA512$
 valid(): $SHA512$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 valid(): f342aae82952db35b8e02c30115e3deed3d80fdfdadacab336f0ba51ac54e297291fa1d6b201d69a2bd77e2535280f17a54fa1e527abc6e2eddba79ad3be11c0


I think it's a problem.

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.