diff options
Diffstat (limited to 'crypto/algapi.c')
-rw-r--r-- | crypto/algapi.c | 35 |
1 files changed, 4 insertions, 31 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c index 313a7682cef1..de30ddc952d8 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c | |||
@@ -21,23 +21,6 @@ | |||
21 | 21 | ||
22 | static LIST_HEAD(crypto_template_list); | 22 | static LIST_HEAD(crypto_template_list); |
23 | 23 | ||
24 | static inline int crypto_set_driver_name(struct crypto_alg *alg) | ||
25 | { | ||
26 | static const char suffix[] = "-generic"; | ||
27 | char *driver_name = alg->cra_driver_name; | ||
28 | int len; | ||
29 | |||
30 | if (*driver_name) | ||
31 | return 0; | ||
32 | |||
33 | len = strlcpy(driver_name, alg->cra_name, CRYPTO_MAX_ALG_NAME); | ||
34 | if (len + sizeof(suffix) > CRYPTO_MAX_ALG_NAME) | ||
35 | return -ENAMETOOLONG; | ||
36 | |||
37 | memcpy(driver_name + len, suffix, sizeof(suffix)); | ||
38 | return 0; | ||
39 | } | ||
40 | |||
41 | static inline void crypto_check_module_sig(struct module *mod) | 24 | static inline void crypto_check_module_sig(struct module *mod) |
42 | { | 25 | { |
43 | if (fips_enabled && mod && !module_sig_ok(mod)) | 26 | if (fips_enabled && mod && !module_sig_ok(mod)) |
@@ -49,6 +32,9 @@ static int crypto_check_alg(struct crypto_alg *alg) | |||
49 | { | 32 | { |
50 | crypto_check_module_sig(alg->cra_module); | 33 | crypto_check_module_sig(alg->cra_module); |
51 | 34 | ||
35 | if (!alg->cra_name[0] || !alg->cra_driver_name[0]) | ||
36 | return -EINVAL; | ||
37 | |||
52 | if (alg->cra_alignmask & (alg->cra_alignmask + 1)) | 38 | if (alg->cra_alignmask & (alg->cra_alignmask + 1)) |
53 | return -EINVAL; | 39 | return -EINVAL; |
54 | 40 | ||
@@ -74,7 +60,7 @@ static int crypto_check_alg(struct crypto_alg *alg) | |||
74 | 60 | ||
75 | refcount_set(&alg->cra_refcnt, 1); | 61 | refcount_set(&alg->cra_refcnt, 1); |
76 | 62 | ||
77 | return crypto_set_driver_name(alg); | 63 | return 0; |
78 | } | 64 | } |
79 | 65 | ||
80 | static void crypto_free_instance(struct crypto_instance *inst) | 66 | static void crypto_free_instance(struct crypto_instance *inst) |
@@ -947,19 +933,6 @@ struct crypto_async_request *crypto_dequeue_request(struct crypto_queue *queue) | |||
947 | } | 933 | } |
948 | EXPORT_SYMBOL_GPL(crypto_dequeue_request); | 934 | EXPORT_SYMBOL_GPL(crypto_dequeue_request); |
949 | 935 | ||
950 | int crypto_tfm_in_queue(struct crypto_queue *queue, struct crypto_tfm *tfm) | ||
951 | { | ||
952 | struct crypto_async_request *req; | ||
953 | |||
954 | list_for_each_entry(req, &queue->list, list) { | ||
955 | if (req->tfm == tfm) | ||
956 | return 1; | ||
957 | } | ||
958 | |||
959 | return 0; | ||
960 | } | ||
961 | EXPORT_SYMBOL_GPL(crypto_tfm_in_queue); | ||
962 | |||
963 | static inline void crypto_inc_byte(u8 *a, unsigned int size) | 936 | static inline void crypto_inc_byte(u8 *a, unsigned int size) |
964 | { | 937 | { |
965 | u8 *b = (a + size); | 938 | u8 *b = (a + size); |