[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <54c1aa3a-9e51-a90f-416a-dc65a70a1b8a@huawei.com>
Date: Sat, 12 Nov 2022 09:51:55 +0800
From: liulongfang <liulongfang@...wei.com>
To: Herbert Xu <herbert@...dor.apana.org.au>
CC: <wangzhou1@...ilicon.com>, <linux-crypto@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] crypto/hisilicon: Add null judgment to the callback
interface
On 2022/11/10 16:53, Herbert Xu wrote:
> On Thu, Nov 10, 2022 at 12:11:15PM +0800, liulongfang wrote:
>>
>> When using crypto's skcipher series interfaces for encryption and decryption
>> services, User can use synchronous mode(by adjusting some skcipher interfaces,
>> here is to remove skcipher_request_set_callback()) or asynchronous mode,
>> but when using synchronous mode and the current asynchronous mode is loaded
>> it will cause a calltrace.
>>
>> The current problem is that the interface of skcipher does not restrict users
>> to call functions in this way for encryption services.
>>
>> If the current driver doesn't handle this, there is a possibility that some users
>> deliberately create this kind of problem to cause the kernel to crash.
>
> It sounds like your code is misusing the skcipher API. By default
> skcipher is always async. You must always set a callback.
>
> The only way to legally use skcipher without setting a callback
> is by allocating it with crypto_alloc_sync_skcipher. In which case
OK! I found in Documentation/crypto/architecture.rst the description
that async mode must provide a callback function.
However, what is confusing is that this document does not describe
the synchronization mode so clearly.
> unless your driver incorrectly declares itself as sync instead of
> async, then it will never be used by such a user.
>
> Cheers,
>
Thanks,
Longfang.
Powered by blists - more mailing lists