VYPR
Unrated severityNVD Advisory· Published May 27, 2026· Updated May 27, 2026

CVE-2026-45854

CVE-2026-45854

Description

In the Linux kernel, the following vulnerability has been resolved:

crypto: inside-secure/eip93 - unregister only available algorithm

EIP93 has an options register. This register indicates which crypto algorithms are implemented in silicon. Supported algorithms are registered on this basis. Unregister algorithms on the same basis. Currently, all algorithms are unregistered, even those not supported by HW. This results in panic on platforms that don't have all options implemented in silicon.

Affected products

1

Patches

6
243d642ff580

crypto: inside-secure/eip93 - unregister only available algorithm

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.gitAleksander Jan BajkowskiJan 11, 2026Fixed in 6.18.14via kernel-cna
2 files changed · +106 80
  • drivers/crypto/inside-secure/eip93/eip93-main.c+53 40 modified
    diff --git a/drivers/crypto/inside-secure/eip93/eip93-main.c b/drivers/crypto/inside-secure/eip93/eip93-main.c
    index 3cdc3308dcac86..b7fd9795062d4c 100644
    --- a/drivers/crypto/inside-secure/eip93/eip93-main.c
    +++ b/drivers/crypto/inside-secure/eip93/eip93-main.c
    @@ -77,11 +77,44 @@ inline void eip93_irq_clear(struct eip93_device *eip93, u32 mask)
     	__raw_writel(mask, eip93->base + EIP93_REG_INT_CLR);
     }
     
    -static void eip93_unregister_algs(unsigned int i)
    +static int eip93_algo_is_supported(u32 alg_flags, u32 supported_algo_flags)
    +{
    +	if ((IS_DES(alg_flags) || IS_3DES(alg_flags)) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_TDES))
    +		return 0;
    +
    +	if (IS_AES(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_AES))
    +		return 0;
    +
    +	if (IS_HASH_MD5(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_MD5))
    +		return 0;
    +
    +	if (IS_HASH_SHA1(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_1))
    +		return 0;
    +
    +	if (IS_HASH_SHA224(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_224))
    +		return 0;
    +
    +	if (IS_HASH_SHA256(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_256))
    +		return 0;
    +
    +	return 1;
    +}
    +
    +static void eip93_unregister_algs(u32 supported_algo_flags, unsigned int i)
     {
     	unsigned int j;
     
     	for (j = 0; j < i; j++) {
    +		if (!eip93_algo_is_supported(eip93_algs[j]->flags,
    +					     supported_algo_flags))
    +			continue;
    +
     		switch (eip93_algs[j]->type) {
     		case EIP93_ALG_TYPE_SKCIPHER:
     			crypto_unregister_skcipher(&eip93_algs[j]->alg.skcipher);
    @@ -106,49 +139,27 @@ static int eip93_register_algs(struct eip93_device *eip93, u32 supported_algo_fl
     
     		eip93_algs[i]->eip93 = eip93;
     
    -		if ((IS_DES(alg_flags) || IS_3DES(alg_flags)) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_TDES))
    +		if (!eip93_algo_is_supported(alg_flags, supported_algo_flags))
     			continue;
     
    -		if (IS_AES(alg_flags)) {
    -			if (!(supported_algo_flags & EIP93_PE_OPTION_AES))
    -				continue;
    +		if (IS_AES(alg_flags) && !IS_HMAC(alg_flags)) {
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY128)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_128;
     
    -			if (!IS_HMAC(alg_flags)) {
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY128)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_128;
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY192)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_192;
     
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY192)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_192;
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY256)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_256;
     
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY256)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_256;
    -
    -				if (IS_RFC3686(alg_flags))
    -					eip93_algs[i]->alg.skcipher.max_keysize +=
    -						CTR_RFC3686_NONCE_SIZE;
    -			}
    +			if (IS_RFC3686(alg_flags))
    +				eip93_algs[i]->alg.skcipher.max_keysize +=
    +					CTR_RFC3686_NONCE_SIZE;
     		}
     
    -		if (IS_HASH_MD5(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_MD5))
    -			continue;
    -
    -		if (IS_HASH_SHA1(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_1))
    -			continue;
    -
    -		if (IS_HASH_SHA224(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_224))
    -			continue;
    -
    -		if (IS_HASH_SHA256(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_256))
    -			continue;
    -
     		switch (eip93_algs[i]->type) {
     		case EIP93_ALG_TYPE_SKCIPHER:
     			ret = crypto_register_skcipher(&eip93_algs[i]->alg.skcipher);
    @@ -167,7 +178,7 @@ static int eip93_register_algs(struct eip93_device *eip93, u32 supported_algo_fl
     	return 0;
     
     fail:
    -	eip93_unregister_algs(i);
    +	eip93_unregister_algs(supported_algo_flags, i);
     
     	return ret;
     }
    @@ -469,8 +480,11 @@ static int eip93_crypto_probe(struct platform_device *pdev)
     static void eip93_crypto_remove(struct platform_device *pdev)
     {
     	struct eip93_device *eip93 = platform_get_drvdata(pdev);
    +	u32 algo_flags;
    +
    +	algo_flags = readl(eip93->base + EIP93_REG_PE_OPTION_1);
     
    -	eip93_unregister_algs(ARRAY_SIZE(eip93_algs));
    +	eip93_unregister_algs(algo_flags, ARRAY_SIZE(eip93_algs));
     	eip93_cleanup(eip93);
     }
     
    -- 
    cgit 1.3-korg
    
    
    
  • drivers/crypto/inside-secure/eip93/eip93-main.c+53 40 modified
    diff --git a/drivers/crypto/inside-secure/eip93/eip93-main.c b/drivers/crypto/inside-secure/eip93/eip93-main.c
    index 3cdc3308dcac86..b7fd9795062d4c 100644
    --- a/drivers/crypto/inside-secure/eip93/eip93-main.c
    +++ b/drivers/crypto/inside-secure/eip93/eip93-main.c
    @@ -77,11 +77,44 @@ inline void eip93_irq_clear(struct eip93_device *eip93, u32 mask)
     	__raw_writel(mask, eip93->base + EIP93_REG_INT_CLR);
     }
     
    -static void eip93_unregister_algs(unsigned int i)
    +static int eip93_algo_is_supported(u32 alg_flags, u32 supported_algo_flags)
    +{
    +	if ((IS_DES(alg_flags) || IS_3DES(alg_flags)) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_TDES))
    +		return 0;
    +
    +	if (IS_AES(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_AES))
    +		return 0;
    +
    +	if (IS_HASH_MD5(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_MD5))
    +		return 0;
    +
    +	if (IS_HASH_SHA1(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_1))
    +		return 0;
    +
    +	if (IS_HASH_SHA224(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_224))
    +		return 0;
    +
    +	if (IS_HASH_SHA256(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_256))
    +		return 0;
    +
    +	return 1;
    +}
    +
    +static void eip93_unregister_algs(u32 supported_algo_flags, unsigned int i)
     {
     	unsigned int j;
     
     	for (j = 0; j < i; j++) {
    +		if (!eip93_algo_is_supported(eip93_algs[j]->flags,
    +					     supported_algo_flags))
    +			continue;
    +
     		switch (eip93_algs[j]->type) {
     		case EIP93_ALG_TYPE_SKCIPHER:
     			crypto_unregister_skcipher(&eip93_algs[j]->alg.skcipher);
    @@ -106,49 +139,27 @@ static int eip93_register_algs(struct eip93_device *eip93, u32 supported_algo_fl
     
     		eip93_algs[i]->eip93 = eip93;
     
    -		if ((IS_DES(alg_flags) || IS_3DES(alg_flags)) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_TDES))
    +		if (!eip93_algo_is_supported(alg_flags, supported_algo_flags))
     			continue;
     
    -		if (IS_AES(alg_flags)) {
    -			if (!(supported_algo_flags & EIP93_PE_OPTION_AES))
    -				continue;
    +		if (IS_AES(alg_flags) && !IS_HMAC(alg_flags)) {
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY128)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_128;
     
    -			if (!IS_HMAC(alg_flags)) {
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY128)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_128;
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY192)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_192;
     
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY192)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_192;
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY256)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_256;
     
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY256)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_256;
    -
    -				if (IS_RFC3686(alg_flags))
    -					eip93_algs[i]->alg.skcipher.max_keysize +=
    -						CTR_RFC3686_NONCE_SIZE;
    -			}
    +			if (IS_RFC3686(alg_flags))
    +				eip93_algs[i]->alg.skcipher.max_keysize +=
    +					CTR_RFC3686_NONCE_SIZE;
     		}
     
    -		if (IS_HASH_MD5(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_MD5))
    -			continue;
    -
    -		if (IS_HASH_SHA1(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_1))
    -			continue;
    -
    -		if (IS_HASH_SHA224(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_224))
    -			continue;
    -
    -		if (IS_HASH_SHA256(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_256))
    -			continue;
    -
     		switch (eip93_algs[i]->type) {
     		case EIP93_ALG_TYPE_SKCIPHER:
     			ret = crypto_register_skcipher(&eip93_algs[i]->alg.skcipher);
    @@ -167,7 +178,7 @@ static int eip93_register_algs(struct eip93_device *eip93, u32 supported_algo_fl
     	return 0;
     
     fail:
    -	eip93_unregister_algs(i);
    +	eip93_unregister_algs(supported_algo_flags, i);
     
     	return ret;
     }
    @@ -469,8 +480,11 @@ static int eip93_crypto_probe(struct platform_device *pdev)
     static void eip93_crypto_remove(struct platform_device *pdev)
     {
     	struct eip93_device *eip93 = platform_get_drvdata(pdev);
    +	u32 algo_flags;
    +
    +	algo_flags = readl(eip93->base + EIP93_REG_PE_OPTION_1);
     
    -	eip93_unregister_algs(ARRAY_SIZE(eip93_algs));
    +	eip93_unregister_algs(algo_flags, ARRAY_SIZE(eip93_algs));
     	eip93_cleanup(eip93);
     }
     
    -- 
    cgit 1.3-korg
    
    
    
4c1c5a1d720f

crypto: inside-secure/eip93 - unregister only available algorithm

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.gitAleksander Jan BajkowskiJan 11, 2026Fixed in 6.19.4via kernel-cna
2 files changed · +106 80
  • drivers/crypto/inside-secure/eip93/eip93-main.c+53 40 modified
    diff --git a/drivers/crypto/inside-secure/eip93/eip93-main.c b/drivers/crypto/inside-secure/eip93/eip93-main.c
    index 3cdc3308dcac86..b7fd9795062d4c 100644
    --- a/drivers/crypto/inside-secure/eip93/eip93-main.c
    +++ b/drivers/crypto/inside-secure/eip93/eip93-main.c
    @@ -77,11 +77,44 @@ inline void eip93_irq_clear(struct eip93_device *eip93, u32 mask)
     	__raw_writel(mask, eip93->base + EIP93_REG_INT_CLR);
     }
     
    -static void eip93_unregister_algs(unsigned int i)
    +static int eip93_algo_is_supported(u32 alg_flags, u32 supported_algo_flags)
    +{
    +	if ((IS_DES(alg_flags) || IS_3DES(alg_flags)) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_TDES))
    +		return 0;
    +
    +	if (IS_AES(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_AES))
    +		return 0;
    +
    +	if (IS_HASH_MD5(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_MD5))
    +		return 0;
    +
    +	if (IS_HASH_SHA1(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_1))
    +		return 0;
    +
    +	if (IS_HASH_SHA224(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_224))
    +		return 0;
    +
    +	if (IS_HASH_SHA256(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_256))
    +		return 0;
    +
    +	return 1;
    +}
    +
    +static void eip93_unregister_algs(u32 supported_algo_flags, unsigned int i)
     {
     	unsigned int j;
     
     	for (j = 0; j < i; j++) {
    +		if (!eip93_algo_is_supported(eip93_algs[j]->flags,
    +					     supported_algo_flags))
    +			continue;
    +
     		switch (eip93_algs[j]->type) {
     		case EIP93_ALG_TYPE_SKCIPHER:
     			crypto_unregister_skcipher(&eip93_algs[j]->alg.skcipher);
    @@ -106,49 +139,27 @@ static int eip93_register_algs(struct eip93_device *eip93, u32 supported_algo_fl
     
     		eip93_algs[i]->eip93 = eip93;
     
    -		if ((IS_DES(alg_flags) || IS_3DES(alg_flags)) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_TDES))
    +		if (!eip93_algo_is_supported(alg_flags, supported_algo_flags))
     			continue;
     
    -		if (IS_AES(alg_flags)) {
    -			if (!(supported_algo_flags & EIP93_PE_OPTION_AES))
    -				continue;
    +		if (IS_AES(alg_flags) && !IS_HMAC(alg_flags)) {
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY128)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_128;
     
    -			if (!IS_HMAC(alg_flags)) {
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY128)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_128;
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY192)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_192;
     
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY192)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_192;
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY256)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_256;
     
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY256)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_256;
    -
    -				if (IS_RFC3686(alg_flags))
    -					eip93_algs[i]->alg.skcipher.max_keysize +=
    -						CTR_RFC3686_NONCE_SIZE;
    -			}
    +			if (IS_RFC3686(alg_flags))
    +				eip93_algs[i]->alg.skcipher.max_keysize +=
    +					CTR_RFC3686_NONCE_SIZE;
     		}
     
    -		if (IS_HASH_MD5(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_MD5))
    -			continue;
    -
    -		if (IS_HASH_SHA1(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_1))
    -			continue;
    -
    -		if (IS_HASH_SHA224(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_224))
    -			continue;
    -
    -		if (IS_HASH_SHA256(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_256))
    -			continue;
    -
     		switch (eip93_algs[i]->type) {
     		case EIP93_ALG_TYPE_SKCIPHER:
     			ret = crypto_register_skcipher(&eip93_algs[i]->alg.skcipher);
    @@ -167,7 +178,7 @@ static int eip93_register_algs(struct eip93_device *eip93, u32 supported_algo_fl
     	return 0;
     
     fail:
    -	eip93_unregister_algs(i);
    +	eip93_unregister_algs(supported_algo_flags, i);
     
     	return ret;
     }
    @@ -469,8 +480,11 @@ static int eip93_crypto_probe(struct platform_device *pdev)
     static void eip93_crypto_remove(struct platform_device *pdev)
     {
     	struct eip93_device *eip93 = platform_get_drvdata(pdev);
    +	u32 algo_flags;
    +
    +	algo_flags = readl(eip93->base + EIP93_REG_PE_OPTION_1);
     
    -	eip93_unregister_algs(ARRAY_SIZE(eip93_algs));
    +	eip93_unregister_algs(algo_flags, ARRAY_SIZE(eip93_algs));
     	eip93_cleanup(eip93);
     }
     
    -- 
    cgit 1.3-korg
    
    
    
  • drivers/crypto/inside-secure/eip93/eip93-main.c+53 40 modified
    diff --git a/drivers/crypto/inside-secure/eip93/eip93-main.c b/drivers/crypto/inside-secure/eip93/eip93-main.c
    index 3cdc3308dcac86..b7fd9795062d4c 100644
    --- a/drivers/crypto/inside-secure/eip93/eip93-main.c
    +++ b/drivers/crypto/inside-secure/eip93/eip93-main.c
    @@ -77,11 +77,44 @@ inline void eip93_irq_clear(struct eip93_device *eip93, u32 mask)
     	__raw_writel(mask, eip93->base + EIP93_REG_INT_CLR);
     }
     
    -static void eip93_unregister_algs(unsigned int i)
    +static int eip93_algo_is_supported(u32 alg_flags, u32 supported_algo_flags)
    +{
    +	if ((IS_DES(alg_flags) || IS_3DES(alg_flags)) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_TDES))
    +		return 0;
    +
    +	if (IS_AES(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_AES))
    +		return 0;
    +
    +	if (IS_HASH_MD5(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_MD5))
    +		return 0;
    +
    +	if (IS_HASH_SHA1(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_1))
    +		return 0;
    +
    +	if (IS_HASH_SHA224(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_224))
    +		return 0;
    +
    +	if (IS_HASH_SHA256(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_256))
    +		return 0;
    +
    +	return 1;
    +}
    +
    +static void eip93_unregister_algs(u32 supported_algo_flags, unsigned int i)
     {
     	unsigned int j;
     
     	for (j = 0; j < i; j++) {
    +		if (!eip93_algo_is_supported(eip93_algs[j]->flags,
    +					     supported_algo_flags))
    +			continue;
    +
     		switch (eip93_algs[j]->type) {
     		case EIP93_ALG_TYPE_SKCIPHER:
     			crypto_unregister_skcipher(&eip93_algs[j]->alg.skcipher);
    @@ -106,49 +139,27 @@ static int eip93_register_algs(struct eip93_device *eip93, u32 supported_algo_fl
     
     		eip93_algs[i]->eip93 = eip93;
     
    -		if ((IS_DES(alg_flags) || IS_3DES(alg_flags)) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_TDES))
    +		if (!eip93_algo_is_supported(alg_flags, supported_algo_flags))
     			continue;
     
    -		if (IS_AES(alg_flags)) {
    -			if (!(supported_algo_flags & EIP93_PE_OPTION_AES))
    -				continue;
    +		if (IS_AES(alg_flags) && !IS_HMAC(alg_flags)) {
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY128)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_128;
     
    -			if (!IS_HMAC(alg_flags)) {
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY128)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_128;
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY192)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_192;
     
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY192)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_192;
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY256)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_256;
     
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY256)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_256;
    -
    -				if (IS_RFC3686(alg_flags))
    -					eip93_algs[i]->alg.skcipher.max_keysize +=
    -						CTR_RFC3686_NONCE_SIZE;
    -			}
    +			if (IS_RFC3686(alg_flags))
    +				eip93_algs[i]->alg.skcipher.max_keysize +=
    +					CTR_RFC3686_NONCE_SIZE;
     		}
     
    -		if (IS_HASH_MD5(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_MD5))
    -			continue;
    -
    -		if (IS_HASH_SHA1(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_1))
    -			continue;
    -
    -		if (IS_HASH_SHA224(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_224))
    -			continue;
    -
    -		if (IS_HASH_SHA256(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_256))
    -			continue;
    -
     		switch (eip93_algs[i]->type) {
     		case EIP93_ALG_TYPE_SKCIPHER:
     			ret = crypto_register_skcipher(&eip93_algs[i]->alg.skcipher);
    @@ -167,7 +178,7 @@ static int eip93_register_algs(struct eip93_device *eip93, u32 supported_algo_fl
     	return 0;
     
     fail:
    -	eip93_unregister_algs(i);
    +	eip93_unregister_algs(supported_algo_flags, i);
     
     	return ret;
     }
    @@ -469,8 +480,11 @@ static int eip93_crypto_probe(struct platform_device *pdev)
     static void eip93_crypto_remove(struct platform_device *pdev)
     {
     	struct eip93_device *eip93 = platform_get_drvdata(pdev);
    +	u32 algo_flags;
    +
    +	algo_flags = readl(eip93->base + EIP93_REG_PE_OPTION_1);
     
    -	eip93_unregister_algs(ARRAY_SIZE(eip93_algs));
    +	eip93_unregister_algs(algo_flags, ARRAY_SIZE(eip93_algs));
     	eip93_cleanup(eip93);
     }
     
    -- 
    cgit 1.3-korg
    
    
    
0ceeadc7b53a

crypto: inside-secure/eip93 - unregister only available algorithm

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.gitAleksander Jan BajkowskiJan 11, 2026Fixed in 7.0via kernel-cna
2 files changed · +106 80
  • drivers/crypto/inside-secure/eip93/eip93-main.c+53 40 modified
    diff --git a/drivers/crypto/inside-secure/eip93/eip93-main.c b/drivers/crypto/inside-secure/eip93/eip93-main.c
    index 3cdc3308dcac86..b7fd9795062d4c 100644
    --- a/drivers/crypto/inside-secure/eip93/eip93-main.c
    +++ b/drivers/crypto/inside-secure/eip93/eip93-main.c
    @@ -77,11 +77,44 @@ inline void eip93_irq_clear(struct eip93_device *eip93, u32 mask)
     	__raw_writel(mask, eip93->base + EIP93_REG_INT_CLR);
     }
     
    -static void eip93_unregister_algs(unsigned int i)
    +static int eip93_algo_is_supported(u32 alg_flags, u32 supported_algo_flags)
    +{
    +	if ((IS_DES(alg_flags) || IS_3DES(alg_flags)) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_TDES))
    +		return 0;
    +
    +	if (IS_AES(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_AES))
    +		return 0;
    +
    +	if (IS_HASH_MD5(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_MD5))
    +		return 0;
    +
    +	if (IS_HASH_SHA1(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_1))
    +		return 0;
    +
    +	if (IS_HASH_SHA224(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_224))
    +		return 0;
    +
    +	if (IS_HASH_SHA256(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_256))
    +		return 0;
    +
    +	return 1;
    +}
    +
    +static void eip93_unregister_algs(u32 supported_algo_flags, unsigned int i)
     {
     	unsigned int j;
     
     	for (j = 0; j < i; j++) {
    +		if (!eip93_algo_is_supported(eip93_algs[j]->flags,
    +					     supported_algo_flags))
    +			continue;
    +
     		switch (eip93_algs[j]->type) {
     		case EIP93_ALG_TYPE_SKCIPHER:
     			crypto_unregister_skcipher(&eip93_algs[j]->alg.skcipher);
    @@ -106,49 +139,27 @@ static int eip93_register_algs(struct eip93_device *eip93, u32 supported_algo_fl
     
     		eip93_algs[i]->eip93 = eip93;
     
    -		if ((IS_DES(alg_flags) || IS_3DES(alg_flags)) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_TDES))
    +		if (!eip93_algo_is_supported(alg_flags, supported_algo_flags))
     			continue;
     
    -		if (IS_AES(alg_flags)) {
    -			if (!(supported_algo_flags & EIP93_PE_OPTION_AES))
    -				continue;
    +		if (IS_AES(alg_flags) && !IS_HMAC(alg_flags)) {
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY128)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_128;
     
    -			if (!IS_HMAC(alg_flags)) {
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY128)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_128;
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY192)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_192;
     
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY192)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_192;
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY256)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_256;
     
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY256)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_256;
    -
    -				if (IS_RFC3686(alg_flags))
    -					eip93_algs[i]->alg.skcipher.max_keysize +=
    -						CTR_RFC3686_NONCE_SIZE;
    -			}
    +			if (IS_RFC3686(alg_flags))
    +				eip93_algs[i]->alg.skcipher.max_keysize +=
    +					CTR_RFC3686_NONCE_SIZE;
     		}
     
    -		if (IS_HASH_MD5(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_MD5))
    -			continue;
    -
    -		if (IS_HASH_SHA1(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_1))
    -			continue;
    -
    -		if (IS_HASH_SHA224(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_224))
    -			continue;
    -
    -		if (IS_HASH_SHA256(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_256))
    -			continue;
    -
     		switch (eip93_algs[i]->type) {
     		case EIP93_ALG_TYPE_SKCIPHER:
     			ret = crypto_register_skcipher(&eip93_algs[i]->alg.skcipher);
    @@ -167,7 +178,7 @@ static int eip93_register_algs(struct eip93_device *eip93, u32 supported_algo_fl
     	return 0;
     
     fail:
    -	eip93_unregister_algs(i);
    +	eip93_unregister_algs(supported_algo_flags, i);
     
     	return ret;
     }
    @@ -469,8 +480,11 @@ static int eip93_crypto_probe(struct platform_device *pdev)
     static void eip93_crypto_remove(struct platform_device *pdev)
     {
     	struct eip93_device *eip93 = platform_get_drvdata(pdev);
    +	u32 algo_flags;
    +
    +	algo_flags = readl(eip93->base + EIP93_REG_PE_OPTION_1);
     
    -	eip93_unregister_algs(ARRAY_SIZE(eip93_algs));
    +	eip93_unregister_algs(algo_flags, ARRAY_SIZE(eip93_algs));
     	eip93_cleanup(eip93);
     }
     
    -- 
    cgit 1.3-korg
    
    
    
  • drivers/crypto/inside-secure/eip93/eip93-main.c+53 40 modified
    diff --git a/drivers/crypto/inside-secure/eip93/eip93-main.c b/drivers/crypto/inside-secure/eip93/eip93-main.c
    index 3cdc3308dcac86..b7fd9795062d4c 100644
    --- a/drivers/crypto/inside-secure/eip93/eip93-main.c
    +++ b/drivers/crypto/inside-secure/eip93/eip93-main.c
    @@ -77,11 +77,44 @@ inline void eip93_irq_clear(struct eip93_device *eip93, u32 mask)
     	__raw_writel(mask, eip93->base + EIP93_REG_INT_CLR);
     }
     
    -static void eip93_unregister_algs(unsigned int i)
    +static int eip93_algo_is_supported(u32 alg_flags, u32 supported_algo_flags)
    +{
    +	if ((IS_DES(alg_flags) || IS_3DES(alg_flags)) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_TDES))
    +		return 0;
    +
    +	if (IS_AES(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_AES))
    +		return 0;
    +
    +	if (IS_HASH_MD5(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_MD5))
    +		return 0;
    +
    +	if (IS_HASH_SHA1(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_1))
    +		return 0;
    +
    +	if (IS_HASH_SHA224(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_224))
    +		return 0;
    +
    +	if (IS_HASH_SHA256(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_256))
    +		return 0;
    +
    +	return 1;
    +}
    +
    +static void eip93_unregister_algs(u32 supported_algo_flags, unsigned int i)
     {
     	unsigned int j;
     
     	for (j = 0; j < i; j++) {
    +		if (!eip93_algo_is_supported(eip93_algs[j]->flags,
    +					     supported_algo_flags))
    +			continue;
    +
     		switch (eip93_algs[j]->type) {
     		case EIP93_ALG_TYPE_SKCIPHER:
     			crypto_unregister_skcipher(&eip93_algs[j]->alg.skcipher);
    @@ -106,49 +139,27 @@ static int eip93_register_algs(struct eip93_device *eip93, u32 supported_algo_fl
     
     		eip93_algs[i]->eip93 = eip93;
     
    -		if ((IS_DES(alg_flags) || IS_3DES(alg_flags)) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_TDES))
    +		if (!eip93_algo_is_supported(alg_flags, supported_algo_flags))
     			continue;
     
    -		if (IS_AES(alg_flags)) {
    -			if (!(supported_algo_flags & EIP93_PE_OPTION_AES))
    -				continue;
    +		if (IS_AES(alg_flags) && !IS_HMAC(alg_flags)) {
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY128)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_128;
     
    -			if (!IS_HMAC(alg_flags)) {
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY128)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_128;
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY192)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_192;
     
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY192)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_192;
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY256)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_256;
     
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY256)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_256;
    -
    -				if (IS_RFC3686(alg_flags))
    -					eip93_algs[i]->alg.skcipher.max_keysize +=
    -						CTR_RFC3686_NONCE_SIZE;
    -			}
    +			if (IS_RFC3686(alg_flags))
    +				eip93_algs[i]->alg.skcipher.max_keysize +=
    +					CTR_RFC3686_NONCE_SIZE;
     		}
     
    -		if (IS_HASH_MD5(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_MD5))
    -			continue;
    -
    -		if (IS_HASH_SHA1(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_1))
    -			continue;
    -
    -		if (IS_HASH_SHA224(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_224))
    -			continue;
    -
    -		if (IS_HASH_SHA256(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_256))
    -			continue;
    -
     		switch (eip93_algs[i]->type) {
     		case EIP93_ALG_TYPE_SKCIPHER:
     			ret = crypto_register_skcipher(&eip93_algs[i]->alg.skcipher);
    @@ -167,7 +178,7 @@ static int eip93_register_algs(struct eip93_device *eip93, u32 supported_algo_fl
     	return 0;
     
     fail:
    -	eip93_unregister_algs(i);
    +	eip93_unregister_algs(supported_algo_flags, i);
     
     	return ret;
     }
    @@ -469,8 +480,11 @@ static int eip93_crypto_probe(struct platform_device *pdev)
     static void eip93_crypto_remove(struct platform_device *pdev)
     {
     	struct eip93_device *eip93 = platform_get_drvdata(pdev);
    +	u32 algo_flags;
    +
    +	algo_flags = readl(eip93->base + EIP93_REG_PE_OPTION_1);
     
    -	eip93_unregister_algs(ARRAY_SIZE(eip93_algs));
    +	eip93_unregister_algs(algo_flags, ARRAY_SIZE(eip93_algs));
     	eip93_cleanup(eip93);
     }
     
    -- 
    cgit 1.3-korg
    
    
    
243d642ff580

crypto: inside-secure/eip93 - unregister only available algorithm

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.gitAleksander Jan BajkowskiJan 11, 2026via nvd-ref
2 files changed · +106 80
  • drivers/crypto/inside-secure/eip93/eip93-main.c+53 40 modified
    diff --git a/drivers/crypto/inside-secure/eip93/eip93-main.c b/drivers/crypto/inside-secure/eip93/eip93-main.c
    index 3cdc3308dcac86..b7fd9795062d4c 100644
    --- a/drivers/crypto/inside-secure/eip93/eip93-main.c
    +++ b/drivers/crypto/inside-secure/eip93/eip93-main.c
    @@ -77,11 +77,44 @@ inline void eip93_irq_clear(struct eip93_device *eip93, u32 mask)
     	__raw_writel(mask, eip93->base + EIP93_REG_INT_CLR);
     }
     
    -static void eip93_unregister_algs(unsigned int i)
    +static int eip93_algo_is_supported(u32 alg_flags, u32 supported_algo_flags)
    +{
    +	if ((IS_DES(alg_flags) || IS_3DES(alg_flags)) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_TDES))
    +		return 0;
    +
    +	if (IS_AES(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_AES))
    +		return 0;
    +
    +	if (IS_HASH_MD5(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_MD5))
    +		return 0;
    +
    +	if (IS_HASH_SHA1(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_1))
    +		return 0;
    +
    +	if (IS_HASH_SHA224(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_224))
    +		return 0;
    +
    +	if (IS_HASH_SHA256(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_256))
    +		return 0;
    +
    +	return 1;
    +}
    +
    +static void eip93_unregister_algs(u32 supported_algo_flags, unsigned int i)
     {
     	unsigned int j;
     
     	for (j = 0; j < i; j++) {
    +		if (!eip93_algo_is_supported(eip93_algs[j]->flags,
    +					     supported_algo_flags))
    +			continue;
    +
     		switch (eip93_algs[j]->type) {
     		case EIP93_ALG_TYPE_SKCIPHER:
     			crypto_unregister_skcipher(&eip93_algs[j]->alg.skcipher);
    @@ -106,49 +139,27 @@ static int eip93_register_algs(struct eip93_device *eip93, u32 supported_algo_fl
     
     		eip93_algs[i]->eip93 = eip93;
     
    -		if ((IS_DES(alg_flags) || IS_3DES(alg_flags)) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_TDES))
    +		if (!eip93_algo_is_supported(alg_flags, supported_algo_flags))
     			continue;
     
    -		if (IS_AES(alg_flags)) {
    -			if (!(supported_algo_flags & EIP93_PE_OPTION_AES))
    -				continue;
    +		if (IS_AES(alg_flags) && !IS_HMAC(alg_flags)) {
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY128)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_128;
     
    -			if (!IS_HMAC(alg_flags)) {
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY128)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_128;
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY192)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_192;
     
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY192)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_192;
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY256)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_256;
     
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY256)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_256;
    -
    -				if (IS_RFC3686(alg_flags))
    -					eip93_algs[i]->alg.skcipher.max_keysize +=
    -						CTR_RFC3686_NONCE_SIZE;
    -			}
    +			if (IS_RFC3686(alg_flags))
    +				eip93_algs[i]->alg.skcipher.max_keysize +=
    +					CTR_RFC3686_NONCE_SIZE;
     		}
     
    -		if (IS_HASH_MD5(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_MD5))
    -			continue;
    -
    -		if (IS_HASH_SHA1(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_1))
    -			continue;
    -
    -		if (IS_HASH_SHA224(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_224))
    -			continue;
    -
    -		if (IS_HASH_SHA256(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_256))
    -			continue;
    -
     		switch (eip93_algs[i]->type) {
     		case EIP93_ALG_TYPE_SKCIPHER:
     			ret = crypto_register_skcipher(&eip93_algs[i]->alg.skcipher);
    @@ -167,7 +178,7 @@ static int eip93_register_algs(struct eip93_device *eip93, u32 supported_algo_fl
     	return 0;
     
     fail:
    -	eip93_unregister_algs(i);
    +	eip93_unregister_algs(supported_algo_flags, i);
     
     	return ret;
     }
    @@ -469,8 +480,11 @@ static int eip93_crypto_probe(struct platform_device *pdev)
     static void eip93_crypto_remove(struct platform_device *pdev)
     {
     	struct eip93_device *eip93 = platform_get_drvdata(pdev);
    +	u32 algo_flags;
    +
    +	algo_flags = readl(eip93->base + EIP93_REG_PE_OPTION_1);
     
    -	eip93_unregister_algs(ARRAY_SIZE(eip93_algs));
    +	eip93_unregister_algs(algo_flags, ARRAY_SIZE(eip93_algs));
     	eip93_cleanup(eip93);
     }
     
    -- 
    cgit 1.3-korg
    
    
    
  • drivers/crypto/inside-secure/eip93/eip93-main.c+53 40 modified
    diff --git a/drivers/crypto/inside-secure/eip93/eip93-main.c b/drivers/crypto/inside-secure/eip93/eip93-main.c
    index 3cdc3308dcac86..b7fd9795062d4c 100644
    --- a/drivers/crypto/inside-secure/eip93/eip93-main.c
    +++ b/drivers/crypto/inside-secure/eip93/eip93-main.c
    @@ -77,11 +77,44 @@ inline void eip93_irq_clear(struct eip93_device *eip93, u32 mask)
     	__raw_writel(mask, eip93->base + EIP93_REG_INT_CLR);
     }
     
    -static void eip93_unregister_algs(unsigned int i)
    +static int eip93_algo_is_supported(u32 alg_flags, u32 supported_algo_flags)
    +{
    +	if ((IS_DES(alg_flags) || IS_3DES(alg_flags)) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_TDES))
    +		return 0;
    +
    +	if (IS_AES(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_AES))
    +		return 0;
    +
    +	if (IS_HASH_MD5(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_MD5))
    +		return 0;
    +
    +	if (IS_HASH_SHA1(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_1))
    +		return 0;
    +
    +	if (IS_HASH_SHA224(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_224))
    +		return 0;
    +
    +	if (IS_HASH_SHA256(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_256))
    +		return 0;
    +
    +	return 1;
    +}
    +
    +static void eip93_unregister_algs(u32 supported_algo_flags, unsigned int i)
     {
     	unsigned int j;
     
     	for (j = 0; j < i; j++) {
    +		if (!eip93_algo_is_supported(eip93_algs[j]->flags,
    +					     supported_algo_flags))
    +			continue;
    +
     		switch (eip93_algs[j]->type) {
     		case EIP93_ALG_TYPE_SKCIPHER:
     			crypto_unregister_skcipher(&eip93_algs[j]->alg.skcipher);
    @@ -106,49 +139,27 @@ static int eip93_register_algs(struct eip93_device *eip93, u32 supported_algo_fl
     
     		eip93_algs[i]->eip93 = eip93;
     
    -		if ((IS_DES(alg_flags) || IS_3DES(alg_flags)) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_TDES))
    +		if (!eip93_algo_is_supported(alg_flags, supported_algo_flags))
     			continue;
     
    -		if (IS_AES(alg_flags)) {
    -			if (!(supported_algo_flags & EIP93_PE_OPTION_AES))
    -				continue;
    +		if (IS_AES(alg_flags) && !IS_HMAC(alg_flags)) {
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY128)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_128;
     
    -			if (!IS_HMAC(alg_flags)) {
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY128)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_128;
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY192)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_192;
     
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY192)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_192;
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY256)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_256;
     
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY256)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_256;
    -
    -				if (IS_RFC3686(alg_flags))
    -					eip93_algs[i]->alg.skcipher.max_keysize +=
    -						CTR_RFC3686_NONCE_SIZE;
    -			}
    +			if (IS_RFC3686(alg_flags))
    +				eip93_algs[i]->alg.skcipher.max_keysize +=
    +					CTR_RFC3686_NONCE_SIZE;
     		}
     
    -		if (IS_HASH_MD5(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_MD5))
    -			continue;
    -
    -		if (IS_HASH_SHA1(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_1))
    -			continue;
    -
    -		if (IS_HASH_SHA224(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_224))
    -			continue;
    -
    -		if (IS_HASH_SHA256(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_256))
    -			continue;
    -
     		switch (eip93_algs[i]->type) {
     		case EIP93_ALG_TYPE_SKCIPHER:
     			ret = crypto_register_skcipher(&eip93_algs[i]->alg.skcipher);
    @@ -167,7 +178,7 @@ static int eip93_register_algs(struct eip93_device *eip93, u32 supported_algo_fl
     	return 0;
     
     fail:
    -	eip93_unregister_algs(i);
    +	eip93_unregister_algs(supported_algo_flags, i);
     
     	return ret;
     }
    @@ -469,8 +480,11 @@ static int eip93_crypto_probe(struct platform_device *pdev)
     static void eip93_crypto_remove(struct platform_device *pdev)
     {
     	struct eip93_device *eip93 = platform_get_drvdata(pdev);
    +	u32 algo_flags;
    +
    +	algo_flags = readl(eip93->base + EIP93_REG_PE_OPTION_1);
     
    -	eip93_unregister_algs(ARRAY_SIZE(eip93_algs));
    +	eip93_unregister_algs(algo_flags, ARRAY_SIZE(eip93_algs));
     	eip93_cleanup(eip93);
     }
     
    -- 
    cgit 1.3-korg
    
    
    
4c1c5a1d720f

crypto: inside-secure/eip93 - unregister only available algorithm

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.gitAleksander Jan BajkowskiJan 11, 2026via nvd-ref
2 files changed · +106 80
  • drivers/crypto/inside-secure/eip93/eip93-main.c+53 40 modified
    diff --git a/drivers/crypto/inside-secure/eip93/eip93-main.c b/drivers/crypto/inside-secure/eip93/eip93-main.c
    index 3cdc3308dcac86..b7fd9795062d4c 100644
    --- a/drivers/crypto/inside-secure/eip93/eip93-main.c
    +++ b/drivers/crypto/inside-secure/eip93/eip93-main.c
    @@ -77,11 +77,44 @@ inline void eip93_irq_clear(struct eip93_device *eip93, u32 mask)
     	__raw_writel(mask, eip93->base + EIP93_REG_INT_CLR);
     }
     
    -static void eip93_unregister_algs(unsigned int i)
    +static int eip93_algo_is_supported(u32 alg_flags, u32 supported_algo_flags)
    +{
    +	if ((IS_DES(alg_flags) || IS_3DES(alg_flags)) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_TDES))
    +		return 0;
    +
    +	if (IS_AES(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_AES))
    +		return 0;
    +
    +	if (IS_HASH_MD5(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_MD5))
    +		return 0;
    +
    +	if (IS_HASH_SHA1(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_1))
    +		return 0;
    +
    +	if (IS_HASH_SHA224(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_224))
    +		return 0;
    +
    +	if (IS_HASH_SHA256(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_256))
    +		return 0;
    +
    +	return 1;
    +}
    +
    +static void eip93_unregister_algs(u32 supported_algo_flags, unsigned int i)
     {
     	unsigned int j;
     
     	for (j = 0; j < i; j++) {
    +		if (!eip93_algo_is_supported(eip93_algs[j]->flags,
    +					     supported_algo_flags))
    +			continue;
    +
     		switch (eip93_algs[j]->type) {
     		case EIP93_ALG_TYPE_SKCIPHER:
     			crypto_unregister_skcipher(&eip93_algs[j]->alg.skcipher);
    @@ -106,49 +139,27 @@ static int eip93_register_algs(struct eip93_device *eip93, u32 supported_algo_fl
     
     		eip93_algs[i]->eip93 = eip93;
     
    -		if ((IS_DES(alg_flags) || IS_3DES(alg_flags)) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_TDES))
    +		if (!eip93_algo_is_supported(alg_flags, supported_algo_flags))
     			continue;
     
    -		if (IS_AES(alg_flags)) {
    -			if (!(supported_algo_flags & EIP93_PE_OPTION_AES))
    -				continue;
    +		if (IS_AES(alg_flags) && !IS_HMAC(alg_flags)) {
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY128)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_128;
     
    -			if (!IS_HMAC(alg_flags)) {
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY128)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_128;
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY192)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_192;
     
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY192)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_192;
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY256)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_256;
     
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY256)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_256;
    -
    -				if (IS_RFC3686(alg_flags))
    -					eip93_algs[i]->alg.skcipher.max_keysize +=
    -						CTR_RFC3686_NONCE_SIZE;
    -			}
    +			if (IS_RFC3686(alg_flags))
    +				eip93_algs[i]->alg.skcipher.max_keysize +=
    +					CTR_RFC3686_NONCE_SIZE;
     		}
     
    -		if (IS_HASH_MD5(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_MD5))
    -			continue;
    -
    -		if (IS_HASH_SHA1(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_1))
    -			continue;
    -
    -		if (IS_HASH_SHA224(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_224))
    -			continue;
    -
    -		if (IS_HASH_SHA256(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_256))
    -			continue;
    -
     		switch (eip93_algs[i]->type) {
     		case EIP93_ALG_TYPE_SKCIPHER:
     			ret = crypto_register_skcipher(&eip93_algs[i]->alg.skcipher);
    @@ -167,7 +178,7 @@ static int eip93_register_algs(struct eip93_device *eip93, u32 supported_algo_fl
     	return 0;
     
     fail:
    -	eip93_unregister_algs(i);
    +	eip93_unregister_algs(supported_algo_flags, i);
     
     	return ret;
     }
    @@ -469,8 +480,11 @@ static int eip93_crypto_probe(struct platform_device *pdev)
     static void eip93_crypto_remove(struct platform_device *pdev)
     {
     	struct eip93_device *eip93 = platform_get_drvdata(pdev);
    +	u32 algo_flags;
    +
    +	algo_flags = readl(eip93->base + EIP93_REG_PE_OPTION_1);
     
    -	eip93_unregister_algs(ARRAY_SIZE(eip93_algs));
    +	eip93_unregister_algs(algo_flags, ARRAY_SIZE(eip93_algs));
     	eip93_cleanup(eip93);
     }
     
    -- 
    cgit 1.3-korg
    
    
    
  • drivers/crypto/inside-secure/eip93/eip93-main.c+53 40 modified
    diff --git a/drivers/crypto/inside-secure/eip93/eip93-main.c b/drivers/crypto/inside-secure/eip93/eip93-main.c
    index 3cdc3308dcac86..b7fd9795062d4c 100644
    --- a/drivers/crypto/inside-secure/eip93/eip93-main.c
    +++ b/drivers/crypto/inside-secure/eip93/eip93-main.c
    @@ -77,11 +77,44 @@ inline void eip93_irq_clear(struct eip93_device *eip93, u32 mask)
     	__raw_writel(mask, eip93->base + EIP93_REG_INT_CLR);
     }
     
    -static void eip93_unregister_algs(unsigned int i)
    +static int eip93_algo_is_supported(u32 alg_flags, u32 supported_algo_flags)
    +{
    +	if ((IS_DES(alg_flags) || IS_3DES(alg_flags)) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_TDES))
    +		return 0;
    +
    +	if (IS_AES(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_AES))
    +		return 0;
    +
    +	if (IS_HASH_MD5(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_MD5))
    +		return 0;
    +
    +	if (IS_HASH_SHA1(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_1))
    +		return 0;
    +
    +	if (IS_HASH_SHA224(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_224))
    +		return 0;
    +
    +	if (IS_HASH_SHA256(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_256))
    +		return 0;
    +
    +	return 1;
    +}
    +
    +static void eip93_unregister_algs(u32 supported_algo_flags, unsigned int i)
     {
     	unsigned int j;
     
     	for (j = 0; j < i; j++) {
    +		if (!eip93_algo_is_supported(eip93_algs[j]->flags,
    +					     supported_algo_flags))
    +			continue;
    +
     		switch (eip93_algs[j]->type) {
     		case EIP93_ALG_TYPE_SKCIPHER:
     			crypto_unregister_skcipher(&eip93_algs[j]->alg.skcipher);
    @@ -106,49 +139,27 @@ static int eip93_register_algs(struct eip93_device *eip93, u32 supported_algo_fl
     
     		eip93_algs[i]->eip93 = eip93;
     
    -		if ((IS_DES(alg_flags) || IS_3DES(alg_flags)) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_TDES))
    +		if (!eip93_algo_is_supported(alg_flags, supported_algo_flags))
     			continue;
     
    -		if (IS_AES(alg_flags)) {
    -			if (!(supported_algo_flags & EIP93_PE_OPTION_AES))
    -				continue;
    +		if (IS_AES(alg_flags) && !IS_HMAC(alg_flags)) {
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY128)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_128;
     
    -			if (!IS_HMAC(alg_flags)) {
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY128)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_128;
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY192)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_192;
     
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY192)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_192;
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY256)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_256;
     
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY256)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_256;
    -
    -				if (IS_RFC3686(alg_flags))
    -					eip93_algs[i]->alg.skcipher.max_keysize +=
    -						CTR_RFC3686_NONCE_SIZE;
    -			}
    +			if (IS_RFC3686(alg_flags))
    +				eip93_algs[i]->alg.skcipher.max_keysize +=
    +					CTR_RFC3686_NONCE_SIZE;
     		}
     
    -		if (IS_HASH_MD5(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_MD5))
    -			continue;
    -
    -		if (IS_HASH_SHA1(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_1))
    -			continue;
    -
    -		if (IS_HASH_SHA224(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_224))
    -			continue;
    -
    -		if (IS_HASH_SHA256(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_256))
    -			continue;
    -
     		switch (eip93_algs[i]->type) {
     		case EIP93_ALG_TYPE_SKCIPHER:
     			ret = crypto_register_skcipher(&eip93_algs[i]->alg.skcipher);
    @@ -167,7 +178,7 @@ static int eip93_register_algs(struct eip93_device *eip93, u32 supported_algo_fl
     	return 0;
     
     fail:
    -	eip93_unregister_algs(i);
    +	eip93_unregister_algs(supported_algo_flags, i);
     
     	return ret;
     }
    @@ -469,8 +480,11 @@ static int eip93_crypto_probe(struct platform_device *pdev)
     static void eip93_crypto_remove(struct platform_device *pdev)
     {
     	struct eip93_device *eip93 = platform_get_drvdata(pdev);
    +	u32 algo_flags;
    +
    +	algo_flags = readl(eip93->base + EIP93_REG_PE_OPTION_1);
     
    -	eip93_unregister_algs(ARRAY_SIZE(eip93_algs));
    +	eip93_unregister_algs(algo_flags, ARRAY_SIZE(eip93_algs));
     	eip93_cleanup(eip93);
     }
     
    -- 
    cgit 1.3-korg
    
    
    
0ceeadc7b53a

crypto: inside-secure/eip93 - unregister only available algorithm

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.gitAleksander Jan BajkowskiJan 11, 2026via nvd-ref
2 files changed · +106 80
  • drivers/crypto/inside-secure/eip93/eip93-main.c+53 40 modified
    diff --git a/drivers/crypto/inside-secure/eip93/eip93-main.c b/drivers/crypto/inside-secure/eip93/eip93-main.c
    index 3cdc3308dcac86..b7fd9795062d4c 100644
    --- a/drivers/crypto/inside-secure/eip93/eip93-main.c
    +++ b/drivers/crypto/inside-secure/eip93/eip93-main.c
    @@ -77,11 +77,44 @@ inline void eip93_irq_clear(struct eip93_device *eip93, u32 mask)
     	__raw_writel(mask, eip93->base + EIP93_REG_INT_CLR);
     }
     
    -static void eip93_unregister_algs(unsigned int i)
    +static int eip93_algo_is_supported(u32 alg_flags, u32 supported_algo_flags)
    +{
    +	if ((IS_DES(alg_flags) || IS_3DES(alg_flags)) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_TDES))
    +		return 0;
    +
    +	if (IS_AES(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_AES))
    +		return 0;
    +
    +	if (IS_HASH_MD5(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_MD5))
    +		return 0;
    +
    +	if (IS_HASH_SHA1(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_1))
    +		return 0;
    +
    +	if (IS_HASH_SHA224(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_224))
    +		return 0;
    +
    +	if (IS_HASH_SHA256(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_256))
    +		return 0;
    +
    +	return 1;
    +}
    +
    +static void eip93_unregister_algs(u32 supported_algo_flags, unsigned int i)
     {
     	unsigned int j;
     
     	for (j = 0; j < i; j++) {
    +		if (!eip93_algo_is_supported(eip93_algs[j]->flags,
    +					     supported_algo_flags))
    +			continue;
    +
     		switch (eip93_algs[j]->type) {
     		case EIP93_ALG_TYPE_SKCIPHER:
     			crypto_unregister_skcipher(&eip93_algs[j]->alg.skcipher);
    @@ -106,49 +139,27 @@ static int eip93_register_algs(struct eip93_device *eip93, u32 supported_algo_fl
     
     		eip93_algs[i]->eip93 = eip93;
     
    -		if ((IS_DES(alg_flags) || IS_3DES(alg_flags)) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_TDES))
    +		if (!eip93_algo_is_supported(alg_flags, supported_algo_flags))
     			continue;
     
    -		if (IS_AES(alg_flags)) {
    -			if (!(supported_algo_flags & EIP93_PE_OPTION_AES))
    -				continue;
    +		if (IS_AES(alg_flags) && !IS_HMAC(alg_flags)) {
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY128)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_128;
     
    -			if (!IS_HMAC(alg_flags)) {
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY128)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_128;
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY192)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_192;
     
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY192)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_192;
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY256)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_256;
     
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY256)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_256;
    -
    -				if (IS_RFC3686(alg_flags))
    -					eip93_algs[i]->alg.skcipher.max_keysize +=
    -						CTR_RFC3686_NONCE_SIZE;
    -			}
    +			if (IS_RFC3686(alg_flags))
    +				eip93_algs[i]->alg.skcipher.max_keysize +=
    +					CTR_RFC3686_NONCE_SIZE;
     		}
     
    -		if (IS_HASH_MD5(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_MD5))
    -			continue;
    -
    -		if (IS_HASH_SHA1(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_1))
    -			continue;
    -
    -		if (IS_HASH_SHA224(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_224))
    -			continue;
    -
    -		if (IS_HASH_SHA256(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_256))
    -			continue;
    -
     		switch (eip93_algs[i]->type) {
     		case EIP93_ALG_TYPE_SKCIPHER:
     			ret = crypto_register_skcipher(&eip93_algs[i]->alg.skcipher);
    @@ -167,7 +178,7 @@ static int eip93_register_algs(struct eip93_device *eip93, u32 supported_algo_fl
     	return 0;
     
     fail:
    -	eip93_unregister_algs(i);
    +	eip93_unregister_algs(supported_algo_flags, i);
     
     	return ret;
     }
    @@ -469,8 +480,11 @@ static int eip93_crypto_probe(struct platform_device *pdev)
     static void eip93_crypto_remove(struct platform_device *pdev)
     {
     	struct eip93_device *eip93 = platform_get_drvdata(pdev);
    +	u32 algo_flags;
    +
    +	algo_flags = readl(eip93->base + EIP93_REG_PE_OPTION_1);
     
    -	eip93_unregister_algs(ARRAY_SIZE(eip93_algs));
    +	eip93_unregister_algs(algo_flags, ARRAY_SIZE(eip93_algs));
     	eip93_cleanup(eip93);
     }
     
    -- 
    cgit 1.3-korg
    
    
    
  • drivers/crypto/inside-secure/eip93/eip93-main.c+53 40 modified
    diff --git a/drivers/crypto/inside-secure/eip93/eip93-main.c b/drivers/crypto/inside-secure/eip93/eip93-main.c
    index 3cdc3308dcac86..b7fd9795062d4c 100644
    --- a/drivers/crypto/inside-secure/eip93/eip93-main.c
    +++ b/drivers/crypto/inside-secure/eip93/eip93-main.c
    @@ -77,11 +77,44 @@ inline void eip93_irq_clear(struct eip93_device *eip93, u32 mask)
     	__raw_writel(mask, eip93->base + EIP93_REG_INT_CLR);
     }
     
    -static void eip93_unregister_algs(unsigned int i)
    +static int eip93_algo_is_supported(u32 alg_flags, u32 supported_algo_flags)
    +{
    +	if ((IS_DES(alg_flags) || IS_3DES(alg_flags)) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_TDES))
    +		return 0;
    +
    +	if (IS_AES(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_AES))
    +		return 0;
    +
    +	if (IS_HASH_MD5(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_MD5))
    +		return 0;
    +
    +	if (IS_HASH_SHA1(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_1))
    +		return 0;
    +
    +	if (IS_HASH_SHA224(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_224))
    +		return 0;
    +
    +	if (IS_HASH_SHA256(alg_flags) &&
    +	    !(supported_algo_flags & EIP93_PE_OPTION_SHA_256))
    +		return 0;
    +
    +	return 1;
    +}
    +
    +static void eip93_unregister_algs(u32 supported_algo_flags, unsigned int i)
     {
     	unsigned int j;
     
     	for (j = 0; j < i; j++) {
    +		if (!eip93_algo_is_supported(eip93_algs[j]->flags,
    +					     supported_algo_flags))
    +			continue;
    +
     		switch (eip93_algs[j]->type) {
     		case EIP93_ALG_TYPE_SKCIPHER:
     			crypto_unregister_skcipher(&eip93_algs[j]->alg.skcipher);
    @@ -106,49 +139,27 @@ static int eip93_register_algs(struct eip93_device *eip93, u32 supported_algo_fl
     
     		eip93_algs[i]->eip93 = eip93;
     
    -		if ((IS_DES(alg_flags) || IS_3DES(alg_flags)) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_TDES))
    +		if (!eip93_algo_is_supported(alg_flags, supported_algo_flags))
     			continue;
     
    -		if (IS_AES(alg_flags)) {
    -			if (!(supported_algo_flags & EIP93_PE_OPTION_AES))
    -				continue;
    +		if (IS_AES(alg_flags) && !IS_HMAC(alg_flags)) {
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY128)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_128;
     
    -			if (!IS_HMAC(alg_flags)) {
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY128)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_128;
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY192)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_192;
     
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY192)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_192;
    +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY256)
    +				eip93_algs[i]->alg.skcipher.max_keysize =
    +					AES_KEYSIZE_256;
     
    -				if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY256)
    -					eip93_algs[i]->alg.skcipher.max_keysize =
    -						AES_KEYSIZE_256;
    -
    -				if (IS_RFC3686(alg_flags))
    -					eip93_algs[i]->alg.skcipher.max_keysize +=
    -						CTR_RFC3686_NONCE_SIZE;
    -			}
    +			if (IS_RFC3686(alg_flags))
    +				eip93_algs[i]->alg.skcipher.max_keysize +=
    +					CTR_RFC3686_NONCE_SIZE;
     		}
     
    -		if (IS_HASH_MD5(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_MD5))
    -			continue;
    -
    -		if (IS_HASH_SHA1(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_1))
    -			continue;
    -
    -		if (IS_HASH_SHA224(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_224))
    -			continue;
    -
    -		if (IS_HASH_SHA256(alg_flags) &&
    -		    !(supported_algo_flags & EIP93_PE_OPTION_SHA_256))
    -			continue;
    -
     		switch (eip93_algs[i]->type) {
     		case EIP93_ALG_TYPE_SKCIPHER:
     			ret = crypto_register_skcipher(&eip93_algs[i]->alg.skcipher);
    @@ -167,7 +178,7 @@ static int eip93_register_algs(struct eip93_device *eip93, u32 supported_algo_fl
     	return 0;
     
     fail:
    -	eip93_unregister_algs(i);
    +	eip93_unregister_algs(supported_algo_flags, i);
     
     	return ret;
     }
    @@ -469,8 +480,11 @@ static int eip93_crypto_probe(struct platform_device *pdev)
     static void eip93_crypto_remove(struct platform_device *pdev)
     {
     	struct eip93_device *eip93 = platform_get_drvdata(pdev);
    +	u32 algo_flags;
    +
    +	algo_flags = readl(eip93->base + EIP93_REG_PE_OPTION_1);
     
    -	eip93_unregister_algs(ARRAY_SIZE(eip93_algs));
    +	eip93_unregister_algs(algo_flags, ARRAY_SIZE(eip93_algs));
     	eip93_cleanup(eip93);
     }
     
    -- 
    cgit 1.3-korg
    
    
    

Vulnerability mechanics

Root cause

"Missing hardware-capability check in the algorithm unregister path causes unregistration of algorithms that were never registered, leading to a kernel panic."

Attack vector

No attacker-controlled input is required; the vulnerability triggers during normal driver removal (unbind or module unload) on EIP93 hardware that lacks certain crypto accelerators in silicon. When `eip93_crypto_remove()` is called, the old code unconditionally unregistered every algorithm in the static `eip93_algs[]` array, including algorithms that were never registered because the hardware's options register indicated they were absent. Calling `crypto_unregister_*()` on an algorithm that was never registered causes a kernel panic. [patch_id=2662070]

Affected code

The bug is in `drivers/crypto/inside-secure/eip93/eip93-main.c`. The `eip93_unregister_algs()` function previously accepted only a count parameter (`unsigned int i`) and iterated over all algorithms in the `eip93_algs[]` array without checking whether each algorithm was actually supported by the hardware. The `eip93_crypto_remove()` function called `eip93_unregister_algs(ARRAY_SIZE(eip93_algs))` without reading the hardware options register. [patch_id=2662070]

What the fix does

The patch introduces a new helper function `eip93_algo_is_supported()` that checks an algorithm's flags against the hardware's supported-algorithm bitmask read from `EIP93_REG_PE_OPTION_1`. The `eip93_unregister_algs()` signature is changed to accept a `supported_algo_flags` parameter, and its loop now skips algorithms that are not supported by the hardware. The `eip93_crypto_remove()` function reads the options register before calling unregister, and the error path in `eip93_register_algs()` also passes the flags through. This ensures only algorithms that were actually registered are later unregistered, preventing the panic. [patch_id=2662070]

Preconditions

  • configThe system must use an EIP93 crypto engine that does not implement all algorithms in silicon (i.e., the options register has some feature bits clear).
  • inputThe driver must be removed (device unbind, module unload, or probe failure rollback).

Generated on May 27, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

3

News mentions

0

No linked articles in our index yet.