Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Jan Glauber <jang@linux.vnet.ibm.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Linux Crypto Mailing List <linux-crypto@vger.kernel.org>
Subject: Re: crypto: sha-s390 - Reset index after processing partial block
Date: Mon, 07 Feb 2011 13:47:07 +0100	[thread overview]
Message-ID: <1297082827.11137.15.camel@bender> (raw)
In-Reply-To: <20110207092817.GA16881@gondor.apana.org.au>

Ouch.

Acked-by: Jan Glauber <jang@linux.vnet.ibm.com>

On Mon, 2011-02-07 at 20:28 +1100, Herbert Xu wrote:
> Hi:
> 
> This patch fixes an old but nasty bug in the sha-s390 code.
> 
> commit 9d20b571f5bda7273656e1b86ef91eddc94adacc
> Author: Herbert Xu <herbert@gondor.apana.org.au>
> Date:   Mon Feb 7 20:26:06 2011 +1100
> 
>     crypto: sha-s390 - Reset index after processing partial block
>     
>     The partial block handling in sha-s390 is broken when we get a
>     partial block that is followed by an update which fills it with
>     bytes left-over.  Instead of storing the newly left-over bytes
>     at the start of the buffer, it will be stored immediately after
>     the previous partial block.
>     
>     This patch fixes this by resetting the index pointer.
>     
>     Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
> 
> diff --git a/arch/s390/crypto/sha_common.c b/arch/s390/crypto/sha_common.c
> index f42dbab..48884f8 100644
> --- a/arch/s390/crypto/sha_common.c
> +++ b/arch/s390/crypto/sha_common.c
> @@ -38,6 +38,7 @@ int s390_sha_update(struct shash_desc *desc, const u8 *data, unsigned int len)
>  		BUG_ON(ret != bsize);
>  		data += bsize - index;
>  		len -= bsize - index;
> +		index = 0;
>  	}
> 
>  	/* process as many blocks as possible */
> 
> Cheers,

  reply	other threads:[~2011-02-07 13:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-07  9:28 crypto: sha-s390 - Reset index after processing partial block Herbert Xu
2011-02-07 12:47 ` Jan Glauber [this message]
2011-02-17  3:25   ` crypto: sha1 - Add test vector to test partial block processing Herbert Xu
2011-02-17 15:11     ` Jan Glauber
2011-02-17 20:52       ` Herbert Xu
2011-02-18  9:37         ` Jan Glauber
2011-02-18  9:43           ` 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=1297082827.11137.15.camel@bender \
    --to=jang@linux.vnet.ibm.com \
    --cc=herbert@gondor.apana.org.au \
    --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