Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120617150832.GN31349@cmpxchg8b.com>
Date: Sun, 17 Jun 2012 17:08:32 +0200
From: Tavis Ormandy <taviso@...xchg8b.com>
To: john-dev@...ts.openwall.com
Subject: Re: Re: [patch] optional new raw sha1 implemetation

On Sun, Jun 17, 2012 at 10:00:44AM -0500, 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.

The path isn't hot, so it's not important, I just like the way it
looks. I don't mind if you want to change it.

I'm ocd about making code line up nicely ;-)

> 
> +  strrchr((char*)key, 0x80) = 0;

You missed the deref I think, but that should work if you prefer it.

> 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.

Yep, that sounds fine too.

Tavis.

-- 
-------------------------------------
taviso@...xchg8b.com | pgp encrypted mail preferred
-------------------------------------------------------

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.