From: "Daniel P. Berrange" <berrange@redhat.com>
To: "Longpeng(Mike)" <longpeng2@huawei.com>
Cc: eblake@redhat.com, armbru@redhat.com, stefanha@redhat.com,
wu.wubin@huawei.com, jianjay.zhou@huawei.com,
arei.gonglei@huawei.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH for-2.9 v2 6/7] crypto: support HMAC algorithms based on nettle
Date: Mon, 12 Dec 2016 10:28:56 +0000 [thread overview]
Message-ID: <20161212102856.GF15611@redhat.com> (raw)
In-Reply-To: <1481530092-20240-7-git-send-email-longpeng2@huawei.com>
On Mon, Dec 12, 2016 at 04:08:11PM +0800, Longpeng(Mike) wrote:
> This patch add nettle-backed HMAC algorithms support
>
> Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com>
> ---
> crypto/hmac-nettle.c | 118 +++++++++++++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 115 insertions(+), 3 deletions(-)
>
> diff --git a/crypto/hmac-nettle.c b/crypto/hmac-nettle.c
> index 7a9cd2e..a082bc0 100644
> --- a/crypto/hmac-nettle.c
> +++ b/crypto/hmac-nettle.c
> @@ -15,9 +15,66 @@
> #include "qemu/osdep.h"
> #include "qapi/error.h"
> #include "crypto/hmac.h"
> +#include <nettle/hmac.h>
> +
> +typedef void (*qcrypto_nettle_hmac_setkey)(void *ctx,
> + size_t key_length, const uint8_t *key);
> +
> +typedef void (*qcrypto_nettle_hmac_update)(void *ctx,
> + size_t length, const uint8_t *data);
> +
> +typedef void (*qcrypto_nettle_hmac_digest)(void *ctx,
> + size_t length, uint8_t *digest);
> +
> +typedef struct QCryptoHmacNettle QCryptoHmacNettle;
> +struct QCryptoHmacNettle {
> + union qcrypto_nettle_hmac_ctx {
> + struct hmac_md5_ctx md5_ctx;
> + struct hmac_sha1_ctx sha1_ctx;
> + struct hmac_sha256_ctx sha256_ctx;
> + struct hmac_sha512_ctx sha512_ctx;
> + } u;
> +};
> +
> +struct qcrypto_nettle_hmac_alg {
> + qcrypto_nettle_hmac_setkey setkey;
> + qcrypto_nettle_hmac_update update;
> + qcrypto_nettle_hmac_digest digest;
> + size_t len;
> +} qcrypto_hmac_alg_map[QCRYPTO_HMAC_ALG__MAX] = {
> + [QCRYPTO_HMAC_ALG_MD5] = {
> + .setkey = (qcrypto_nettle_hmac_setkey)hmac_md5_set_key,
> + .update = (qcrypto_nettle_hmac_update)hmac_md5_update,
> + .digest = (qcrypto_nettle_hmac_digest)hmac_md5_digest,
> + .len = MD5_DIGEST_SIZE,
> + },
> + [QCRYPTO_HMAC_ALG_SHA1] = {
> + .setkey = (qcrypto_nettle_hmac_setkey)hmac_sha1_set_key,
> + .update = (qcrypto_nettle_hmac_update)hmac_sha1_update,
> + .digest = (qcrypto_nettle_hmac_digest)hmac_sha1_digest,
> + .len = SHA1_DIGEST_SIZE,
> + },
> + [QCRYPTO_HMAC_ALG_SHA256] = {
> + .setkey = (qcrypto_nettle_hmac_setkey)hmac_sha256_set_key,
> + .update = (qcrypto_nettle_hmac_update)hmac_sha256_update,
> + .digest = (qcrypto_nettle_hmac_digest)hmac_sha256_digest,
> + .len = SHA256_DIGEST_SIZE,
> + },
> + [QCRYPTO_HMAC_ALG_SHA512] = {
> + .setkey = (qcrypto_nettle_hmac_setkey)hmac_sha512_set_key,
> + .update = (qcrypto_nettle_hmac_update)hmac_sha512_update,
> + .digest = (qcrypto_nettle_hmac_digest)hmac_sha512_digest,
> + .len = SHA512_DIGEST_SIZE,
> + },
> +};
Can you implement all 7 hash algorithms supported by QEMU.
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:[~2016-12-12 10:29 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-12 8:08 [Qemu-devel] [PATCH for-2.9 v2 0/7] crypto: add HMAC algorithms support Longpeng(Mike)
2016-12-12 8:08 ` [Qemu-devel] [PATCH for-2.9 v2 1/7] qapi: crypto: add defination about HMAC algorithms Longpeng(Mike)
2016-12-12 10:13 ` Daniel P. Berrange
2016-12-12 8:08 ` [Qemu-devel] [PATCH for-2.9 v2 2/7] crypto: add HMAC algorithms framework Longpeng(Mike)
2016-12-12 10:18 ` Daniel P. Berrange
2016-12-12 8:08 ` [Qemu-devel] [PATCH for-2.9 v2 3/7] configure: add CONFIG_GCRYPT_SUPPORT_HMAC item Longpeng(Mike)
2016-12-12 10:19 ` Daniel P. Berrange
2016-12-12 8:08 ` [Qemu-devel] [PATCH for-2.9 v2 4/7] crypto: support HMAC algorithms based on libgcrypt Longpeng(Mike)
2016-12-12 10:25 ` Daniel P. Berrange
2016-12-12 8:08 ` [Qemu-devel] [PATCH for-2.9 v2 5/7] crypto: support HMAC algorithms based on glibc Longpeng(Mike)
2016-12-12 8:08 ` [Qemu-devel] [PATCH for-2.9 v2 6/7] crypto: support HMAC algorithms based on nettle Longpeng(Mike)
2016-12-12 10:28 ` Daniel P. Berrange [this message]
2016-12-12 8:08 ` [Qemu-devel] [PATCH for-2.9 v2 7/7] crypto: add HMAC algorithms testcases Longpeng(Mike)
2016-12-12 10:31 ` Daniel P. Berrange
2016-12-13 7:06 ` Longpeng (Mike)
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=20161212102856.GF15611@redhat.com \
--to=berrange@redhat.com \
--cc=arei.gonglei@huawei.com \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=jianjay.zhou@huawei.com \
--cc=longpeng2@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--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.