Skip to content

Remove generate-bindings feature from tss-esapi#1205

Merged
ansasaki merged 1 commit intokeylime:masterfrom
sarroutbi:202603101440-remove-bindings
Mar 11, 2026
Merged

Remove generate-bindings feature from tss-esapi#1205
ansasaki merged 1 commit intokeylime:masterfrom
sarroutbi:202603101440-remove-bindings

Conversation

@sarroutbi
Copy link
Copy Markdown
Contributor

The generate-bindings feature causes tss-esapi-sys to regenerate FFI bindings from the system's tpm2-tss C headers at build time. On systems with tpm2-tss 4.x (e.g. Fedora 44), many TPM2 structs (TPML_DIGEST, TPMT_TK_HASHCHECK, TPM2B_ECC_POINT, etc.) are now opaque, which makes the regenerated bindings incompatible with tss-esapi 7.6.0 code that directly accesses struct fields.

Without this feature, tss-esapi-sys uses its pre-bundled bindings generated against tpm2-tss 3.x, which contain the correct non-opaque struct definitions expected by the Rust wrapper code.

@sarroutbi sarroutbi force-pushed the 202603101440-remove-bindings branch 2 times, most recently from fe5e266 to 9b8485d Compare March 10, 2026 16:56
@sarroutbi
Copy link
Copy Markdown
Contributor Author

Example of a CI job where Fedora 44 compilation fails without this patch:
https://artifacts.dev.testing-farm.io/73a58516-f26b-450f-bf45-88c5bfd6260f/

@ansasaki
Copy link
Copy Markdown
Contributor

If it uses the bindings generated for the tpm2-tss version 3.x, will it work with the version 4.x? I mean, apparently the ABI was broken from 3.x to 4.x (otherwise the bindings would work just fine). I'm trying to remember when we introduced the use of generate-bindings feature exactly to make it more flexible with these sudden breaking changes coming from the tpm stack.

@sarroutbi
Copy link
Copy Markdown
Contributor Author

If it uses the bindings generated for the tpm2-tss version 3.x, will it work with the version 4.x? I mean, apparently the ABI was broken from 3.x to 4.x (otherwise the bindings would work just fine). I'm trying to remember when we introduced the use of generate-bindings feature exactly to make it more flexible with these sudden breaking changes coming from the tpm stack.

You're right that it was introduced for flexibility. Removing it is a workaround, not a proper fix. The correct long-term solution is to upgrade to tss-esapi 8.x, which properly supports the 4.x opaque API by using accessor functions instead of direct field access. But tss-esapi 8.0.0 is still in alpha, and, obviously, not available in Fedora.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.54%. Comparing base (28ee5b2) to head (058c826).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
Flag Coverage Δ
e2e-testsuite 39.05% <ø> (-0.03%) ⬇️
upstream-unit-tests 66.13% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 7 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sarroutbi sarroutbi marked this pull request as ready for review March 10, 2026 21:06
@sarroutbi
Copy link
Copy Markdown
Contributor Author

Fedora 44 compilation is fixed if this change is applied:
https://github.com/keylime/keylime/pull/1863/checks?check_run_id=66515389433

The generate-bindings feature causes tss-esapi-sys to regenerate FFI
bindings from the system's tpm2-tss C headers at build time. On systems
with tpm2-tss 4.x (e.g. Fedora 44), many TPM2 structs (TPML_DIGEST,
TPMT_TK_HASHCHECK, TPM2B_ECC_POINT, etc.) are now opaque, which makes
the regenerated bindings incompatible with tss-esapi 7.6.0 code that
directly accesses struct fields.

Without this feature, tss-esapi-sys uses its pre-bundled bindings
generated against tpm2-tss 3.x, which contain the correct non-opaque
struct definitions expected by the Rust wrapper code.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
@sarroutbi sarroutbi force-pushed the 202603101440-remove-bindings branch from 9b8485d to 058c826 Compare March 11, 2026 09:21
Copy link
Copy Markdown
Contributor

@ansasaki ansasaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Since the tests are now passing on Fedora 44, let's merge this (and hope breaking changes are not introduced again)

@ansasaki ansasaki merged commit 468c30e into keylime:master Mar 11, 2026
17 checks passed
@sarroutbi sarroutbi deleted the 202603101440-remove-bindings branch March 19, 2026 15:07
@ansasaki ansasaki mentioned this pull request Mar 25, 2026
33 tasks
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.

3 participants