diff options
Diffstat (limited to 'crypto/ablkcipher.c')
-rw-r--r-- | crypto/ablkcipher.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c index 40886c4..7d4a8d2 100644 --- a/crypto/ablkcipher.c +++ b/crypto/ablkcipher.c @@ -16,7 +16,9 @@ #include <crypto/internal/skcipher.h> #include <linux/cpumask.h> #include <linux/err.h> +#include <linux/init.h> #include <linux/kernel.h> +#include <linux/module.h> #include <linux/rtnetlink.h> #include <linux/sched.h> #include <linux/slab.h> @@ -28,6 +30,8 @@ #include "internal.h" +static const char *skcipher_default_geniv __read_mostly; + struct ablkcipher_buffer { struct list_head entry; struct scatter_walk dst; @@ -523,7 +527,8 @@ const char *crypto_default_geniv(const struct crypto_alg *alg) alg->cra_blocksize) return "chainiv"; - return "eseqiv"; + return alg->cra_flags & CRYPTO_ALG_ASYNC ? + "eseqiv" : skcipher_default_geniv; } static int crypto_givcipher_default(struct crypto_alg *alg, u32 type, u32 mask) @@ -704,3 +709,17 @@ err: return ERR_PTR(err); } EXPORT_SYMBOL_GPL(crypto_alloc_ablkcipher); + +static int __init skcipher_module_init(void) +{ + skcipher_default_geniv = num_possible_cpus() > 1 ? + "eseqiv" : "chainiv"; + return 0; +} + +static void skcipher_module_exit(void) +{ +} + +module_init(skcipher_module_init); +module_exit(skcipher_module_exit); |