aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto/ccp
diff options
context:
space:
mode:
authorTom Lendacky <thomas.lendacky@amd.com>2014-01-24 17:17:56 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2014-02-08 20:59:15 -0500
commitd81ed6534fd988a8a24fb607b459444d4b3d391a (patch)
tree2aa7c861542ded81d5c1c1ebb7bd82bde357ed60 /drivers/crypto/ccp
parent80e84c16e72a0eac30085322b4664b7b6b0dde75 (diff)
crypto: ccp - Allow for selective disablement of crypto API algorithms
Introduce module parameters that allow for disabling of a crypto algorithm by not registering the algorithm with the crypto API. Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/ccp')
-rw-r--r--drivers/crypto/ccp/ccp-crypto-main.c37
1 files changed, 25 insertions, 12 deletions
diff --git a/drivers/crypto/ccp/ccp-crypto-main.c b/drivers/crypto/ccp/ccp-crypto-main.c
index 2636f044789d..b3f22b07b5bd 100644
--- a/drivers/crypto/ccp/ccp-crypto-main.c
+++ b/drivers/crypto/ccp/ccp-crypto-main.c
@@ -11,6 +11,7 @@
11 */ 11 */
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/moduleparam.h>
14#include <linux/kernel.h> 15#include <linux/kernel.h>
15#include <linux/list.h> 16#include <linux/list.h>
16#include <linux/ccp.h> 17#include <linux/ccp.h>
@@ -24,6 +25,14 @@ MODULE_LICENSE("GPL");
24MODULE_VERSION("1.0.0"); 25MODULE_VERSION("1.0.0");
25MODULE_DESCRIPTION("AMD Cryptographic Coprocessor crypto API support"); 26MODULE_DESCRIPTION("AMD Cryptographic Coprocessor crypto API support");
26 27
28static unsigned int aes_disable;
29module_param(aes_disable, uint, 0444);
30MODULE_PARM_DESC(aes_disable, "Disable use of AES - any non-zero value");
31
32static unsigned int sha_disable;
33module_param(sha_disable, uint, 0444);
34MODULE_PARM_DESC(sha_disable, "Disable use of SHA - any non-zero value");
35
27 36
28/* List heads for the supported algorithms */ 37/* List heads for the supported algorithms */
29static LIST_HEAD(hash_algs); 38static LIST_HEAD(hash_algs);
@@ -337,21 +346,25 @@ static int ccp_register_algs(void)
337{ 346{
338 int ret; 347 int ret;
339 348
340 ret = ccp_register_aes_algs(&cipher_algs); 349 if (!aes_disable) {
341 if (ret) 350 ret = ccp_register_aes_algs(&cipher_algs);
342 return ret; 351 if (ret)
352 return ret;
343 353
344 ret = ccp_register_aes_cmac_algs(&hash_algs); 354 ret = ccp_register_aes_cmac_algs(&hash_algs);
345 if (ret) 355 if (ret)
346 return ret; 356 return ret;
347 357
348 ret = ccp_register_aes_xts_algs(&cipher_algs); 358 ret = ccp_register_aes_xts_algs(&cipher_algs);
349 if (ret) 359 if (ret)
350 return ret; 360 return ret;
361 }
351 362
352 ret = ccp_register_sha_algs(&hash_algs); 363 if (!sha_disable) {
353 if (ret) 364 ret = ccp_register_sha_algs(&hash_algs);
354 return ret; 365 if (ret)
366 return ret;
367 }
355 368
356 return 0; 369 return 0;
357} 370}