diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2008-02-22 22:12:06 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2008-02-22 22:12:06 -0500 |
commit | 76fc60a2e3c6aa6e98cd3a5cb81a1855c637b274 (patch) | |
tree | ab29e31b06045971853ff58bb6fabd6d40fd23c8 | |
parent | c8620c2590f43eff864fe597fcbe5b72ab7a7b94 (diff) |
[CRYPTO] skcipher: Move chainiv/seqiv into crypto_blkcipher module
For compatibility with dm-crypt initramfs setups it is useful to merge
chainiv/seqiv into the crypto_blkcipher module. Since they're required
by most algorithms anyway this is an acceptable trade-off.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | crypto/Makefile | 4 | ||||
-rw-r--r-- | crypto/ablkcipher.c | 3 | ||||
-rw-r--r-- | crypto/blkcipher.c | 29 | ||||
-rw-r--r-- | crypto/chainiv.c | 12 | ||||
-rw-r--r-- | crypto/eseqiv.c | 12 | ||||
-rw-r--r-- | include/crypto/internal/skcipher.h | 6 |
6 files changed, 45 insertions, 21 deletions
diff --git a/crypto/Makefile b/crypto/Makefile index 48c758379954..7cf36253a75e 100644 --- a/crypto/Makefile +++ b/crypto/Makefile | |||
@@ -12,9 +12,9 @@ obj-$(CONFIG_CRYPTO_AEAD) += aead.o | |||
12 | 12 | ||
13 | crypto_blkcipher-objs := ablkcipher.o | 13 | crypto_blkcipher-objs := ablkcipher.o |
14 | crypto_blkcipher-objs += blkcipher.o | 14 | crypto_blkcipher-objs += blkcipher.o |
15 | crypto_blkcipher-objs += chainiv.o | ||
16 | crypto_blkcipher-objs += eseqiv.o | ||
15 | obj-$(CONFIG_CRYPTO_BLKCIPHER) += crypto_blkcipher.o | 17 | obj-$(CONFIG_CRYPTO_BLKCIPHER) += crypto_blkcipher.o |
16 | obj-$(CONFIG_CRYPTO_BLKCIPHER) += chainiv.o | ||
17 | obj-$(CONFIG_CRYPTO_BLKCIPHER) += eseqiv.o | ||
18 | obj-$(CONFIG_CRYPTO_SEQIV) += seqiv.o | 18 | obj-$(CONFIG_CRYPTO_SEQIV) += seqiv.o |
19 | 19 | ||
20 | crypto_hash-objs := hash.o | 20 | crypto_hash-objs := hash.o |
diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c index 3bcb099b4a85..94140b3756fc 100644 --- a/crypto/ablkcipher.c +++ b/crypto/ablkcipher.c | |||
@@ -341,6 +341,3 @@ err: | |||
341 | return ERR_PTR(err); | 341 | return ERR_PTR(err); |
342 | } | 342 | } |
343 | EXPORT_SYMBOL_GPL(crypto_alloc_ablkcipher); | 343 | EXPORT_SYMBOL_GPL(crypto_alloc_ablkcipher); |
344 | |||
345 | MODULE_LICENSE("GPL"); | ||
346 | MODULE_DESCRIPTION("Asynchronous block chaining cipher type"); | ||
diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c index 4a7e65c4df4d..185f955fb0d7 100644 --- a/crypto/blkcipher.c +++ b/crypto/blkcipher.c | |||
@@ -696,5 +696,34 @@ void skcipher_geniv_exit(struct crypto_tfm *tfm) | |||
696 | } | 696 | } |
697 | EXPORT_SYMBOL_GPL(skcipher_geniv_exit); | 697 | EXPORT_SYMBOL_GPL(skcipher_geniv_exit); |
698 | 698 | ||
699 | static 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 | |||
711 | out: | ||
712 | return err; | ||
713 | |||
714 | eseqiv_err: | ||
715 | chainiv_module_exit(); | ||
716 | goto out; | ||
717 | } | ||
718 | |||
719 | static void __exit blkcipher_module_exit(void) | ||
720 | { | ||
721 | eseqiv_module_exit(); | ||
722 | chainiv_module_exit(); | ||
723 | } | ||
724 | |||
725 | module_init(blkcipher_module_init); | ||
726 | module_exit(blkcipher_module_exit); | ||
727 | |||
699 | MODULE_LICENSE("GPL"); | 728 | MODULE_LICENSE("GPL"); |
700 | MODULE_DESCRIPTION("Generic block chaining cipher type"); | 729 | MODULE_DESCRIPTION("Generic block chaining cipher type"); |
diff --git a/crypto/chainiv.c b/crypto/chainiv.c index d17fa0454dc3..0a7cac6e9089 100644 --- a/crypto/chainiv.c +++ b/crypto/chainiv.c | |||
@@ -314,18 +314,14 @@ static struct crypto_template chainiv_tmpl = { | |||
314 | .module = THIS_MODULE, | 314 | .module = THIS_MODULE, |
315 | }; | 315 | }; |
316 | 316 | ||
317 | static int __init chainiv_module_init(void) | 317 | int __init chainiv_module_init(void) |
318 | { | 318 | { |
319 | return crypto_register_template(&chainiv_tmpl); | 319 | return crypto_register_template(&chainiv_tmpl); |
320 | } | 320 | } |
321 | EXPORT_SYMBOL_GPL(chainiv_module_init); | ||
321 | 322 | ||
322 | static void __exit chainiv_module_exit(void) | 323 | void __exit chainiv_module_exit(void) |
323 | { | 324 | { |
324 | crypto_unregister_template(&chainiv_tmpl); | 325 | crypto_unregister_template(&chainiv_tmpl); |
325 | } | 326 | } |
326 | 327 | EXPORT_SYMBOL_GPL(chainiv_module_exit); | |
327 | module_init(chainiv_module_init); | ||
328 | module_exit(chainiv_module_exit); | ||
329 | |||
330 | MODULE_LICENSE("GPL"); | ||
331 | MODULE_DESCRIPTION("Chain IV Generator"); | ||
diff --git a/crypto/eseqiv.c b/crypto/eseqiv.c index eb90d27ae118..6f2cd063b6fe 100644 --- a/crypto/eseqiv.c +++ b/crypto/eseqiv.c | |||
@@ -247,18 +247,14 @@ static struct crypto_template eseqiv_tmpl = { | |||
247 | .module = THIS_MODULE, | 247 | .module = THIS_MODULE, |
248 | }; | 248 | }; |
249 | 249 | ||
250 | static int __init eseqiv_module_init(void) | 250 | int __init eseqiv_module_init(void) |
251 | { | 251 | { |
252 | return crypto_register_template(&eseqiv_tmpl); | 252 | return crypto_register_template(&eseqiv_tmpl); |
253 | } | 253 | } |
254 | EXPORT_SYMBOL_GPL(eseqiv_module_init); | ||
254 | 255 | ||
255 | static void __exit eseqiv_module_exit(void) | 256 | void __exit eseqiv_module_exit(void) |
256 | { | 257 | { |
257 | crypto_unregister_template(&eseqiv_tmpl); | 258 | crypto_unregister_template(&eseqiv_tmpl); |
258 | } | 259 | } |
259 | 260 | EXPORT_SYMBOL_GPL(eseqiv_module_exit); | |
260 | module_init(eseqiv_module_init); | ||
261 | module_exit(eseqiv_module_exit); | ||
262 | |||
263 | MODULE_LICENSE("GPL"); | ||
264 | MODULE_DESCRIPTION("Encrypted Sequence Number IV Generator"); | ||
diff --git a/include/crypto/internal/skcipher.h b/include/crypto/internal/skcipher.h index 2ba42cd7d6aa..a8f12644a13c 100644 --- a/include/crypto/internal/skcipher.h +++ b/include/crypto/internal/skcipher.h | |||
@@ -15,6 +15,7 @@ | |||
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> | ||
18 | #include <linux/types.h> | 19 | #include <linux/types.h> |
19 | 20 | ||
20 | struct rtattr; | 21 | struct rtattr; |
@@ -64,6 +65,11 @@ void skcipher_geniv_free(struct crypto_instance *inst); | |||
64 | int skcipher_geniv_init(struct crypto_tfm *tfm); | 65 | int skcipher_geniv_init(struct crypto_tfm *tfm); |
65 | void skcipher_geniv_exit(struct crypto_tfm *tfm); | 66 | void skcipher_geniv_exit(struct crypto_tfm *tfm); |
66 | 67 | ||
68 | int __init eseqiv_module_init(void); | ||
69 | void __exit eseqiv_module_exit(void); | ||
70 | int __init chainiv_module_init(void); | ||
71 | void __exit chainiv_module_exit(void); | ||
72 | |||
67 | static inline struct crypto_ablkcipher *skcipher_geniv_cipher( | 73 | static inline struct crypto_ablkcipher *skcipher_geniv_cipher( |
68 | struct crypto_ablkcipher *geniv) | 74 | struct crypto_ablkcipher *geniv) |
69 | { | 75 | { |