aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2008-08-17 04:04:30 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2008-08-29 01:50:00 -0400
commit5be5e667a9a5d8d5553e009e67bc692d95e5916a (patch)
treea3a64ea1ec9d303a21319ee72579522a5f42a101
parent1aa4ecd95d8d67d21731a00646326a71295dafa3 (diff)
crypto: skcipher - Move IV generators into their own modules
This patch moves the default IV generators into their own modules in order to break a dependency loop between cryptomgr, rng, and blkcipher. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--crypto/Makefile4
-rw-r--r--crypto/blkcipher.c29
-rw-r--r--crypto/chainiv.c10
-rw-r--r--crypto/eseqiv.c10
-rw-r--r--include/crypto/internal/skcipher.h6
5 files changed, 18 insertions, 41 deletions
diff --git a/crypto/Makefile b/crypto/Makefile
index 59ab5008eb99..256e33e81e3e 100644
--- a/crypto/Makefile
+++ b/crypto/Makefile
@@ -13,9 +13,9 @@ obj-$(CONFIG_CRYPTO_AEAD) += aead.o
13 13
14crypto_blkcipher-objs := ablkcipher.o 14crypto_blkcipher-objs := ablkcipher.o
15crypto_blkcipher-objs += blkcipher.o 15crypto_blkcipher-objs += blkcipher.o
16crypto_blkcipher-objs += chainiv.o
17crypto_blkcipher-objs += eseqiv.o
18obj-$(CONFIG_CRYPTO_BLKCIPHER) += crypto_blkcipher.o 16obj-$(CONFIG_CRYPTO_BLKCIPHER) += crypto_blkcipher.o
17obj-$(CONFIG_CRYPTO_BLKCIPHER) += chainiv.o
18obj-$(CONFIG_CRYPTO_BLKCIPHER) += eseqiv.o
19obj-$(CONFIG_CRYPTO_SEQIV) += seqiv.o 19obj-$(CONFIG_CRYPTO_SEQIV) += seqiv.o
20 20
21crypto_hash-objs := hash.o 21crypto_hash-objs := hash.o
diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c
index 185f955fb0d7..4a7e65c4df4d 100644
--- a/crypto/blkcipher.c
+++ b/crypto/blkcipher.c
@@ -696,34 +696,5 @@ void skcipher_geniv_exit(struct crypto_tfm *tfm)
696} 696}
697EXPORT_SYMBOL_GPL(skcipher_geniv_exit); 697EXPORT_SYMBOL_GPL(skcipher_geniv_exit);
698 698
699static int __init blkcipher_module_init(void)
700{
701 int err;
702
703 err = chainiv_module_init();
704 if (err)
705 goto out;
706
707 err = eseqiv_module_init();
708 if (err)
709 goto eseqiv_err;
710
711out:
712 return err;
713
714eseqiv_err:
715 chainiv_module_exit();
716 goto out;
717}
718
719static void __exit blkcipher_module_exit(void)
720{
721 eseqiv_module_exit();
722 chainiv_module_exit();
723}
724
725module_init(blkcipher_module_init);
726module_exit(blkcipher_module_exit);
727
728MODULE_LICENSE("GPL"); 699MODULE_LICENSE("GPL");
729MODULE_DESCRIPTION("Generic block chaining cipher type"); 700MODULE_DESCRIPTION("Generic block chaining cipher type");
diff --git a/crypto/chainiv.c b/crypto/chainiv.c
index 9affadee3287..cf68d4365347 100644
--- a/crypto/chainiv.c
+++ b/crypto/chainiv.c
@@ -320,12 +320,18 @@ static struct crypto_template chainiv_tmpl = {
320 .module = THIS_MODULE, 320 .module = THIS_MODULE,
321}; 321};
322 322
323int __init chainiv_module_init(void) 323static int __init chainiv_module_init(void)
324{ 324{
325 return crypto_register_template(&chainiv_tmpl); 325 return crypto_register_template(&chainiv_tmpl);
326} 326}
327 327
328void chainiv_module_exit(void) 328static void chainiv_module_exit(void)
329{ 329{
330 crypto_unregister_template(&chainiv_tmpl); 330 crypto_unregister_template(&chainiv_tmpl);
331} 331}
332
333module_init(chainiv_module_init);
334module_exit(chainiv_module_exit);
335
336MODULE_LICENSE("GPL");
337MODULE_DESCRIPTION("Chain IV Generator");
diff --git a/crypto/eseqiv.c b/crypto/eseqiv.c
index 881d30910434..f5def217a8f1 100644
--- a/crypto/eseqiv.c
+++ b/crypto/eseqiv.c
@@ -248,12 +248,18 @@ static struct crypto_template eseqiv_tmpl = {
248 .module = THIS_MODULE, 248 .module = THIS_MODULE,
249}; 249};
250 250
251int __init eseqiv_module_init(void) 251static int __init eseqiv_module_init(void)
252{ 252{
253 return crypto_register_template(&eseqiv_tmpl); 253 return crypto_register_template(&eseqiv_tmpl);
254} 254}
255 255
256void __exit eseqiv_module_exit(void) 256static void __exit eseqiv_module_exit(void)
257{ 257{
258 crypto_unregister_template(&eseqiv_tmpl); 258 crypto_unregister_template(&eseqiv_tmpl);
259} 259}
260
261module_init(eseqiv_module_init);
262module_exit(eseqiv_module_exit);
263
264MODULE_LICENSE("GPL");
265MODULE_DESCRIPTION("Encrypted Sequence Number IV Generator");
diff --git a/include/crypto/internal/skcipher.h b/include/crypto/internal/skcipher.h
index ccc32bad9a89..2ba42cd7d6aa 100644
--- a/include/crypto/internal/skcipher.h
+++ b/include/crypto/internal/skcipher.h
@@ -15,7 +15,6 @@
15 15
16#include <crypto/algapi.h> 16#include <crypto/algapi.h>
17#include <crypto/skcipher.h> 17#include <crypto/skcipher.h>
18#include <linux/init.h>
19#include <linux/types.h> 18#include <linux/types.h>
20 19
21struct rtattr; 20struct rtattr;
@@ -65,11 +64,6 @@ void skcipher_geniv_free(struct crypto_instance *inst);
65int skcipher_geniv_init(struct crypto_tfm *tfm); 64int skcipher_geniv_init(struct crypto_tfm *tfm);
66void skcipher_geniv_exit(struct crypto_tfm *tfm); 65void skcipher_geniv_exit(struct crypto_tfm *tfm);
67 66
68int __init eseqiv_module_init(void);
69void __exit eseqiv_module_exit(void);
70int __init chainiv_module_init(void);
71void chainiv_module_exit(void);
72
73static inline struct crypto_ablkcipher *skcipher_geniv_cipher( 67static inline struct crypto_ablkcipher *skcipher_geniv_cipher(
74 struct crypto_ablkcipher *geniv) 68 struct crypto_ablkcipher *geniv)
75{ 69{