crypto: ctr - Use chainiv on raw counter mode
authorHerbert Xu <herbert@gondor.apana.org.au>
Thu, 13 Aug 2009 13:10:39 +0000 (23:10 +1000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 13 Aug 2009 13:10:39 +0000 (23:10 +1000)
Raw counter mode only works with chainiv, which is no longer
the default IV generator on SMP machines.  This broke raw counter
mode as it can no longer instantiate as a givcipher.

This patch fixes it by always picking chainiv on raw counter
mode.  This is based on the diagnosis and a patch by Huang
Ying.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/ctr.c

index 2d7425f0e7b816d9c236aae7bc635ab8f9145888..6c3bfabb9d1d1b7a54a675373b66d46b70310e32 100644 (file)
@@ -219,6 +219,8 @@ static struct crypto_instance *crypto_ctr_alloc(struct rtattr **tb)
        inst->alg.cra_blkcipher.encrypt = crypto_ctr_crypt;
        inst->alg.cra_blkcipher.decrypt = crypto_ctr_crypt;
 
+       inst->alg.cra_blkcipher.geniv = "chainiv";
+
 out:
        crypto_mod_put(alg);
        return inst;