Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Sun, 3 Jun 2012 13:57:16 -0500
From: "jfoug" <jfoug@....net>
To: <john-dev@...ts.openwall.com>
Subject: RE: memory usage within JtR and possible ways to significantly reduce it.

>From: Solar Designer [mailto:solar@...nwall.com]
>
>I just want the main magnum-jumbo to stay without this stuff for now.
>

This code was fully removed from magnum-jumbo.  It was left in bleeding
edge.  There now IS a patch on the wiki-page
(http://openwall.info/wiki/john/patches) which will patch this code INTO
magnum jumbo.  In this patch, all formats NOT using get_source, have the
pointer left off in the fmt_main structure, and code within fmt_init will
properly set the pointer to point to fmt_default_get_source.  This was done
to keep this patch MUCH smaller, and so that it will be much more likely
that it will continue to patch properly, as the format files themselves get
changed.


There have been a couple of changes, and now this code is MUCH more stable.
I would love to get the blessing from Alex on this, but know his time is
sparce.  I fully believe with the changes made, that this code is testing
properly, is reducing duplicates within input files properly, removing .pot
already founds properly, and is working with salted hashes, properly.

Here are the changes.

1. changed the method signature to:
   char *(*get_source)(struct db_password *current_pw, char
ReturnBuf[LINE_BUFFER_SIZE]);
   from:
   char *(*get_source)(void *binary, void *salt, char
ReturnBuf[LINE_BUFFER_SIZE]);

2. the source pointer in db_password has been 'optionally' changed.
   a. If a format does not define a get_source method, then the original
behavior is maintained.  i.e. the hash is allocated and this points to it.
   b. If a format has a get_source, then the db_password->source is pointed
at the salt for this hash.

3. within the get_source method, the ReturnBuf must be used, AND a format
must be able to build a source, that takes up fewer bytes than
LINE_BUFFER_SIZE.  If not then that format cannot use get_source.  This is
so get_source is thread-safe, which it MUST be.  There can be NO static data
inside a get_source function.

4. within get_source, ONLY the binary, and source (salt) pointers of the
db_password object should be used.  If a format DOES NOT use a salt, then it
should NOT access the source pointer (but why would it, since it is
unsalted?).   

5. Between the binary and source (salt) pointers of the db_password, the
format should be able to recreate the proper source data. IF not, then it
cannot use a get_source method.

6. This relationship MUST be preserved, and it is tested for within
fmt_self_test:
   strcmp(get_hash(source(),salt()), split(prepare(original_hash))) == 0

7. The fmt_default_get_source simply returns the current_pw->source    since
the loader code properly allocated and stored this.

8. the several places in code which used   current_pw->source, now simply
call fmt->get_source(current_pw, buffer)    The exact and correct work is
done.

 
Jim.


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.