[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [virtio-dev] Re: [PATCH v4 07/13] virtio-crypto: set ca
From: |
Gonglei (Arei) |
Subject: |
Re: [Qemu-devel] [virtio-dev] Re: [PATCH v4 07/13] virtio-crypto: set capacity of algorithms supported |
Date: |
Wed, 5 Oct 2016 03:30:42 +0000 |
> -----Original Message-----
> From: address@hidden [mailto:address@hidden
> On Behalf Of Stefan Hajnoczi
> Sent: Tuesday, October 04, 2016 5:46 PM
> Subject: [virtio-dev] Re: [PATCH v4 07/13] virtio-crypto: set capacity of
> algorithms supported
>
> On Wed, Sep 28, 2016 at 04:25:46PM +0800, Gonglei wrote:
> > static void virtio_crypto_get_config(VirtIODevice *vdev, uint8_t *config)
> > {
> > -
> > + VirtIOCrypto *c = VIRTIO_CRYPTO(vdev);
> > + struct virtio_crypto_config crypto_cfg;
> > +
> > + crypto_cfg.status = c->status;
> > + crypto_cfg.max_dataqueues = c->max_queues;
> > + crypto_cfg.crypto_services = c->conf.crypto_services;
> > + crypto_cfg.cipher_algo_l = c->conf.cipher_algo_l;
> > + crypto_cfg.cipher_algo_h = c->conf.cipher_algo_h;
> > + crypto_cfg.hash_algo = c->conf.hash_algo;
> > + crypto_cfg.mac_algo_l = c->conf.mac_algo_l;
> > + crypto_cfg.mac_algo_h = c->conf.mac_algo_h;
> > + crypto_cfg.aead_algo = c->conf.aead_algo;
> > +
> > + memcpy(config, &crypto_cfg, c->config_size);
> > }
>
> What about endianness? For example, if the host is big-endian then this
> VIRTIO 1.0 device needs to byteswap multi-byte fields. There is a
> family of functions to help with this: virtio_stl_p().
I did that in v1. Michael told me that Virtio-1.0 devices are always
little-endian, so
I removed those helper functions in the following functions. But after this
version,
the virtio-crypto device isn't virtio-1.0 device by default, so I should use
them again.
Regards,
-Gonglei