]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
crypto: blkcipher - Do not use eseqiv on stream ciphers
authorHerbert Xu <herbert@gondor.apana.org.au>
Fri, 14 Aug 2009 12:55:35 +0000 (22:55 +1000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 14 Aug 2009 12:58:18 +0000 (22:58 +1000)
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>
crypto/ablkcipher.c

index 03fb5facf0b4925dc7e2a2bd5f5bae17cde976d7..f6f08336df5dda1889e1dd46135cef2eb12bb3d7 100644 (file)
@@ -183,6 +183,12 @@ EXPORT_SYMBOL_GPL(crypto_givcipher_type);
 
 const char *crypto_default_geniv(const struct crypto_alg *alg)
 {
+       if (((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) ==
+            CRYPTO_ALG_TYPE_BLKCIPHER ? alg->cra_blkcipher.ivsize :
+                                        alg->cra_ablkcipher.ivsize) !=
+           alg->cra_blocksize)
+               return "chainiv";
+
        return alg->cra_flags & CRYPTO_ALG_ASYNC ?
               "eseqiv" : skcipher_default_geniv;
 }