Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[sfrench/cifs-2.6.git] / crypto / algapi.c
index 313a7682cef1bd1a5d1a8cdb5a3ade8f066b934b..de30ddc952d85c400b76c017e92009b648b72e51 100644 (file)
 
 static LIST_HEAD(crypto_template_list);
 
-static inline int crypto_set_driver_name(struct crypto_alg *alg)
-{
-       static const char suffix[] = "-generic";
-       char *driver_name = alg->cra_driver_name;
-       int len;
-
-       if (*driver_name)
-               return 0;
-
-       len = strlcpy(driver_name, alg->cra_name, CRYPTO_MAX_ALG_NAME);
-       if (len + sizeof(suffix) > CRYPTO_MAX_ALG_NAME)
-               return -ENAMETOOLONG;
-
-       memcpy(driver_name + len, suffix, sizeof(suffix));
-       return 0;
-}
-
 static inline void crypto_check_module_sig(struct module *mod)
 {
        if (fips_enabled && mod && !module_sig_ok(mod))
@@ -49,6 +32,9 @@ static int crypto_check_alg(struct crypto_alg *alg)
 {
        crypto_check_module_sig(alg->cra_module);
 
+       if (!alg->cra_name[0] || !alg->cra_driver_name[0])
+               return -EINVAL;
+
        if (alg->cra_alignmask & (alg->cra_alignmask + 1))
                return -EINVAL;
 
@@ -74,7 +60,7 @@ static int crypto_check_alg(struct crypto_alg *alg)
 
        refcount_set(&alg->cra_refcnt, 1);
 
-       return crypto_set_driver_name(alg);
+       return 0;
 }
 
 static void crypto_free_instance(struct crypto_instance *inst)
@@ -947,19 +933,6 @@ struct crypto_async_request *crypto_dequeue_request(struct crypto_queue *queue)
 }
 EXPORT_SYMBOL_GPL(crypto_dequeue_request);
 
-int crypto_tfm_in_queue(struct crypto_queue *queue, struct crypto_tfm *tfm)
-{
-       struct crypto_async_request *req;
-
-       list_for_each_entry(req, &queue->list, list) {
-               if (req->tfm == tfm)
-                       return 1;
-       }
-
-       return 0;
-}
-EXPORT_SYMBOL_GPL(crypto_tfm_in_queue);
-
 static inline void crypto_inc_byte(u8 *a, unsigned int size)
 {
        u8 *b = (a + size);