summaryrefslogtreecommitdiff
path: root/drivers/crypto/allwinner/sun4i-ss
diff options
context:
space:
mode:
authorCorentin Labbe <clabbe.montjoie@gmail.com>2019-11-14 11:58:13 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2019-11-22 18:48:37 +0800
commit626abd3125e02d75e26f3cd2e2aa4a6fb74507b5 (patch)
treee7ae4f8d9f65d0576aeb5736a8fa32d0e9405804 /drivers/crypto/allwinner/sun4i-ss
parent7ca2a71d177f51d1d0d339657d3b0cc988d1518e (diff)
crypto: sun4i-ss - use crypto_ahash_digestsize
The size of the digest is different between MD5 and SHA1 so instead of using the higher value (5 words), let's use crypto_ahash_digestsize(). Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/allwinner/sun4i-ss')
-rw-r--r--drivers/crypto/allwinner/sun4i-ss/sun4i-ss-hash.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-hash.c b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-hash.c
index 91cf58db3845..b19dc737dfe3 100644
--- a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-hash.c
+++ b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-hash.c
@@ -227,7 +227,7 @@ static int sun4i_hash(struct ahash_request *areq)
*/
if (op->byte_count) {
ivmode = SS_IV_ARBITRARY;
- for (i = 0; i < 5; i++)
+ for (i = 0; i < crypto_ahash_digestsize(tfm) / 4; i++)
writel(op->hash[i], ss->base + SS_IV0 + i * 4);
}
/* Enable the device */