Skip to content

feat: add sbom Makefile target#805

Open
MarkAtwood wants to merge 1 commit into
wolfSSL:masterfrom
MarkAtwood:feat/add-sbom-make-target
Open

feat: add sbom Makefile target#805
MarkAtwood wants to merge 1 commit into
wolfSSL:masterfrom
MarkAtwood:feat/add-sbom-make-target

Conversation

@MarkAtwood

Copy link
Copy Markdown

Summary

Adds a make sbom target that produces CycloneDX and SPDX SBOM files for wolfBoot.

wolfBoot is unique in that its SBOM must be TARGET- and SIGN-specific: different build configurations compile different sets of wolfcrypt source files directly into the bootloader image.

  • Enumerates sources from $(OBJS) via $(wildcard $(patsubst %.o,%.c,...)) — no build required
  • wolfcrypt sources are listed as wolfBoot's own (they are compiled in, not a separate library)
  • Extracts version from include/wolfboot/version.h
  • TARGET and SIGN must be set (same as for a normal build)

Usage

```sh
make sbom TARGET=stm32h7 SIGN=ECC256 GEN_SBOM=/path/to/gen-sbom
```

Or if wolfssl is present as the lib/wolfssl submodule:
```sh
make sbom TARGET=stm32h7 SIGN=ECC256
```

Outputs: wolfboot-<version>.cdx.json, wolfboot-<version>.spdx.json

Requirements

  • GEN_SBOM must point to scripts/gen-sbom from a wolfssl tree with the feat/sbom-embedded branch, OR lib/wolfssl submodule must be checked out
  • python3 on the build host
  • TARGET and SIGN must match a real build configuration

Test plan

  • make sbom TARGET=stm32h7 SIGN=ECC256 GEN_SBOM=...
  • Verify CDX and SPDX output files are produced with correct version and source count
  • Try a different TARGET to confirm different source sets

Adds sbom target that produces CycloneDX and SPDX
SBOM files for a specific TARGET+SIGN combination.
Sources extracted from OBJS variable via wildcard.
wolfcrypt sources compiled into wolfBoot are listed
as wolfBoot's own sources (not a separate component).
Requires GEN_SBOM or WOLFBOOT_LIB_WOLFSSL set.
@MarkAtwood MarkAtwood requested review from Copilot and sameehj June 23, 2026 01:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.

Adds a make sbom target to generate CycloneDX and SPDX SBOMs for wolfBoot based on the selected build configuration.

Changes:

  • Introduces Makefile variables and an sbom target to derive sources from $(OBJS) and run scripts/gen-sbom
  • Extracts version from include/wolfboot/version.h to name output artifacts
  • Adds a host-side preprocessor pass (cc -dM -E) to provide configuration defines to the SBOM generator

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Makefile
Comment on lines +791 to +795
# Usage: make sbom TARGET=<target> SIGN=<scheme> [HASH=SHA256] [EXT_FLASH=0]
#
# TARGET and SIGN select the build configuration; they default to stm32f4 and
# ED25519 (via tools/config.mk) if not supplied. Pass them explicitly to get
# an SBOM that reflects your actual build configuration.
Comment thread Makefile
Comment on lines +808 to +817
WOLFBOOT_VERSION:=$(shell sed -n \
's/.*LIBWOLFBOOT_VERSION_STRING[[:space:]]*"\([^"]*\)".*/\1/p' \
include/wolfboot/version.h)
GEN_SBOM:=$(WOLFBOOT_LIB_WOLFSSL)/scripts/gen-sbom
SBOM_CDX_OUT:=wolfboot-$(WOLFBOOT_VERSION).cdx.json
SBOM_SPDX_OUT:=wolfboot-$(WOLFBOOT_VERSION).spdx.json
SBOM_PYTHON?=$(or $(CRA_PYTHON),python3)

sbom:
@echo "wolfBoot SBOM: version=$(WOLFBOOT_VERSION) target=$(TARGET) sign=$(SIGN)"
Comment thread Makefile
WOLFBOOT_VERSION:=$(shell sed -n \
's/.*LIBWOLFBOOT_VERSION_STRING[[:space:]]*"\([^"]*\)".*/\1/p' \
include/wolfboot/version.h)
GEN_SBOM:=$(WOLFBOOT_LIB_WOLFSSL)/scripts/gen-sbom
Comment thread Makefile
-DWOLFSSL_USER_SETTINGS \
-x c /dev/null >"$$_dh" 2>/dev/null || \
{ echo "ERROR: cc -dM -E failed; install a host C compiler." >&2; exit 1; }; \
$(SBOM_PYTHON) "$(GEN_SBOM)" \
Comment thread Makefile
--supplier "wolfSSL Inc." \
--license-file "$(WOLFBOOT_ROOT)/LICENSE" \
--options-h "$$_dh" \
--srcs $(_SBOM_SRCS) \
Comment thread Makefile
@set -e; \
_dh=$$(mktemp /tmp/wolfboot-sbom-defines.XXXXXX); \
trap 'rm -f "$$_dh"' EXIT; \
cc -dM -E \
Comment thread Makefile
-I"$(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src" \
-DWOLFSSL_USER_SETTINGS \
-x c /dev/null >"$$_dh" 2>/dev/null || \
{ echo "ERROR: cc -dM -E failed; install a host C compiler." >&2; exit 1; }; \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants