Re: [PATCH] sha1dc: fix issues with a big endian platform

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Junio,

On Wed, 17 May 2017, Junio C Hamano wrote:

> diff --git a/sha1dc/sha1.c b/sha1dc/sha1.c
> index 35e9dd5bf4..ae25318c47 100644
> --- a/sha1dc/sha1.c
> +++ b/sha1dc/sha1.c
> @@ -20,7 +20,7 @@
>   */
>  #if (defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || \
>      (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __BIG_ENDIAN__)) || \
> -    defined(__BIG_ENDIAN__) || defined(__ARMEB__) || defined(__THUMBEB__) ||  defined(__AARCH64EB__) || \
> +    defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN__) || defined(__ARMEB__) || defined(__THUMBEB__) ||  defined(__AARCH64EB__) || \
>      defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__)
>  
>  #define SHA1DC_BIGENDIAN	1
> @@ -1728,7 +1728,8 @@ void SHA1DCUpdate(SHA1_CTX* ctx, const char* buf, size_t len)
>  	while (len >= 64)
>  	{
>  		ctx->total += 64;
> -		sha1_process(ctx, (uint32_t*)(buf));
> +		memcpy(ctx->buffer, buf, 64);
> +		sha1_process(ctx, (uint32_t*)(ctx->buffer));
>  		buf += 64;

There is actually a discussion going on about this. See

https://github.com/cr-marcstevens/sha1collisiondetection/commit/33a694a9ee1b79c24be45f9eab5ac0e1aeeaf271#commitcomment-22158243

for details.

The fixup commit under discussion is here:

https://github.com/cr-marcstevens/sha1collisiondetection/commit/40f07a0c12d525b24ac1235ee8a81bbf33957ca5

Ciao,
dscho



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]