| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * AMD Cryptographic Coprocessor (CCP) crypto API support |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2013,2017 Advanced Micro Devices, Inc. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * 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. |
|---|
| 11 | 8 | */ |
|---|
| 12 | 9 | |
|---|
| 13 | 10 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 44 | 41 | |
|---|
| 45 | 42 | /* List heads for the supported algorithms */ |
|---|
| 46 | 43 | static LIST_HEAD(hash_algs); |
|---|
| 47 | | -static LIST_HEAD(cipher_algs); |
|---|
| 44 | +static LIST_HEAD(skcipher_algs); |
|---|
| 48 | 45 | static LIST_HEAD(aead_algs); |
|---|
| 49 | 46 | static LIST_HEAD(akcipher_algs); |
|---|
| 50 | 47 | |
|---|
| .. | .. |
|---|
| 333 | 330 | int ret; |
|---|
| 334 | 331 | |
|---|
| 335 | 332 | if (!aes_disable) { |
|---|
| 336 | | - ret = ccp_register_aes_algs(&cipher_algs); |
|---|
| 333 | + ret = ccp_register_aes_algs(&skcipher_algs); |
|---|
| 337 | 334 | if (ret) |
|---|
| 338 | 335 | return ret; |
|---|
| 339 | 336 | |
|---|
| .. | .. |
|---|
| 341 | 338 | if (ret) |
|---|
| 342 | 339 | return ret; |
|---|
| 343 | 340 | |
|---|
| 344 | | - ret = ccp_register_aes_xts_algs(&cipher_algs); |
|---|
| 341 | + ret = ccp_register_aes_xts_algs(&skcipher_algs); |
|---|
| 345 | 342 | if (ret) |
|---|
| 346 | 343 | return ret; |
|---|
| 347 | 344 | |
|---|
| .. | .. |
|---|
| 351 | 348 | } |
|---|
| 352 | 349 | |
|---|
| 353 | 350 | if (!des3_disable) { |
|---|
| 354 | | - ret = ccp_register_des3_algs(&cipher_algs); |
|---|
| 351 | + ret = ccp_register_des3_algs(&skcipher_algs); |
|---|
| 355 | 352 | if (ret) |
|---|
| 356 | 353 | return ret; |
|---|
| 357 | 354 | } |
|---|
| .. | .. |
|---|
| 374 | 371 | static void ccp_unregister_algs(void) |
|---|
| 375 | 372 | { |
|---|
| 376 | 373 | 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; |
|---|
| 378 | 375 | struct ccp_crypto_aead *aead_alg, *aead_tmp; |
|---|
| 379 | 376 | struct ccp_crypto_akcipher_alg *akc_alg, *akc_tmp; |
|---|
| 380 | 377 | |
|---|
| .. | .. |
|---|
| 384 | 381 | kfree(ahash_alg); |
|---|
| 385 | 382 | } |
|---|
| 386 | 383 | |
|---|
| 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); |
|---|
| 389 | 386 | list_del(&ablk_alg->entry); |
|---|
| 390 | 387 | kfree(ablk_alg); |
|---|
| 391 | 388 | } |
|---|
| .. | .. |
|---|
| 408 | 405 | int ret; |
|---|
| 409 | 406 | |
|---|
| 410 | 407 | ret = ccp_present(); |
|---|
| 411 | | - if (ret) |
|---|
| 408 | + if (ret) { |
|---|
| 409 | + pr_err("Cannot load: there are no available CCPs\n"); |
|---|
| 412 | 410 | return ret; |
|---|
| 411 | + } |
|---|
| 413 | 412 | |
|---|
| 414 | 413 | spin_lock_init(&req_queue_lock); |
|---|
| 415 | 414 | INIT_LIST_HEAD(&req_queue.cmds); |
|---|