Skip to content

Commit 1f6151b

Browse files
toromanoSTMgregkh
authored andcommitted
crypto: stm32/cryp - fix lrw chaining mode
[ Upstream commit fa97dc2 ] This fixes the lrw autotest if lrw uses the CRYP as the AES block cipher provider (as ecb(aes)). At end of request, CRYP should not update the IV in case of ECB chaining mode. Indeed the ECB chaining mode never uses the IV, but the software LRW chaining mode uses the IV field as a counter and due to the (unexpected) update done by CRYP while the AES block process, the counter get a wrong value when the IV overflow. Fixes: 5f49f18 ("crypto: stm32/cryp - update to return iv_out") 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>
1 parent 2bd40e3 commit 1f6151b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎drivers/crypto/stm32/stm32-cryp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ static void stm32_cryp_finish_req(struct stm32_cryp *cryp, int err)
644644
/* Phase 4 : output tag */
645645
err = stm32_cryp_read_auth_tag(cryp);
646646

647-
if (!err && (!(is_gcm(cryp) || is_ccm(cryp))))
647+
if (!err && (!(is_gcm(cryp) || is_ccm(cryp) || is_ecb(cryp))))
648648
stm32_cryp_get_iv(cryp);
649649

650650
if (cryp->sgs_copied) {

0 commit comments

Comments
 (0)