Commit 5be5e667a9a5d8d5553e009e67bc692d95e5916a
1 parent
1aa4ecd95d
Exists in
master
and in
20 other branches
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>
Showing 5 changed files with 18 additions and 41 deletions Side-by-side Diff
crypto/Makefile
... | ... | @@ -13,9 +13,9 @@ |
13 | 13 | |
14 | 14 | crypto_blkcipher-objs := ablkcipher.o |
15 | 15 | crypto_blkcipher-objs += blkcipher.o |
16 | -crypto_blkcipher-objs += chainiv.o | |
17 | -crypto_blkcipher-objs += eseqiv.o | |
18 | 16 | obj-$(CONFIG_CRYPTO_BLKCIPHER) += crypto_blkcipher.o |
17 | +obj-$(CONFIG_CRYPTO_BLKCIPHER) += chainiv.o | |
18 | +obj-$(CONFIG_CRYPTO_BLKCIPHER) += eseqiv.o | |
19 | 19 | obj-$(CONFIG_CRYPTO_SEQIV) += seqiv.o |
20 | 20 | |
21 | 21 | crypto_hash-objs := hash.o |
crypto/blkcipher.c
... | ... | @@ -696,35 +696,6 @@ |
696 | 696 | } |
697 | 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 | - | |
728 | 699 | MODULE_LICENSE("GPL"); |
729 | 700 | MODULE_DESCRIPTION("Generic block chaining cipher type"); |
crypto/chainiv.c
... | ... | @@ -320,13 +320,19 @@ |
320 | 320 | .module = THIS_MODULE, |
321 | 321 | }; |
322 | 322 | |
323 | -int __init chainiv_module_init(void) | |
323 | +static int __init chainiv_module_init(void) | |
324 | 324 | { |
325 | 325 | return crypto_register_template(&chainiv_tmpl); |
326 | 326 | } |
327 | 327 | |
328 | -void chainiv_module_exit(void) | |
328 | +static void chainiv_module_exit(void) | |
329 | 329 | { |
330 | 330 | crypto_unregister_template(&chainiv_tmpl); |
331 | 331 | } |
332 | + | |
333 | +module_init(chainiv_module_init); | |
334 | +module_exit(chainiv_module_exit); | |
335 | + | |
336 | +MODULE_LICENSE("GPL"); | |
337 | +MODULE_DESCRIPTION("Chain IV Generator"); |
crypto/eseqiv.c
... | ... | @@ -248,13 +248,19 @@ |
248 | 248 | .module = THIS_MODULE, |
249 | 249 | }; |
250 | 250 | |
251 | -int __init eseqiv_module_init(void) | |
251 | +static int __init eseqiv_module_init(void) | |
252 | 252 | { |
253 | 253 | return crypto_register_template(&eseqiv_tmpl); |
254 | 254 | } |
255 | 255 | |
256 | -void __exit eseqiv_module_exit(void) | |
256 | +static void __exit eseqiv_module_exit(void) | |
257 | 257 | { |
258 | 258 | crypto_unregister_template(&eseqiv_tmpl); |
259 | 259 | } |
260 | + | |
261 | +module_init(eseqiv_module_init); | |
262 | +module_exit(eseqiv_module_exit); | |
263 | + | |
264 | +MODULE_LICENSE("GPL"); | |
265 | +MODULE_DESCRIPTION("Encrypted Sequence Number IV Generator"); |
include/crypto/internal/skcipher.h
... | ... | @@ -15,7 +15,6 @@ |
15 | 15 | |
16 | 16 | #include <crypto/algapi.h> |
17 | 17 | #include <crypto/skcipher.h> |
18 | -#include <linux/init.h> | |
19 | 18 | #include <linux/types.h> |
20 | 19 | |
21 | 20 | struct rtattr; |
... | ... | @@ -64,11 +63,6 @@ |
64 | 63 | void skcipher_geniv_free(struct crypto_instance *inst); |
65 | 64 | int skcipher_geniv_init(struct crypto_tfm *tfm); |
66 | 65 | void skcipher_geniv_exit(struct crypto_tfm *tfm); |
67 | - | |
68 | -int __init eseqiv_module_init(void); | |
69 | -void __exit eseqiv_module_exit(void); | |
70 | -int __init chainiv_module_init(void); | |
71 | -void chainiv_module_exit(void); | |
72 | 66 | |
73 | 67 | static inline struct crypto_ablkcipher *skcipher_geniv_cipher( |
74 | 68 | struct crypto_ablkcipher *geniv) |