Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 17 Feb 2009 06:11:50 +0300
From: Solar Designer <solar@...nwall.com>
To: john-users@...ts.openwall.com
Subject: Re: 2 known letters + wordlist word --> is new format definition best way?

On Tue, Feb 17, 2009 at 02:53:46AM +0000, P PO1434 wrote:
> perhaps the salts should be stored/checked in an array?

No, the rest of JtR should take care of this for you if you define your
"format" correctly.

> Here are my salt functions (OSCSalt is a global var):
> 
> // Convert ASCII salt to its internal representation
> static void *oscmd5_get_salt(char *ciphertext) {
>     strncpy(OSCSalt,ciphertext+5,SALT_SIZE);
>     OSCSalt[2]=0;
>     return OSCSalt;
> }
> /* Sets a salt for the crypt_all() method */
> static void oscmd5_set_salt(void *salt) {
>     strncpy(OSCSalt,salt,SALT_SIZE+1);
> }
> 
> Is there something wrong with these?

No, nothing major.  I think that your bug is elsewhere.  Maybe you have
not defined SALT_SIZE correctly (it should be 2 in your case).  Maybe
you have not adjusted the definition of "struct fmt_main fmt_OSC" to
refer to both functions.

Also, normally the salt() function (oscmd5_get_salt() in your case)
would not alter the salt set with set_salt().  I don't recall any code
in JtR that would depend on this, though, but I also don't recall any
other "format" that would "test" doing things in your way - so this is
something you could want to fix.  For example, you could do:

static void *get_salt(char *ciphertext)
{
	return ciphertext + 5;
}

static void set_salt(void *salt)
{
	memcpy(OSCSalt, salt, SALT_SIZE);
}

(assuming that the rest of your code does not rely on OSCSalt being
NUL-terminated - there should be no need for that).

Alexander

-- 
To unsubscribe, e-mail john-users-unsubscribe@...ts.openwall.com and reply
to the automated confirmation request that will be sent to you.

Powered by blists - more mailing lists

Your e-mail address:

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