Support for i.MX Code Signing Tools
cover Support for i.MX Code Signing Tools
This path serie add the i.MX CST package that allows to sign bootloader stages, to be able to boot them on i.MX targets that verify the digital signatures through HABv4 and AHAB.
Thomas Perrot (2):
package/byacc: add new package
package/imx-cst: add new package
DEVELOPERS | 4 ++++ package/Config.in.host | 1 + package/byacc/Config.in.host | 10 ++++++++ package/byacc/byacc.hash | 3 +++ package/byacc/byacc.mk | 15 ++++++++++++ package/imx-cst/Config.in.host | 8 +++++++ package/imx-cst/imx-cst.hash | 3 +++ package/imx-cst/imx-cst.mk | 42 ++++++++++++++++++++++++++++++++++ 8 files changed, 86 insertions(+) create mode 100644 package/byacc/Config.in.host create mode 100644 package/byacc/byacc.hash create mode 100644 package/byacc/byacc.mk create mode 100644 package/imx-cst/Config.in.host create mode 100644 package/imx-cst/imx-cst.hash create mode 100644 package/imx-cst/imx-cst.mk
--
2.35.1
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 1/2 package/byacc: add new package
This package provides a Berkeley LALR Yacc parser generator that has been use by i.MX Code Signing tool.
--- DEVELOPERS | 3 +++ package/byacc/Config.in.host | 10 ++++++++++ package/byacc/byacc.hash | 3 +++ package/byacc/byacc.mk | 15 +++++++++++++++ 4 files changed, 31 insertions(+) create mode 100644 package/byacc/Config.in.host create mode 100644 package/byacc/byacc.hash create mode 100644 package/byacc/byacc.mk
DEVELOPERS +3 -0
@@ -2765,6 +2765,9 @@ F: package/frotz/ F: package/kvm-unit-tests/ F: package/xorcurses/ +N: Thomas Perrot <[email protected]> +F: package/byacc + N: Thomas Petazzoni <[email protected]> F: arch/Config.in.arm F: board/beaglev/
package/byacc/Config.in.host new file +10 -0
@@ -0,0 +1,10 @@ +config BR2_PACKAGE_HOST_BYACC + bool "host byacc" + help + A parser generator utility that reads a grammar + specification from a file and generates an LR(1) + parser for it. The parsers consist of a set of + LALR(1) parsing tables and a driver routine written + in the C programming language. + + http://invisible-island.net/byacc/
package/byacc/byacc.hash new file +3 -0
@@ -0,0 +1,3 @@ +# Locally calculated +sha256 42c1805cc529314e6a76326fe1b33e80c70862a44b01474da362e2f7db2d749c byacc-20220128.tgz +sha256 654a231fe9cd4d36e580214962fa777a1df0771d6889cfc74d19a3d414f14711 LICENSE
package/byacc/byacc.mk new file +15 -0
@@ -0,0 +1,15 @@ +################################################################################ +# +# byacc +# +################################################################################ + +BYACC_SITE = https://invisible-mirror.net/archives/byacc +BYACC_VERSION = 20220128 +BYACC_SOURCE = byacc-$(BYACC_VERSION).tgz +BYACC_LICENSE = Public Domain +BYACC_LICENSE_FILES = LICENSE + +HOST_BYACC_CONF_OPTS = --program-transform-name='s,^,b,' + +$(eval $(host-autotools-package))
Signature · 6 lines
2.35.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/2 package/imx-cst: add new package
In reply to Thomas Perrot via buildrootThis package provides i.MX Code Signing Tools uses to sign i.MX bootloader to enable secure boot (HABv4 and AHAB).
--- DEVELOPERS | 1 + package/Config.in.host | 1 + package/imx-cst/Config.in.host | 8 +++++++ package/imx-cst/imx-cst.hash | 3 +++ package/imx-cst/imx-cst.mk | 42 ++++++++++++++++++++++++++++++++++ 5 files changed, 55 insertions(+) create mode 100644 package/imx-cst/Config.in.host create mode 100644 package/imx-cst/imx-cst.hash create mode 100644 package/imx-cst/imx-cst.mk
DEVELOPERS +1 -0
@@ -2767,6 +2767,7 @@ F: package/xorcurses/ N: Thomas Perrot <[email protected]> F: package/byacc +F: package/imx-cst N: Thomas Petazzoni <[email protected]> F: arch/Config.in.arm
package/Config.in.host +1 -0
@@ -40,6 +40,7 @@ menu "Host utilities" source "package/google-breakpad/Config.in.host" source "package/gptfdisk/Config.in.host" source "package/imagemagick/Config.in.host" + source "package/imx-cst/Config.in.host" source "package/imx-mkimage/Config.in.host" source "package/imx-usb-loader/Config.in.host" source "package/jh71xx-tools/Config.in.host"
package/imx-cst/Config.in.host new file +8 -0
@@ -0,0 +1,8 @@ +config BR2_PACKAGE_HOST_IMX_CST + bool "host imx-cst" + help + I.MX code signing tool provides software code signing + support designed that integrate the HABv4 and AHAB + library. + + https://www.nxp.com/webapp/sps/download/license.jsp?colCode=IMX_CST_TOOL
package/imx-cst/imx-cst.hash new file +3 -0
@@ -0,0 +1,3 @@ +# Locally calculated +sha256 2bcc03c7cedba58f7207a72a28e75cfe78007988d68c1095c793cce991c2936e imx-cst-e2c687a856e6670e753147aacef42d0a3c07891a-br1.tar.gz +sha256 5dee6f54c636a97b15d7e9dfc8075248c36764b3819828cbc94cbd17c1755fb9 LICENSE.bsd3
package/imx-cst/imx-cst.mk new file +42 -0
42 lines not on this page · raw message
Signature · 6 lines
2.35.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 1/2] package/byacc: add new package
In reply to Thomas Perrot via buildrootHello Thomas,
Thanks for your contribution.
Commit title should be just:
package/byacc: new package
Quoted 7 lines · On Tue, 19 Apr 2022 11:21:50 +0200 Thomas Perrot <[email protected]>…
This package provides a Berkeley LALR Yacc parser generator that has been use by i.MX Code Signing tool.
Signed-off-by Thomas Perrot <[email protected]>--- DEVELOPERS | 3 +++ package/byacc/Config.in.host | 10 ++++++++++
Config.in.host not needed, this package is merely a build dependency of another, so we don't need to see it in menuconfig.
DEVELOPERS F: package/frotz/ · line 2769
Quoted 2 lines
DEVELOPERS +2
-0+N: Thomas Perrot <[email protected]> +F: package/byacc
Please add a trailing slash, like other entries in this file.
Quoted 18 lines
package/byacc/byacc.hash new file +3
-0@@ -0,0 +1,3 @@ +# Locally calculated +sha256 42c1805cc529314e6a76326fe1b33e80c70862a44b01474da362e2f7db2d749c byacc-20220128.tgz +sha256 654a231fe9cd4d36e580214962fa777a1df0771d6889cfc74d19a3d414f14711 LICENSEpackage/byacc/byacc.mk new file +3
-0@@ -0,0 +1,15 @@ +################################################################################ +# +# byacc
package/byacc/byacc.mk line 13
Quoted 10 lines
package/byacc/byacc.mk new file +10
-0+# +################################################################################ + +BYACC_SITE = https://invisible-mirror.net/archives/byacc +BYACC_VERSION = 20220128 +BYACC_SOURCE = byacc-$(BYACC_VERSION).tgz +BYACC_LICENSE = Public Domain +BYACC_LICENSE_FILES = LICENSE + +HOST_BYACC_CONF_OPTS = --program-transform-name='s,^,b,'
Please add a comment above this that explains why this is needed, it looks strange.
Thanks!
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 2/2] package/imx-cst: add new package
In reply to Thomas Perrot via buildrootHello Thomas,
Quoted 3 lines · On Tue, 19 Apr 2022 11:21:51 +0200 Thomas Perrot <[email protected]>…
N: Thomas Perrot <[email protected]>
F: package/byacc
+F: package/imx-cst
Trailing slash needed.
Quoted 6 lines
package/imx-cst/Config.in.host new file +0
-0
package/imx-cst/Config.in.host line 8
Quoted 8 lines
package/imx-cst/Config.in.host new file +8
-0@@ -0,0 +1,8 @@ +config BR2_PACKAGE_HOST_IMX_CST + bool "host imx-cst" + help + I.MX code signing tool provides software code signing + support designed that integrate the HABv4 and AHAB + library. + + https://www.nxp.com/webapp/sps/download/license.jsp?colCode=IMX_CST_TOOL
When I go to this page, I need to agree to a "SOFTWARE LICENSE AGREEMENT i.MX CODE SIGNING TOOL", but then your .mk is pointing to a non-NXP Git repository, and you state the license is BSD-3-Clause.
package/imx-cst/Config.in.host
Quoted 2 lines
package/imx-cst/Config.in.host new file +2
-0+# debian/3.3.1+dfsg-2 +IMX_CST_SITE = https://gitlab.apertis.org/pkg/imx-code-signing-tool.git
What is this location? Just someone who put the NXP code online? Or a separate implementation?
package/imx-cst/Config.in.host
Quoted 4 lines
package/imx-cst/Config.in.host new file +4
-0+IMX_CST_SITE_METHOD = git +IMX_CST_VERSION = e2c687a856e6670e753147aacef42d0a3c07891a +IMX_CST_LICENSE = BSD-3-Clause +IMX_CST_LICENSE_FILES = LICENSE.bsd3
There are two other license files in this Git repo, the hidapi license and the OpenSSL license. You are confident they are not relevant? Would be worth explaining that.
package/imx-cst/Config.in.host
Quoted 5 lines
package/imx-cst/Config.in.host new file +5
-0+HOST_IMX_CST_DEPENDENCIES = host-byacc host-flex host-openssl + +define HOST_IMX_CST_BUILD_CMDS + $(HOST_MAKE_ENV) $(MAKE) $(HOST_CONFIGURE_OPTS) \ + OSTYPE=linux64 \
Would be useful to explain why linux64 is fine even on 32-bit host platforms. Actually, when I look at
https://gitlab.apertis.org/pkg/imx-code-signing-tool/-/blob/apertis/v2023dev2/code/cst/code/obj.linux64/Makefile
I believe that using OSTYPE=linux64 on 32-bit host machines will not work, as it adds -m64 to the compiler flags.
package/imx-cst/Config.in.host
Quoted 9 lines
package/imx-cst/Config.in.host new file +9
-0+ ENCRYPTION=yes \ + COPTIONS="$(HOST_CFLAGS) $(HOST_CPPFLAGS)" \ + LDFLAGS="$(HOST_LDFLAGS) -lcrypto" \ + PWD=$(@D)/code/cst \ + CC="$(CC) -I../../code/common/hdr \ + -I../../code/back_end/hdr \ + -I../../code/srktool/hdr \ + -I../../code/front_end/hdr \ + -I../../code/convlb/hdr" \
This looks strange. Flags are normally passed using CFLAGS, and $(CC) in Buildroot doesn't exist, it's $(HOSTCC) that should be used.
Also, I think the list of header paths is properly set with:
CINCLUDES := $(SUBSYS:%=-I$(CST_CODE_PATH)/%/hdr)
but it gets overridden by the fact that you override CFLAGS.
I believe there's a better way, let me have a look.
package/imx-cst/Config.in.host
Quoted 1 line
package/imx-cst/Config.in.host new file +1
-0+ LD=$(CC) \
$(CC) doesn't exist, it should be $(HOSTCC).
package/imx-cst/Config.in.host
Quoted 2 lines
package/imx-cst/Config.in.host new file +2
-0+ -C $(@D)/code/cst \ + build
Best regards,
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 2/2] package/imx-cst: add new package
Quoted 10 lines · On Tue, 19 Apr 2022 14:26:35 +0200 Thomas Petazzoni via buildroot…
This looks strange. Flags are normally passed using CFLAGS, and $(CC) in Buildroot doesn't exist, it's $(HOSTCC) that should be used.
Also, I think the list of header paths is properly set with:
CINCLUDES := $(SUBSYS:%=-I$(CST_CODE_PATH)/%/hdr)
but it gets overridden by the fact that you override CFLAGS.
I believe there's a better way, let me have a look.
Here is what I could come up with:
ifneq ($(filter %64,$(HOSTARCH)),)HOST_IMX_CST_OSTYPE = linux64
elseHOST_IMX_CST_OSTYPE = linux32
endif
# We don't use HOST_CONFIGURE_OPTS when building cst, because we need
# to preserve the CFLAGS/LDFLAGS used by their Makefile. define HOST_IMX_CST_BUILD_CMDS $(HOST_MAKE_ENV) $(MAKE) \ OSTYPE=$(HOST_IMX_CST_OSTYPE) \ ENCRYPTION=yes \ AR="$(HOSTAR)" \ CC="$(HOSTCC)" \ LD="$(HOSTCC)" \ OBJCOPY="$(HOSTOBJCOPY)" \ RANLIB="$(HOSTRANLIB)" \ EXTRACFLAGS="$(HOST_CFLAGS) $(HOST_CPPFLAGS)" \ EXTRALDFLAGS="$(HOST_LDFLAGS)" \ PWD=$(@D)/code/cst \ -C $(@D)/code/cst \ build $(HOST_MAKE_ENV) $(MAKE) $(HOST_CONFIGURE_OPTS) \ COPTS="$(HOST_CFLAGS) $(HOST_CPPFLAGS) $(HOST_LDFLAGS)" \ -C $(@D)/code/hab_csf_parser endef
define HOST_IMX_CST_INSTALL_CMDS
$(INSTALL) -D -m 755 $(@D)/code/cst/code/obj.$(HOST_IMX_CST_OSTYPE)/cst $(HOST_DIR)/bin/cst $(INSTALL) -D -m 755 $(@D)/code/cst/code/obj.$(HOST_IMX_CST_OSTYPE)/srktool $(HOST_DIR)/bin/srktool $(INSTALL) -D -m 755 $(@D)/code/hab_csf_parser/csf_parser $(HOST_DIR)/bin/csf_parser
endef
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 2/2] package/imx-cst: add new package
In reply to Thomas Petazzoni via buildrootHello Thomas,
Quoted 32 lines · Thomas Petazzoni via buildroot
Hello Thomas,
Quoted 3 lines · On Tue, 19 Apr 2022 11:21:51 +0200 Thomas Perrot <[email protected]>…
N: Thomas Perrot <[email protected]>
F: package/byacc
+F: package/imx-cstTrailing slash needed.
Quoted 15 lines
package/imx- renamed from package/imx-cst/Config.in.host +0
-0cst/Config.in.host
new file mode 100644
index 000000000000..84cb825e59cfpackage/imx-cst/Config.in.host new file +8
-0@@ -0,0 +1,8 @@ +config BR2_PACKAGE_HOST_IMX_CST + bool "host imx-cst" + help + I.MX code signing tool provides software code signing + support designed that integrate the HABv4 and AHAB + library. + +When I go to this page, I need to agree to a "SOFTWARE LICENSE AGREEMENT i.MX CODE SIGNING TOOL", but then your .mk is pointing to a non-NXP Git repository, and you state the license is BSD-3-Clause.
Quoted 6 lines
Quoted 3 lines
package/imx-cst/Config.in.host new file +2
-0+# debian/3.3.1+dfsg-2 +IMX_CST_SITE =What is this location? Just someone who put the NXP code online? Or a separate implementation?
NXP code has been put by Debian maintainers.
Quoted 11 lines
package/imx-cst/Config.in.host
Quoted 5 lines
package/imx-cst/Config.in.host new file +4
-0+IMX_CST_SITE_METHOD = git +IMX_CST_VERSION = e2c687a856e6670e753147aacef42d0a3c07891a +IMX_CST_LICENSE = BSD-3-Clause +IMX_CST_LICENSE_FILES = LICENSE.bsd3There are two other license files in this Git repo, the hidapi license
and the OpenSSL license. You are confident they are not relevant? Would
be worth explaining that.
I think it is correct because from source the file "Software_Content_Register_CST.txt" indicates that the outgoing license is BSD-3-Clause, and Debian also use this BSD license.
Kind regards,
Thomas Perrot
Quoted 44 lines
package/imx-cst/Config.in.host
Quoted 6 lines
package/imx-cst/Config.in.host new file +5
-0+HOST_IMX_CST_DEPENDENCIES = host-byacc host-flex host-openssl + +define HOST_IMX_CST_BUILD_CMDS + $(HOST_MAKE_ENV) $(MAKE) $(HOST_CONFIGURE_OPTS) \ + OSTYPE=linux64 \Would be useful to explain why linux64 is fine even on 32-bit host platforms. Actually, when I look at
https://gitlab.apertis.org/pkg/imx-code-signing-tool/-/blob/apertis/v2023dev2/code/cst/code/obj.linux64/Makefile
I believe that using OSTYPE=linux64 on 32-bit host machines will not work, as it adds -m64 to the compiler flags.Quoted 9 lines
+ ENCRYPTION=yes \
+ COPTIONS="$(HOST_CFLAGS) $(HOST_CPPFLAGS)" \
+ LDFLAGS="$(HOST_LDFLAGS) -lcrypto" \
+ PWD=$(@D)/code/cst \
+ CC="$(CC) -I../../code/common/hdr \
+ -I../../code/back_end/hdr \
+ -I../../code/srktool/hdr \
+ -I../../code/front_end/hdr \
+ -I../../code/convlb/hdr" \This looks strange. Flags are normally passed using CFLAGS, and $(CC) in Buildroot doesn't exist, it's $(HOSTCC) that should be used.
Also, I think the list of header paths is properly set with:
CINCLUDES := $(SUBSYS:%=-I$(CST_CODE_PATH)/%/hdr)
but it gets overridden by the fact that you override CFLAGS.
I believe there's a better way, let me have a look.
Quoted 1 line
+ LD=$(CC) \
$(CC) doesn't exist, it should be $(HOSTCC).
Quoted 2 lines
+ -C $(@D)/code/cst \
+ buildBest regards,
Thomas
Signature · 3 lines
Thomas Perrot, Bootlin Embedded Linux and kernel engineering https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 2/2] package/imx-cst: add new package
Hello,
Quoted 4 lines · On Wed, 20 Apr 2022 10:39:16 +0200 Thomas Perrot <[email protected]>…
Quoted 2 lines
What is this location? Just someone who put the NXP code online? Or a separate implementation?
NXP code has been put by Debian maintainers.
OK.
Quoted 3 lines
I think it is correct because from source the file "Software_Content_Register_CST.txt" indicates that the outgoing license is BSD-3-Clause, and Debian also use this BSD license.
Indeed, it seems OK.
Maybe it would have been useful to have those details somewhere (in the commit log perhaps)? But it's probably not worth sending another iteration just for this.
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot