Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ jobs:
- name: Run codespell
uses: codespell-project/actions-codespell@v2
with:
skip: .git,./IDE,./certs,./m4,*.der,*.pem
skip: .git,./IDE,./certs,./m4,*.der,*.pem,*prebuilt_bindings.rs
ignore_words_list: inh,inout,keypair,nd,parm,rcv,ser,loadIn,importIn,certifyIn,bu,fo,daa,pris,hsi,fram,hart
6 changes: 0 additions & 6 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
# Release Notes

## Unreleased

* Added SPDM transport-bound TPM policies (PR #594).
- Added `TPM2_PolicyTransportSPDM` client support and fwTPM enforcement.
- Added SPDM-bound NV policy examples and tests.

## wolfTPM Release 4.2.0 (Sep 14, 2026)

**Summary**
Expand Down
3 changes: 3 additions & 0 deletions wrapper/rust/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# wolfTPM Rust wrapper

[![crates.io](https://img.shields.io/crates/v/wolftpm.svg)](https://crates.io/crates/wolftpm)
[![docs.rs](https://docs.rs/wolftpm/badge.svg)](https://docs.rs/wolftpm)

Official Rust bindings for wolfTPM. The crate lives in [`wolftpm/`](wolftpm/);
see its [README](wolftpm/README.md) for the full API, build, and test details.

Expand Down
1 change: 1 addition & 0 deletions wrapper/rust/include.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ EXTRA_DIST += wrapper/rust/wolftpm/README.md
EXTRA_DIST += wrapper/rust/wolftpm/Makefile
EXTRA_DIST += wrapper/rust/wolftpm/build.rs
EXTRA_DIST += wrapper/rust/wolftpm/headers.h
EXTRA_DIST += wrapper/rust/wolftpm/prebuilt_bindings.rs
EXTRA_DIST += wrapper/rust/wolftpm/src/lib.rs
EXTRA_DIST += wrapper/rust/wolftpm/src/sys.rs
EXTRA_DIST += wrapper/rust/wolftpm/src/device.rs
Expand Down
18 changes: 17 additions & 1 deletion wrapper/rust/wolftpm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,21 @@ rust-version = "1.81"
description = "Rust wrapper for the wolfTPM TPM 2.0 library"
license = "GPL-3.0-or-later"
repository = "https://github.com/wolfSSL/wolfTPM"
documentation = "https://github.com/wolfSSL/wolfTPM/tree/master/wrapper/rust"
documentation = "https://docs.rs/wolftpm"
keywords = ["wolftpm", "tpm", "tpm2", "security", "api-bindings"]
categories = ["cryptography", "hardware-support", "api-bindings"]
readme = "README.md"
include = [
"src/**/*.rs",
"examples/*.rs",
"tests/**/*.rs",
"build.rs",
"headers.h",
"prebuilt_bindings.rs",
"README.md",
"CHANGELOG.md",
"Cargo.toml",
]

[features]
default = []
Expand All @@ -22,3 +33,8 @@ zeroize = { version = "1.8", default-features = false, features = ["alloc"] }
[build-dependencies]
bindgen = "0.72"
regex = "1.5"

[package.metadata.docs.rs]
# docs.rs sets DOCS_RS=1; build.rs then uses prebuilt_bindings.rs and skips the
# native link. Pin the target the committed x86_64 Linux bindings were made for.
default-target = "x86_64-unknown-linux-gnu"
3 changes: 3 additions & 0 deletions wrapper/rust/wolftpm/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# wolftpm

[![crates.io](https://img.shields.io/crates/v/wolftpm.svg)](https://crates.io/crates/wolftpm)
[![docs.rs](https://docs.rs/wolftpm/badge.svg)](https://docs.rs/wolftpm)

Safe Rust bindings for wolfTPM, the portable TPM 2.0 library.

The raw FFI is generated with bindgen and kept in the `sys` module. The rest of
Expand Down
20 changes: 20 additions & 0 deletions wrapper/rust/wolftpm/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,33 @@ fn main() {
fn run_build() -> Result<()> {
println!("cargo:rerun-if-env-changed=WOLFTPM_PREFIX");
println!("cargo:rerun-if-env-changed=WOLFSSL_PREFIX");
println!("cargo:rerun-if-env-changed=DOCS_RS");
// docs.rs builds in a sandbox with no wolfTPM/wolfSSL headers or libraries.
// Use the committed bindings and skip the link so the API docs still render;
// rustdoc compiles the crate but does not link the native library.
if env::var_os("DOCS_RS").is_some() {
return docs_rs_build();
}
generate_bindings()?;
setup_link()?;
scan_cfg()?;
scan_options()?;
Ok(())
}

/// docs.rs build path: copy the committed FFI bindings into `$OUT_DIR`, emit the
/// cfgs a software-TPM build produces, and skip linking.
fn docs_rs_build() -> Result<()> {
println!("cargo:rerun-if-changed=prebuilt_bindings.rs");
fs::copy("prebuilt_bindings.rs", bindings_path())?;
scan_cfg()?;
for cfg in ["swtpm", "devtpm", "mmio", "fwtpm", "winapi", "linux_autodetect"] {
println!("cargo::rustc-check-cfg=cfg({})", cfg);
}
println!("cargo:rustc-cfg=swtpm");
Ok(())
}

fn crate_dir() -> Result<String> {
Ok(env::current_dir()?.display().to_string())
}
Expand Down
3 changes: 3 additions & 0 deletions wrapper/rust/wolftpm/prebuilt_bindings.rs

Large diffs are not rendered by default.

Loading