[PATCH 04/11] crypto: ccp - register algorithms only for supported engines
From: Depei Yang
Date: Wed Nov 25 2026 - 02:47:09 EST
ccp_register_algs() registers every algorithm family the driver knows
about. A device that does not implement the matching engine still gets
the algorithms advertised, and requests for them end up on a queue that
cannot execute them.
Gate each family on the engine it is built on, using the capability
information from probe time. The AMD v5 variants advertise all of their
engines and keep the current set of algorithms; the v3 CCP does not
implement DES3 and no longer advertises des3.
Reviewed-by: Shan Chen <chenshan@xxxxxxxx>
Tested-by: Yongwei Xu <xuyongwei@xxxxxxxx>
Signed-off-by: Depei Yang <yangdepei@xxxxxxxx>
---
drivers/crypto/ccp/ccp-crypto-main.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/crypto/ccp/ccp-crypto-main.c b/drivers/crypto/ccp/ccp-crypto-main.c
index 698e39ab107f..388ecb1694e5 100644
--- a/drivers/crypto/ccp/ccp-crypto-main.c
+++ b/drivers/crypto/ccp/ccp-crypto-main.c
@@ -325,7 +325,7 @@ static int ccp_register_algs(void)
{
int ret;
- if (!aes_disable) {
+ if (!aes_disable && ccp_has_cap(CCP_CAPS_AES)) {
ret = ccp_register_aes_algs(&skcipher_algs);
if (ret)
return ret;
@@ -334,28 +334,30 @@ static int ccp_register_algs(void)
if (ret)
return ret;
- ret = ccp_register_aes_xts_algs(&skcipher_algs);
+ ret = ccp_register_aes_aeads(&aead_algs);
if (ret)
return ret;
+ }
- ret = ccp_register_aes_aeads(&aead_algs);
+ if (!aes_disable && ccp_has_cap(CCP_CAPS_AES_XTS)) {
+ ret = ccp_register_aes_xts_algs(&skcipher_algs);
if (ret)
return ret;
}
- if (!des3_disable) {
+ if (!des3_disable && ccp_has_cap(CCP_CAPS_DES3)) {
ret = ccp_register_des3_algs(&skcipher_algs);
if (ret)
return ret;
}
- if (!sha_disable) {
+ if (!sha_disable && ccp_has_cap(CCP_CAPS_SHA)) {
ret = ccp_register_sha_algs(&hash_algs);
if (ret)
return ret;
}
- if (!rsa_disable) {
+ if (!rsa_disable && ccp_has_cap(CCP_CAPS_RSA)) {
ret = ccp_register_rsa_algs(&akcipher_algs);
if (ret)
return ret;
--
2.34.1