qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v4 07/13] virtio-crypto: set capacity of algorit


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v4 07/13] virtio-crypto: set capacity of algorithms supported
Date: Tue, 4 Oct 2016 10:46:10 +0100
User-agent: Mutt/1.7.0 (2016-08-17)

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().

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]