[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] hw/crypto: add Allwinner sun4i-ss crypto device
From: |
Daniel P . Berrangé |
Subject: |
Re: [PATCH] hw/crypto: add Allwinner sun4i-ss crypto device |
Date: |
Thu, 21 Apr 2022 14:18:13 +0100 |
User-agent: |
Mutt/2.1.5 (2021-12-30) |
On Thu, Apr 21, 2022 at 01:38:00PM +0100, Peter Maydell wrote:
> On Sun, 10 Apr 2022 at 20:12, Corentin Labbe <clabbe@baylibre.com> wrote:
> >
> > From: Corentin LABBE <clabbe@baylibre.com>
> >
> > The Allwinner A10 has a cryptographic offloader device which
> > could be easily emulated.
> > The emulated device is tested with Linux only as any of BSD does not
> > support it.
> >
> > Signed-off-by: Corentin LABBE <clabbe@baylibre.com>
>
> > +The ``sun4i-ss`` emulates the Allwinner cryptographic offloader
> > +present on early Allwinner SoCs (A10, A10s, A13, A20, A33)
> > +In qemu only A10 via the cubieboard machine is supported.
> > +
> > +The emulated hardware is capable of handling the following algorithms:
> > +- SHA1 and MD5 hash algorithms
> > +- AES/DES/DES3 in CBC/ECB
> > +- PRNG
> > +
> > +The emulated hardware does not handle yet:
> > +- CTS for AES
> > +- CTR for AES/DES/DES3
> > @@ -48,6 +50,10 @@ static void aw_a10_init(Object *obj)
> >
> > object_initialize_child(obj, "emac", &s->emac, TYPE_AW_EMAC);
> >
> > +#if defined CONFIG_NETTLE
> > + object_initialize_child(obj, "crypto", &s->crypto, TYPE_AW_SUN4I_SS);
> > +#endif
>
> Don't put this kind of ifdef into device/SoC code, please.
> The device emulation needs to work regardless of what
> the specific crypto backends that got compiled into QEMU are.
>
> > +#include <nettle/aes.h>
> > +#include <nettle/cbc.h>
> > +#include <nettle/des.h>
> > +#include <nettle/md5.h>
> > +#include <nettle/sha1.h>
>
> Similarly, don't directly include nettle headers. The device needs
> to use the backend-agnostic headers from include/crypto. To the
> extent that they aren't sufficient to implement this device we
> can look at enhancing them.
The include/crypto/{cipher,hash}.h files should provide APIs that
cover these uses cases from what I see in this patch.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
- [PATCH] hw/crypto: add Allwinner sun4i-ss crypto device, Corentin Labbe, 2022/04/10
- Re: [PATCH] hw/crypto: add Allwinner sun4i-ss crypto device, Peter Maydell, 2022/04/21
- Re: [PATCH] hw/crypto: add Allwinner sun4i-ss crypto device,
Daniel P . Berrangé <=
- Re: [PATCH] hw/crypto: add Allwinner sun4i-ss crypto device, LABBE Corentin, 2022/04/24
- Re: [PATCH] hw/crypto: add Allwinner sun4i-ss crypto device, Daniel P . Berrangé, 2022/04/25
- Re: [PATCH] hw/crypto: add Allwinner sun4i-ss crypto device, LABBE Corentin, 2022/04/25
- Re: [PATCH] hw/crypto: add Allwinner sun4i-ss crypto device, Daniel P . Berrangé, 2022/04/25
- Re: [PATCH] hw/crypto: add Allwinner sun4i-ss crypto device, LABBE Corentin, 2022/04/27
- Re: [PATCH] hw/crypto: add Allwinner sun4i-ss crypto device, Daniel P . Berrangé, 2022/04/27