Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <84fc99dbf937ae21e9b99e083d56c4bf@smtp.hushmail.com>
Date: Sun, 17 Jun 2012 17:11:08 +0200
From: magnum <john.magnum@...hmail.com>
To: john-dev@...ts.openwall.com
Subject: Re: Re: [patch] optional new raw sha1 implemetation

It's gone again anyway, Tavis reverted to defining _GNU_SOURCE and using 
memrchr. Will this work on *BSD? I have no idea. For a Sparc it's no 
issue since the format won't be included anyway.

magnum


On 2012-06-17 17:00, jfoug wrote:
> Why are we doing a memset here?  A simply *ptr=0 is  all that is needed. We
> simply need to return a ASCIIZ string, changing the 0x80 to 0x00.
>
> +  strrchr((char*)key, 0x80) = 0;
>
> We are assured that there will be a 0x80 within first 16 bytes, and we have
> an array that now is 20 bytes long.
>
> I also think the key[4] = 0 could be eliminated by doing:   static uint32_t
> key[5] = {0};  or by using a pointer and calloc(17).
>
> Jim.
>
>> @@ -270,7 +270,7 @@ static void sha1_fmt_set_key(char *key, int index)
>>
>>   static char * sha1_fmt_get_key(int index)
>>   {
>> -    static uint32_t key[4];
>> +    static uint32_t key[5];
>>
>>       // This function is not hot, we can do this slowly. First, restore
>>       // endianness.
>> @@ -279,6 +279,9 @@ static char * sha1_fmt_get_key(int index)
>>       key[2] = __builtin_bswap32(M[index][2]);
>>       key[3] = __builtin_bswap32(M[index][3]);
>>
>> +    // We need a null byte for the strrchr
>> +    key[4] = 0;
>> +
>>       // Skip backwards until we hit the trailing bit, then remove it.
>>       memset(strrchr((char*)key, 0x80), 0x00, 1);
>>
>>
>> magnum
>
>


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.