Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 20 additions & 19 deletions .github/workflows/sbom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,11 @@ jobs:
if-no-files-found: warn
retention-days: 90

# tools/sbom/ is a vendored copy of the wolfGlass share/ set, pinned by
# tools/sbom/.wolfglass-rev. wolfglass-sync --check fails when the copy
# differs from that revision.
wolfglass_drift:
# tools/sbom/ is a vendored copy of the wolfssl-compliance-tooling share/
# set, pinned by tools/sbom/.wolfssl-compliance-tooling-rev.
# wolfssl-compliance-tooling-sync --check fails when the copy differs from
# that revision.
compliance_tooling_drift:
runs-on: ubuntu-latest
container:
image: ghcr.io/wolfssl/wolftpm-ci:v1.1
Expand All @@ -161,36 +162,36 @@ jobs:
with:
submodules: true

- name: Read the pinned wolfGlass revision
- name: Read the pinned wolfssl-compliance-tooling revision
id: pin
run: |
rev="$(tr -d '[:space:]' < tools/sbom/.wolfglass-rev)"
rev="$(tr -d '[:space:]' < tools/sbom/.wolfssl-compliance-tooling-rev)"
if [ -z "$rev" ]; then
echo "ERROR: tools/sbom/.wolfglass-rev is empty." >&2
echo "ERROR: tools/sbom/.wolfssl-compliance-tooling-rev is empty." >&2
exit 1
fi
echo "rev=$rev" >> "$GITHUB_OUTPUT"
echo "Pinned wolfGlass revision: $rev"
echo "Pinned wolfssl-compliance-tooling revision: $rev"

- name: Check out wolfGlass at the pinned revision
- name: Check out wolfssl-compliance-tooling at the pinned revision
id: fetch
continue-on-error: true
uses: actions/checkout@v4
with:
repository: wolfSSL/wolfGlass
repository: wolfSSL/wolfssl-compliance-tooling
ref: ${{ steps.pin.outputs.rev }}
path: .wolfglass-src
path: .wolfssl-compliance-tooling-src

- name: Drift check against wolfGlass
- name: Drift check against wolfssl-compliance-tooling
env:
PINNED_REV: ${{ steps.pin.outputs.rev }}
run: |
if [ ! -d .wolfglass-src/share ]; then
echo "ERROR: wolfGlass revision $PINNED_REV does not resolve." >&2
echo "tools/sbom/.wolfglass-rev must name a commit that exists in" >&2
echo "wolfSSL/wolfGlass. Re-run tools/wolfglass-sync to re-pin." >&2
if [ ! -d .wolfssl-compliance-tooling-src/share ]; then
echo "ERROR: wolfssl-compliance-tooling revision $PINNED_REV does not resolve." >&2
echo "tools/sbom/.wolfssl-compliance-tooling-rev must name a commit that exists in" >&2
echo "wolfSSL/wolfssl-compliance-tooling. Re-run tools/wolfssl-compliance-tooling-sync to re-pin." >&2
exit 1
fi
git config --global --add safe.directory "$GITHUB_WORKSPACE/.wolfglass-src"
python3 .wolfglass-src/tools/wolfglass-sync \
--check --src .wolfglass-src --dest .
git config --global --add safe.directory "$GITHUB_WORKSPACE/.wolfssl-compliance-tooling-src"
python3 .wolfssl-compliance-tooling-src/tools/wolfssl-compliance-tooling-sync \
--check --src .wolfssl-compliance-tooling-src --dest .
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1047,9 +1047,10 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/wolftpm/
# SBOM generation target
####################################################
#
# The generator is the wolfGlass snapshot in tools/sbom/. WOLFSSL_DIR is
# optional: when set to a wolfSSL source tree, the dependency version is read
# from wolfssl/version.h. Otherwise the driver uses pkg-config.
# The generator is the wolfssl-compliance-tooling snapshot in tools/sbom/.
# WOLFSSL_DIR is optional: when set to a wolfSSL source tree, the dependency
# version is read from wolfssl/version.h. Otherwise the driver uses
# pkg-config.
#
# Usage:
# cmake -B build .
Expand Down Expand Up @@ -1154,7 +1155,7 @@ if(BUILD_WOLFTPM_LIB)
if(NOT _sbom_wolfssl_version STREQUAL "")
list(APPEND _sbom_args DEP_VERSION "wolfssl=${_sbom_wolfssl_version}")
endif()
wolfglass_add_sbom(${_sbom_args})
wolfssl_compliance_tooling_add_sbom(${_sbom_args})

# Stage the installed library before the driver hashes it, matching
# the autotools `make install` into _sbom_staging. The public `sbom`
Expand Down
14 changes: 10 additions & 4 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,10 @@ cppcheck:
--error-exitcode=89 --std=c89 \
-I wolftpm src/ hal/ examples

# SBOM generation. The recipe and generator are the vendored wolfGlass
# snapshot in tools/sbom/ (pinned by tools/sbom/.wolfglass-rev). wolfTPM
# declares itself here: a libwolftpm library that links wolfSSL.
# SBOM generation. The recipe and generator are the vendored
# wolfssl-compliance-tooling snapshot in tools/sbom/ (pinned by
# tools/sbom/.wolfssl-compliance-tooling-rev). wolfTPM declares itself here:
# a libwolftpm library that links wolfSSL.
# WOLFSSL_DIR is optional. When it points at a wolfSSL source tree, the
# recipe reads wolfssl/version.h for the dependency version. Otherwise
# gen-sbom uses pkg-config.
Expand All @@ -162,11 +163,16 @@ EXTRA_DIST += tools/sbom/sbom.am
EXTRA_DIST += tools/sbom/validate_sbom.py
EXTRA_DIST += tools/sbom/README.md
EXTRA_DIST += tools/sbom/VERSION
EXTRA_DIST += tools/sbom/.wolfglass-rev
EXTRA_DIST += tools/sbom/.wolfssl-compliance-tooling-rev
EXTRA_DIST += tools/sbom/build/install-sbom.cmake
EXTRA_DIST += tools/sbom/build/sbom-paths.cmake
EXTRA_DIST += tools/sbom/build/sbom-with-sde.cmake
EXTRA_DIST += tools/sbom/build/sbom.cmake
EXTRA_DIST += tools/sbom/build/sbom.mk
EXTRA_DIST += tools/sbom/build/uninstall-sbom.cmake
EXTRA_DIST += tools/sbom/frontends/compdb_sbom.py
EXTRA_DIST += tools/sbom/frontends/iar_sbom.py
EXTRA_DIST += tools/sbom/frontends/included_sources.py
EXTRA_DIST += tools/sbom/frontends/zephyr_sbom.py

include tools/sbom/sbom.am
12 changes: 6 additions & 6 deletions docs/ja/sbom-and-compliance.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ wolfTPM は、EU サイバーレジリエンス法 (CRA) への準拠を支援

## SBOM と EU CRA コンプライアンス

wolfTPM は CycloneDX 1.6 および SPDX 2.3 形式で SBOM を生成します。ジェネレータは `tools/sbom/` にベンダリングされた wolfGlass のスナップショットで、`tools/sbom/.wolfglass-rev` で固定されています。SBOM には、設定されたビルドオプション (`wolftpm/options.h` から取得)、ビルドされた `libwolftpm` ライブラリ成果物 (共有または静的、ELF、Mach-O、PE) のハッシュ、および依存関係としての wolfSSL が記録されるため、脆弱性スキャナーは wolfSSL のアドバイザリを wolfTPM のデプロイメントに関連付けることができます。
wolfTPM は CycloneDX 1.6 および SPDX 2.3 形式で SBOM を生成します。ジェネレータは `tools/sbom/` にベンダリングされた wolfssl-compliance-tooling のスナップショットで、`tools/sbom/.wolfssl-compliance-tooling-rev` で固定されています。SBOM には、設定されたビルドオプション (`wolftpm/options.h` から取得)、ビルドされた `libwolftpm` ライブラリ成果物 (共有または静的、ELF、Mach-O、PE) のハッシュ、および依存関係としての wolfSSL が記録されるため、脆弱性スキャナーは wolfSSL のアドバイザリを wolfTPM のデプロイメントに関連付けることができます。

出力は再現可能です。`SOURCE_DATE_EPOCH` を設定する (または最後のコミット時刻が使用される git チェックアウトからビルドする) と、繰り返し実行しても出力はバイト単位で同一になります。

Expand Down Expand Up @@ -48,7 +48,7 @@ CRA に関するさらなるガイダンスは [wolfssl/doc/CRA.md](https://gith

## ジェネレータの内部構成

wolfGlass のうち、ベンダリング可能なのは `share/` セットのみです。`tools/wolfglass-sync` スクリプトは、これらのファイルを、固定用ファイル (`VERSION` と `.wolfglass-rev`) とともに、製品内の `tools/sbom/` にコピーします。コピーするのはファイルであり、`share/` フォルダ名ではありません。
wolfssl-compliance-tooling のうち、ベンダリング可能なのは `share/` セットのみです。`tools/wolfssl-compliance-tooling-sync` スクリプトは、これらのファイルを、固定用ファイル (`VERSION` と `.wolfssl-compliance-tooling-rev`) とともに、製品内の `tools/sbom/` にコピーします。コピーするのはファイルであり、`share/` フォルダ名ではありません。

### 内容

Expand All @@ -60,8 +60,8 @@ wolfGlass のうち、ベンダリング可能なのは `share/` セットのみ
| `frontends/compdb_sbom.py` | 任意の `compile_commands.json` に対するエクストラクタ。 |
| `frontends/iar_sbom.py` | IAR Embedded Workbench の `.ewp` に対するエクストラクタ。 |
| `frontends/zephyr_sbom.py` | Zephyr モジュールの `CMakeLists.txt` に対するエクストラクタ。 |
| `build/sbom.mk` | 共有のプレーン Make フラグメントと `wolfglass_sbom_rule` マクロ。 |
| `build/sbom.cmake` | 共有の CMake ヘルパー: `wolfglass_add_sbom()`。 |
| `build/sbom.mk` | 共有のプレーン Make フラグメントと `wolfssl_compliance_tooling_sbom_rule` マクロ。 |
| `build/sbom.cmake` | 共有の CMake ヘルパー: `wolfssl_compliance_tooling_add_sbom()`。 |
| `gen-sbom` | ベンダリングされた SBOM ジェネレータ。 |
| `sbom.am` | 共有の autotools フラグメント。 |

Expand Down Expand Up @@ -92,8 +92,8 @@ wolfGlass のうち、ベンダリング可能なのは `share/` セットのみ

製品はロジックをコピーしません。自身を記述します。

- **Make:** `SBOM_NAME`、`SBOM_SRCS`、`SBOM_CFLAGS`、およびバージョン (`SBOM_VERSION`、または `SBOM_VERSION_FILE` と `SBOM_VERSION_MACRO`) を設定し、`include tools/sbom/build/sbom.mk` します。2 つ目のターゲットには `$(eval $(call wolfglass_sbom_rule,<target>,<prefix>))` をインスタンス化します。製品の構成が `user_settings.h` にある場合は、`SBOM_SETTINGS_H` も設定します (そのヘッダーが CFLAGS にまだ含まれていないパスを必要とする場合は `SBOM_INCLUDE_DIRS` も設定)。`SBOM_CFLAGS` だけでは、文字どおりの `-D` の集合のみが記録され、そこから派生するものは記録されません。ゲートされたヘッダーでは、SBOM が誰もビルドしていない構成を記述してしまうことになります。
- **CMake:** `include(tools/sbom/build/sbom.cmake)` し、`NAME`、`VERSION_FILE`、`VERSION_MACRO`、`TARGETS`、`DEFS`、`LICENSE` を指定して `wolfglass_add_sbom()` を呼び出します。`SBOM_GEN` が正式なジェネレータ上書き用の変数です。`GEN_SBOM` は互換性のため、従来のエイリアスとして残されています。
- **Make:** `SBOM_NAME`、`SBOM_SRCS`、`SBOM_CFLAGS`、およびバージョン (`SBOM_VERSION`、または `SBOM_VERSION_FILE` と `SBOM_VERSION_MACRO`) を設定し、`include tools/sbom/build/sbom.mk` します。2 つ目のターゲットには `$(eval $(call wolfssl_compliance_tooling_sbom_rule,<target>,<prefix>))` をインスタンス化します。製品の構成が `user_settings.h` にある場合は、`SBOM_SETTINGS_H` も設定します (そのヘッダーが CFLAGS にまだ含まれていないパスを必要とする場合は `SBOM_INCLUDE_DIRS` も設定)。`SBOM_CFLAGS` だけでは、文字どおりの `-D` の集合のみが記録され、そこから派生するものは記録されません。ゲートされたヘッダーでは、SBOM が誰もビルドしていない構成を記述してしまうことになります。
- **CMake:** `include(tools/sbom/build/sbom.cmake)` し、`NAME`、`VERSION_FILE`、`VERSION_MACRO`、`TARGETS`、`DEFS`、`LICENSE` を指定して `wolfssl_compliance_tooling_add_sbom()` を呼び出します。`SBOM_GEN` が正式なジェネレータ上書き用の変数です。`GEN_SBOM` は互換性のため、従来のエイリアスとして残されています。
- **Autotools:** `SBOM_*` 変数を設定し、`include tools/sbom/sbom.am` します。

製品に残すのは、真に製品固有の知識のみです。具体的には、ルーティング用スクリプト、モジュールエクストラクタ、HAL ソースセレクタです。
Expand Down
12 changes: 6 additions & 6 deletions docs/sbom-and-compliance.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ wolfTPM can generate a Software Bill of Materials (SBOM) to support compliance w

## SBOM and EU CRA compliance

wolfTPM generates an SBOM in CycloneDX 1.6 and SPDX 2.3 formats. The generator is the wolfGlass snapshot vendored in `tools/sbom/` and pinned by `tools/sbom/.wolfglass-rev`. The SBOM records the configured build options (from `wolftpm/options.h`), hashes the built `libwolftpm` library artifact (shared or static; ELF, Mach-O, or PE), and lists wolfSSL as a dependency so vulnerability scanners can associate wolfSSL advisories with a wolfTPM deployment.
wolfTPM generates an SBOM in CycloneDX 1.6 and SPDX 2.3 formats. The generator is the wolfssl-compliance-tooling snapshot vendored in `tools/sbom/` and pinned by `tools/sbom/.wolfssl-compliance-tooling-rev`. The SBOM records the configured build options (from `wolftpm/options.h`), hashes the built `libwolftpm` library artifact (shared or static; ELF, Mach-O, or PE), and lists wolfSSL as a dependency so vulnerability scanners can associate wolfSSL advisories with a wolfTPM deployment.

Output is reproducible. Set `SOURCE_DATE_EPOCH` (or build from a git checkout, which uses the last commit time) and repeated runs are byte-identical.

Expand Down Expand Up @@ -48,7 +48,7 @@ For further CRA guidance see [wolfssl/doc/CRA.md](https://github.com/wolfSSL/wol

## Generator internals

The `share/` set of wolfGlass is the only vendorable part. The `tools/wolfglass-sync` script copies these files into a product at `tools/sbom/`, together with the pin files (`VERSION` and `.wolfglass-rev`). Copy the files, not the `share/` folder name.
The `share/` set of wolfssl-compliance-tooling is the only vendorable part. The `tools/wolfssl-compliance-tooling-sync` script copies these files into a product at `tools/sbom/`, together with the pin files (`VERSION` and `.wolfssl-compliance-tooling-rev`). Copy the files, not the `share/` folder name.

### Contents

Expand All @@ -60,8 +60,8 @@ The `share/` set of wolfGlass is the only vendorable part. The `tools/wolfglass-
| `frontends/compdb_sbom.py` | Extractor for any `compile_commands.json`. |
| `frontends/iar_sbom.py` | Extractor for an IAR Embedded Workbench `.ewp`. |
| `frontends/zephyr_sbom.py` | Extractor for a Zephyr module `CMakeLists.txt`. |
| `build/sbom.mk` | Shared plain-Make fragment and `wolfglass_sbom_rule` macro. |
| `build/sbom.cmake` | Shared CMake helper: `wolfglass_add_sbom()`. |
| `build/sbom.mk` | Shared plain-Make fragment and `wolfssl_compliance_tooling_sbom_rule` macro. |
| `build/sbom.cmake` | Shared CMake helper: `wolfssl_compliance_tooling_add_sbom()`. |
| `gen-sbom` | The vendored SBOM generator. |
| `sbom.am` | Shared autotools fragment. |

Expand Down Expand Up @@ -92,8 +92,8 @@ The shared driver is product-neutral and calls the vendored `share/gen-sbom` by

A product does not copy logic. It describes itself:

- **Make:** set `SBOM_NAME`, `SBOM_SRCS`, `SBOM_CFLAGS`, and a version (`SBOM_VERSION`, or `SBOM_VERSION_FILE` and `SBOM_VERSION_MACRO`), then `include tools/sbom/build/sbom.mk`. For a second target, instantiate `$(eval $(call wolfglass_sbom_rule,<target>,<prefix>))`. If the product configuration lives in a `user_settings.h`, also set `SBOM_SETTINGS_H` (and `SBOM_INCLUDE_DIRS` if that header needs paths the CFLAGS do not already carry). `SBOM_CFLAGS` alone records the literal `-D` set and nothing it derives, which for a gated header means the SBOM describes a configuration nobody built.
- **CMake:** `include(tools/sbom/build/sbom.cmake)` and call `wolfglass_add_sbom()` with `NAME`, `VERSION_FILE`, `VERSION_MACRO`, `TARGETS`, `DEFS`, `LICENSE`. `SBOM_GEN` is the canonical generator override. `GEN_SBOM` remains a legacy alias for compatibility.
- **Make:** set `SBOM_NAME`, `SBOM_SRCS`, `SBOM_CFLAGS`, and a version (`SBOM_VERSION`, or `SBOM_VERSION_FILE` and `SBOM_VERSION_MACRO`), then `include tools/sbom/build/sbom.mk`. For a second target, instantiate `$(eval $(call wolfssl_compliance_tooling_sbom_rule,<target>,<prefix>))`. If the product configuration lives in a `user_settings.h`, also set `SBOM_SETTINGS_H` (and `SBOM_INCLUDE_DIRS` if that header needs paths the CFLAGS do not already carry). `SBOM_CFLAGS` alone records the literal `-D` set and nothing it derives, which for a gated header means the SBOM describes a configuration nobody built.
- **CMake:** `include(tools/sbom/build/sbom.cmake)` and call `wolfssl_compliance_tooling_add_sbom()` with `NAME`, `VERSION_FILE`, `VERSION_MACRO`, `TARGETS`, `DEFS`, `LICENSE`. `SBOM_GEN` is the canonical generator override. `GEN_SBOM` remains a legacy alias for compatibility.
- **Autotools:** set the `SBOM_*` variables and `include tools/sbom/sbom.am`.

Keep only true product knowledge in the product: the route-through script, the module extractor, and the HAL source selector.
Expand Down
1 change: 0 additions & 1 deletion tools/sbom/.wolfglass-rev

This file was deleted.

1 change: 1 addition & 0 deletions tools/sbom/.wolfssl-compliance-tooling-rev
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8a96c64f9dc022fa136682a18f23860196de8610
Loading
Loading