Commit 626abd31 authored by Corentin Labbe's avatar Corentin Labbe Committed by Herbert Xu

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: default avatarCorentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 7ca2a71d
...@@ -227,7 +227,7 @@ static int sun4i_hash(struct ahash_request *areq) ...@@ -227,7 +227,7 @@ static int sun4i_hash(struct ahash_request *areq)
*/ */
if (op->byte_count) { if (op->byte_count) {
ivmode = SS_IV_ARBITRARY; 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); writel(op->hash[i], ss->base + SS_IV0 + i * 4);
} }
/* Enable the device */ /* Enable the device */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment