Skip to content

feat: add sbom Makefile target#85

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

feat: add sbom Makefile target#85
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 wolfsentry.

  • Extracts version from WOLFSENTRY_VERSION_MAJOR/MINOR/TINY macros in wolfsentry/wolfsentry.h
  • Enumerates sources from src/*.c (sorted)
  • Hashes each source file
  • Calls gen-sbom (located via GEN_SBOM or WOLFSSL_DIR/scripts/gen-sbom)
  • wolfsentry is standalone (no wolfssl dependency), so WOLFSSL_DIR is only needed to locate gen-sbom

Usage

```sh

With WOLFSSL_DIR (points gen-sbom location):

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

Or with explicit gen-sbom path:

make sbom GEN_SBOM=/path/to/wolfssl/scripts/gen-sbom
```

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

Requirements

  • gen-sbom from a wolfssl tree containing scripts/gen-sbom (available on the feat/sbom-embedded branch of wolfssl)
  • python3 on the build host

Test plan

  • make sbom WOLFSSL_DIR=...
  • Verify CDX and SPDX output files are produced

Adds sbom target that calls gen-sbom to produce
CycloneDX and SPDX output files.
Extracts version from WOLFSENTRY_VERSION_MAJOR/MINOR/TINY
macros in wolfsentry/wolfsentry.h.
Sources enumerated from src/*.c.
Requires WOLFSSL_DIR or GEN_SBOM pointing to gen-sbom.
@MarkAtwood MarkAtwood requested review from Copilot and sameehj June 23, 2026 01:39

Copilot AI left a comment

Copy link
Copy Markdown

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 wolfsentry.

Changes:

  • Extracts wolfsentry version from wolfsentry/wolfsentry.h and uses it to name SBOM outputs.
  • Locates and invokes gen-sbom, generating both CycloneDX and SPDX JSON outputs.
  • Captures compiler preprocessor defines into a temp header for gen-sbom input.

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

Comment thread Makefile
Comment on lines +559 to +563
sbom:
$(Q)if [ -z "$(SBOM_VERSION)" ] || [ "$(SBOM_VERSION)" = ".." ]; then \
echo "ERROR: could not extract version from wolfsentry/wolfsentry.h" 1>&2; \
exit 1; \
fi
Comment thread Makefile
Comment on lines +586 to +589
_srcs=""; \
for _f in $(SRCS); do _srcs="$$_srcs $(SRC_TOP)/src/$$_f"; done; \
python3 "$$_gen_sbom" \
--name wolfsentry \
Comment thread Makefile
Comment on lines +582 to +585
if ! $(CC) -dM -E -I'$(SRC_TOP)' -x c /dev/null >"$$_defines_h" 2>/dev/null; then \
echo "ERROR: $(CC) -dM -E failed" 1>&2; \
exit 1; \
fi; \
Comment thread Makefile
Comment on lines +595 to +596
--cdx-out "$(BUILD_TOP)/$(SBOM_CDX)" \
--spdx-out "$(BUILD_TOP)/$(SBOM_SPDX)"
Comment thread Makefile
Comment on lines +553 to +555
SBOM_CDX = wolfsentry-$(SBOM_VERSION).cdx.json
SBOM_SPDX = wolfsentry-$(SBOM_VERSION).spdx.json
SBOM_SPDX_TV = wolfsentry-$(SBOM_VERSION).spdx
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