@@ -151,6 +151,7 @@ F: board/sifive/
F: boot/opensbi/
F: configs/hifive_unleashed_defconfig
F: package/libspdm/
+F: package/spdm-utils/
F: package/xen/
N: Alvaro G. M <alvaro.gamez@hazent.com>
@@ -3288,6 +3289,9 @@ F: package/uclibc/
F: package/uclibc-ng-test/
F: support/testing/tests/package/test_ruby.py
+N: Wilfred Mallawa <wilfred.opensource@gmail.com>
+F: package/spdm-utils/
+
N: Will Newton <will.newton@gmail.com>
F: package/enchant/
F: package/erlang/
@@ -2740,6 +2740,7 @@ comment "Utilities"
source "package/screen/Config.in"
source "package/screenfetch/Config.in"
source "package/sexpect/Config.in"
+ source "package/spdm-utils/Config.in"
source "package/sudo/Config.in"
source "package/terminology/Config.in"
source "package/time/Config.in"
new file mode 100644
@@ -0,0 +1,24 @@
+config BR2_PACKAGE_SPDM_UTILS
+ bool "spdm-utils"
+ depends on BR2_HOST_GCC_AT_LEAST_7 # host-clang, host-ruby
+ depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
+ depends on BR2_PACKAGE_HAS_UDEV
+ select BR2_PACKAGE_HOST_RUSTC
+ select BR2_PACKAGE_PCIUTILS
+ select BR2_PACKAGE_LIBSPDM
+ help
+ SPDM-Utils is a Linux application designed to support,
+ test and develop SPDM requesters and responders.
+ SPDM-Utils uses libspdm as the backend to perform SPDM
+ communication. SPDM-Utils currently supports the
+ PCIe Data Object Exchange (DOE) Capability.
+
+ https://github.com/westerndigitalcorporation/spdm-utils
+
+comment "spdm-utils needs udev /dev management"
+ depends on BR2_PACKAGE_LIBSPDM_ARCH_SUPPORTS
+ depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
+ depends on !BR2_PACKAGE_HAS_UDEV
+
+comment "spdm-utils requires host gcc >= 7"
+ depends on !BR2_HOST_GCC_AT_LEAST_7
new file mode 100644
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256 2816ff5ed5f27d565708441259ba295b32ae1ed3fe1366730e76f7bedde5e783 spdm-utils-0.6.0-cargo2.tar.gz
new file mode 100644
@@ -0,0 +1,61 @@
+################################################################################
+#
+# spdm-utils
+#
+################################################################################
+
+SPDM_UTILS_VERSION = 0.6.0
+SPDM_UTILS_SITE = $(call github,westerndigitalcorporation,spdm-utils,v$(SPDM_UTILS_VERSION))
+SPDM_UTILS_LICENSE = Apache-2.0 or MIT
+SPDM_UTILS_DEPENDENCIES = udev host-clang host-ruby pciutils libspdm
+SPDM_UTILS_CBOR_DIAG_VERSION = 0.8.7
+
+SPDM_UTILS_ALIAS_CERTS = \
+ openssl.cnf \
+ slot0/immutable.der \
+ slot0/device.cert.der \
+ slot0/device.der \
+ slot0/device.key \
+ slot0/bundle_responder.certchain.der
+
+# Used to generate SPDM Alias certificate model certificates,
+# required by `setup_certs.sh`
+SPDM_UTILS_GENERIC_CERTS = \
+ slot0/param.pem \
+ slot0/end_requester.req \
+ slot0/end_requester.key \
+ slot0/end_responder.key \
+ slot0/end_responder.req
+
+# SPDM-Utils expects the following certificates to be present for SPDM
+# functionality, make sure they are all copied.
+#
+# `setup_certs.sh` shall be used by a responder to regenerate it's mutable
+# certificate chain, typically on start up.
+define SPDM_UTILS_INSTALL_CERTS
+ $(INSTALL) -D -m 0755 $(@D)/certs/setup_certs.sh $(TARGET_DIR)/usr/share/spdm/certs/setup_certs.sh
+ $(INSTALL) -D -m 0644 $(@D)/certs/openssl.cnf $(TARGET_DIR)/usr/share/spdm/certs/openssl.cnf
+
+ $(foreach f,$(SPDM_UTILS_ALIAS_CERTS),
+ $(INSTALL) -D -m 0644 $(@D)/certs/alias/$(f) $(TARGET_DIR)/usr/share/spdm/certs/alias/$(f)
+ )
+
+ $(foreach f,$(SPDM_UTILS_GENERIC_CERTS),
+ $(INSTALL) -D -m 0644 $(@D)/certs/$(f) $(TARGET_DIR)/usr/share/spdm/certs/$(f)
+ )
+ $(INSTALL) -D -m 0644 $(@D)/manifest/manifest.out.cbor $(TARGET_DIR)/usr/share/spdm/manifest/manifest.out.cbor
+endef
+
+# SPDM-Utils uses the `cbor-diag` ruby gem to encode/decode SPDM measurement
+# manifests. It is checked at compile time by SPDM-Utils, as such it must
+# be available in the host environment.
+# `--bindir` allows the respective binaries to be placed at the specified path.
+define SPDM_UTILS_INSTALL_CBOR_DIAG
+ # check-package DoNotInstallToHostdirUsr
+ $(HOST_DIR)/bin/gem install -v $(SPDM_UTILS_CBOR_DIAG_VERSION) --bindir $(HOST_DIR)/usr/bin cbor-diag
+endef
+
+SPDM_UTILS_POST_INSTALL_TARGET_HOOKS += SPDM_UTILS_INSTALL_CERTS
+SPDM_UTILS_PRE_BUILD_HOOKS += SPDM_UTILS_INSTALL_CBOR_DIAG
+
+$(eval $(cargo-package))