summaryrefslogtreecommitdiff
path: root/drivers/crypto/nx/nx-sha512.c
diff options
context:
space:
mode:
authorMarcelo Cerri <mhcerri@linux.vnet.ibm.com>2013-08-29 18:36:40 +0400
committerHerbert Xu <herbert@gondor.apana.org.au>2013-09-02 14:32:56 +0400
commit069fa0453f9dc86fd97dd5b3f5fda4724ed5ff69 (patch)
tree7ceed83003c64dd51c5a99fafef144bf8320e124 /drivers/crypto/nx/nx-sha512.c
parentdec0ed6c1b2c8c2aa37c04feccaf4784764c95f1 (diff)
downloadlinux-069fa0453f9dc86fd97dd5b3f5fda4724ed5ff69.tar.xz
crypto: nx - fix SHA-2 for chunks bigger than block size
Each call to the co-processor, with exception of the last call, needs to send data that is multiple of block size. As consequence, any remaining data is kept in the internal NX context. This patch fixes a bug in the driver that causes it to save incorrect data into the context when data is bigger than the block size. Reviewed-by: Joy Latten <jmlatten@linux.vnet.ibm.com> Signed-off-by: Marcelo Cerri <mhcerri@linux.vnet.ibm.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/nx/nx-sha512.c')
-rw-r--r--drivers/crypto/nx/nx-sha512.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/crypto/nx/nx-sha512.c b/drivers/crypto/nx/nx-sha512.c
index 236e6afeab10..4ae5b0f221d5 100644
--- a/drivers/crypto/nx/nx-sha512.c
+++ b/drivers/crypto/nx/nx-sha512.c
@@ -131,7 +131,7 @@ static int nx_sha512_update(struct shash_desc *desc, const u8 *data,
NX_CPB_FDM(csbcpb) |= NX_FDM_CONTINUATION;
total -= to_process;
- data += to_process;
+ data += to_process - sctx->count[0];
sctx->count[0] = 0;
in_sg = nx_ctx->in_sg;
} while (leftover >= SHA512_BLOCK_SIZE);