From: Ludovic Desroches Date: Tue, 7 Apr 2015 09:45:04 +0000 (+0800) Subject: crypto: atmel-sha - correct the way data are split X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=0099286b664493c85f0f2248f09f3b467a0e3a78;p=linux-beck.git crypto: atmel-sha - correct the way data are split When a hash is requested on data bigger than the buffer allocated by the SHA driver, the way DMA transfers are performed is quite strange: The buffer is filled at each update request. When full, a DMA transfer is done. On next update request, another DMA transfer is done. Then we wait to have a full buffer (or the end of the data) to perform the dma transfer. Such a situation lead sometimes, on SAMA5D4, to a case where dma transfer is finished but the data ready irq never comes. Moreover hash was incorrect in this case. With this patch, dma transfers are only performed when the buffer is full or when there is no more data. So it removes the transfer whose size is equal the update size after the full buffer transmission. Signed-off-by: Ludovic Desroches Signed-off-by: Leilei Zhao Acked-by: Nicolas Ferre Signed-off-by: Herbert Xu --- diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c index f1a00aa944eb..215858a829c3 100644 --- a/drivers/crypto/atmel-sha.c +++ b/drivers/crypto/atmel-sha.c @@ -529,7 +529,7 @@ static int atmel_sha_update_dma_slow(struct atmel_sha_dev *dd) if (final) atmel_sha_fill_padding(ctx, 0); - if (final || (ctx->bufcnt == ctx->buflen && ctx->total)) { + if (final || (ctx->bufcnt == ctx->buflen)) { count = ctx->bufcnt; ctx->bufcnt = 0; return atmel_sha_xmit_dma_map(dd, ctx, count, final);