From 244b2c5ca8b14627e4a17755e5922221e121c771 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Wed, 09 Oct 2024 06:15:07 +0000
Subject: [PATCH] change system file
---
kernel/crypto/algboss.c | 42 +++++++++++-------------------------------
1 files changed, 11 insertions(+), 31 deletions(-)
diff --git a/kernel/crypto/algboss.c b/kernel/crypto/algboss.c
index 0c57c71..5ebccbd 100644
--- a/kernel/crypto/algboss.c
+++ b/kernel/crypto/algboss.c
@@ -1,13 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Create default crypto algorithm instances.
*
* Copyright (c) 2006 Herbert Xu <herbert@gondor.apana.org.au>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
*/
#include <crypto/internal/aead.h>
@@ -63,7 +58,6 @@
{
struct cryptomgr_param *param = data;
struct crypto_template *tmpl;
- struct crypto_instance *inst;
int err;
tmpl = crypto_lookup_template(param->template);
@@ -71,16 +65,7 @@
goto out;
do {
- if (tmpl->create) {
- err = tmpl->create(tmpl, param->tb);
- continue;
- }
-
- inst = tmpl->alloc(param->tb);
- if (IS_ERR(inst))
- err = PTR_ERR(inst);
- else if ((err = crypto_register_instance(tmpl, inst)))
- tmpl->free(inst);
+ err = tmpl->create(tmpl, param->tb);
} while (err == -EAGAIN && !signal_pending(current));
crypto_tmpl_put(tmpl);
@@ -205,7 +190,6 @@
return NOTIFY_OK;
}
-#ifndef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
static int cryptomgr_test(void *data)
{
struct crypto_test_param *param = data;
@@ -227,13 +211,10 @@
kfree(param);
module_put_and_exit(0);
}
-#endif /* CONFIG_CRYPTO_MANAGER_DISABLE_TESTS */
static int cryptomgr_schedule_test(struct crypto_alg *alg)
{
-#ifndef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
struct task_struct *thread;
-#endif
struct crypto_test_param *param;
u32 type;
@@ -254,23 +235,14 @@
param->type = type;
-#ifndef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
thread = kthread_run(cryptomgr_test, param, "cryptomgr_test");
if (IS_ERR(thread))
goto err_free_param;
-#else
- crypto_alg_tested(param->driver, 0);
-
- kfree(param);
- module_put(THIS_MODULE);
-#endif
return NOTIFY_STOP;
-#ifndef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
err_free_param:
kfree(param);
-#endif
err_put_module:
module_put(THIS_MODULE);
err:
@@ -285,6 +257,8 @@
return cryptomgr_schedule_probe(data);
case CRYPTO_MSG_ALG_REGISTER:
return cryptomgr_schedule_test(data);
+ case CRYPTO_MSG_ALG_LOADED:
+ break;
}
return NOTIFY_DONE;
@@ -305,7 +279,13 @@
BUG_ON(err);
}
-subsys_initcall(cryptomgr_init);
+/*
+ * This is arch_initcall() so that the crypto self-tests are run on algorithms
+ * registered early by subsys_initcall(). subsys_initcall() is needed for
+ * generic implementations so that they're available for comparison tests when
+ * other implementations are registered later by module_init().
+ */
+arch_initcall(cryptomgr_init);
module_exit(cryptomgr_exit);
MODULE_LICENSE("GPL");
--
Gitblit v1.6.2