mbox series

[0/6] crypto: additional fixes for omap-aes

Message ID 20191026145259.16040-1-ardb@kernel.org (mailing list archive)
Headers show
Series crypto: additional fixes for omap-aes | expand

Message

Ard Biesheuvel Oct. 26, 2019, 2:52 p.m. UTC
This series applies onto Tero's series [0], and addresses a number of
additional issues that exist in the omap-aes driver that aren't being
addresses by Tero's fixes.

Note that the resulting code is still not 100% correct: an issue remains
where inputs into GCM consisting solely of assocdata are not being processed
correctly, e.g.,

alg: aead: gcm-aes-omap encryption test failed (wrong result) on test vector
  "random: alen=38 plen=0 authsize=16 klen=32",
   cfg="random: inplace may_sleep use_digest src_divs=[100.0%@+19] iv_offset=31"

I have no idea how to fix this, so I'll leave this to people that know this
hardware and have access to the Sitara TRM.

Note that I also spotted some issues in the SHAM driver, i.e.,

alg: ahash: omap-sha1 test failed (wrong result) on test vector
  "random: psize=7928 ksize=0", cfg="random: inplace use_final 
      src_divs=[5.64%@+13, 59.70%@+18, <flush>31.53%@+4072,
      <flush,nosimd>3.13%@alignmask+263]"
alg: ahash: omap-hmac-sha256 test failed (wrong result) on test vector
  "random: psize=960 ksize=37", cfg="random: inplace use_final
      src_divs=[32.54%@+2449, 17.18%@+4, <flush>50.28%@+1] iv_offset=31"

All of these failures are triggered by CONFIG_CRYPTO_MANAGER_EXTRA_TESTS,
so they will not show up when using the standard set of test vectors.

[0] https://lore.kernel.org/linux-crypto/20191017122549.4634-1-t-kristo@ti.com/

Cc: linux-omap@vger.kernel.org
Cc: Tero Kristo <t-kristo@ti.com>

Ard Biesheuvel (6):
  crypto: omap-aes - reject invalid input sizes for block modes
  crypto: omap-aes-ctr - set blocksize to 1
  crypto: omap-aes-gcm - deal with memory allocation failure
  crypto: omap-aes-gcm - add missing .setauthsize hooks
  crypto: omap-aes-gcm - check length of assocdata in RFC4106 mode
  crypto: omap-aes-gcm - use the AES library to encrypt the tag

 drivers/crypto/omap-aes-gcm.c | 119 ++++++++------------
 drivers/crypto/omap-aes.c     |  33 ++----
 drivers/crypto/omap-aes.h     |  10 +-
 3 files changed, 61 insertions(+), 101 deletions(-)

Comments

Tero Kristo Nov. 5, 2019, 12:19 p.m. UTC | #1
On 26/10/2019 17:52, Ard Biesheuvel wrote:
> This series applies onto Tero's series [0], and addresses a number of
> additional issues that exist in the omap-aes driver that aren't being
> addresses by Tero's fixes.
> 
> Note that the resulting code is still not 100% correct: an issue remains
> where inputs into GCM consisting solely of assocdata are not being processed
> correctly, e.g.,
> 
> alg: aead: gcm-aes-omap encryption test failed (wrong result) on test vector
>    "random: alen=38 plen=0 authsize=16 klen=32",
>     cfg="random: inplace may_sleep use_digest src_divs=[100.0%@+19] iv_offset=31"
> 
> I have no idea how to fix this, so I'll leave this to people that know this
> hardware and have access to the Sitara TRM.
> 
> Note that I also spotted some issues in the SHAM driver, i.e.,
> 
> alg: ahash: omap-sha1 test failed (wrong result) on test vector
>    "random: psize=7928 ksize=0", cfg="random: inplace use_final
>        src_divs=[5.64%@+13, 59.70%@+18, <flush>31.53%@+4072,
>        <flush,nosimd>3.13%@alignmask+263]"
> alg: ahash: omap-hmac-sha256 test failed (wrong result) on test vector
>    "random: psize=960 ksize=37", cfg="random: inplace use_final
>        src_divs=[32.54%@+2449, 17.18%@+4, <flush>50.28%@+1] iv_offset=31"
> 
> All of these failures are triggered by CONFIG_CRYPTO_MANAGER_EXTRA_TESTS,
> so they will not show up when using the standard set of test vectors.
> 
> [0] https://lore.kernel.org/linux-crypto/20191017122549.4634-1-t-kristo@ti.com/
> 
> Cc: linux-omap@vger.kernel.org
> Cc: Tero Kristo <t-kristo@ti.com>

For the whole series:

Reviewed-by: Tero Kristo <t-kristo@ti.com>
Tested-by: Tero Kristo <t-kristo@ti.com>

-Tero

> 
> Ard Biesheuvel (6):
>    crypto: omap-aes - reject invalid input sizes for block modes
>    crypto: omap-aes-ctr - set blocksize to 1
>    crypto: omap-aes-gcm - deal with memory allocation failure
>    crypto: omap-aes-gcm - add missing .setauthsize hooks
>    crypto: omap-aes-gcm - check length of assocdata in RFC4106 mode
>    crypto: omap-aes-gcm - use the AES library to encrypt the tag
> 
>   drivers/crypto/omap-aes-gcm.c | 119 ++++++++------------
>   drivers/crypto/omap-aes.c     |  33 ++----
>   drivers/crypto/omap-aes.h     |  10 +-
>   3 files changed, 61 insertions(+), 101 deletions(-)
> 

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Herbert Xu Nov. 5, 2019, 1:20 p.m. UTC | #2
On Tue, Nov 05, 2019 at 02:19:54PM +0200, Tero Kristo wrote:
> On 26/10/2019 17:52, Ard Biesheuvel wrote:
> > This series applies onto Tero's series [0], and addresses a number of
> > additional issues that exist in the omap-aes driver that aren't being
> > addresses by Tero's fixes.
> > 
> > Note that the resulting code is still not 100% correct: an issue remains
> > where inputs into GCM consisting solely of assocdata are not being processed
> > correctly, e.g.,
> > 
> > alg: aead: gcm-aes-omap encryption test failed (wrong result) on test vector
> >    "random: alen=38 plen=0 authsize=16 klen=32",
> >     cfg="random: inplace may_sleep use_digest src_divs=[100.0%@+19] iv_offset=31"
> > 
> > I have no idea how to fix this, so I'll leave this to people that know this
> > hardware and have access to the Sitara TRM.
> > 
> > Note that I also spotted some issues in the SHAM driver, i.e.,
> > 
> > alg: ahash: omap-sha1 test failed (wrong result) on test vector
> >    "random: psize=7928 ksize=0", cfg="random: inplace use_final
> >        src_divs=[5.64%@+13, 59.70%@+18, <flush>31.53%@+4072,
> >        <flush,nosimd>3.13%@alignmask+263]"
> > alg: ahash: omap-hmac-sha256 test failed (wrong result) on test vector
> >    "random: psize=960 ksize=37", cfg="random: inplace use_final
> >        src_divs=[32.54%@+2449, 17.18%@+4, <flush>50.28%@+1] iv_offset=31"
> > 
> > All of these failures are triggered by CONFIG_CRYPTO_MANAGER_EXTRA_TESTS,
> > so they will not show up when using the standard set of test vectors.
> > 
> > [0] https://lore.kernel.org/linux-crypto/20191017122549.4634-1-t-kristo@ti.com/
> > 
> > Cc: linux-omap@vger.kernel.org
> > Cc: Tero Kristo <t-kristo@ti.com>
> 
> For the whole series:
> 
> Reviewed-by: Tero Kristo <t-kristo@ti.com>
> Tested-by: Tero Kristo <t-kristo@ti.com>

Actually I've lost track of both of your patch series.  Please
repost both in the correct order for merging.

Thanks,
Tero Kristo Nov. 5, 2019, 1:38 p.m. UTC | #3
On 05/11/2019 15:20, Herbert Xu wrote:
> On Tue, Nov 05, 2019 at 02:19:54PM +0200, Tero Kristo wrote:
>> On 26/10/2019 17:52, Ard Biesheuvel wrote:
>>> This series applies onto Tero's series [0], and addresses a number of
>>> additional issues that exist in the omap-aes driver that aren't being
>>> addresses by Tero's fixes.
>>>
>>> Note that the resulting code is still not 100% correct: an issue remains
>>> where inputs into GCM consisting solely of assocdata are not being processed
>>> correctly, e.g.,
>>>
>>> alg: aead: gcm-aes-omap encryption test failed (wrong result) on test vector
>>>     "random: alen=38 plen=0 authsize=16 klen=32",
>>>      cfg="random: inplace may_sleep use_digest src_divs=[100.0%@+19] iv_offset=31"
>>>
>>> I have no idea how to fix this, so I'll leave this to people that know this
>>> hardware and have access to the Sitara TRM.
>>>
>>> Note that I also spotted some issues in the SHAM driver, i.e.,
>>>
>>> alg: ahash: omap-sha1 test failed (wrong result) on test vector
>>>     "random: psize=7928 ksize=0", cfg="random: inplace use_final
>>>         src_divs=[5.64%@+13, 59.70%@+18, <flush>31.53%@+4072,
>>>         <flush,nosimd>3.13%@alignmask+263]"
>>> alg: ahash: omap-hmac-sha256 test failed (wrong result) on test vector
>>>     "random: psize=960 ksize=37", cfg="random: inplace use_final
>>>         src_divs=[32.54%@+2449, 17.18%@+4, <flush>50.28%@+1] iv_offset=31"
>>>
>>> All of these failures are triggered by CONFIG_CRYPTO_MANAGER_EXTRA_TESTS,
>>> so they will not show up when using the standard set of test vectors.
>>>
>>> [0] https://lore.kernel.org/linux-crypto/20191017122549.4634-1-t-kristo@ti.com/
>>>
>>> Cc: linux-omap@vger.kernel.org
>>> Cc: Tero Kristo <t-kristo@ti.com>
>>
>> For the whole series:
>>
>> Reviewed-by: Tero Kristo <t-kristo@ti.com>
>> Tested-by: Tero Kristo <t-kristo@ti.com>
> 
> Actually I've lost track of both of your patch series.  Please
> repost both in the correct order for merging.

Yeah, I was kinda expecting this. :)

Will repost all as single series.

-Tero
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki