Skip to content

Commit 14aa1a8

Browse files
ebiggersherbertx
authored andcommitted
crypto: algapi - remove crypto_alloc_instance()
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>
1 parent 31d40c2 commit 14aa1a8

3 files changed

Lines changed: 7 additions & 38 deletions

File tree

‎crypto/algapi.c‎

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -845,8 +845,8 @@ int crypto_inst_setname(struct crypto_instance *inst, const char *name,
845845
}
846846
EXPORT_SYMBOL_GPL(crypto_inst_setname);
847847

848-
void *crypto_alloc_instance2(const char *name, struct crypto_alg *alg,
849-
unsigned int head)
848+
void *crypto_alloc_instance(const char *name, struct crypto_alg *alg,
849+
unsigned int head)
850850
{
851851
struct crypto_instance *inst;
852852
char *p;
@@ -869,35 +869,6 @@ void *crypto_alloc_instance2(const char *name, struct crypto_alg *alg,
869869
kfree(p);
870870
return ERR_PTR(err);
871871
}
872-
EXPORT_SYMBOL_GPL(crypto_alloc_instance2);
873-
874-
struct crypto_instance *crypto_alloc_instance(const char *name,
875-
struct crypto_alg *alg)
876-
{
877-
struct crypto_instance *inst;
878-
struct crypto_spawn *spawn;
879-
int err;
880-
881-
inst = crypto_alloc_instance2(name, alg, 0);
882-
if (IS_ERR(inst))
883-
goto out;
884-
885-
spawn = crypto_instance_ctx(inst);
886-
err = crypto_init_spawn(spawn, alg, inst,
887-
CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC);
888-
889-
if (err)
890-
goto err_free_inst;
891-
892-
return inst;
893-
894-
err_free_inst:
895-
kfree(inst);
896-
inst = ERR_PTR(err);
897-
898-
out:
899-
return inst;
900-
}
901872
EXPORT_SYMBOL_GPL(crypto_alloc_instance);
902873

903874
void crypto_init_queue(struct crypto_queue *queue, unsigned int max_qlen)

‎include/crypto/algapi.h‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,8 @@ static inline struct crypto_alg *crypto_attr_alg(struct rtattr *rta,
185185
int crypto_attr_u32(struct rtattr *rta, u32 *num);
186186
int crypto_inst_setname(struct crypto_instance *inst, const char *name,
187187
struct crypto_alg *alg);
188-
void *crypto_alloc_instance2(const char *name, struct crypto_alg *alg,
189-
unsigned int head);
190-
struct crypto_instance *crypto_alloc_instance(const char *name,
191-
struct crypto_alg *alg);
188+
void *crypto_alloc_instance(const char *name, struct crypto_alg *alg,
189+
unsigned int head);
192190

193191
void crypto_init_queue(struct crypto_queue *queue, unsigned int max_qlen);
194192
int crypto_enqueue_request(struct crypto_queue *queue,

‎include/crypto/internal/hash.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ static inline unsigned int ahash_instance_headroom(void)
170170
static inline struct ahash_instance *ahash_alloc_instance(
171171
const char *name, struct crypto_alg *alg)
172172
{
173-
return crypto_alloc_instance2(name, alg, ahash_instance_headroom());
173+
return crypto_alloc_instance(name, alg, ahash_instance_headroom());
174174
}
175175

176176
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)
233233
static inline struct shash_instance *shash_alloc_instance(
234234
const char *name, struct crypto_alg *alg)
235235
{
236-
return crypto_alloc_instance2(name, alg,
237-
sizeof(struct shash_alg) - sizeof(*alg));
236+
return crypto_alloc_instance(name, alg,
237+
sizeof(struct shash_alg) - sizeof(*alg));
238238
}
239239

240240
static inline struct crypto_shash *crypto_spawn_shash(

0 commit comments

Comments
 (0)