Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Tim Chen <tim.c.chen@linux.intel.com>
To: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Cc: linux-crypto@vger.kernel.org,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH] crypto: sha512_ssse3: fix byte count to bit count conversion
Date: Mon, 23 Jun 2014 09:58:55 -0700	[thread overview]
Message-ID: <1403542735.2970.604.camel@schen9-DESK> (raw)
In-Reply-To: <20140623164105.13319.42220.stgit@localhost6.localdomain6>

Thanks for catching this.

Should propagate this patch to stable kernels 3.14, 3.12 and 3.10 too.

Acked-by: Tim Chen <tim.c.chen@linux.intel.com>

On Mon, 2014-06-23 at 19:41 +0300, Jussi Kivilinna wrote:
> Byte-to-bit-count computation is only partly converted to big-endian and is
> mixing in CPU-endian values. Problem was noticed by sparce with warning:
> 
>   CHECK   arch/x86/crypto/sha512_ssse3_glue.c
> arch/x86/crypto/sha512_ssse3_glue.c:144:19: warning: restricted __be64 degrades to integer
> arch/x86/crypto/sha512_ssse3_glue.c:144:17: warning: incorrect type in assignment (different base types)
> arch/x86/crypto/sha512_ssse3_glue.c:144:17:    expected restricted __be64 <noident>
> arch/x86/crypto/sha512_ssse3_glue.c:144:17:    got unsigned long long
> 
> Cc: Tim Chen <tim.c.chen@linux.intel.com>
> Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
> ---
>  arch/x86/crypto/sha512_ssse3_glue.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/crypto/sha512_ssse3_glue.c b/arch/x86/crypto/sha512_ssse3_glue.c
> index f30cd10..8626b03 100644
> --- a/arch/x86/crypto/sha512_ssse3_glue.c
> +++ b/arch/x86/crypto/sha512_ssse3_glue.c
> @@ -141,7 +141,7 @@ static int sha512_ssse3_final(struct shash_desc *desc, u8 *out)
>  
>  	/* save number of bits */
>  	bits[1] = cpu_to_be64(sctx->count[0] << 3);
> -	bits[0] = cpu_to_be64(sctx->count[1] << 3) | sctx->count[0] >> 61;
> +	bits[0] = cpu_to_be64(sctx->count[1] << 3 | sctx->count[0] >> 61);
>  
>  	/* Pad out to 112 mod 128 and append length */
>  	index = sctx->count[0] & 0x7f;
> 

  reply	other threads:[~2014-06-23 16:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-23 16:41 [PATCH] crypto: sha512_ssse3: fix byte count to bit count conversion Jussi Kivilinna
2014-06-23 16:58 ` Tim Chen [this message]
2014-06-25 13:56 ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1403542735.2970.604.camel@schen9-DESK \
    --to=tim.c.chen@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=jussi.kivilinna@iki.fi \
    --cc=linux-crypto@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox