hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/crypto/ccp/ccp-crypto-main.c
....@@ -1,13 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * AMD Cryptographic Coprocessor (CCP) crypto API support
34 *
45 * Copyright (C) 2013,2017 Advanced Micro Devices, Inc.
56 *
67 * Author: Tom Lendacky <thomas.lendacky@amd.com>
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License version 2 as
10
- * published by the Free Software Foundation.
118 */
129
1310 #include <linux/module.h>
....@@ -44,7 +41,7 @@
4441
4542 /* List heads for the supported algorithms */
4643 static LIST_HEAD(hash_algs);
47
-static LIST_HEAD(cipher_algs);
44
+static LIST_HEAD(skcipher_algs);
4845 static LIST_HEAD(aead_algs);
4946 static LIST_HEAD(akcipher_algs);
5047
....@@ -333,7 +330,7 @@
333330 int ret;
334331
335332 if (!aes_disable) {
336
- ret = ccp_register_aes_algs(&cipher_algs);
333
+ ret = ccp_register_aes_algs(&skcipher_algs);
337334 if (ret)
338335 return ret;
339336
....@@ -341,7 +338,7 @@
341338 if (ret)
342339 return ret;
343340
344
- ret = ccp_register_aes_xts_algs(&cipher_algs);
341
+ ret = ccp_register_aes_xts_algs(&skcipher_algs);
345342 if (ret)
346343 return ret;
347344
....@@ -351,7 +348,7 @@
351348 }
352349
353350 if (!des3_disable) {
354
- ret = ccp_register_des3_algs(&cipher_algs);
351
+ ret = ccp_register_des3_algs(&skcipher_algs);
355352 if (ret)
356353 return ret;
357354 }
....@@ -374,7 +371,7 @@
374371 static void ccp_unregister_algs(void)
375372 {
376373 struct ccp_crypto_ahash_alg *ahash_alg, *ahash_tmp;
377
- struct ccp_crypto_ablkcipher_alg *ablk_alg, *ablk_tmp;
374
+ struct ccp_crypto_skcipher_alg *ablk_alg, *ablk_tmp;
378375 struct ccp_crypto_aead *aead_alg, *aead_tmp;
379376 struct ccp_crypto_akcipher_alg *akc_alg, *akc_tmp;
380377
....@@ -384,8 +381,8 @@
384381 kfree(ahash_alg);
385382 }
386383
387
- list_for_each_entry_safe(ablk_alg, ablk_tmp, &cipher_algs, entry) {
388
- crypto_unregister_alg(&ablk_alg->alg);
384
+ list_for_each_entry_safe(ablk_alg, ablk_tmp, &skcipher_algs, entry) {
385
+ crypto_unregister_skcipher(&ablk_alg->alg);
389386 list_del(&ablk_alg->entry);
390387 kfree(ablk_alg);
391388 }
....@@ -408,8 +405,10 @@
408405 int ret;
409406
410407 ret = ccp_present();
411
- if (ret)
408
+ if (ret) {
409
+ pr_err("Cannot load: there are no available CCPs\n");
412410 return ret;
411
+ }
413412
414413 spin_lock_init(&req_queue_lock);
415414 INIT_LIST_HEAD(&req_queue.cmds);