mbox series

[v2,0/7] crypto: Introduce ECDSA algorithm

Message ID 20220622091549.31115-1-helei.sig11@bytedance.com (mailing list archive)
Headers show
Series crypto: Introduce ECDSA algorithm | expand

Message

Lei He June 22, 2022, 9:15 a.m. UTC
This patch introduced ECDSA algorithm for crypto.

V1 -> V2:
- The reserved function prefix '_' is no longer used.
- When parsing ECDSA key: 1) set errp as early as possible,
2) use g_autoptr to avoid manually freeing memory, 3) simplified the
code parsing public key for gcrypt.
- When parsing the ECDSA private key, save the public key 
info (if any) so that the private key can also be used for
verification.
- Fixed a bug, gcrypt-ecdsa can truncate digest correctly now,
and a related unit-test is added.
- Fixed a bug, nettle-ecdsa can correctly add leading-zero (if needed)
when encoding the signature now.
- Minor tweaks to code style and typo fix.

V1:
- make the built-in ASN.1 decoder support more ASN.1 types.
- support ECDSA key and signature parsing.
- implement the ECDSA algorithm using nettle and gcrypt respectively.

Lei He (7):
  crypto: Introduce ECDSA algorithm API
  crypto: Support more ASN.1 types
  crypto: Remove "qemu/osdep.h" in rsakey.h
  crypto: Add ECDSA key parser
  crypto: Implement ECDSA algorithm by hogweed
  crypto: Implement ECDSA algorithm by gcrypt
  crypto: Add test suite for ECDSA algorithm

 crypto/akcipher-gcrypt.c.inc      | 409 ++++++++++++++++++++++++++++++++++++++
 crypto/akcipher-nettle.c.inc      | 282 ++++++++++++++++++++++++++
 crypto/der.c                      | 173 ++++++++++++++--
 crypto/der.h                      | 128 +++++++++++-
 crypto/ecdsakey-builtin.c.inc     | 252 +++++++++++++++++++++++
 crypto/ecdsakey.c                 | 118 +++++++++++
 crypto/ecdsakey.h                 |  66 ++++++
 crypto/meson.build                |   1 +
 crypto/rsakey.c                   |   1 +
 crypto/rsakey.h                   |   1 -
 qapi/crypto.json                  |  28 ++-
 tests/unit/test-crypto-akcipher.c | 338 +++++++++++++++++++++++++++++--
 tests/unit/test-crypto-der.c      | 126 ++++++++++--
 13 files changed, 1859 insertions(+), 64 deletions(-)
 create mode 100644 crypto/ecdsakey-builtin.c.inc
 create mode 100644 crypto/ecdsakey.c
 create mode 100644 crypto/ecdsakey.h

Comments

Lei He June 30, 2022, 9:12 a.m. UTC | #1
> On Jun 22, 2022, at 5:15 PM, Lei He <helei.sig11@bytedance.com> wrote:
> 
> This patch introduced ECDSA algorithm for crypto.
> 
> V1 -> V2:
> - The reserved function prefix '_' is no longer used.
> - When parsing ECDSA key: 1) set errp as early as possible,
> 2) use g_autoptr to avoid manually freeing memory, 3) simplified the
> code parsing public key for gcrypt.
> - When parsing the ECDSA private key, save the public key 
> info (if any) so that the private key can also be used for
> verification.
> - Fixed a bug, gcrypt-ecdsa can truncate digest correctly now,
> and a related unit-test is added.
> - Fixed a bug, nettle-ecdsa can correctly add leading-zero (if needed)
> when encoding the signature now.
> - Minor tweaks to code style and typo fix.
> 
> V1:
> - make the built-in ASN.1 decoder support more ASN.1 types.
> - support ECDSA key and signature parsing.
> - implement the ECDSA algorithm using nettle and gcrypt respectively.
> 

Ping for:
<https://patchew.org/QEMU/20220622091549.31115-1-helei.sig11@bytedance.com/>.