]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
crypto: stm32/cryp - fix xts and race condition in crypto_engine requests
authorNicolas Toromanoff <nicolas.toromanoff@foss.st.com>
Tue, 30 Nov 2021 07:54:56 +0000 (08:54 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 7 Mar 2022 15:35:41 +0000 (16:35 +0100)
commit74a96adc117e017fbe35ccd7858bb113833088bb
tree7c024d784d5d44c269242c07c38e4a2bca532c3d
parent10cc4fafb6536ddca5061cd2997f4d71ef7e1b27
crypto: stm32/cryp - fix xts and race condition in crypto_engine requests

BugLink: https://bugs.launchpad.net/bugs/1960566
[ Upstream commit d703c7a994ee34b7fa89baf21631fca0aa9f17fc ]

Don't erase key:
If key is erased before the crypto_finalize_.*_request() call, some
pending process will run with a key={ 0 }.
Moreover if the key is reset at end of request, it breaks xts chaining
mode, as for last xts block (in case input len is not a multiple of
block) a new AES request is started without calling again set_key().

Fixes: 9e054ec21ef8 ("crypto: stm32 - Support for STM32 CRYP crypto module")
Signed-off-by: Nicolas Toromanoff <nicolas.toromanoff@foss.st.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/crypto/stm32/stm32-cryp.c