diff options
| author | Tom Lendacky <thomas.lendacky@amd.com> | 2014-09-05 11:31:09 -0400 |
|---|---|---|
| committer | Herbert Xu <herbert@gondor.apana.org.au> | 2014-09-24 02:23:34 -0400 |
| commit | c9f21cb6388898bfe69886d001316dae7ecc9a4b (patch) | |
| tree | 6ebee443acb2d588656f3a36c935ff383f8a5608 /include/linux | |
| parent | 413e55742a4f18da6173271ca66748e690997f30 (diff) | |
crypto: ccp - Check for CCP before registering crypto algs
If the ccp is built as a built-in module, then ccp-crypto (whether
built as a module or a built-in module) will be able to load and
it will register its crypto algorithms. If the system does not have
a CCP this will result in -ENODEV being returned whenever a command
is attempted to be queued by the registered crypto algorithms.
Add an API, ccp_present(), that checks for the presence of a CCP
on the system. The ccp-crypto module can use this to determine if it
should register it's crypto alogorithms.
Cc: stable@vger.kernel.org
Reported-by: Scot Doyle <lkml14@scotdoyle.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Tested-by: Scot Doyle <lkml14@scotdoyle.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/ccp.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/ccp.h b/include/linux/ccp.h index ebcc9d146219..7f437036baa4 100644 --- a/include/linux/ccp.h +++ b/include/linux/ccp.h | |||
| @@ -27,6 +27,13 @@ struct ccp_cmd; | |||
| 27 | defined(CONFIG_CRYPTO_DEV_CCP_DD_MODULE) | 27 | defined(CONFIG_CRYPTO_DEV_CCP_DD_MODULE) |
| 28 | 28 | ||
| 29 | /** | 29 | /** |
| 30 | * ccp_present - check if a CCP device is present | ||
| 31 | * | ||
| 32 | * Returns zero if a CCP device is present, -ENODEV otherwise. | ||
| 33 | */ | ||
| 34 | int ccp_present(void); | ||
| 35 | |||
| 36 | /** | ||
| 30 | * ccp_enqueue_cmd - queue an operation for processing by the CCP | 37 | * ccp_enqueue_cmd - queue an operation for processing by the CCP |
| 31 | * | 38 | * |
| 32 | * @cmd: ccp_cmd struct to be processed | 39 | * @cmd: ccp_cmd struct to be processed |
| @@ -53,6 +60,11 @@ int ccp_enqueue_cmd(struct ccp_cmd *cmd); | |||
| 53 | 60 | ||
| 54 | #else /* CONFIG_CRYPTO_DEV_CCP_DD is not enabled */ | 61 | #else /* CONFIG_CRYPTO_DEV_CCP_DD is not enabled */ |
| 55 | 62 | ||
| 63 | static inline int ccp_present(void) | ||
| 64 | { | ||
| 65 | return -ENODEV; | ||
| 66 | } | ||
| 67 | |||
| 56 | static inline int ccp_enqueue_cmd(struct ccp_cmd *cmd) | 68 | static inline int ccp_enqueue_cmd(struct ccp_cmd *cmd) |
| 57 | { | 69 | { |
| 58 | return -ENODEV; | 70 | return -ENODEV; |
