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

crypto: sun8i-ss - Fix a test in sun8i_ss_setup_ivs()

SS_ENCRYPTION is (0 << 7 = 0), so the test can never be true.
Use a direct comparison to SS_ENCRYPTION instead.

The same king of test is already done the same way in sun8i_ss_run_task().

Fixes: 359e893e8af4 ("crypto: sun8i-ss - rework handling of IV")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Christophe JAILLET and committed by
Herbert Xu
8fd91151 482c84e9

+1 -1
+1 -1
drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c
··· 151 151 } 152 152 rctx->p_iv[i] = a; 153 153 /* we need to setup all others IVs only in the decrypt way */ 154 - if (rctx->op_dir & SS_ENCRYPTION) 154 + if (rctx->op_dir == SS_ENCRYPTION) 155 155 return 0; 156 156 todo = min(len, sg_dma_len(sg)); 157 157 len -= todo;