aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crypto/ablkcipher.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c
index 43fc8fb9f978..03fb5facf0b4 100644
--- a/crypto/ablkcipher.c
+++ b/crypto/ablkcipher.c
@@ -14,6 +14,7 @@
14 */ 14 */
15 15
16#include <crypto/internal/skcipher.h> 16#include <crypto/internal/skcipher.h>
17#include <linux/cpumask.h>
17#include <linux/err.h> 18#include <linux/err.h>
18#include <linux/init.h> 19#include <linux/init.h>
19#include <linux/kernel.h> 20#include <linux/kernel.h>
@@ -25,6 +26,8 @@
25 26
26#include "internal.h" 27#include "internal.h"
27 28
29static const char *skcipher_default_geniv __read_mostly;
30
28static int setkey_unaligned(struct crypto_ablkcipher *tfm, const u8 *key, 31static int setkey_unaligned(struct crypto_ablkcipher *tfm, const u8 *key,
29 unsigned int keylen) 32 unsigned int keylen)
30{ 33{
@@ -180,7 +183,8 @@ EXPORT_SYMBOL_GPL(crypto_givcipher_type);
180 183
181const char *crypto_default_geniv(const struct crypto_alg *alg) 184const char *crypto_default_geniv(const struct crypto_alg *alg)
182{ 185{
183 return alg->cra_flags & CRYPTO_ALG_ASYNC ? "eseqiv" : "chainiv"; 186 return alg->cra_flags & CRYPTO_ALG_ASYNC ?
187 "eseqiv" : skcipher_default_geniv;
184} 188}
185 189
186static int crypto_givcipher_default(struct crypto_alg *alg, u32 type, u32 mask) 190static int crypto_givcipher_default(struct crypto_alg *alg, u32 type, u32 mask)
@@ -361,3 +365,17 @@ err:
361 return ERR_PTR(err); 365 return ERR_PTR(err);
362} 366}
363EXPORT_SYMBOL_GPL(crypto_alloc_ablkcipher); 367EXPORT_SYMBOL_GPL(crypto_alloc_ablkcipher);
368
369static int __init skcipher_module_init(void)
370{
371 skcipher_default_geniv = num_possible_cpus() > 1 ?
372 "eseqiv" : "chainiv";
373 return 0;
374}
375
376static void skcipher_module_exit(void)
377{
378}
379
380module_init(skcipher_module_init);
381module_exit(skcipher_module_exit);