diff options
author | Eric Biggers <ebiggers@google.com> | 2019-01-03 23:16:25 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2019-01-11 01:16:58 -0500 |
commit | 14aa1a839a33b4ade7479ffcad8a5fabe5cc4000 (patch) | |
tree | eb0e9fa2d4cd29d8d54f30d1fde8f5b454930629 | |
parent | 31d40c20983fd26a41541be208687fb2fc62fec3 (diff) |
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>
-rw-r--r-- | crypto/algapi.c | 33 | ||||
-rw-r--r-- | include/crypto/algapi.h | 6 | ||||
-rw-r--r-- | include/crypto/internal/hash.h | 6 |
3 files changed, 7 insertions, 38 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c index 8b65ada33e5d..f3d766312bd9 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c | |||
@@ -845,8 +845,8 @@ int crypto_inst_setname(struct crypto_instance *inst, const char *name, | |||
845 | } | 845 | } |
846 | EXPORT_SYMBOL_GPL(crypto_inst_setname); | 846 | EXPORT_SYMBOL_GPL(crypto_inst_setname); |
847 | 847 | ||
848 | void *crypto_alloc_instance2(const char *name, struct crypto_alg *alg, | 848 | void *crypto_alloc_instance(const char *name, struct crypto_alg *alg, |
849 | unsigned int head) | 849 | unsigned int head) |
850 | { | 850 | { |
851 | struct crypto_instance *inst; | 851 | struct crypto_instance *inst; |
852 | char *p; | 852 | char *p; |
@@ -869,35 +869,6 @@ err_free_inst: | |||
869 | kfree(p); | 869 | kfree(p); |
870 | return ERR_PTR(err); | 870 | return ERR_PTR(err); |
871 | } | 871 | } |
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 | } | ||
901 | EXPORT_SYMBOL_GPL(crypto_alloc_instance); | 872 | EXPORT_SYMBOL_GPL(crypto_alloc_instance); |
902 | 873 | ||
903 | void crypto_init_queue(struct crypto_queue *queue, unsigned int max_qlen) | 874 | void crypto_init_queue(struct crypto_queue *queue, unsigned int max_qlen) |
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h index 4a5ad10e75f0..093869f175d6 100644 --- a/include/crypto/algapi.h +++ b/include/crypto/algapi.h | |||
@@ -185,10 +185,8 @@ static inline struct crypto_alg *crypto_attr_alg(struct rtattr *rta, | |||
185 | int crypto_attr_u32(struct rtattr *rta, u32 *num); | 185 | int crypto_attr_u32(struct rtattr *rta, u32 *num); |
186 | int crypto_inst_setname(struct crypto_instance *inst, const char *name, | 186 | int crypto_inst_setname(struct crypto_instance *inst, const char *name, |
187 | struct crypto_alg *alg); | 187 | struct crypto_alg *alg); |
188 | void *crypto_alloc_instance2(const char *name, struct crypto_alg *alg, | 188 | void *crypto_alloc_instance(const char *name, struct crypto_alg *alg, |
189 | unsigned int head); | 189 | unsigned int head); |
190 | struct crypto_instance *crypto_alloc_instance(const char *name, | ||
191 | struct crypto_alg *alg); | ||
192 | 190 | ||
193 | void crypto_init_queue(struct crypto_queue *queue, unsigned int max_qlen); | 191 | void crypto_init_queue(struct crypto_queue *queue, unsigned int max_qlen); |
194 | int crypto_enqueue_request(struct crypto_queue *queue, | 192 | int crypto_enqueue_request(struct crypto_queue *queue, |
diff --git a/include/crypto/internal/hash.h b/include/crypto/internal/hash.h index a0b0ad9d585e..e355fdb642a9 100644 --- a/include/crypto/internal/hash.h +++ b/include/crypto/internal/hash.h | |||
@@ -170,7 +170,7 @@ static inline unsigned int ahash_instance_headroom(void) | |||
170 | static inline struct ahash_instance *ahash_alloc_instance( | 170 | static inline struct ahash_instance *ahash_alloc_instance( |
171 | const char *name, struct crypto_alg *alg) | 171 | const char *name, struct crypto_alg *alg) |
172 | { | 172 | { |
173 | return crypto_alloc_instance2(name, alg, ahash_instance_headroom()); | 173 | return crypto_alloc_instance(name, alg, ahash_instance_headroom()); |
174 | } | 174 | } |
175 | 175 | ||
176 | static inline void ahash_request_complete(struct ahash_request *req, int err) | 176 | 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) | |||
233 | static inline struct shash_instance *shash_alloc_instance( | 233 | static inline struct shash_instance *shash_alloc_instance( |
234 | const char *name, struct crypto_alg *alg) | 234 | const char *name, struct crypto_alg *alg) |
235 | { | 235 | { |
236 | return crypto_alloc_instance2(name, alg, | 236 | return crypto_alloc_instance(name, alg, |
237 | sizeof(struct shash_alg) - sizeof(*alg)); | 237 | sizeof(struct shash_alg) - sizeof(*alg)); |
238 | } | 238 | } |
239 | 239 | ||
240 | static inline struct crypto_shash *crypto_spawn_shash( | 240 | static inline struct crypto_shash *crypto_spawn_shash( |