Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: inside-secure - fix the sha state length in hmac_sha1_setkey

A check is performed on the ipad/opad in the safexcel_hmac_sha1_setkey
function, but the index used by the loop doing it is wrong. It is
currently the size of the state array while it should be the size of a
sha1 state. This patch fixes it.

Fixes: 1b44c5a60c13 ("crypto: inside-secure - add SafeXcel EIP197 crypto engine driver")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Antoine Ténart and committed by
Herbert Xu
60c4081e 42ef3bed

+1 -1
+1 -1
drivers/crypto/inside-secure/safexcel_hash.c
··· 883 883 if (ret) 884 884 return ret; 885 885 886 - for (i = 0; i < ARRAY_SIZE(istate.state); i++) { 886 + for (i = 0; i < SHA1_DIGEST_SIZE / sizeof(u32); i++) { 887 887 if (ctx->ipad[i] != le32_to_cpu(istate.state[i]) || 888 888 ctx->opad[i] != le32_to_cpu(ostate.state[i])) { 889 889 ctx->base.needs_inv = true;