diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-11 01:01:27 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-11 01:01:27 -0500 |
commit | 4f58cb90bcb04cfe18f524d1c9a65edef5eb3f51 (patch) | |
tree | 8c686e8b736eed7258921909282c0955543c7d2f /crypto/algapi.c | |
parent | e7691a1ce341c80ed9504244a36b31c025217391 (diff) | |
parent | 08c70fc3a239475122e20b7a21dfae4c264c24f7 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (54 commits)
crypto: gf128mul - remove leftover "(EXPERIMENTAL)" in Kconfig
crypto: serpent-sse2 - remove unneeded LRW/XTS #ifdefs
crypto: serpent-sse2 - select LRW and XTS
crypto: twofish-x86_64-3way - remove unneeded LRW/XTS #ifdefs
crypto: twofish-x86_64-3way - select LRW and XTS
crypto: xts - remove dependency on EXPERIMENTAL
crypto: lrw - remove dependency on EXPERIMENTAL
crypto: picoxcell - fix boolean and / or confusion
crypto: caam - remove DECO access initialization code
crypto: caam - fix polarity of "propagate error" logic
crypto: caam - more desc.h cleanups
crypto: caam - desc.h - convert spaces to tabs
crypto: talitos - convert talitos_error to struct device
crypto: talitos - remove NO_IRQ references
crypto: talitos - fix bad kfree
crypto: convert drivers/crypto/* to use module_platform_driver()
char: hw_random: convert drivers/char/hw_random/* to use module_platform_driver()
crypto: serpent-sse2 - should select CRYPTO_CRYPTD
crypto: serpent - rename serpent.c to serpent_generic.c
crypto: serpent - cleanup checkpatch errors and warnings
...
Diffstat (limited to 'crypto/algapi.c')
-rw-r--r-- | crypto/algapi.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c index 54dd4e33b5d6..9d4a9fe913f8 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c | |||
@@ -518,6 +518,35 @@ err: | |||
518 | } | 518 | } |
519 | EXPORT_SYMBOL_GPL(crypto_register_instance); | 519 | EXPORT_SYMBOL_GPL(crypto_register_instance); |
520 | 520 | ||
521 | int crypto_unregister_instance(struct crypto_alg *alg) | ||
522 | { | ||
523 | int err; | ||
524 | struct crypto_instance *inst = (void *)alg; | ||
525 | struct crypto_template *tmpl = inst->tmpl; | ||
526 | LIST_HEAD(users); | ||
527 | |||
528 | if (!(alg->cra_flags & CRYPTO_ALG_INSTANCE)) | ||
529 | return -EINVAL; | ||
530 | |||
531 | BUG_ON(atomic_read(&alg->cra_refcnt) != 1); | ||
532 | |||
533 | down_write(&crypto_alg_sem); | ||
534 | |||
535 | hlist_del_init(&inst->list); | ||
536 | err = crypto_remove_alg(alg, &users); | ||
537 | |||
538 | up_write(&crypto_alg_sem); | ||
539 | |||
540 | if (err) | ||
541 | return err; | ||
542 | |||
543 | tmpl->free(inst); | ||
544 | crypto_remove_final(&users); | ||
545 | |||
546 | return 0; | ||
547 | } | ||
548 | EXPORT_SYMBOL_GPL(crypto_unregister_instance); | ||
549 | |||
521 | int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg, | 550 | int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg, |
522 | struct crypto_instance *inst, u32 mask) | 551 | struct crypto_instance *inst, u32 mask) |
523 | { | 552 | { |