2020-08-26 08:16:13

by Martin Cerveny

[permalink] [raw]
Subject: PROBLEM: SHA1 on Allwinner V3s failed

Hello.

[1.] One line summary of the problem:

SHA1 on Allwinner V3s failed

[2.] Full description of the problem/report:

I enabled support crypto engine (compatible with A31) to DT.
https://github.com/mcerveny/linux/commit/ec8069049ce44590d41e6a7efb3f0a41a7db05f0
When I enable "selftest" crypto the SHA1 fails all other seems to work.
https://github.com/mcerveny/linux/commit/1de17a919d53059e9e14228f09ca39a4eb572e51
Driver is:
drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c
Other platforms using the same driver should be tested too.

[4.] Kernel information
[4.1.] Kernel version (from /proc/version):

Linux version 5.9.0-rc2-g1de17a919 (user@ubuntu1804)
(arm-linux-gnueabihf-gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0, GNU
ld (GNU Binutils for Ubuntu) 2.30) #1 SMP Wed Aug 26 09:00:52 CEST 2020

[4.2.] Kernel .config file:

sunxi_defconfig with https://github.com/mcerveny/linux/commit/1de17a919d53059e9e14228f09ca39a4eb572e51

[6.] Output of Oops.. message (if applicable) with symbolic information
resolved (see Documentation/admin-guide/bug-hunting.rst)

DMESG:
[ 0.876684] sun4i-ss 1c15000.crypto: Die ID 7
[ 0.885280] alg: ahash: sha1-sun4i-ss test failed (wrong result) on test vector 0, cfg="init+update+final aligned buffer"
[ 0.925753] alg: No test for stdrng (sun4i_ss_rng)

[8.] Environment
[8.2.] Processor information (from /proc/cpuinfo):

processor : 0
model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS : 48.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva
idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 5

Hardware : Allwinner sun8i Family
Revision : 0000
Serial : 12c00003a8a27b14

[8.7.] Other information that might be relevant to the problem
(please look in /proc and include all information that you
think to be relevant):

Attached benchmark test with "tcrypt" (console) - mode: 500,501,502,302(using sha1-generic not sha1-sun4i-ss),303
and /proc/crypto.


Attachments:
v3s-crypto.txt (28.76 kB)

2020-08-26 09:10:00

by Corentin Labbe

[permalink] [raw]
Subject: Re: PROBLEM: SHA1 on Allwinner V3s failed

On Wed, Aug 26, 2020 at 09:52:30AM +0200, Martin Cerveny wrote:
> Hello.
>
> [1.] One line summary of the problem:
>
> SHA1 on Allwinner V3s failed
>

Hello

Since only SHA1 is failling, could you try to use the "allwinner,sun8i-a33-crypto", just in case V3s has the same SHA1 HW quirck than A33.

Regards

2020-08-26 11:40:22

by Martin Cerveny

[permalink] [raw]
Subject: Re: PROBLEM: SHA1 on Allwinner V3s failed

Hello.

On Wed, 26 Aug 2020, Corentin Labbe wrote:
> On Wed, Aug 26, 2020 at 09:52:30AM +0200, Martin Cerveny wrote:
>> Hello.
>>
>> [1.] One line summary of the problem:
>>
>> SHA1 on Allwinner V3s failed
>>
> Since only SHA1 is failling, could you try to use the "allwinner,sun8i-a33-crypto", just in case V3s has the same SHA1 HW quirck than A33.

Yes. This do the trick. All startup verification passes now.
Performance (SHA1 with sha1-sun4i-ss) "tcrypt mode=303 sec=1" test output attached.
So, all seems to be working now. Released new patch with possibility to merge.

https://github.com/mcerveny/linux/commit/e3c76436de3d8cd2b2ddaeadef879a4a4d723bf4

Regards, Martin


Attachments:
v3s-crypto-sha1.txt (3.05 kB)

2020-08-26 11:55:43

by Corentin Labbe

[permalink] [raw]
Subject: Re: PROBLEM: SHA1 on Allwinner V3s failed

On Wed, Aug 26, 2020 at 01:33:20PM +0200, Martin Cerveny wrote:
> Hello.
>
> On Wed, 26 Aug 2020, Corentin Labbe wrote:
> > On Wed, Aug 26, 2020 at 09:52:30AM +0200, Martin Cerveny wrote:
> >> Hello.
> >>
> >> [1.] One line summary of the problem:
> >>
> >> SHA1 on Allwinner V3s failed
> >>
> > Since only SHA1 is failling, could you try to use the "allwinner,sun8i-a33-crypto", just in case V3s has the same SHA1 HW quirck than A33.
>
> Yes. This do the trick. All startup verification passes now.
> Performance (SHA1 with sha1-sun4i-ss) "tcrypt mode=303 sec=1" test output attached.
> So, all seems to be working now. Released new patch with possibility to merge.
>
> https://github.com/mcerveny/linux/commit/e3c76436de3d8cd2b2ddaeadef879a4a4d723bf4
>
> Regards, Martin

For proper solution, a new compatible "allwinner,sun8i-v3s-crypto" should be added instead.
Furthermore it should be added in sun4i-ss-core.s along with a new variant for v3s with .sha1_in_be = True.

The new compatible should also be added in Documentation/devicetree/bindings/crypto/allwinner,sun4i-a10-crypto.yaml

Regards

2020-08-27 17:26:09

by Martin Cerveny

[permalink] [raw]
Subject: [SOLVED] Re: PROBLEM: SHA1 on Allwinner V3s failed

Ok. I will send patch ASAP.

Regards, Martin

On Wed, 26 Aug 2020, Corentin Labbe wrote:

> On Wed, Aug 26, 2020 at 01:33:20PM +0200, Martin Cerveny wrote:
>> Hello.
>>
>> On Wed, 26 Aug 2020, Corentin Labbe wrote:
>>> On Wed, Aug 26, 2020 at 09:52:30AM +0200, Martin Cerveny wrote:
>>>> Hello.
>>>>
>>>> [1.] One line summary of the problem:
>>>>
>>>> SHA1 on Allwinner V3s failed
>>>>
>>> Since only SHA1 is failling, could you try to use the "allwinner,sun8i-a33-crypto", just in case V3s has the same SHA1 HW quirck than A33.
>>
>> Yes. This do the trick. All startup verification passes now.
>> Performance (SHA1 with sha1-sun4i-ss) "tcrypt mode=303 sec=1" test output attached.
>> So, all seems to be working now. Released new patch with possibility to merge.
>>
>> https://github.com/mcerveny/linux/commit/e3c76436de3d8cd2b2ddaeadef879a4a4d723bf4
>>
>> Regards, Martin
>
> For proper solution, a new compatible "allwinner,sun8i-v3s-crypto" should be added instead.
> Furthermore it should be added in sun4i-ss-core.s along with a new variant for v3s with .sha1_in_be = True.
>
> The new compatible should also be added in Documentation/devicetree/bindings/crypto/allwinner,sun4i-a10-crypto.yaml
>
> Regards
>