Re: [PATCH RESEND 1/9] crypto: caam/jr - add fallback for XTS with more than 8B IV

From: Horia Geantă
Date: Fri Aug 21 2020 - 08:03:14 EST


On 8/21/2020 6:47 AM, Herbert Xu wrote:
> On Tue, Aug 11, 2020 at 05:30:41PM +0300, Horia Geantă wrote:
>>
>>> + if (IS_ERR(fallback)) {
>>> + pr_err("Failed to allocate %s fallback: %ld\n",
>>> + tfm_name, PTR_ERR(fallback));
>>> + return PTR_ERR(fallback);
>> Shouldn't error out so early. It might be that the fallback won't be needed.
>> Let's postpone this until we're sure fallback is required.
>
> Why? The generic should always be there as otherwise you won't
> even pass the self-test. If we're OOM then we should error out
> ASAP.
>
self-tests don't check the cases where a fallback is needed,
so in theory things could go well for a misconfigured kernel
(where a fallback is not available).

But I agree, if driver is updated to select CRYPTO_XTS
then it's probably better to return an error here.

Thanks,
Horia