[dpdk-stable] [dpdk-dev] [PATCH] crypto/virtio: fix iv physical address

Akhil Goyal akhil.goyal at nxp.com
Thu Jun 14 14:38:51 CEST 2018


On 6/14/2018 4:32 PM, Fan Zhang wrote:
> The physical address of IV required by Virtio was computed using
> crypto operations' physical address plus the offset. However not
> all crypto ops will have physical address field initialized and
> compute it runtimely is costly. This patch fixes this problem by
> adding iv field in virtio_crypto_op_cookie and does a memcpy of
> iv instead.
>
> Fixes: 82adb12a1fce ("crypto/virtio: support burst enqueue/dequeue")
> Cc: stable at dpdk.org
>
> Signed-off-by: Fan Zhang <roy.fan.zhang at intel.com>
> ---
>  drivers/crypto/virtio/virtio_cryptodev.c | 6 ++++++
>  drivers/crypto/virtio/virtio_cryptodev.h | 3 +++
>  drivers/crypto/virtio/virtio_rxtx.c      | 8 +++++++-
>  3 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c
> index df88953f6..6ffa7619c 100644
> --- a/drivers/crypto/virtio/virtio_cryptodev.c
> +++ b/drivers/crypto/virtio/virtio_cryptodev.c
> @@ -1223,6 +1223,12 @@ virtio_crypto_sym_pad_op_ctrl_req(
>  	/* Get cipher xform from crypto xform chain */
>  	cipher_xform = virtio_crypto_get_cipher_xform(xform);
>  	if (cipher_xform) {
> +		if (cipher_xform->iv.length > VIRTIO_CRYPTO_MAX_IV_SIZE) {
> +			VIRTIO_CRYPTO_SESSION_LOG_ERR(
> +				"cipher IV cannot longer than %u",
> +				VIRTIO_CRYPTO_MAX_IV_SIZE);
> +			return -1;
> +		}
>  		if (is_chainned)
>  			ret = virtio_crypto_sym_pad_cipher_param(
>  				&ctrl->u.sym_create_session.u.chain.para
> diff --git a/drivers/crypto/virtio/virtio_cryptodev.h b/drivers/crypto/virtio/virtio_cryptodev.h
> index e402c0309..676e008d9 100644
> --- a/drivers/crypto/virtio/virtio_cryptodev.h
> +++ b/drivers/crypto/virtio/virtio_cryptodev.h
> @@ -16,6 +16,8 @@
>
>  #define NUM_ENTRY_VIRTIO_CRYPTO_OP 7
>
> +#define VIRTIO_CRYPTO_MAX_IV_SIZE 32
> +

max iv size supported in capability is 16 and here it is 32.




More information about the stable mailing list