diff options
-rw-r--r-- | crypto/algapi.c | 16 | ||||
-rw-r--r-- | include/crypto/algapi.h | 2 |
2 files changed, 18 insertions, 0 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c index 3103e6a1282e..abf100c054e0 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c | |||
@@ -612,6 +612,22 @@ out: | |||
612 | } | 612 | } |
613 | EXPORT_SYMBOL_GPL(crypto_init_spawn2); | 613 | EXPORT_SYMBOL_GPL(crypto_init_spawn2); |
614 | 614 | ||
615 | int crypto_grab_spawn(struct crypto_spawn *spawn, const char *name, | ||
616 | u32 type, u32 mask) | ||
617 | { | ||
618 | struct crypto_alg *alg; | ||
619 | int err; | ||
620 | |||
621 | alg = crypto_find_alg(name, spawn->frontend, type, mask); | ||
622 | if (IS_ERR(alg)) | ||
623 | return PTR_ERR(alg); | ||
624 | |||
625 | err = crypto_init_spawn(spawn, alg, spawn->inst, mask); | ||
626 | crypto_mod_put(alg); | ||
627 | return err; | ||
628 | } | ||
629 | EXPORT_SYMBOL_GPL(crypto_grab_spawn); | ||
630 | |||
615 | void crypto_drop_spawn(struct crypto_spawn *spawn) | 631 | void crypto_drop_spawn(struct crypto_spawn *spawn) |
616 | { | 632 | { |
617 | if (!spawn->alg) | 633 | if (!spawn->alg) |
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h index 0ecb7688af71..a949bf70983b 100644 --- a/include/crypto/algapi.h +++ b/include/crypto/algapi.h | |||
@@ -144,6 +144,8 @@ int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg, | |||
144 | int crypto_init_spawn2(struct crypto_spawn *spawn, struct crypto_alg *alg, | 144 | int crypto_init_spawn2(struct crypto_spawn *spawn, struct crypto_alg *alg, |
145 | struct crypto_instance *inst, | 145 | struct crypto_instance *inst, |
146 | const struct crypto_type *frontend); | 146 | const struct crypto_type *frontend); |
147 | int crypto_grab_spawn(struct crypto_spawn *spawn, const char *name, | ||
148 | u32 type, u32 mask); | ||
147 | 149 | ||
148 | void crypto_drop_spawn(struct crypto_spawn *spawn); | 150 | void crypto_drop_spawn(struct crypto_spawn *spawn); |
149 | struct crypto_tfm *crypto_spawn_tfm(struct crypto_spawn *spawn, u32 type, | 151 | struct crypto_tfm *crypto_spawn_tfm(struct crypto_spawn *spawn, u32 type, |