]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - crypto/akcipher.c
Merge tag 'riscv-for-linus-5.6-mw0' of git://git.kernel.org/pub/scm/linux/kernel...
[linux.git] / crypto / akcipher.c
index 7d5cf49394238d49442099974f540c65f1a960fd..f866085c8a4a38e83e94bb64efcaa80e5e7eff73 100644 (file)
@@ -90,11 +90,12 @@ static const struct crypto_type crypto_akcipher_type = {
        .tfmsize = offsetof(struct crypto_akcipher, base),
 };
 
-int crypto_grab_akcipher(struct crypto_akcipher_spawn *spawn, const char *name,
-                        u32 type, u32 mask)
+int crypto_grab_akcipher(struct crypto_akcipher_spawn *spawn,
+                        struct crypto_instance *inst,
+                        const char *name, u32 type, u32 mask)
 {
        spawn->base.frontend = &crypto_akcipher_type;
-       return crypto_grab_spawn(&spawn->base, name, type, mask);
+       return crypto_grab_spawn(&spawn->base, inst, name, type, mask);
 }
 EXPORT_SYMBOL_GPL(crypto_grab_akcipher);
 
@@ -146,6 +147,8 @@ EXPORT_SYMBOL_GPL(crypto_unregister_akcipher);
 int akcipher_register_instance(struct crypto_template *tmpl,
                               struct akcipher_instance *inst)
 {
+       if (WARN_ON(!inst->free))
+               return -EINVAL;
        akcipher_prepare_alg(&inst->alg);
        return crypto_register_instance(tmpl, akcipher_crypto_instance(inst));
 }