All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/5] Enable ECDSA FIT verification for stm32mp
@ 2021-05-17 18:38 Alexandru Gagniuc
  2021-05-17 18:39 ` [PATCH v5 1/5] dm: crypto: Define UCLASS API for ECDSA signature verification Alexandru Gagniuc
                   ` (4 more replies)
  0 siblings, 5 replies; 29+ messages in thread
From: Alexandru Gagniuc @ 2021-05-17 18:38 UTC (permalink / raw)
  To: u-boot

This series is based on the following:
    "[PATCH 00/18] image: Reduce #ifdef abuse in image code"

This rebase is awesome because we don't need to change #defines in
common code or rely on hidden #ifdefs.

Q: Will there be a software-only implementation of ECDSA ?
A: That is the goal, so that we can have more extensive testing with
   the sandbox. I don not have the bandwidth to implement it. There
   has been an initial poer of software ecdsa here:
       https://github.com/timr11/u-boot/tree/ecdsa-vrf-1

Q: Can more code be shared with the RSA verification path?
A: Probably yes. Mostly having to do with parsing the "/signature"
   node and "key-name-hint"s in the u-boot FDT. Although there isn't
   any copypasted RSA code, or code with substantial similarity.

Changes since v4:
  - Use U_BOOT_CRYPTO_ALGO() to add ECDSA to .u_boot_list
  - No need to #define IMAGE_ENABLE_VERIFY_ECDSA
  - Use ut_asserteq(x, -ENODEV) instead of ut_assert(x == -ENODEV)

Changes since v3:
  - Remove unused ecdsa_check_key() function

Changes since v2:
  - Spell out "elliptic curve" in Kconfig (Although RSA isn't spelled out)

Changes since v1:
  - Add test to make sure the UCLASS is enabled
  - Fix check against wrong sig_len in ecdsa_romapi.c
  - s/U_BOOT_DEVICE/U_BOOT_DRVINFO/
  - Use "if(!ret)" instead of "if (ret == 0)"
  - Use uclass_first_device_err() instead of uclass_first_device()
  - Make sure #includes are correctly alphabetized

Alexandru Gagniuc (5):
  dm: crypto: Define UCLASS API for ECDSA signature verification
  lib: ecdsa: Implement UCLASS_ECDSA verification on target
  arm: stm32mp1: Implement ECDSA signature verification
  Kconfig: FIT_SIGNATURE should not select RSA_VERIFY
  test: dm: Add test for ECDSA UCLASS support

 arch/arm/mach-stm32mp/Kconfig        |   9 ++
 arch/arm/mach-stm32mp/Makefile       |   1 +
 arch/arm/mach-stm32mp/ecdsa_romapi.c | 102 ++++++++++++++++++++
 common/Kconfig.boot                  |   8 +-
 configs/sandbox_defconfig            |   2 +
 include/crypto/ecdsa-uclass.h        |  39 ++++++++
 include/dm/uclass-id.h               |   1 +
 lib/Kconfig                          |   1 +
 lib/Makefile                         |   1 +
 lib/ecdsa/Kconfig                    |  23 +++++
 lib/ecdsa/Makefile                   |   1 +
 lib/ecdsa/ecdsa-verify.c             | 134 +++++++++++++++++++++++++++
 test/dm/Makefile                     |   1 +
 test/dm/ecdsa.c                      |  39 ++++++++
 14 files changed, 358 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/mach-stm32mp/ecdsa_romapi.c
 create mode 100644 include/crypto/ecdsa-uclass.h
 create mode 100644 lib/ecdsa/Kconfig
 create mode 100644 lib/ecdsa/Makefile
 create mode 100644 lib/ecdsa/ecdsa-verify.c
 create mode 100644 test/dm/ecdsa.c

-- 
2.31.1

^ permalink raw reply	[flat|nested] 29+ messages in thread
* [PATCH 0/5] Enable ECDSA FIT verification for stm32mp
@ 2021-01-11 15:41 Alexandru Gagniuc
  2021-01-11 15:41 ` [PATCH 1/5] dm: crypto: Define UCLASS API for ECDSA signature verification Alexandru Gagniuc
  0 siblings, 1 reply; 29+ messages in thread
From: Alexandru Gagniuc @ 2021-01-11 15:41 UTC (permalink / raw)
  To: u-boot

This series is Part II of the ECDSA saga. It applies on top of [1]:
 * [PATCH v4 0/6] Add support for ECDSA image signing (with test)

I've designed the UCLASS_ECDSA such that it aligns with the ROM API
of the stm32mp. Instead of splitting the verification into
(1) curve operations and (2) modular exponentiation, I've
concatenated everything in a 'verify' step. It would be impossible to
split the steps and use the stm32mp ROM for verification.

Should more granular control be required, this API could be extended
at a later time. Until we have more hardware supporting ECDSA, this
is purely speculative.

The ROM API of the stm32mp is passed in 'r0' when the FSBL is called.
While we can save 'r0' in SPL, this series does not implement a
mechanism to pass this to u-boot. Thus the ROM API, and ECDSA
verification are only available for SPL. Although extending this to
u-boot by adding the ROM address to the FDT blob, implementing and
verifying this is beyond the scope of this series.

[1] https://lists.denx.de/pipermail/u-boot/2021-January/436935.html

Alexandru Gagniuc (5):
  dm: crypto: Define UCLASS API for ECDSA signature verification
  lib: ecdsa: Add skeleton to implement ecdsa verification in u-boot
  lib: ecdsa: Implement signature verification for crypto_algo API
  arm: stm32mp1: Implement ECDSA signature verification
  Kconfig: FIT_SIGNATURE should not select RSA_VERIFY

 arch/arm/mach-stm32mp/Kconfig        |   9 ++
 arch/arm/mach-stm32mp/Makefile       |   1 +
 arch/arm/mach-stm32mp/ecdsa_romapi.c | 106 ++++++++++++++++++++++
 common/Kconfig.boot                  |   8 +-
 include/crypto/ecdsa-uclass.h        |  39 ++++++++
 include/dm/uclass-id.h               |   1 +
 include/image.h                      |  10 +--
 include/u-boot/rsa.h                 |   2 +-
 lib/Kconfig                          |   1 +
 lib/Makefile                         |   1 +
 lib/ecdsa/Kconfig                    |  23 +++++
 lib/ecdsa/Makefile                   |   1 +
 lib/ecdsa/ecdsa-verify.c             | 128 +++++++++++++++++++++++++++
 13 files changed, 320 insertions(+), 10 deletions(-)
 create mode 100644 arch/arm/mach-stm32mp/ecdsa_romapi.c
 create mode 100644 include/crypto/ecdsa-uclass.h
 create mode 100644 lib/ecdsa/Kconfig
 create mode 100644 lib/ecdsa/Makefile
 create mode 100644 lib/ecdsa/ecdsa-verify.c

-- 
2.26.2

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2021-08-16 11:32 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-17 18:38 [PATCH v5 0/5] Enable ECDSA FIT verification for stm32mp Alexandru Gagniuc
2021-05-17 18:39 ` [PATCH v5 1/5] dm: crypto: Define UCLASS API for ECDSA signature verification Alexandru Gagniuc
2021-05-19 16:36   ` Simon Glass
2021-05-17 18:39 ` [PATCH v5 2/5] lib: ecdsa: Implement UCLASS_ECDSA verification on target Alexandru Gagniuc
2021-05-19 16:36   ` Simon Glass
2021-05-17 18:39 ` [PATCH v5 3/5] arm: stm32mp1: Implement ECDSA signature verification Alexandru Gagniuc
2021-05-17 18:39 ` [PATCH v5 4/5] Kconfig: FIT_SIGNATURE should not select RSA_VERIFY Alexandru Gagniuc
2021-05-17 19:10   ` Igor Opaniuk
2021-05-17 18:39 ` [PATCH v5 5/5] test: dm: Add test for ECDSA UCLASS support Alexandru Gagniuc
2021-07-27  8:09   ` Patrick DELAUNAY
2021-07-29 16:47     ` [PATCH 0/5] Enable ECDSA FIT verification for stm32mp Alexandru Gagniuc
2021-07-29 16:47       ` [PATCH 1/5] dm: crypto: Define UCLASS API for ECDSA signature verification Alexandru Gagniuc
2021-07-30  9:47         ` Patrick DELAUNAY
2021-08-16 11:31           ` Patrice CHOTARD
2021-07-29 16:47       ` [PATCH 2/5] lib: ecdsa: Implement UCLASS_ECDSA verification on target Alexandru Gagniuc
2021-07-30  9:49         ` Patrick DELAUNAY
2021-07-29 16:47       ` [PATCH 3/5] arm: stm32mp1: Implement ECDSA signature verification Alexandru Gagniuc
2021-07-30  9:51         ` Patrick DELAUNAY
2021-08-16 11:31           ` Patrice CHOTARD
2021-07-29 16:47       ` [PATCH 4/5] Kconfig: FIT_SIGNATURE should not select RSA_VERIFY Alexandru Gagniuc
2021-07-30  9:52         ` Patrick DELAUNAY
2021-08-16 11:32           ` Patrice CHOTARD
2021-07-29 16:47       ` [PATCH 5/5] test: dm: Add test for ECDSA UCLASS support Alexandru Gagniuc
2021-07-30  9:53         ` Patrick DELAUNAY
2021-08-16 11:32           ` Patrice CHOTARD
  -- strict thread matches above, loose matches on Subject: below --
2021-01-11 15:41 [PATCH 0/5] Enable ECDSA FIT verification for stm32mp Alexandru Gagniuc
2021-01-11 15:41 ` [PATCH 1/5] dm: crypto: Define UCLASS API for ECDSA signature verification Alexandru Gagniuc
2021-01-13 16:10   ` Simon Glass
2021-01-14 16:09     ` Alex G.
2021-01-14 19:16       ` Simon Glass

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.