diff options
-rw-r--r-- | crypto/algapi.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c index 7c51f45d1cf1..5278e139a161 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c | |||
@@ -26,23 +26,6 @@ | |||
26 | 26 | ||
27 | static LIST_HEAD(crypto_template_list); | 27 | static LIST_HEAD(crypto_template_list); |
28 | 28 | ||
29 | static inline int crypto_set_driver_name(struct crypto_alg *alg) | ||
30 | { | ||
31 | static const char suffix[] = "-generic"; | ||
32 | char *driver_name = alg->cra_driver_name; | ||
33 | int len; | ||
34 | |||
35 | if (*driver_name) | ||
36 | return 0; | ||
37 | |||
38 | len = strlcpy(driver_name, alg->cra_name, CRYPTO_MAX_ALG_NAME); | ||
39 | if (len + sizeof(suffix) > CRYPTO_MAX_ALG_NAME) | ||
40 | return -ENAMETOOLONG; | ||
41 | |||
42 | memcpy(driver_name + len, suffix, sizeof(suffix)); | ||
43 | return 0; | ||
44 | } | ||
45 | |||
46 | static inline void crypto_check_module_sig(struct module *mod) | 29 | static inline void crypto_check_module_sig(struct module *mod) |
47 | { | 30 | { |
48 | if (fips_enabled && mod && !module_sig_ok(mod)) | 31 | if (fips_enabled && mod && !module_sig_ok(mod)) |
@@ -54,6 +37,9 @@ static int crypto_check_alg(struct crypto_alg *alg) | |||
54 | { | 37 | { |
55 | crypto_check_module_sig(alg->cra_module); | 38 | crypto_check_module_sig(alg->cra_module); |
56 | 39 | ||
40 | if (!alg->cra_name[0] || !alg->cra_driver_name[0]) | ||
41 | return -EINVAL; | ||
42 | |||
57 | if (alg->cra_alignmask & (alg->cra_alignmask + 1)) | 43 | if (alg->cra_alignmask & (alg->cra_alignmask + 1)) |
58 | return -EINVAL; | 44 | return -EINVAL; |
59 | 45 | ||
@@ -79,7 +65,7 @@ static int crypto_check_alg(struct crypto_alg *alg) | |||
79 | 65 | ||
80 | refcount_set(&alg->cra_refcnt, 1); | 66 | refcount_set(&alg->cra_refcnt, 1); |
81 | 67 | ||
82 | return crypto_set_driver_name(alg); | 68 | return 0; |
83 | } | 69 | } |
84 | 70 | ||
85 | static void crypto_free_instance(struct crypto_instance *inst) | 71 | static void crypto_free_instance(struct crypto_instance *inst) |