crypto: algapi - remove crypto_alloc_instance()
authorEric Biggers <ebiggers@google.com>
Fri, 4 Jan 2019 04:16:25 +0000 (20:16 -0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 11 Jan 2019 06:16:58 +0000 (14:16 +0800)
Now that all "blkcipher" templates have been converted to "skcipher",
crypto_alloc_instance() is no longer used.  And it's not useful any
longer as it creates an old-style weakly typed instance rather than a
new-style strongly typed instance.  So remove it, and now that the name
is freed up rename crypto_alloc_instance2() to crypto_alloc_instance().

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/algapi.c
include/crypto/algapi.h
include/crypto/internal/hash.h

index 8b65ada..f3d7663 100644 (file)
@@ -845,8 +845,8 @@ int crypto_inst_setname(struct crypto_instance *inst, const char *name,
 }
 EXPORT_SYMBOL_GPL(crypto_inst_setname);
 
-void *crypto_alloc_instance2(const char *name, struct crypto_alg *alg,
-                            unsigned int head)
+void *crypto_alloc_instance(const char *name, struct crypto_alg *alg,
+                           unsigned int head)
 {
        struct crypto_instance *inst;
        char *p;
@@ -869,35 +869,6 @@ err_free_inst:
        kfree(p);
        return ERR_PTR(err);
 }
-EXPORT_SYMBOL_GPL(crypto_alloc_instance2);
-
-struct crypto_instance *crypto_alloc_instance(const char *name,
-                                             struct crypto_alg *alg)
-{
-       struct crypto_instance *inst;
-       struct crypto_spawn *spawn;
-       int err;
-
-       inst = crypto_alloc_instance2(name, alg, 0);
-       if (IS_ERR(inst))
-               goto out;
-
-       spawn = crypto_instance_ctx(inst);
-       err = crypto_init_spawn(spawn, alg, inst,
-                               CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC);
-
-       if (err)
-               goto err_free_inst;
-
-       return inst;
-
-err_free_inst:
-       kfree(inst);
-       inst = ERR_PTR(err);
-
-out:
-       return inst;
-}
 EXPORT_SYMBOL_GPL(crypto_alloc_instance);
 
 void crypto_init_queue(struct crypto_queue *queue, unsigned int max_qlen)
index 4a5ad10..093869f 100644 (file)
@@ -185,10 +185,8 @@ static inline struct crypto_alg *crypto_attr_alg(struct rtattr *rta,
 int crypto_attr_u32(struct rtattr *rta, u32 *num);
 int crypto_inst_setname(struct crypto_instance *inst, const char *name,
                        struct crypto_alg *alg);
-void *crypto_alloc_instance2(const char *name, struct crypto_alg *alg,
-                            unsigned int head);
-struct crypto_instance *crypto_alloc_instance(const char *name,
-                                             struct crypto_alg *alg);
+void *crypto_alloc_instance(const char *name, struct crypto_alg *alg,
+                           unsigned int head);
 
 void crypto_init_queue(struct crypto_queue *queue, unsigned int max_qlen);
 int crypto_enqueue_request(struct crypto_queue *queue,
index a0b0ad9..e355fdb 100644 (file)
@@ -170,7 +170,7 @@ static inline unsigned int ahash_instance_headroom(void)
 static inline struct ahash_instance *ahash_alloc_instance(
        const char *name, struct crypto_alg *alg)
 {
-       return crypto_alloc_instance2(name, alg, ahash_instance_headroom());
+       return crypto_alloc_instance(name, alg, ahash_instance_headroom());
 }
 
 static inline void ahash_request_complete(struct ahash_request *req, int err)
@@ -233,8 +233,8 @@ static inline void *shash_instance_ctx(struct shash_instance *inst)
 static inline struct shash_instance *shash_alloc_instance(
        const char *name, struct crypto_alg *alg)
 {
-       return crypto_alloc_instance2(name, alg,
-                                     sizeof(struct shash_alg) - sizeof(*alg));
+       return crypto_alloc_instance(name, alg,
+                                    sizeof(struct shash_alg) - sizeof(*alg));
 }
 
 static inline struct crypto_shash *crypto_spawn_shash(