public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@nabladev.com>
To: U-Boot Mailing List <u-boot@lists.denx.de>
Cc: "Heiko Schocher" <hs@nabladev.com>,
	"Alif Zakuan Yuslaimi" <alif.zakuan.yuslaimi@altera.com>,
	"Andrew Goodbody" <andrew.goodbody@linaro.org>,
	"Arturs Artamonovs" <arturs.artamonovs@analog.com>,
	"Christoph Niedermaier" <cniedermaier@dh-electronics.com>,
	"Dinesh Maniyam" <dinesh.maniyam@altera.com>,
	"Duje Mihanović" <duje@dujemihanovic.xyz>,
	"Greg Malysa" <malysagreg@gmail.com>,
	"Heinrich Schuchardt" <xypron.glpk@gmx.de>,
	"Ibai Erkiaga" <ibai.erkiaga-elorza@amd.com>,
	"Ilias Apalodimas" <ilias.apalodimas@linaro.org>,
	"Jaehoon Chung" <jh80.chung@samsung.com>,
	"Jerome Forissier" <jerome.forissier@linaro.org>,
	"Marek Vasut" <marek.vasut@mailbox.org>,
	"Martin Schwan" <m.schwan@phytec.de>,
	"Mattijs Korpershoek" <mkorpershoek@kernel.org>,
	"Michal Simek" <michal.simek@amd.com>,
	"Mikhail Kshevetskiy" <mikhail.kshevetskiy@iopsys.eu>,
	"Miquel Raynal" <miquel.raynal@bootlin.com>,
	"Nathan Barrett-Morrison" <nathan.morrison@timesys.com>,
	"Patrice Chotard" <patrice.chotard@foss.st.com>,
	"Paul Barker" <paul.barker.ct@bp.renesas.com>,
	"Peng Fan" <peng.fan@nxp.com>,
	"Peter Robinson" <pbrobinson@gmail.com>,
	"Philippe Reynes" <philippe.reynes@softathome.com>,
	"Raymond Mao" <raymond.mao@linaro.org>,
	"Simon Glass" <sjg@chromium.org>,
	"Stefan Roese" <stefan.roese@mailbox.org>,
	"Sumit Garg" <sumit.garg@kernel.org>,
	"Tom Rini" <trini@konsulko.com>,
	"Utsav Agarwal" <utsav.agarwal@analog.com>,
	"Vasileios Bimpikas" <vasileios.bimpikas@analog.com>
Subject: [PATCH v1 0/5] Add support for SM3 secure hash
Date: Sat,  1 Nov 2025 07:49:02 +0100	[thread overview]
Message-ID: <20251101064907.5037-1-hs@nabladev.com> (raw)


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, 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=188&view=results


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

 MAINTAINERS            |   7 +
 boot/Kconfig           |   1 +
 cmd/Kconfig            |  16 +++
 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   |  34 +++++
 lib/Kconfig            |   7 +
 lib/Makefile           |   1 +
 lib/sm3.c              | 313 +++++++++++++++++++++++++++++++++++++++++
 lib/tpm-v2.c           |   4 +-
 test/cmd/hash.c        |  48 ++++++-
 15 files changed, 543 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: e6d1bcd668341af940254482b206a484e6a98db9

             reply	other threads:[~2025-11-01 15:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-01  6:49 Heiko Schocher [this message]
2025-11-01  6:49 ` [PATCH v1 1/5] lib: Import rol32 function from Linux Heiko Schocher
2025-11-01  6:49 ` [PATCH v1 2/5] lib: implement SM3 secure hash Heiko Schocher
2025-11-01 17:11   ` Raymond Mao
2025-11-03  8:56     ` Heiko Schocher
2025-11-04  2:30       ` Raymond Mao
2025-11-01  6:49 ` [PATCH v1 3/5] test: cmd: add unit test for sm3 hash Heiko Schocher
2025-11-01  6:49 ` [PATCH v1 4/5] tpm2: add sm3 256 hash support Heiko Schocher
2025-11-10 11:51   ` Ilias Apalodimas
2025-11-10 13:06     ` Heiko Schocher
2025-11-01  6:49 ` [PATCH v1 5/5] test: cmd: fix a typo in md5 test Heiko Schocher
2025-11-01  7:45   ` Heinrich Schuchardt

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=20251101064907.5037-1-hs@nabladev.com \
    --to=hs@nabladev.com \
    --cc=alif.zakuan.yuslaimi@altera.com \
    --cc=andrew.goodbody@linaro.org \
    --cc=arturs.artamonovs@analog.com \
    --cc=cniedermaier@dh-electronics.com \
    --cc=dinesh.maniyam@altera.com \
    --cc=duje@dujemihanovic.xyz \
    --cc=ibai.erkiaga-elorza@amd.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jerome.forissier@linaro.org \
    --cc=jh80.chung@samsung.com \
    --cc=m.schwan@phytec.de \
    --cc=malysagreg@gmail.com \
    --cc=marek.vasut@mailbox.org \
    --cc=michal.simek@amd.com \
    --cc=mikhail.kshevetskiy@iopsys.eu \
    --cc=miquel.raynal@bootlin.com \
    --cc=mkorpershoek@kernel.org \
    --cc=nathan.morrison@timesys.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=paul.barker.ct@bp.renesas.com \
    --cc=pbrobinson@gmail.com \
    --cc=peng.fan@nxp.com \
    --cc=philippe.reynes@softathome.com \
    --cc=raymond.mao@linaro.org \
    --cc=sjg@chromium.org \
    --cc=stefan.roese@mailbox.org \
    --cc=sumit.garg@kernel.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=utsav.agarwal@analog.com \
    --cc=vasileios.bimpikas@analog.com \
    --cc=xypron.glpk@gmx.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox