From: "Daniel P. Berrange" <berrange@redhat.com>
To: "Longpeng(Mike)" <longpeng2@huawei.com>
Cc: wu.wubin@huawei.com, jianjay.zhou@huawei.com,
arei.gonglei@huawei.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH RESEND 2/6] crypto: add AEAD algorithms framework
Date: Fri, 6 Jan 2017 11:28:04 +0000 [thread overview]
Message-ID: <20170106112803.GG31112@redhat.com> (raw)
In-Reply-To: <1483577381-38088-3-git-send-email-longpeng2@huawei.com>
On Thu, Jan 05, 2017 at 08:49:37AM +0800, Longpeng(Mike) wrote:
> This patch introduce AEAD algorithms framework.
So AEAD is essentially just encryption with extra metadata on
input and output stages. As such I don't think this should be
implemented via new objects in QEMU.
Instead, we should add the extra APIs to the existing
cipher.{c,h} file.
You've only implemented AES support here, so the code duplication
is not obvious, but if we were to extend AEAD to other algorithms
we'd see alot of duplication with the way you've done things.
So....
> +int qcrypto_aead_set_nonce(QCryptoAead *aead,
> + const uint8_t *nonce, size_t nonce_len,
> + size_t aad_len, size_t in_len,
> + size_t tag_len,
> + Error **errp);
> +int qcrypto_aead_authenticate(QCryptoAead *aead,
> + const uint8_t *aad, size_t aad_len,
> + Error **errp);
> +
> +int qcrypto_aead_get_tag(QCryptoAead *aead,
> + uint8_t *tag, size_t tag_len,
> + Error **errp);
> +
Just add these three methods to cipher.h instead
> diff --git a/qapi/crypto.json b/qapi/crypto.json
> index f4fd93b..edb2962 100644
> --- a/qapi/crypto.json
> +++ b/qapi/crypto.json
> @@ -87,6 +87,8 @@
> #
> # The supported modes for content encryption ciphers
> #
> +# @ccm: Counter with CBC-MAC Mode (Since 2.9)
> +# @gcm: Galois Counter Mode (Since 2.9)
> # @ecb: Electronic Code Book
> # @cbc: Cipher Block Chaining
> # @xts: XEX with tweaked code book and ciphertext stealing
> @@ -95,7 +97,7 @@
> ##
> { 'enum': 'QCryptoCipherMode',
> 'prefix': 'QCRYPTO_CIPHER_MODE',
> - 'data': ['ecb', 'cbc', 'xts', 'ctr']}
> + 'data': ['ccm', 'gcm', 'ecb', 'cbc', 'xts', 'ctr']}
This is fine.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://entangle-photo.org -o- http://search.cpan.org/~danberr/ :|
next prev parent reply other threads:[~2017-01-06 11:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-05 0:49 [Qemu-devel] [PATCH RESEND 0/6] crypto:add AEAD algorithms support Longpeng(Mike)
2017-01-05 0:49 ` [Qemu-devel] [PATCH RESEND 1/6] configure: add CONFIG_GCRYPT/NETTLE_AEAD item Longpeng(Mike)
2017-01-05 0:49 ` [Qemu-devel] [PATCH RESEND 2/6] crypto: add AEAD algorithms framework Longpeng(Mike)
2017-01-06 11:28 ` Daniel P. Berrange [this message]
2017-01-07 7:33 ` Longpeng (Mike)
2017-01-05 0:49 ` [Qemu-devel] [PATCH RESEND 3/6] crypto: implement nettle-backed AEAD algorithms Longpeng(Mike)
2017-01-05 0:49 ` [Qemu-devel] [PATCH RESEND 4/6] crypto: implement gcrypt-backed " Longpeng(Mike)
2017-01-05 0:49 ` [Qemu-devel] [PATCH RESEND 5/6] crypto: implement other common funcs for " Longpeng(Mike)
2017-01-05 0:49 ` [Qemu-devel] [PATCH RESEND 6/6] crypto: add AEAD algorithms testcases Longpeng(Mike)
2017-01-06 11:28 ` 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=20170106112803.GG31112@redhat.com \
--to=berrange@redhat.com \
--cc=arei.gonglei@huawei.com \
--cc=jianjay.zhou@huawei.com \
--cc=longpeng2@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=wu.wubin@huawei.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.