|
|
Message-ID: <20130414123904.GA29391@openwall.com>
Date: Sun, 14 Apr 2013 16:39:04 +0400
From: Solar Designer <solar@...nwall.com>
To: john-dev@...ts.openwall.com
Subject: Re: [patch] sse/xop implementation of raw-sha512
On Sun, Apr 14, 2013 at 04:56:34AM -0700, Jeremi Gosney wrote:
> +static inline void alter_endianity_64 (void *_x, unsigned int size)
> +{
> + uint64_t *x = (uint64_t *) _x;
> + int i;
> +
> + for (i=0; i < (size >> 2); i++)
> + x[i] = __builtin_bswap64 (x[i]);
> +}
Since you're working on uint64_t here, "size >> 2" should probably be
"size >> 3" (or just "size / sizeof(*x)" to keep this line generic).
> +static int binary_hash_0 (void *binary) { return *(uint64_t *) binary & 0xf; }
Your use of uint64_t here requires that binary be 8-byte aligned, but I
think you're only ensuring it is 4-byte aligned. I suggest that you use
uint32_t here. This code will only ever run on little-endian anyway -
well, or at least it needs other changes for AltiVec.
There may be more issues like this, stemming from the code update from
SHA-256 to SHA-512, which turned many things into 64-bit (but not all).
Thanks,
Alexander
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.