Skip to content

feat: add sbom Makefile target#414

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

feat: add sbom Makefile target#414
MarkAtwood wants to merge 1 commit into
wolfSSL:mainfrom
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 wolfHSM.

  • Parses version from ChangeLog.md (e.g., # wolfHSM Release v1.4.0)
  • Enumerates sources from src/*.c (sorted)
  • Hashes each source file (SHA-256 combined fingerprint)
  • Calls gen-sbom to produce CDX + SPDX outputs
  • No build system changes — pure Makefile target

Usage

```sh
make sbom WOLFSSL_DIR=/path/to/wolfssl/source
```

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

Requirements

  • WOLFSSL_DIR must point to a wolfssl source tree containing scripts/gen-sbom (available on the feat/sbom-embedded branch of wolfssl)
  • python3 and pip install spdx-tools on the build host

Test plan

  • make sbom WOLFSSL_DIR=...
  • Verify CDX and SPDX output files are produced with correct version and source count

Adds sbom target that calls gen-sbom to produce
CycloneDX and SPDX output files.
Parses version from ChangeLog.md.
Sources enumerated from src/*.c.
Requires WOLFSSL_DIR pointing to wolfssl tree with
the feat/sbom-embedded branch (includes gen-sbom).
@MarkAtwood MarkAtwood requested review from Copilot and sameehj June 23, 2026 01:39

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 SBOM artifacts for wolfHSM using wolfSSL’s scripts/gen-sbom.

Changes:

  • Introduces an sbom Makefile target with checks for version parsing and WOLFSSL_DIR.
  • Gathers sources from src/*.c and passes compiler defines + metadata into gen-sbom.
  • Emits versioned wolfhsm-<version>.cdx.json and wolfhsm-<version>.spdx.json outputs.

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

Comment thread Makefile
# ---- SBOM generation ----
CC ?= cc
WOLFSSL_DIR ?= ../../wolfssl
VERSION := $(shell sed -n 's/^# wolfHSM Release v\([0-9][0-9.]*\).*/\1/p' ChangeLog.md | head -1)
Comment thread Makefile
CC ?= cc
WOLFSSL_DIR ?= ../../wolfssl
VERSION := $(shell sed -n 's/^# wolfHSM Release v\([0-9][0-9.]*\).*/\1/p' ChangeLog.md | head -1)
SRCS := $(wildcard src/*.c)
Comment thread Makefile
--supplier "wolfSSL Inc." \
--license-file LICENSING \
--options-h "$$_defines" \
--srcs $(SRCS) \
Comment thread Makefile
Comment on lines +92 to +94
_py=$$(command -v python3 2>/dev/null || command -v python 2>/dev/null) && \
[ -n "$$_py" ] || { echo "ERROR: python3 not found." >&2; exit 1; } && \
"$$_py" $(WOLFSSL_DIR)/scripts/gen-sbom \
Comment thread Makefile
Comment on lines +87 to +88
@_defines=$$(mktemp /tmp/wolfhsm-defines.XXXXXX) && \
trap 'rm -f "$$_defines"' EXIT && \
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