Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 27
feat: add sbom Makefile target#85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MarkAtwood
wants to merge
6
commits into
wolfSSL:masterChoose a base branch
from
MarkAtwood:feat/add-sbom-make-target
base:master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Uh oh!
There was an error while loading. Please reload this page.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2df14cf
feat: add sbom target to Makefile
MarkAtwood e0e1e8d
docs: add SBOM/EU CRA Compliance section to README and build docs
MarkAtwood 352caaa
fix: single-line SBOM_VERSION shell for make 3.81
MarkAtwood cfcc5da
fix: escape # in awk so make 3.81 parses shell
MarkAtwood 409ed3f
fix: address SBOM review feedback
MarkAtwood d23ddd4
fix: sbom install targets, real options file
MarkAtwood File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -547,6 +547,76 @@ doc: doc-html $(BUILD_TOP)/doc/pdf/refman.pdf | ||
| doc-clean: doc-html-clean doc-pdf-clean | ||
| # SBOM generation (CRA compliance) | ||
| SBOM_VERSION := $(shell $(AWK) '/^\#define WOLFSENTRY_VERSION_MAJOR/{maj=$$3} /^\#define WOLFSENTRY_VERSION_MINOR/{min=$$3} /^\#define WOLFSENTRY_VERSION_TINY/{tiny=$$3} END{print maj"."min"."tiny}' '$(SRC_TOP)/wolfsentry/wolfsentry.h' 2>/dev/null) | ||
| SBOM_CDX = wolfsentry-$(SBOM_VERSION).cdx.json | ||
| SBOM_SPDX = wolfsentry-$(SBOM_VERSION).spdx.json | ||
| .PHONY: sbom | ||
| # The effective build configuration comes from $(OPTIONS_FILE): either the | ||
| # generated $(BUILD_TOP)/wolfsentry/wolfsentry_options.h (distilled from the | ||
| # real CFLAGS by build_wolfsentry_options_h.awk) or, under USER_SETTINGS_FILE, | ||
| # the user's own settings header, which gen-sbom parses with --user-settings | ||
| # since it is not a flat define dump. | ||
| ifdef USER_SETTINGS_FILE | ||
| SBOM_OPTIONS_ARG = --user-settings "$(OPTIONS_FILE)" | ||
| else | ||
| SBOM_OPTIONS_ARG = --options-h "$(OPTIONS_FILE)" | ||
| endif | ||
| sbom: $(OPTIONS_FILE) | ||
| $(Q)if ! printf '%s' "$(SBOM_VERSION)" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$$'; then \ | ||
| echo "ERROR: could not extract a valid version (got '$(SBOM_VERSION)') from wolfsentry/wolfsentry.h" 1>&2; \ | ||
| exit 1; \ | ||
| fi | ||
| $(Q)if [ -n "$(GEN_SBOM)" ]; then \ | ||
| _gen_sbom="$(GEN_SBOM)"; \ | ||
| elif [ -n "$(WOLFSSL_DIR)" ]; then \ | ||
| _gen_sbom="$(WOLFSSL_DIR)/scripts/gen-sbom"; \ | ||
| else \ | ||
| echo "ERROR: set WOLFSSL_DIR (path to wolfssl repo) or GEN_SBOM (path to gen-sbom script)" 1>&2; \ | ||
| exit 1; \ | ||
| fi; \ | ||
| if [ ! -f "$$_gen_sbom" ]; then \ | ||
| echo "ERROR: gen-sbom not found: $$_gen_sbom" 1>&2; \ | ||
| exit 1; \ | ||
| fi; \ | ||
| if ! command -v python3 >/dev/null 2>&1; then \ | ||
| echo "ERROR: python3 not found in PATH" 1>&2; \ | ||
| exit 1; \ | ||
| fi; \ | ||
| _srcs=""; \ | ||
| for _f in $(SRCS); do _srcs="$$_srcs $(SRC_TOP)/src/$$_f"; done; \ | ||
| mkdir -p "$(BUILD_TOP)"; \ | ||
| python3 "$$_gen_sbom" \ | ||
| --name wolfsentry \ | ||
| --version "$(SBOM_VERSION)" \ | ||
| --supplier "wolfSSL Inc." \ | ||
| --license-file "$(SRC_TOP)/LICENSING" \ | ||
| $(SBOM_OPTIONS_ARG) \ | ||
| --srcs $$_srcs \ | ||
| --cdx-out "$(BUILD_TOP)/$(SBOM_CDX)" \ | ||
| --spdx-out "$(BUILD_TOP)/$(SBOM_SPDX)" | ||
MarkAtwood marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| ifndef VERY_QUIET | ||
| $(Q)echo "SBOM written: $(BUILD_TOP)/$(SBOM_CDX)" | ||
| $(Q)echo " $(BUILD_TOP)/$(SBOM_SPDX)" | ||
| endif | ||
| ifndef INSTALL_DOCDIR | ||
| INSTALL_DOCDIR := $(INSTALL_DIR)/share/doc/wolfsentry | ||
| endif | ||
| .PHONY: install-sbom | ||
| install-sbom: sbom | ||
| $(Q)mkdir -p $(INSTALL_DOCDIR) | ||
| install -p -m 0644 $(BUILD_TOP)/$(SBOM_CDX) $(BUILD_TOP)/$(SBOM_SPDX) $(INSTALL_DOCDIR) | ||
| .PHONY: uninstall-sbom | ||
| uninstall-sbom: | ||
| $(RM) $(INSTALL_DOCDIR)/$(SBOM_CDX) $(INSTALL_DOCDIR)/$(SBOM_SPDX) | ||
| @rmdir $(INSTALL_DOCDIR) 2>/dev/null || exit 0 | ||
| .PHONY: clean | ||
| clean: | ||
| $(Q)rm $(CLEAN_RM_ARGS) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -219,3 +219,25 @@ build with wolfSentry integration, and use `--with-wolfsentry=/the/install/path` | ||
| if wolfSentry is installed in a nonstandard location. The wolfSSL test | ||
| client/server can be loaded with user-supplied wolfSentry JSON configurations | ||
| from the command line, using `--wolfsentry-config <file>`. | ||
| ## SBOM / EU CRA Compliance | ||
| wolfSentry generates a Software Bill of Materials (SBOM) in CycloneDX 1.6 and | ||
| SPDX 2.3 formats to support compliance with the EU Cyber Resilience Act (CRA). | ||
| ```sh | ||
| make sbom WOLFSSL_DIR=/path/to/wolfssl | ||
| ``` | ||
| Requires `python3` and `pyspdxtools` (`pip install spdx-tools`). `WOLFSSL_DIR` | ||
| must point to a wolfssl source tree containing `scripts/gen-sbom` (branch | ||
| `feat/sbom-embedded`, or `master` once wolfSSL/wolfssl#10343 merges). | ||
| Output: `wolfsentry-<version>.cdx.json`, `wolfsentry-<version>.spdx.json`, `wolfsentry-<version>.spdx` | ||
| ```sh | ||
MarkAtwood marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| make install-sbom # installs to $(INSTALL_DOCDIR), default /usr/local/share/doc/wolfsentry/ | ||
| make uninstall-sbom | ||
| ``` | ||
| For further CRA guidance see [wolfssl/doc/CRA.md](https://github.com/wolfSSL/wolfssl/blob/master/doc/CRA.md). | ||
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.