All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: zhenwei pi <pizhenwei@bytedance.com>
Cc: mst@redhat.com, arei.gonglei@huawei.com, qemu-devel@nongnu.org,
	virtualization@lists.linux-foundation.org,
	linux-crypto@vger.kernel.org, helei.sig11@bytedance.com,
	cohuck@redhat.com, jasowang@redhat.com
Subject: Re: [PATCH v4 7/8] tests/crypto: Add test suite for crypto akcipher
Date: Tue, 26 Apr 2022 12:57:05 +0100	[thread overview]
Message-ID: <YmfeEaQHupPLBteU@redhat.com> (raw)
In-Reply-To: <20220411104327.197048-8-pizhenwei@bytedance.com>

On Mon, Apr 11, 2022 at 06:43:26PM +0800, zhenwei pi wrote:
> From: lei he <helei.sig11@bytedance.com>
> 
> Add unit test and benchmark test for crypto akcipher.
> 
> Signed-off-by: lei he <helei.sig11@bytedance.com>
> Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
> ---
>  tests/bench/benchmark-crypto-akcipher.c | 161 ++++++
>  tests/bench/meson.build                 |   4 +
>  tests/bench/test_akcipher_keys.inc      | 537 ++++++++++++++++++
>  tests/unit/meson.build                  |   1 +
>  tests/unit/test-crypto-akcipher.c       | 708 ++++++++++++++++++++++++
>  5 files changed, 1411 insertions(+)
>  create mode 100644 tests/bench/benchmark-crypto-akcipher.c
>  create mode 100644 tests/bench/test_akcipher_keys.inc
>  create mode 100644 tests/unit/test-crypto-akcipher.c
> 

> diff --git a/tests/bench/test_akcipher_keys.inc b/tests/bench/test_akcipher_keys.inc
> new file mode 100644
> index 0000000000..7adf218135
> --- /dev/null
> +++ b/tests/bench/test_akcipher_keys.inc
> @@ -0,0 +1,537 @@
> +/*
> + * Copyright (c) 2022 Bytedance, and/or its affiliates
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + *
> + * Author: lei he <helei.sig11@bytedance.com>
> + */
> +
> +/* RSA test keys, generated by OpenSSL */
> +static const uint8_t rsa1024_priv_key[] = {
> +    0x30, 0x82, 0x02, 0x5c, 0x02, 0x01, 0x00, 0x02,
> +	0x81, 0x81, 0x00, 0xe6, 0x4d, 0x76, 0x4f, 0xb2,

snip

For the patch as is:

 Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


It could be nice to add another test with some intentionally corrupt
RSA keys with bad DER encoding, as a way to prove that we're handling
errors in DER decoding correctly when faced with malicous data from a
bad guest.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


WARNING: multiple messages have this Message-ID (diff)
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: zhenwei pi <pizhenwei@bytedance.com>
Cc: helei.sig11@bytedance.com, mst@redhat.com, cohuck@redhat.com,
	qemu-devel@nongnu.org, virtualization@lists.linux-foundation.org,
	linux-crypto@vger.kernel.org
Subject: Re: [PATCH v4 7/8] tests/crypto: Add test suite for crypto akcipher
Date: Tue, 26 Apr 2022 12:57:05 +0100	[thread overview]
Message-ID: <YmfeEaQHupPLBteU@redhat.com> (raw)
In-Reply-To: <20220411104327.197048-8-pizhenwei@bytedance.com>

On Mon, Apr 11, 2022 at 06:43:26PM +0800, zhenwei pi wrote:
> From: lei he <helei.sig11@bytedance.com>
> 
> Add unit test and benchmark test for crypto akcipher.
> 
> Signed-off-by: lei he <helei.sig11@bytedance.com>
> Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
> ---
>  tests/bench/benchmark-crypto-akcipher.c | 161 ++++++
>  tests/bench/meson.build                 |   4 +
>  tests/bench/test_akcipher_keys.inc      | 537 ++++++++++++++++++
>  tests/unit/meson.build                  |   1 +
>  tests/unit/test-crypto-akcipher.c       | 708 ++++++++++++++++++++++++
>  5 files changed, 1411 insertions(+)
>  create mode 100644 tests/bench/benchmark-crypto-akcipher.c
>  create mode 100644 tests/bench/test_akcipher_keys.inc
>  create mode 100644 tests/unit/test-crypto-akcipher.c
> 

> diff --git a/tests/bench/test_akcipher_keys.inc b/tests/bench/test_akcipher_keys.inc
> new file mode 100644
> index 0000000000..7adf218135
> --- /dev/null
> +++ b/tests/bench/test_akcipher_keys.inc
> @@ -0,0 +1,537 @@
> +/*
> + * Copyright (c) 2022 Bytedance, and/or its affiliates
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + *
> + * Author: lei he <helei.sig11@bytedance.com>
> + */
> +
> +/* RSA test keys, generated by OpenSSL */
> +static const uint8_t rsa1024_priv_key[] = {
> +    0x30, 0x82, 0x02, 0x5c, 0x02, 0x01, 0x00, 0x02,
> +	0x81, 0x81, 0x00, 0xe6, 0x4d, 0x76, 0x4f, 0xb2,

snip

For the patch as is:

 Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


It could be nice to add another test with some intentionally corrupt
RSA keys with bad DER encoding, as a way to prove that we're handling
errors in DER decoding correctly when faced with malicous data from a
bad guest.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

WARNING: multiple messages have this Message-ID (diff)
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: zhenwei pi <pizhenwei@bytedance.com>
Cc: helei.sig11@bytedance.com, mst@redhat.com, jasowang@redhat.com,
	cohuck@redhat.com, qemu-devel@nongnu.org,
	virtualization@lists.linux-foundation.org,
	arei.gonglei@huawei.com, linux-crypto@vger.kernel.org
Subject: Re: [PATCH v4 7/8] tests/crypto: Add test suite for crypto akcipher
Date: Tue, 26 Apr 2022 12:57:05 +0100	[thread overview]
Message-ID: <YmfeEaQHupPLBteU@redhat.com> (raw)
In-Reply-To: <20220411104327.197048-8-pizhenwei@bytedance.com>

On Mon, Apr 11, 2022 at 06:43:26PM +0800, zhenwei pi wrote:
> From: lei he <helei.sig11@bytedance.com>
> 
> Add unit test and benchmark test for crypto akcipher.
> 
> Signed-off-by: lei he <helei.sig11@bytedance.com>
> Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
> ---
>  tests/bench/benchmark-crypto-akcipher.c | 161 ++++++
>  tests/bench/meson.build                 |   4 +
>  tests/bench/test_akcipher_keys.inc      | 537 ++++++++++++++++++
>  tests/unit/meson.build                  |   1 +
>  tests/unit/test-crypto-akcipher.c       | 708 ++++++++++++++++++++++++
>  5 files changed, 1411 insertions(+)
>  create mode 100644 tests/bench/benchmark-crypto-akcipher.c
>  create mode 100644 tests/bench/test_akcipher_keys.inc
>  create mode 100644 tests/unit/test-crypto-akcipher.c
> 

> diff --git a/tests/bench/test_akcipher_keys.inc b/tests/bench/test_akcipher_keys.inc
> new file mode 100644
> index 0000000000..7adf218135
> --- /dev/null
> +++ b/tests/bench/test_akcipher_keys.inc
> @@ -0,0 +1,537 @@
> +/*
> + * Copyright (c) 2022 Bytedance, and/or its affiliates
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + *
> + * Author: lei he <helei.sig11@bytedance.com>
> + */
> +
> +/* RSA test keys, generated by OpenSSL */
> +static const uint8_t rsa1024_priv_key[] = {
> +    0x30, 0x82, 0x02, 0x5c, 0x02, 0x01, 0x00, 0x02,
> +	0x81, 0x81, 0x00, 0xe6, 0x4d, 0x76, 0x4f, 0xb2,

snip

For the patch as is:

 Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


It could be nice to add another test with some intentionally corrupt
RSA keys with bad DER encoding, as a way to prove that we're handling
errors in DER decoding correctly when faced with malicous data from a
bad guest.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  reply	other threads:[~2022-04-26 11:57 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-11 10:43 [PATCH v4 0/8] Introduce akcipher service for virtio-crypto zhenwei pi
2022-04-11 10:43 ` zhenwei pi
2022-04-11 10:43 ` zhenwei pi
2022-04-11 10:43 ` [PATCH v4 1/8] virtio-crypto: header update zhenwei pi
2022-04-11 10:43   ` zhenwei pi
2022-04-11 10:43   ` zhenwei pi
2022-04-11 10:43 ` [PATCH v4 2/8] crypto-akcipher: Introduce akcipher types to qapi zhenwei pi
2022-04-11 10:43   ` zhenwei pi
2022-04-11 10:43   ` zhenwei pi
2022-04-26 10:34   ` Daniel P. Berrangé
2022-04-26 10:34     ` Daniel P. Berrangé
2022-04-26 10:34     ` Daniel P. Berrangé
2022-04-11 10:43 ` [PATCH v4 3/8] crypto: Introduce akcipher crypto class zhenwei pi
2022-04-11 10:43   ` zhenwei pi
2022-04-11 10:43   ` zhenwei pi
2022-04-26 10:41   ` Daniel P. Berrangé
2022-04-26 10:41     ` Daniel P. Berrangé
2022-04-26 10:41     ` Daniel P. Berrangé
2022-04-11 10:43 ` [PATCH v4 4/8] crypto: add ASN.1 decoder zhenwei pi
2022-04-11 10:43   ` zhenwei pi
2022-04-11 10:43   ` zhenwei pi
2022-04-26 11:38   ` Daniel P. Berrangé
2022-04-26 11:38     ` Daniel P. Berrangé
2022-04-26 11:38     ` Daniel P. Berrangé
2022-04-11 10:43 ` [PATCH v4 5/8] crypto: Implement RSA algorithm by hogweed zhenwei pi
2022-04-11 10:43   ` zhenwei pi
2022-04-11 10:43   ` zhenwei pi
2022-04-26 11:51   ` Daniel P. Berrangé
2022-04-26 11:51     ` Daniel P. Berrangé
2022-04-26 11:51     ` Daniel P. Berrangé
2022-04-11 10:43 ` [PATCH v4 6/8] crypto: Implement RSA algorithm by gcrypt zhenwei pi
2022-04-11 10:43   ` zhenwei pi
2022-04-11 10:43   ` zhenwei pi
2022-04-26 11:54   ` Daniel P. Berrangé
2022-04-26 11:54     ` Daniel P. Berrangé
2022-04-26 11:54     ` Daniel P. Berrangé
2022-04-11 10:43 ` [PATCH v4 7/8] tests/crypto: Add test suite for crypto akcipher zhenwei pi
2022-04-11 10:43   ` zhenwei pi
2022-04-11 10:43   ` zhenwei pi
2022-04-26 11:57   ` Daniel P. Berrangé [this message]
2022-04-26 11:57     ` Daniel P. Berrangé
2022-04-26 11:57     ` Daniel P. Berrangé
2022-04-11 10:43 ` [PATCH v4 8/8] crypto: Introduce RSA algorithm zhenwei pi
2022-04-11 10:43   ` zhenwei pi
2022-04-11 10:43   ` zhenwei pi
2022-04-12  9:47 ` [PATCH v4 0/8] Introduce akcipher service for virtio-crypto Paolo Bonzini
2022-04-12  9:47   ` Paolo Bonzini
2022-04-12 10:21   ` zhenwei pi
2022-04-12 10:21     ` zhenwei pi
2022-04-12 10:21     ` zhenwei pi
2022-04-21  1:41 ` PING: " zhenwei pi
2022-04-21  1:41   ` zhenwei pi
2022-04-21  1:41   ` zhenwei pi
2022-04-21  8:10   ` Daniel P. Berrangé
2022-04-21  8:10     ` Daniel P. Berrangé
2022-04-21  8:10     ` Daniel P. Berrangé

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=YmfeEaQHupPLBteU@redhat.com \
    --to=berrange@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=cohuck@redhat.com \
    --cc=helei.sig11@bytedance.com \
    --cc=jasowang@redhat.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=pizhenwei@bytedance.com \
    --cc=qemu-devel@nongnu.org \
    --cc=virtualization@lists.linux-foundation.org \
    /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.