All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] Add support for SM3 secure hash
@ 2025-11-11  5:48 Heiko Schocher
  2025-11-11  5:48 ` [PATCH v2 1/5] lib: Import rol32 function from Linux Heiko Schocher
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Heiko Schocher @ 2025-11-11  5:48 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Ilias Apalodimas, Heiko Schocher, Alif Zakuan Yuslaimi,
	Andrew Goodbody, Arturs Artamonovs, Casey Connolly,
	Christoph Niedermaier, Dinesh Maniyam, Greg Malysa,
	Heinrich Schuchardt, Ibai Erkiaga, Jaehoon Chung,
	Jerome Forissier, Marek Vasut, Martin Schwan, Mattijs Korpershoek,
	Michal Simek, Mikhail Kshevetskiy, Miquel Raynal,
	Nathan Barrett-Morrison, Oliver Gaskell, Patrice Chotard,
	Paul Barker, Peng Fan, Peter Robinson, Philippe Reynes,
	Raymond Mao, Sean Edmond, Simon Glass, Stefan Roese, Sumit Garg,
	Tom Rini, Utsav Agarwal, Vasileios Bimpikas,
	Venkatesh Yadav Abbarapu, Yao Zi, briansune


Add SM3 secure hash, as specified by OSCCA GM/T 0004-2012 SM3 and described
at https://datatracker.ietf.org/doc/html/draft-sca-cfrg-sm3-02

TPMv2 defines hash algo sm3_256, which is currently
not supported and prevented TPMv2 chip with newer
firmware to work with U-Boot. Seen this on a ST33TPHF2XI2C

    u-boot=> tpm2 init
    u-boot=> tpm2 autostart
    tpm2_get_pcr_info: too many pcrs: 5
    Error: -90
    u-boot=>

Implement sm3 hash, so we can fix this problem.

Azure build:
https://dev.azure.com/hs0298/hs/_build/results?buildId=190&view=results

Changes in v2:
rebase to
6b27b688694: ("Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sh")
add Ilias to Series-cc
add sm3_hash to header file, so we can use it.
add comments from Ilias
- use ARRAY_SIZE(hash_algo_list) instead of a fix number
  in tpm2_get_pcr_info() for the count of supported hashes
  in U-Boot.
- add SM3 hash in tpm_tcg2
Added Reviewed-by tag from Heinrich

Heiko Schocher (5):
  lib: Import rol32 function from Linux
  lib: implement sm3 256 hash
  test: cmd: hash: add unit test for sm3_256
  tpm2: add sm3 256 hash support
  test: cmd: fix a typo in md5 test

 MAINTAINERS            |   7 +
 boot/Kconfig           |   1 +
 cmd/Kconfig            |  15 ++
 cmd/Makefile           |   1 +
 cmd/sm3sum.c           |  48 +++++++
 cmd/tpm-v2.c           |   1 +
 common/hash.c          |  43 +++++-
 include/linux/bitops.h |  11 ++
 include/tpm-v2.h       |  12 ++
 include/u-boot/sm3.h   |  35 +++++
 lib/Kconfig            |   7 +
 lib/Makefile           |   1 +
 lib/sm3.c              | 313 +++++++++++++++++++++++++++++++++++++++++
 lib/tpm-v2.c           |   4 +-
 lib/tpm_tcg2.c         |   9 ++
 test/cmd/hash.c        |  48 ++++++-
 16 files changed, 552 insertions(+), 4 deletions(-)
 create mode 100644 cmd/sm3sum.c
 create mode 100644 include/u-boot/sm3.h
 create mode 100644 lib/sm3.c

-- 
2.20.1

base-commit: 9094482ca7576877b2bfaa57c8e73cfeb536f8b9

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

end of thread, other threads:[~2025-11-12 13:12 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-11  5:48 [PATCH v2 0/5] Add support for SM3 secure hash Heiko Schocher
2025-11-11  5:48 ` [PATCH v2 1/5] lib: Import rol32 function from Linux Heiko Schocher
2025-11-11  9:07   ` Ilias Apalodimas
2025-11-11  5:48 ` [PATCH v2 2/5] lib: implement sm3 256 hash Heiko Schocher
2025-11-11  9:47   ` Ilias Apalodimas
2025-11-12  5:05     ` Heiko Schocher
2025-11-11  5:48 ` [PATCH v2 3/5] test: cmd: hash: add unit test for sm3_256 Heiko Schocher
2025-11-11  6:39   ` Heinrich Schuchardt
2025-11-12  4:44     ` Heiko Schocher
2025-11-11  5:48 ` [PATCH v2 4/5] tpm2: add sm3 256 hash support Heiko Schocher
2025-11-11  9:34   ` Ilias Apalodimas
2025-11-11  9:38     ` Ilias Apalodimas
2025-11-12  4:46     ` Heiko Schocher
2025-11-11  5:48 ` [PATCH v2 5/5] test: cmd: fix a typo in md5 test Heiko Schocher
2025-11-11  8:57   ` Ilias Apalodimas

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.