Re: [PATCH v2 7/7] crypto: Add test suite for ECDSA algorithm

2024-07-04 Thread Giacomo Parmeggiani
PING
Hello Li He, maintainers,

Any chance to revive this thread? 
The patch series no longer applies to latest QEMU and it would be a useful 
feature to have.

BR
Giacomo

> On 22 Jun 2022, at 11:15, Lei He  wrote:
> 
> 1. add test suite for ecdsa algorithm.
> 2. use qcrypto_akcihper_max_xxx_len to help create buffers in
> 
> Signed-off-by: lei he 
> Reviewed-by: Daniel P. Berrangé 
> ---
> tests/unit/test-crypto-akcipher.c | 338 --
> 1 file changed, 323 insertions(+), 15 deletions(-)
> 
> diff --git a/tests/unit/test-crypto-akcipher.c 
> b/tests/unit/test-crypto-akcipher.c
> index 4f1f4214dd..414387cfb4 100644
> --- a/tests/unit/test-crypto-akcipher.c
> +++ b/tests/unit/test-crypto-akcipher.c
> @@ -314,12 +314,117 @@ static const uint8_t rsa2048_public_key[] = {
>0xed, 0x02, 0x03, 0x01, 0x00, 0x01
> };
> 
> +static const uint8_t ecdsa_p192_public_key[] = {
> +0x04, 0xc4, 0x16, 0xb3, 0xff, 0xac, 0xd5, 0x87,
> +0x98, 0xf7, 0xd9, 0x45, 0xfe, 0xd3, 0x5c, 0x17,
> +0x9d, 0xb2, 0x36, 0x22, 0xcc, 0x07, 0xb3, 0x6d,
> +0x3c, 0x4e, 0x04, 0x5f, 0xeb, 0xb6, 0x52, 0x58,
> +0xfb, 0x36, 0x10, 0x52, 0xb7, 0x01, 0x62, 0x0e,
> +0x94, 0x51, 0x1d, 0xe2, 0xef, 0x10, 0x82, 0x88,
> +0x78,
> +};
> +
> +static const uint8_t ecdsa_p192_private_key[] = {
> +0x30, 0x53, 0x02, 0x01, 0x01, 0x04, 0x18, 0xcb,
> +0xc8, 0x86, 0x0e, 0x66, 0x3c, 0xf7, 0x5a, 0x44,
> +0x13, 0xb8, 0xef, 0xea, 0x1d, 0x7b, 0xa6, 0x1c,
> +0xda, 0xf4, 0x1b, 0xc7, 0x67, 0x6b, 0x35, 0xa1,
> +0x34, 0x03, 0x32, 0x00, 0x04, 0xc4, 0x16, 0xb3,
> +0xff, 0xac, 0xd5, 0x87, 0x98, 0xf7, 0xd9, 0x45,
> +0xfe, 0xd3, 0x5c, 0x17, 0x9d, 0xb2, 0x36, 0x22,
> +0xcc, 0x07, 0xb3, 0x6d, 0x3c, 0x4e, 0x04, 0x5f,
> +0xeb, 0xb6, 0x52, 0x58, 0xfb, 0x36, 0x10, 0x52,
> +0xb7, 0x01, 0x62, 0x0e, 0x94, 0x51, 0x1d, 0xe2,
> +0xef, 0x10, 0x82, 0x88, 0x78,
> +};
> +
> +static const uint8_t ecdsa_p256_private_key[] = {
> +0x30, 0x77, 0x02, 0x01, 0x01, 0x04, 0x20, 0xf6,
> +0x92, 0xdd, 0x29, 0x1c, 0x6e, 0xef, 0xb6, 0xb2,
> +0x73, 0x9f, 0x40, 0x1b, 0xb3, 0x2a, 0x28, 0xd2,
> +0x37, 0xd6, 0x4a, 0x5b, 0xe4, 0x40, 0x4c, 0x6a,
> +0x95, 0x99, 0xfa, 0xf7, 0x92, 0x49, 0xbe, 0xa0,
> +0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d,
> +0x03, 0x01, 0x07, 0xa1, 0x44, 0x03, 0x42, 0x00,
> +0x04, 0xed, 0x42, 0x9c, 0x67, 0x79, 0xbe, 0x46,
> +0x83, 0x88, 0x3e, 0x8c, 0xc1, 0x33, 0xf3, 0xc3,
> +0xf6, 0x2c, 0xf3, 0x13, 0x6a, 0x00, 0xc2, 0xc9,
> +0x3e, 0x87, 0x7f, 0x86, 0x39, 0xe6, 0xae, 0xe3,
> +0xb9, 0xba, 0x2f, 0x58, 0x63, 0x32, 0x62, 0x62,
> +0x54, 0x07, 0x27, 0xf9, 0x5a, 0x3a, 0xc7, 0x3a,
> +0x6b, 0x5b, 0xbc, 0x0d, 0x33, 0xba, 0xbb, 0xd4,
> +0xa3, 0xff, 0x4f, 0x9e, 0xdd, 0xf5, 0x59, 0xc0,
> +0xf6,
> +};
> +
> +static const uint8_t ecdsa_p256_public_key[] = {
> +0x04, 0xed, 0x42, 0x9c, 0x67, 0x79, 0xbe, 0x46,
> +0x83, 0x88, 0x3e, 0x8c, 0xc1, 0x33, 0xf3, 0xc3,
> +0xf6, 0x2c, 0xf3, 0x13, 0x6a, 0x00, 0xc2, 0xc9,
> +0x3e, 0x87, 0x7f, 0x86, 0x39, 0xe6, 0xae, 0xe3,
> +0xb9, 0xba, 0x2f, 0x58, 0x63, 0x32, 0x62, 0x62,
> +0x54, 0x07, 0x27, 0xf9, 0x5a, 0x3a, 0xc7, 0x3a,
> +0x6b, 0x5b, 0xbc, 0x0d, 0x33, 0xba, 0xbb, 0xd4,
> +0xa3, 0xff, 0x4f, 0x9e, 0xdd, 0xf5, 0x59, 0xc0,
> +0xf6,
> +};
> +
> +static const uint8_t ecdsa_p384_public_key[] = {
> +0x04, 0xab, 0xd5, 0xf8, 0x87, 0x1d, 0x23, 0x9b,
> +0x26, 0xb9, 0x57, 0x7e, 0x97, 0x78, 0x10, 0xcd,
> +0x13, 0xe3, 0x98, 0x25, 0xa8, 0xd6, 0xab, 0x66,
> +0x35, 0x26, 0x68, 0x8a, 0x0e, 0x49, 0xd9, 0x4a,
> +0x91, 0x7d, 0x6c, 0x94, 0x06, 0x06, 0x99, 0xf1,
> +0x8d, 0x2a, 0x25, 0x8d, 0xf9, 0xbf, 0x40, 0xfa,
> +0xb7, 0xcb, 0xe1, 0x14, 0x22, 0x0a, 0xa7, 0xfb,
> +0x0a, 0xb4, 0x02, 0x05, 0x8b, 0x98, 0xaa, 0x78,
> +0xcd, 0x53, 0x00, 0x1e, 0xd1, 0x79, 0x6a, 0x5f,
> +0x09, 0x01, 0x88, 0xb4, 0xbc, 0x32, 0x62, 0x83,
> +0x92, 0x84, 0x2d, 0xc6, 0xf8, 0xda, 0xc4, 0x7f,
> +0x10, 0xa3, 0x18, 0x1d, 0xae, 0x0d, 0xa4, 0x41,
> +0x9f,
> +};
> +
> +static const uint8_t ecdsa_p384_private_key[] = {
> +0x30, 0x81, 0x9b, 0x02, 0x01, 0x01, 0x04, 0x30,
> +0xb6, 0x04, 0xef, 0xb1, 0x2c, 0x98, 0xdf, 0xcf,
> +0xd4, 0x16, 0x31, 0xd4, 0x69, 0x0c, 0x27, 0x81,
> +0x4a, 0xac, 0x1a, 0x83, 0x3c, 0xe4, 0xef, 0x65,
> +0xe1, 0x7a, 0x6a, 0xc6, 0xd6, 0xf7, 0xea, 0x79,
> +0xbe, 0xf1, 0x00, 0x3c, 0xdf, 0x6e, 0x9d, 0x10,
> +0x22, 0x61, 0x1b, 0x11, 0xcf, 0x49, 0x6e, 0x62,
> +0xa1, 0x64, 0x03, 0x62, 0x00, 0x04, 0xab, 0xd5,
> +0xf8, 0x87, 0x1d, 0x23, 0x9b, 0x26, 0xb9, 0x57,
> +0x7e, 0x97, 0x78, 0x10, 0xcd, 0x13, 0xe3, 0x98,
> +0x25, 0xa8, 0xd6, 0xab, 0x66, 0x35, 0x26, 0x68,
> +0x8a, 0x0e, 0x49, 0xd9, 0x4a, 0x91, 0x7d, 0x6c,
> +0x94, 0x06, 0x06, 0x99, 0xf1, 0x8d, 0x2a, 0x25,
> +0x8d, 0xf9, 0xbf, 0x40, 0xfa, 0xb7, 0xcb, 0xe1,
> +0x14, 0x22, 0x0a, 0xa7, 0xfb, 0x0a, 0xb4, 0x02,
> +0x05, 0x8b, 0x98, 0xaa, 0x78, 0xcd, 0x53, 0x00,

Re: [PATCH] m25p80: Add support for the GD25WQ32E flash

2024-04-14 Thread Giacomo Parmeggiani
PING

Hi all, could you have a look at this small patch?
See also:
https://patchew.org/QEMU/20240330203520.64892-1-giacomo.parmeggi...@gmail.com/

BR,
Giacomo Parmeggiani

On Sat, Mar 30, 2024 at 9:36 PM Giacomo Parmeggiani <
giacomo.parmeggi...@gmail.com> wrote:

> This introduces the GigaDevice GD25WQ32E flash, including the SFDP table
>
> Signed-off-by: Giacomo Parmeggiani 
> ---
>  hw/block/m25p80.c  |  2 ++
>  hw/block/m25p80_sfdp.c | 40 
>  hw/block/m25p80_sfdp.h |  2 ++
>  3 files changed, 44 insertions(+)
>
> diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
> index 8dec134832..6cc05b63e5 100644
> --- a/hw/block/m25p80.c
> +++ b/hw/block/m25p80.c
> @@ -205,6 +205,8 @@ static const FlashPartInfo known_devices[] = {
>  /* GigaDevice */
>  { INFO("gd25q32", 0xc84016,  0,  64 << 10,  64, ER_4K) },
>  { INFO("gd25q64", 0xc84017,  0,  64 << 10, 128, ER_4K) },
> +{ INFO("gd25wq32e",   0xc86516,  0,  64 << 10,  64, ER_4K),
> +  .sfdp_read = m25p80_sfdp_gd25wq32e },
>
>  /* Intel/Numonyx -- xxxs33b */
>  { INFO("160s33b", 0x898911,  0,  64 << 10,  32, 0) },
> diff --git a/hw/block/m25p80_sfdp.c b/hw/block/m25p80_sfdp.c
> index 6ee2cfaf11..cb0963328d 100644
> --- a/hw/block/m25p80_sfdp.c
> +++ b/hw/block/m25p80_sfdp.c
> @@ -406,3 +406,43 @@ static const uint8_t sfdp_is25wp256[] = {
>  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
>  };
>  define_sfdp_read(is25wp256);
> +
> +/*
> + * GigaDevice
> + */
> +
> +static const uint8_t sfdp_gd25wq32e[] = {
> +0x53, 0x46, 0x44, 0x50, 0x06, 0x01, 0x01, 0xff,
> +0x00, 0x06, 0x01, 0x10, 0x30, 0x00, 0x00, 0xff,
> +0xc8, 0x00, 0x01, 0x03, 0x90, 0x00, 0x00, 0xff,
> +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +0xe5, 0x20, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x01,
> +0x44, 0xeb, 0x08, 0x6b, 0x08, 0x3b, 0x42, 0xbb,
> +0xee, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff,
> +0xff, 0xff, 0x00, 0xff, 0x0c, 0x20, 0x0f, 0x52,
> +0x10, 0xd8, 0x00, 0xff, 0x63, 0x92, 0xfd, 0xfe,
> +0x83, 0x2f, 0x26, 0x46, 0xec, 0x82, 0x18, 0x44,
> +0x7a, 0x75, 0x7a, 0x75, 0x04, 0xbd, 0xd5, 0x5c,
> +0x00, 0x06, 0x64, 0x00, 0x08, 0x10, 0x00, 0x00,
> +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +0x00, 0x36, 0x50, 0x16, 0x9e, 0xf9, 0x77, 0x64,
> +0xfc, 0xcb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
> +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
> +};
> +define_sfdp_read(gd25wq32e);
> diff --git a/hw/block/m25p80_sfdp.h b/hw/block/m25p80_sfdp.h
> index 1733b56950..7d1f60f2ee 100644
> --- a/hw/block/m25p80_sfdp.h
> +++ b/hw/block/m25p80_sfdp.h
> @@ -29,4 +29,6 @@ uint8_t m25p80_sfdp_w25q01jvq(uint32_t addr);
>
>  uint8_t m25p80_sfdp_is25wp256(uint32_t addr);
>
> +uint8_t m25p80_sfdp_gd25wq32e(uint32_t addr);
> +
>  #endif
> --
> 2.32.1 (Apple Git-133)
>
>

-- 
*Giacomo Parmeggiani*


[PATCH] m25p80: Add support for the GD25WQ32E flash

2024-03-30 Thread Giacomo Parmeggiani
This introduces the GigaDevice GD25WQ32E flash, including the SFDP table

Signed-off-by: Giacomo Parmeggiani 
---
 hw/block/m25p80.c  |  2 ++
 hw/block/m25p80_sfdp.c | 40 
 hw/block/m25p80_sfdp.h |  2 ++
 3 files changed, 44 insertions(+)

diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
index 8dec134832..6cc05b63e5 100644
--- a/hw/block/m25p80.c
+++ b/hw/block/m25p80.c
@@ -205,6 +205,8 @@ static const FlashPartInfo known_devices[] = {
 /* GigaDevice */
 { INFO("gd25q32", 0xc84016,  0,  64 << 10,  64, ER_4K) },
 { INFO("gd25q64", 0xc84017,  0,  64 << 10, 128, ER_4K) },
+{ INFO("gd25wq32e",   0xc86516,  0,  64 << 10,  64, ER_4K),
+  .sfdp_read = m25p80_sfdp_gd25wq32e },
 
 /* Intel/Numonyx -- xxxs33b */
 { INFO("160s33b", 0x898911,  0,  64 << 10,  32, 0) },
diff --git a/hw/block/m25p80_sfdp.c b/hw/block/m25p80_sfdp.c
index 6ee2cfaf11..cb0963328d 100644
--- a/hw/block/m25p80_sfdp.c
+++ b/hw/block/m25p80_sfdp.c
@@ -406,3 +406,43 @@ static const uint8_t sfdp_is25wp256[] = {
 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
 };
 define_sfdp_read(is25wp256);
+
+/*
+ * GigaDevice
+ */
+
+static const uint8_t sfdp_gd25wq32e[] = {
+0x53, 0x46, 0x44, 0x50, 0x06, 0x01, 0x01, 0xff,
+0x00, 0x06, 0x01, 0x10, 0x30, 0x00, 0x00, 0xff,
+0xc8, 0x00, 0x01, 0x03, 0x90, 0x00, 0x00, 0xff,
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+0xe5, 0x20, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x01,
+0x44, 0xeb, 0x08, 0x6b, 0x08, 0x3b, 0x42, 0xbb,
+0xee, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff,
+0xff, 0xff, 0x00, 0xff, 0x0c, 0x20, 0x0f, 0x52,
+0x10, 0xd8, 0x00, 0xff, 0x63, 0x92, 0xfd, 0xfe,
+0x83, 0x2f, 0x26, 0x46, 0xec, 0x82, 0x18, 0x44,
+0x7a, 0x75, 0x7a, 0x75, 0x04, 0xbd, 0xd5, 0x5c,
+0x00, 0x06, 0x64, 0x00, 0x08, 0x10, 0x00, 0x00,
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+0x00, 0x36, 0x50, 0x16, 0x9e, 0xf9, 0x77, 0x64,
+0xfc, 0xcb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
+};
+define_sfdp_read(gd25wq32e);
diff --git a/hw/block/m25p80_sfdp.h b/hw/block/m25p80_sfdp.h
index 1733b56950..7d1f60f2ee 100644
--- a/hw/block/m25p80_sfdp.h
+++ b/hw/block/m25p80_sfdp.h
@@ -29,4 +29,6 @@ uint8_t m25p80_sfdp_w25q01jvq(uint32_t addr);
 
 uint8_t m25p80_sfdp_is25wp256(uint32_t addr);
 
+uint8_t m25p80_sfdp_gd25wq32e(uint32_t addr);
+
 #endif
-- 
2.32.1 (Apple Git-133)