]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: atmel-sha - fix error handling when setting hmac key
authorEric Biggers <ebiggers@google.com>
Tue, 31 Dec 2019 03:19:33 +0000 (21:19 -0600)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 9 Jan 2020 03:30:52 +0000 (11:30 +0800)
commit005499ab5725a70c6bfa11ba5e2a95da30c410f0
tree8f2ad13aee56ee35f00ba823fd338482c7fad9cd
parentd303029597e5817ee1866f4890fb03bac073b468
crypto: atmel-sha - fix error handling when setting hmac key

HMAC keys can be of any length, and atmel_sha_hmac_key_set() can only
fail due to -ENOMEM.  But atmel_sha_hmac_setkey() incorrectly treated
any error as a "bad key length" error.  Fix it to correctly propagate
the -ENOMEM error code and not set any tfm result flags.

Fixes: d7efe98bade3 ("crypto: atmel-sha - add support to hmac(shaX)")
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Ludovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/atmel-sha.c