Skip to content

Commit 63b5ac2

Browse files
committed
crypto: blkcipher - Do not use eseqiv on stream ciphers
Recently we switched to using eseqiv on SMP machines in preference over chainiv. However, eseqiv does not support stream ciphers so they should still default to chainiv. This patch applies the same check as done by eseqiv to weed out the stream ciphers. In particular, all algorithms where the IV size is not equal to the block size will now default to chainiv. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent aef2713 commit 63b5ac2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

crypto/ablkcipher.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,12 @@ EXPORT_SYMBOL_GPL(crypto_givcipher_type);
183183

184184
const char *crypto_default_geniv(const struct crypto_alg *alg)
185185
{
186+
if (((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) ==
187+
CRYPTO_ALG_TYPE_BLKCIPHER ? alg->cra_blkcipher.ivsize :
188+
alg->cra_ablkcipher.ivsize) !=
189+
alg->cra_blocksize)
190+
return "chainiv";
191+
186192
return alg->cra_flags & CRYPTO_ALG_ASYNC ?
187193
"eseqiv" : skcipher_default_geniv;
188194
}

0 commit comments

Comments
 (0)