RE: [PATCH] crypto: add virtio-crypto driver

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

 



Hi Gonglei,

...
> +
> +static int virtio_crypto_alg_ablkcipher_init_session(
> +		struct virtio_crypto_ablkcipher_ctx *ctx,
> +		int alg, const uint8_t *key,
> +		unsigned int keylen,
> +		int encrypt)
> +{
> +	struct scatterlist outhdr, key_sg, inhdr, *sgs[3];
> +	unsigned int tmp;
> +	struct virtio_crypto_session_input input;
> +	struct virtio_crypto_op_ctrl_req ctrl;
> +	struct virtio_crypto *vcrypto = ctx->vcrypto;
> +	int op = encrypt ? VIRTIO_CRYPTO_OP_ENCRYPT :
> VIRTIO_CRYPTO_OP_DECRYPT;
> +	int err;
> +	unsigned int num_out = 0, num_in = 0;
> +
> +	memset(&ctrl, 0, sizeof(ctrl));
> +	memset(&input, 0, sizeof(input));
> +	/* Pad ctrl header */
> +	ctrl.header.opcode =
> cpu_to_le32(VIRTIO_CRYPTO_CIPHER_CREATE_SESSION);
> +	ctrl.header.algo = cpu_to_le32((uint32_t)alg);
> +	/* Set the default dataqueue id to 0 */
> +	ctrl.header.queue_id = 0;
> +
> +	input.status = cpu_to_le32(VIRTIO_CRYPTO_ERR);
> +	/* Pad cipher's parameters */
> +	ctrl.u.sym_create_session.op_type =
> +		cpu_to_le32(VIRTIO_CRYPTO_SYM_OP_CIPHER);
> +	ctrl.u.sym_create_session.u.cipher.para.algo = ctrl.header.algo;
> +	ctrl.u.sym_create_session.u.cipher.para.keylen =
> cpu_to_le32(keylen);
> +	ctrl.u.sym_create_session.u.cipher.para.op = cpu_to_le32(op);
> +
> +	sg_init_one(&outhdr, &ctrl, sizeof(ctrl));

I believe this won't work when the new virtually-mapped kernel stack (VMAP_STACK)
is enabled.

Regards,
Salvatore
_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization



[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux