mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aleksander Jan Bajkowski <olek2@wp.pl>
To: Antoine Tenart <atenart@kernel.org>
Cc: ansuelsmth@gmail.com, herbert@gondor.apana.org.au,
	davem@davemloft.net, vschagen@icloud.com,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] crypto: inside-secure/eip93 - unregister only available algorithm
Date: Sat, 10 Jan 2026 18:24:10 +0100	[thread overview]
Message-ID: <546d3fae-15ea-4614-8bae-90e7207fb399@wp.pl> (raw)
In-Reply-To: <aVvRxqB6-Fdu0MXz@kwain>

Hi Antoine,

On 1/5/26 16:01, Antoine Tenart wrote:
> On Wed, Dec 31, 2025 at 12:51:57AM +0100, Aleksander Jan Bajkowski wrote:
>> 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.
>>
>> Fixes: 9739f5f93b78 ("crypto: eip93 - Add Inside Secure SafeXcel EIP-93 crypto engine support")
>> Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
>> ---
>>   .../crypto/inside-secure/eip93/eip93-main.c   | 107 ++++++++++--------
>>   1 file changed, 61 insertions(+), 46 deletions(-)
>>
>> diff --git a/drivers/crypto/inside-secure/eip93/eip93-main.c b/drivers/crypto/inside-secure/eip93/eip93-main.c
>> index 3cdc3308dcac..dfac2b23e2d9 100644
>> --- a/drivers/crypto/inside-secure/eip93/eip93-main.c
>> +++ b/drivers/crypto/inside-secure/eip93/eip93-main.c
>> @@ -77,11 +77,65 @@ 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(struct eip93_alg_template *eip93_algo,
>> +				   u32 supported_algo_flags)
>> +{
>> +	u32 alg_flags = eip93_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)) {
>> +		if (!(supported_algo_flags & EIP93_PE_OPTION_AES))
>> +			return 0;
>> +
>> +		if (!IS_HMAC(alg_flags)) {
>> +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY128)
>> +				eip93_algo->alg.skcipher.max_keysize =
>> +					AES_KEYSIZE_128;
>> +
>> +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY192)
>> +				eip93_algo->alg.skcipher.max_keysize =
>> +					AES_KEYSIZE_192;
>> +
>> +			if (supported_algo_flags & EIP93_PE_OPTION_AES_KEY256)
>> +				eip93_algo->alg.skcipher.max_keysize =
>> +					AES_KEYSIZE_256;
>> +
>> +			if (IS_RFC3686(alg_flags))
>> +				eip93_algo->alg.skcipher.max_keysize +=
>> +					CTR_RFC3686_NONCE_SIZE;
> Shouldn't the keysize assignment parts be kept in eip93_register_algs as
> this has nothing to do with checking if an alg is supported and as
> there's no point setting those (again) in the unregistration path?
>
You're right. I'll fix this in v2.


Regards,
Aleksander

  reply	other threads:[~2026-01-10 17:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-30 23:51 Aleksander Jan Bajkowski
2026-01-05 15:01 ` Antoine Tenart
2026-01-10 17:24   ` Aleksander Jan Bajkowski [this message]
2026-01-11 13:20 Aleksander Jan Bajkowski
2026-01-12  8:56 ` Antoine Tenart
2026-01-31  2:48 ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=546d3fae-15ea-4614-8bae-90e7207fb399@wp.pl \
    --to=olek2@wp.pl \
    --cc=ansuelsmth@gmail.com \
    --cc=atenart@kernel.org \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vschagen@icloud.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®