mbox series

[0/3] crypto:hisilicon/sec - fixes some coding style

Message ID 1612519857-30714-1-git-send-email-liulongfang@huawei.com
Headers show
Series crypto:hisilicon/sec - fixes some coding style | expand

Message

liulongfang Feb. 5, 2021, 10:10 a.m. UTC
1. Fix two problems.
2. Fix some coding style.

Longfang Liu (3):
  crypto: hisilicon/sec - fixes some log printing style
  crypto: hisilicon/sec - fixes some driver coding style
  crypto: hisilicon/sec - fixes shash test error

 arch/arm64/configs/defconfig               |   2 +-
 drivers/crypto/hisilicon/sec2/sec.h        |   5 +-
 drivers/crypto/hisilicon/sec2/sec_crypto.c |  82 +++++++++---------
 drivers/crypto/hisilicon/sec2/sec_crypto.h |   2 -
 drivers/crypto/hisilicon/sec2/sec_main.c   | 131 +++++++++++++++++------------
 5 files changed, 119 insertions(+), 103 deletions(-)

Comments

Herbert Xu Feb. 5, 2021, 11:44 a.m. UTC | #1
On Fri, Feb 05, 2021 at 06:10:57PM +0800, Longfang Liu wrote:
> If this configuration item is not turned on,
> the allocation of crypto_tfm will fail when
> the shash algorithm calculates the hash
> through the software.
> 
> Signed-off-by: Longfang Liu <liulongfang@huawei.com>
> ---
>  arch/arm64/configs/defconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
> index 8383016..7cfc9b6 100644
> --- a/arch/arm64/configs/defconfig
> +++ b/arch/arm64/configs/defconfig
> @@ -117,7 +117,7 @@ CONFIG_KVM=y
>  CONFIG_ARM64_CRYPTO=y
>  CONFIG_CRYPTO_SHA1_ARM64_CE=y
>  CONFIG_CRYPTO_SHA2_ARM64_CE=y
> -CONFIG_CRYPTO_SHA512_ARM64_CE=m
> +CONFIG_CRYPTO_SHA512_ARM64_CE=y

If this is truly needed then it should be enabled through Kconfig.

Cheers,
liulongfang Feb. 7, 2021, 2:46 a.m. UTC | #2
On 2021/2/5 19:44, Herbert Xu write:
> On Fri, Feb 05, 2021 at 06:10:57PM +0800, Longfang Liu wrote:

>> If this configuration item is not turned on,

>> the allocation of crypto_tfm will fail when

>> the shash algorithm calculates the hash

>> through the software.

>>

>> Signed-off-by: Longfang Liu <liulongfang@huawei.com>

>> ---

>>  arch/arm64/configs/defconfig | 2 +-

>>  1 file changed, 1 insertion(+), 1 deletion(-)

>>

>> diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig

>> index 8383016..7cfc9b6 100644

>> --- a/arch/arm64/configs/defconfig

>> +++ b/arch/arm64/configs/defconfig

>> @@ -117,7 +117,7 @@ CONFIG_KVM=y

>>  CONFIG_ARM64_CRYPTO=y

>>  CONFIG_CRYPTO_SHA1_ARM64_CE=y

>>  CONFIG_CRYPTO_SHA2_ARM64_CE=y

>> -CONFIG_CRYPTO_SHA512_ARM64_CE=m

>> +CONFIG_CRYPTO_SHA512_ARM64_CE=y

> 

> If this is truly needed then it should be enabled through Kconfig.

> 

> Cheers,

> 

Hi Herbert,
The option select CRYPTO_SHA512 already exists in Kconfig.
Can I change it to this: select CRYPTO_SHA512 || CRYPTO_SHA512_ARM64_CE
Thanks,
Longfang Liu.
Ard Biesheuvel Feb. 7, 2021, 8:02 a.m. UTC | #3
On Sun, 7 Feb 2021 at 03:47, liulongfang <liulongfang@huawei.com> wrote:
>

> On 2021/2/5 19:44, Herbert Xu write:

> > On Fri, Feb 05, 2021 at 06:10:57PM +0800, Longfang Liu wrote:

> >> If this configuration item is not turned on,

> >> the allocation of crypto_tfm will fail when

> >> the shash algorithm calculates the hash

> >> through the software.

> >>

> >> Signed-off-by: Longfang Liu <liulongfang@huawei.com>

> >> ---

> >>  arch/arm64/configs/defconfig | 2 +-

> >>  1 file changed, 1 insertion(+), 1 deletion(-)

> >>

> >> diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig

> >> index 8383016..7cfc9b6 100644

> >> --- a/arch/arm64/configs/defconfig

> >> +++ b/arch/arm64/configs/defconfig

> >> @@ -117,7 +117,7 @@ CONFIG_KVM=y

> >>  CONFIG_ARM64_CRYPTO=y

> >>  CONFIG_CRYPTO_SHA1_ARM64_CE=y

> >>  CONFIG_CRYPTO_SHA2_ARM64_CE=y

> >> -CONFIG_CRYPTO_SHA512_ARM64_CE=m

> >> +CONFIG_CRYPTO_SHA512_ARM64_CE=y

> >

> > If this is truly needed then it should be enabled through Kconfig.

> >

> > Cheers,

> >

> Hi Herbert,

> The option select CRYPTO_SHA512 already exists in Kconfig.


In that case, how can the shash TFM allocation fail?

> Can I change it to this: select CRYPTO_SHA512 || CRYPTO_SHA512_ARM64_CE


No, you cannot select expressions like that.

Could you please explain the problem you are trying to solve?
liulongfang Feb. 7, 2021, 9:49 a.m. UTC | #4
On 2021/2/7 16:02, Ard Biesheuvel wrote:
> On Sun, 7 Feb 2021 at 03:47, liulongfang <liulongfang@huawei.com> wrote:

>>

>> On 2021/2/5 19:44, Herbert Xu write:

>>> On Fri, Feb 05, 2021 at 06:10:57PM +0800, Longfang Liu wrote:

>>>> If this configuration item is not turned on,

>>>> the allocation of crypto_tfm will fail when

>>>> the shash algorithm calculates the hash

>>>> through the software.

>>>>

>>>> Signed-off-by: Longfang Liu <liulongfang@huawei.com>

>>>> ---

>>>>  arch/arm64/configs/defconfig | 2 +-

>>>>  1 file changed, 1 insertion(+), 1 deletion(-)

>>>>

>>>> diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig

>>>> index 8383016..7cfc9b6 100644

>>>> --- a/arch/arm64/configs/defconfig

>>>> +++ b/arch/arm64/configs/defconfig

>>>> @@ -117,7 +117,7 @@ CONFIG_KVM=y

>>>>  CONFIG_ARM64_CRYPTO=y

>>>>  CONFIG_CRYPTO_SHA1_ARM64_CE=y

>>>>  CONFIG_CRYPTO_SHA2_ARM64_CE=y

>>>> -CONFIG_CRYPTO_SHA512_ARM64_CE=m

>>>> +CONFIG_CRYPTO_SHA512_ARM64_CE=y

>>>

>>> If this is truly needed then it should be enabled through Kconfig.

>>>

>>> Cheers,

>>>

>> Hi Herbert,

>> The option select CRYPTO_SHA512 already exists in Kconfig.

> 

> In that case, how can the shash TFM allocation fail?

> 

Hi
After comparison and investigation, the problem is that the header
file "crypto/internal/hash.h" is not added. After adding this header file,
which CRYPTO_SHA512_ARM64_C compilation option does not need to be enabled.
I will modify it in the next patch.
>> Can I change it to this: select CRYPTO_SHA512 || CRYPTO_SHA512_ARM64_CE

> 

> No, you cannot select expressions like that.

> 

> Could you please explain the problem you are trying to solve?

> .

> 

When allocation shash TFM with hmac(sha512)-cbc(aes) algorithm,
TFM will return an error.
Thanks
Longfang.
liulongfang Feb. 20, 2021, 9:51 a.m. UTC | #5
On 2021/2/5 19:44, Herbert Xu Wrote:
> On Fri, Feb 05, 2021 at 06:10:57PM +0800, Longfang Liu wrote:

>> If this configuration item is not turned on,

>> the allocation of crypto_tfm will fail when

>> the shash algorithm calculates the hash

>> through the software.

>>

>> Signed-off-by: Longfang Liu <liulongfang@huawei.com>

>> ---

>>  arch/arm64/configs/defconfig | 2 +-

>>  1 file changed, 1 insertion(+), 1 deletion(-)

>>

>> diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig

>> index 8383016..7cfc9b6 100644

>> --- a/arch/arm64/configs/defconfig

>> +++ b/arch/arm64/configs/defconfig

>> @@ -117,7 +117,7 @@ CONFIG_KVM=y

>>  CONFIG_ARM64_CRYPTO=y

>>  CONFIG_CRYPTO_SHA1_ARM64_CE=y

>>  CONFIG_CRYPTO_SHA2_ARM64_CE=y

>> -CONFIG_CRYPTO_SHA512_ARM64_CE=m

>> +CONFIG_CRYPTO_SHA512_ARM64_CE=y

> 

> If this is truly needed then it should be enabled through Kconfig.

> 

> Cheers,

> 

Hi,
Since patch3 is an unnecessary patch,
can you just remove it and merge patch1 and patch2?
Thanks,
Longfang.
Herbert Xu March 4, 2021, 4:41 a.m. UTC | #6
On Sat, Feb 20, 2021 at 05:51:22PM +0800, liulongfang wrote:
.
> Since patch3 is an unnecessary patch,

> can you just remove it and merge patch1 and patch2?


Please repost.

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
liulongfang March 4, 2021, 5:56 a.m. UTC | #7
On 2021/3/4 12:41, Herbert Xu wrote:
> On Sat, Feb 20, 2021 at 05:51:22PM +0800, liulongfang wrote:

> .

>> Since patch3 is an unnecessary patch,

>> can you just remove it and merge patch1 and patch2?

> 

> Please repost.

> 

> Thanks,

> 

Ok.
Thanks,
Longfang