From: Gonglei <arei.gonglei@huawei.com>
To: "Daniel P. Berrange" <berrange@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Gerd Hoffmann <kraxel@redhat.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH v2 04/10] crypto: introduce generic cipher API & built-in implementation
Date: Mon, 8 Jun 2015 17:14:53 +0800 [thread overview]
Message-ID: <55755D0D.90200@huawei.com> (raw)
In-Reply-To: <1433252721-19610-5-git-send-email-berrange@redhat.com>
On 2015/6/2 21:45, Daniel P. Berrange wrote:
> +
> +static int qcrypto_cipher_encrypt_des_rfb(QCryptoCipher *cipher,
> + const void *in,
> + void *out,
> + size_t len,
> + Error **errp)
> +{
> + QCryptoCipherBuiltin *ctxt = cipher->opaque;
> + size_t i;
> +
> + deskey(ctxt->state.desrfb.key, EN0);
> +
Why not move the below check to top of deskey() ? and...
> + if (len % 8) {
> + error_setg(errp, _("Buffer size must be multiple of 8 not %zu"),
> + len);
> + return -1;
> + }
> +
> + for (i = 0; i < len; i += 8) {
> + des((void *)in + i, out + i);
> + }
> +
> + return 0;
> +}
> +
> +
> +static int qcrypto_cipher_decrypt_des_rfb(QCryptoCipher *cipher,
> + const void *in,
> + void *out,
> + size_t len,
> + Error **errp)
> +{
> + QCryptoCipherBuiltin *ctxt = cipher->opaque;
> + size_t i;
> +
> + deskey(ctxt->state.desrfb.key, DE1);
> +
...the same.
> + if (len % 8) {
> + error_setg(errp, _("Buffer size must be multiple of 8 not %zu"),
> + len);
> + return -1;
> + }
> +
> + for (i = 0; i < len; i += 8) {
> + des((void *)in + i, out + i);
> + }
> +
> + return 0;
> +}
Regards,
-Gonglei
next prev parent reply other threads:[~2015-06-08 9:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-02 13:45 [Qemu-devel] [PATCH v2 00/10] Consolidate crypto APIs & implementations Daniel P. Berrange
2015-06-02 13:45 ` [Qemu-devel] [PATCH v2 01/10] crypto: introduce new module for computing hash digests Daniel P. Berrange
2015-06-02 15:49 ` Richard Henderson
2015-06-02 13:45 ` [Qemu-devel] [PATCH v2 02/10] crypto: move built-in AES implementation into crypto/ Daniel P. Berrange
2015-06-02 13:45 ` [Qemu-devel] [PATCH v2 03/10] crypto: move built-in D3DES " Daniel P. Berrange
2015-06-02 13:45 ` [Qemu-devel] [PATCH v2 04/10] crypto: introduce generic cipher API & built-in implementation Daniel P. Berrange
2015-06-08 9:14 ` Gonglei [this message]
2015-06-02 13:45 ` [Qemu-devel] [PATCH v2 05/10] crypto: add a gcrypt cipher implementation Daniel P. Berrange
2015-06-08 9:20 ` Gonglei
2015-06-02 13:45 ` [Qemu-devel] [PATCH v2 06/10] crypto: add a nettle " Daniel P. Berrange
2015-06-02 13:45 ` [Qemu-devel] [PATCH v2 07/10] block: convert quorum blockdrv to use crypto APIs Daniel P. Berrange
2015-06-02 13:45 ` [Qemu-devel] [PATCH v2 08/10] ui: convert VNC websockets " Daniel P. Berrange
2015-06-02 13:45 ` [Qemu-devel] [PATCH v2 09/10] block: convert qcow/qcow2 to use generic cipher API Daniel P. Berrange
2015-06-02 13:45 ` [Qemu-devel] [PATCH v2 10/10] ui: convert VNC " Daniel P. Berrange
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55755D0D.90200@huawei.com \
--to=arei.gonglei@huawei.com \
--cc=berrange@redhat.com \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).