Skip to content

Commit 30619d2

Browse files
committed
feat: SBOM generation and OmniBOR build provenance (CRA compliance)
Adds two complementary supply chain transparency targets to the wolfSSL autotools build, and documentation covering both as a unified whole. ## make sbom Generates a Software Bill of Materials for EU Cyber Resilience Act (CRA) compliance. Produces three files in the build directory: wolfssl-<version>.cdx.json CycloneDX 1.6 JSON wolfssl-<version>.spdx.json SPDX 2.3 JSON wolfssl-<version>.spdx SPDX 2.3 tag-value (validated) The SPDX JSON is validated by pyspdxtools before the tag-value file is written; make sbom fails if validation fails. SBOM contents: package name/version, supplier, license (parsed from LICENSING at generation time, not hardcoded), copyright, SHA-256 of the installed library, CPE, PURL, download location, and build configuration defines as a comment. Third-party dependencies (liboqs, libz, libxmss, liblms) are included when enabled. Implementation: scripts/gen-sbom (Python 3, stdlib only) stages a make install into a temporary directory, hashes the installed library, generates both SBOM formats, then removes the staging directory. configure.ac detects python3, pyspdxtools, and git via AC_PATH_PROG. install-sbom / uninstall-sbom targets install the three files to $(datadir)/doc/wolfssl/. make clean removes all generated files. ## make bomsh Generates an OmniBOR artifact dependency graph using the Bomsh project (https://github.com/omnibor/bomsh), providing cryptographic traceability from every built binary back to the exact set of source files that produced it. Runs a full clean rebuild under bomtrace3 (a patched strace, userspace only — no kernel modifications required). bomtrace3 intercepts every compiler execve() syscall and records inputs and outputs; it cannot post-process an already-built tree, hence the clean rebuild. bomsh_create_bom.py processes the raw logfile to produce the OmniBOR artifact objects and metadata in omnibor/. If bomsh_sbom.py is available and wolfssl-<version>.spdx.json exists (from make sbom), annotates that SPDX document with a PERSISTENT-ID gitoid ExternalRef, producing omnibor.wolfssl-<version>.spdx.json. This enriched SPDX bridges component identity and build provenance in a single document. configure.ac detects bomtrace3, bomsh_create_bom.py, and bomsh_sbom.py via AC_PATH_PROG. The raw logfile and conf file are written to the build directory (not /tmp/) to avoid concurrent-build collisions, and removed by make clean. install-bomsh / uninstall-bomsh targets install omnibor/ and the enriched SPDX to $(datadir)/doc/wolfssl/. ## Documentation doc/SBOM.md: unified reference covering both make sbom and make bomsh as parts of a single supply chain transparency story — component identity (what) and build provenance (how) — with a combined workflow section and full output file reference. doc/CRA.md: product-integrator guide covering how to incorporate wolfSSL's SBOM artefacts into a downstream product SBOM (SPDX ExternalDocumentRef and CycloneDX component reference patterns), commercial license concluded-field guidance, OmniBOR gitoid meaning, auditor handoff checklist, and links to OpenSSF CRA and SBOM Everywhere SIG guidance pages. INSTALL: sections 21 (make sbom) and 22 (make bomsh). README.md: brief SBOM/CRA and OmniBOR/Bomsh sections. doc/include.am: SBOM.md and CRA.md added to dist_doc_DATA.
1 parent c098e53 commit 30619d2

8 files changed

Lines changed: 1123 additions & 1 deletion

File tree

INSTALL

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,3 +322,76 @@ We also have vcpkg ports for wolftpm, wolfmqtt and curl.
322322

323323
Deprecated. wolfSSL now has its own XMMS/XMSS^MT implementation in
324324
wolfCrypt.
325+
326+
21. Generating an SBOM (Software Bill of Materials)
327+
328+
wolfSSL can generate a Software Bill of Materials for EU Cyber Resilience
329+
Act (CRA) compliance after a normal build and install.
330+
331+
Prerequisites:
332+
- python3 (detected automatically by configure)
333+
- pyspdxtools (pip install spdx-tools)
334+
335+
Usage:
336+
337+
$ ./configure
338+
$ make
339+
$ make sbom
340+
341+
This produces three files in the build directory:
342+
343+
wolfssl-<version>.cdx.json CycloneDX 1.6 JSON
344+
wolfssl-<version>.spdx.json SPDX 2.3 JSON
345+
wolfssl-<version>.spdx SPDX 2.3 tag-value (validated by pyspdxtools)
346+
347+
The SPDX JSON is validated by pyspdxtools before the tag-value file is
348+
written; make sbom fails if validation fails.
349+
350+
To install the SBOM files to $(datadir)/doc/wolfssl/:
351+
352+
$ make install-sbom
353+
354+
To remove installed SBOM files:
355+
356+
$ make uninstall-sbom
357+
358+
The generated files are removed by make clean.
359+
360+
For details on the SBOM contents and CRA context, see doc/SBOM.md.
361+
362+
22. Generating OmniBOR build artifact graph (Bomsh)
363+
364+
wolfSSL supports generating an OmniBOR artifact dependency graph using
365+
the Bomsh project (https://github.com/omnibor/bomsh). OmniBOR provides
366+
cryptographic traceability from every binary artifact back to the exact
367+
source files that produced it.
368+
369+
Prerequisites:
370+
- bomtrace3 (build from https://github.com/omnibor/bomsh)
371+
- bomsh_create_bom.py (from the bomsh scripts/ directory, in PATH)
372+
- bomsh_sbom.py (optional; from bomsh scripts/, for SPDX enrichment)
373+
374+
Both bomtrace3 and the Python scripts are detected by configure.
375+
make bomsh fails with a clear error message if either required tool
376+
is missing.
377+
378+
Usage:
379+
380+
$ ./configure
381+
$ make
382+
$ make bomsh
383+
384+
This performs a clean rebuild of wolfSSL under bomtrace3 tracing,
385+
then produces an OmniBOR artifact graph in omnibor/ in the build
386+
directory. If bomsh_sbom.py is available and a wolfssl-<ver>.spdx.json
387+
exists (from 'make sbom'), it also produces an OmniBOR-enriched SPDX
388+
document omnibor.wolfssl-<ver>.spdx.json.
389+
390+
To install:
391+
392+
$ make install-bomsh # installs omnibor/ to $(datadir)/doc/wolfssl/
393+
$ make uninstall-bomsh # removes installed files
394+
395+
The generated files are removed by make clean.
396+
397+
See doc/SBOM.md for full details.

Makefile.am

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,3 +350,113 @@ merge-clean:
350350

351351
.cu.lo:
352352
$(LIBTOOL) --tag=CC --mode=compile $(COMPILE) --compile -o $@ $< -static
353+
354+
# SBOM generation (CRA compliance)
355+
SBOM_CDX = wolfssl-$(PACKAGE_VERSION).cdx.json
356+
SBOM_SPDX = wolfssl-$(PACKAGE_VERSION).spdx.json
357+
SBOM_SPDX_TV = wolfssl-$(PACKAGE_VERSION).spdx
358+
sbomdir = $(datadir)/doc/$(PACKAGE)
359+
360+
.PHONY: sbom install-sbom uninstall-sbom
361+
362+
sbom:
363+
@if test -z "$(PYTHON3)"; then \
364+
echo ""; \
365+
echo "ERROR: 'python3' not found in PATH. Cannot generate SBOM."; \
366+
echo ""; \
367+
exit 1; \
368+
fi
369+
@if test -z "$(PYSPDXTOOLS)"; then \
370+
echo ""; \
371+
echo "ERROR: 'pyspdxtools' not found in PATH. Cannot validate SBOM."; \
372+
echo " Install: pip install spdx-tools"; \
373+
echo ""; \
374+
exit 1; \
375+
fi
376+
rm -rf $(abs_builddir)/_sbom_staging
377+
$(MAKE) install DESTDIR=$(abs_builddir)/_sbom_staging
378+
$(PYTHON3) $(srcdir)/scripts/gen-sbom \
379+
--name $(PACKAGE) \
380+
--version $(PACKAGE_VERSION) \
381+
--license-file $(srcdir)/LICENSING \
382+
--options-h $(abs_builddir)/wolfssl/options.h \
383+
--lib $(abs_builddir)/_sbom_staging$(libdir)/libwolfssl.so.$(WOLFSSL_LIBRARY_VERSION_FIRST).$(WOLFSSL_LIBRARY_VERSION_SECOND).$(WOLFSSL_LIBRARY_VERSION_THIRD) \
384+
--dep-liboqs $(ENABLED_LIBOQS) \
385+
--dep-libxmss $(ENABLED_LIBXMSS) \
386+
--dep-libxmss-root '$(XMSS_ROOT)' \
387+
--dep-liblms $(ENABLED_LIBLMS) \
388+
--dep-liblms-root '$(LIBLMS_ROOT)' \
389+
--dep-libz $(ENABLED_LIBZ) \
390+
--git '$(GIT)' \
391+
--cdx-out $(abs_builddir)/$(SBOM_CDX) \
392+
--spdx-out $(abs_builddir)/$(SBOM_SPDX)
393+
rm -rf $(abs_builddir)/_sbom_staging
394+
$(PYSPDXTOOLS) --infile $(abs_builddir)/$(SBOM_SPDX) \
395+
--outfile $(abs_builddir)/$(SBOM_SPDX_TV)
396+
397+
install-sbom: sbom
398+
$(MKDIR_P) $(DESTDIR)$(sbomdir)
399+
$(INSTALL_DATA) $(SBOM_CDX) $(DESTDIR)$(sbomdir)/
400+
$(INSTALL_DATA) $(SBOM_SPDX) $(DESTDIR)$(sbomdir)/
401+
$(INSTALL_DATA) $(SBOM_SPDX_TV) $(DESTDIR)$(sbomdir)/
402+
403+
uninstall-sbom:
404+
-rm -f $(DESTDIR)$(sbomdir)/$(SBOM_CDX)
405+
-rm -f $(DESTDIR)$(sbomdir)/$(SBOM_SPDX)
406+
-rm -f $(DESTDIR)$(sbomdir)/$(SBOM_SPDX_TV)
407+
408+
CLEANFILES += $(SBOM_CDX) $(SBOM_SPDX) $(SBOM_SPDX_TV)
409+
410+
# Bomsh (OmniBOR build artifact tracing + SBOM enrichment)
411+
BOMSH_RAWLOG_BASE = $(abs_builddir)/bomsh_raw_logfile
412+
BOMSH_RAWLOG = $(BOMSH_RAWLOG_BASE).sha1
413+
BOMSH_CONF = $(abs_builddir)/_bomsh.conf
414+
BOMSH_OMNIBORDIR = $(abs_builddir)/omnibor
415+
BOMSH_SPDX_OUT = omnibor.wolfssl-$(PACKAGE_VERSION).spdx.json
416+
bomshdir = $(datadir)/doc/$(PACKAGE)
417+
418+
.PHONY: bomsh install-bomsh uninstall-bomsh
419+
420+
bomsh:
421+
@if test -z "$(BOMTRACE3)"; then \
422+
echo ""; \
423+
echo "ERROR: 'bomtrace3' not found in PATH. Cannot generate OmniBOR data."; \
424+
echo " Build bomtrace3 from: https://github.com/omnibor/bomsh"; \
425+
echo ""; \
426+
exit 1; \
427+
fi
428+
@if test -z "$(BOMSH_CREATE_BOM)"; then \
429+
echo ""; \
430+
echo "ERROR: 'bomsh_create_bom.py' not found in PATH. Cannot process OmniBOR data."; \
431+
echo " Install from: https://github.com/omnibor/bomsh"; \
432+
echo ""; \
433+
exit 1; \
434+
fi
435+
$(MAKE) clean
436+
@printf 'raw_logfile=%s\n' '$(BOMSH_RAWLOG_BASE)' > '$(BOMSH_CONF)'
437+
$(BOMTRACE3) -c '$(BOMSH_CONF)' $(MAKE)
438+
$(BOMSH_CREATE_BOM) -r '$(BOMSH_RAWLOG)' -b '$(BOMSH_OMNIBORDIR)'
439+
@if test -n "$(BOMSH_SBOM)" && test -f '$(abs_builddir)/wolfssl-$(PACKAGE_VERSION).spdx.json'; then \
440+
echo "Enriching SPDX with OmniBOR ExternalRefs..."; \
441+
$(BOMSH_SBOM) \
442+
-b '$(BOMSH_OMNIBORDIR)' \
443+
-i '$(abs_builddir)/wolfssl-$(PACKAGE_VERSION).spdx.json' \
444+
-f '$(abs_builddir)/src/.libs/libwolfssl.so.$(WOLFSSL_LIBRARY_VERSION_FIRST).$(WOLFSSL_LIBRARY_VERSION_SECOND).$(WOLFSSL_LIBRARY_VERSION_THIRD)' \
445+
-s spdx-json \
446+
-O '$(abs_builddir)'; \
447+
elif test -n "$(BOMSH_SBOM)"; then \
448+
echo "NOTE: run 'make sbom' first, then 'make bomsh' for OmniBOR-enriched SPDX."; \
449+
fi
450+
451+
install-bomsh: bomsh
452+
$(MKDIR_P) $(DESTDIR)$(bomshdir)
453+
cp -r '$(BOMSH_OMNIBORDIR)' '$(DESTDIR)$(bomshdir)/omnibor'
454+
@if test -f '$(abs_builddir)/$(BOMSH_SPDX_OUT)'; then \
455+
$(INSTALL_DATA) '$(abs_builddir)/$(BOMSH_SPDX_OUT)' '$(DESTDIR)$(bomshdir)/'; \
456+
fi
457+
458+
uninstall-bomsh:
459+
-rm -rf '$(DESTDIR)$(bomshdir)/omnibor'
460+
-rm -f '$(DESTDIR)$(bomshdir)/$(BOMSH_SPDX_OUT)'
461+
462+
CLEANFILES += $(BOMSH_RAWLOG) $(BOMSH_RAWLOG_BASE).sha256 $(BOMSH_CONF) $(BOMSH_SPDX_OUT)

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@ applications which have previously used the OpenSSL package. For a complete
3030
feature list, see [Chapter 4](https://www.wolfssl.com/docs/wolfssl-manual/ch4/)
3131
of the wolfSSL manual.
3232

33+
## SBOM / CRA Compliance
34+
35+
wolfSSL provides a Software Bill of Materials (SBOM) for EU Cyber Resilience
36+
Act (CRA) compliance via `make sbom`. See `doc/SBOM.md` for details.
37+
38+
## OmniBOR / Bomsh
39+
40+
wolfSSL supports generating an OmniBOR artifact dependency graph via
41+
`make bomsh`, providing cryptographic traceability from the installed
42+
library back to every source file that produced it. See `doc/SBOM.md`
43+
for details.
44+
3345
## Notes, Please Read
3446

3547
### Note 1

configure.ac

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1989,6 +1989,7 @@ done
19891989
# liblms
19901990
# Get the path to the hash-sigs LMS HSS lib.
19911991
ENABLED_LIBLMS="no"
1992+
LIBLMS_ROOT=""
19921993
tryliblmsdir=""
19931994
AC_ARG_WITH([liblms],
19941995
[AS_HELP_STRING([--with-liblms=PATH],[PATH to hash-sigs LMS/HSS install (default /usr/local) (requires --enable-experimental)!])],
@@ -2051,6 +2052,7 @@ AC_ARG_WITH([liblms],
20512052
20522053
AM_CFLAGS="$AM_CFLAGS -DHAVE_LIBLMS"
20532054
ENABLED_LIBLMS="yes"
2055+
LIBLMS_ROOT=$tryliblmsdir
20542056
]
20552057
)
20562058

@@ -11756,6 +11758,21 @@ AC_SUBST([WOLFSSL_PREFIX_ABS])
1175611758
AC_SUBST([WOLFSSL_LIBDIR_ABS])
1175711759
AC_SUBST([WOLFSSL_INCLUDEDIR_ABS])
1175811760
11761+
# SBOM generation
11762+
AC_PATH_PROG([PYTHON3], [python3])
11763+
AC_PATH_PROG([PYSPDXTOOLS], [pyspdxtools])
11764+
AC_PATH_PROG([GIT], [git])
11765+
AC_SUBST([ENABLED_LIBOQS])
11766+
AC_SUBST([ENABLED_LIBXMSS])
11767+
AC_SUBST([ENABLED_LIBLMS])
11768+
AC_SUBST([ENABLED_LIBZ])
11769+
AC_SUBST([LIBLMS_ROOT])
11770+
11771+
# Bomsh (OmniBOR build artifact tracing + SBOM enrichment)
11772+
AC_PATH_PROG([BOMTRACE3], [bomtrace3])
11773+
AC_PATH_PROG([BOMSH_CREATE_BOM], [bomsh_create_bom.py])
11774+
AC_PATH_PROG([BOMSH_SBOM], [bomsh_sbom.py])
11775+
1175911776
# FINAL
1176011777
AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
1176111778
AC_CONFIG_FILES([Makefile

0 commit comments

Comments
 (0)