2017-11-06 18:11:38

by Tudor Ambarus

[permalink] [raw]
Subject: Re: [PATCH 2/2] crypto: atmel-aes - Reset the controller before each use

Hi, Romain,

On 10/31/2017 05:25 PM, Romain Izard wrote:
> When using the rfc4543(gcm(aes))) mode, the registers of the hardware
> engine are not empty after use. If the engine is not reset before its
> next use, the following results will be invalid.
>
> Always reset the hardware engine.

Thanks for the fix! I could reproduce the issue only when running
rfc4543(gcm(aes))) and then, immediately after, ecb(aes).

Have you encountered this bug with other combination of algorithms?

I'm trying to isolate the bug so that we can have a more fine-grained
fix.

Cheers,
ta

From 1583337252691999271@xxx Mon Nov 06 17:07:52 +0000 2017
X-GM-THRID: 1582787357553038657
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread


2017-11-06 17:07:52

by Romain Izard

[permalink] [raw]
Subject: Re: [PATCH 2/2] crypto: atmel-aes - Reset the controller before each use

2017-11-06 16:45 GMT+01:00 Tudor Ambarus <[email protected]>:
> Hi, Romain,
>
> On 10/31/2017 05:25 PM, Romain Izard wrote:
>>
>> When using the rfc4543(gcm(aes))) mode, the registers of the hardware
>> engine are not empty after use. If the engine is not reset before its
>> next use, the following results will be invalid.
>>
>> Always reset the hardware engine.
>
>
> Thanks for the fix! I could reproduce the issue only when running
> rfc4543(gcm(aes))) and then, immediately after, ecb(aes).
>
> Have you encountered this bug with other combination of algorithms?
>
> I'm trying to isolate the bug so that we can have a more fine-grained
> fix.

I just ran the tcrypt tests because they were failing on the
cts(cbc(aes)) transform and I observed this issue when the ecb
test failed only on the second run.

For me, the issue looks like the rfc4543 mode does not read
all the registers from the AES engine, and the following operation
fails because the registers are reused directly in the ECB mode.

As the ECB mode is a rare case where we do not use an IV, this
may be the reason why other modes do not display the issue.

--
Romain Izard

From 1582787357553038657@xxx Tue Oct 31 15:27:31 +0000 2017
X-GM-THRID: 1582787357553038657
X-Gmail-Labels: Inbox,Category Forums