qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] crypto: add virtio-crypto driver


From: gong lei
Subject: Re: [Qemu-devel] [PATCH] crypto: add virtio-crypto driver
Date: Sun, 20 Nov 2016 07:11:50 +0000

on 2016/11/17 23:55, Benedetto, Salvatore wrote:

> 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.
I see, will fix it in the next version. Thanks for your comments :)
>
> Regards,
> Salvatore

-- 
Regards,
-Gonglei




reply via email to

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