From 0e7a2b19a5a1d7dc81a0db1a5c780467c60db6e6 Mon Sep 17 00:00:00 2001 From: Michael Richardson Date: Thu, 13 Nov 2025 20:33:52 -0500 Subject: [PATCH 1/2] bug: mark some unused things as allowed, and comment them out --- .../tpm_commands/object_commands/create_command_output.rs | 3 ++- tss-esapi/src/lib.rs | 1 + tss-esapi/src/traits.rs | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tss-esapi/src/context/tpm_commands/object_commands/create_command_output.rs b/tss-esapi/src/context/tpm_commands/object_commands/create_command_output.rs index b36b649d3..1874d704f 100644 --- a/tss-esapi/src/context/tpm_commands/object_commands/create_command_output.rs +++ b/tss-esapi/src/context/tpm_commands/object_commands/create_command_output.rs @@ -82,7 +82,8 @@ impl TryFrom for CreateKeyResult { let creation_ticket_owned = unsafe { take_from_esys(ffi_data_handler.ffi_creation_ticket_ptr)? }; - ffi_data_handler.ffi_creation_ticket_ptr = null_mut(); + //#[allow(unused_assignments)] + //ffi_data_handler.ffi_creation_ticket_ptr = null_mut(); Ok(CreateKeyResult { out_private: Private::try_from(out_private_owned)?, diff --git a/tss-esapi/src/lib.rs b/tss-esapi/src/lib.rs index 1fe9fea3c..41f81386d 100644 --- a/tss-esapi/src/lib.rs +++ b/tss-esapi/src/lib.rs @@ -29,6 +29,7 @@ missing_copy_implementations, rustdoc::broken_intra_doc_links, )] +#![feature(stmt_expr_attributes)] //! # TSS 2.0 Rust Wrapper over Enhanced System API //! This crate exposes the functionality of the TCG Software Stack Enhanced System API to diff --git a/tss-esapi/src/traits.rs b/tss-esapi/src/traits.rs index 0d8febae8..21568e346 100644 --- a/tss-esapi/src/traits.rs +++ b/tss-esapi/src/traits.rs @@ -179,6 +179,7 @@ macro_rules! impl_mu_complex { // Make the macros usable outside of the module. pub(crate) use impl_marshall_trait; +#[allow(unused_imports)] pub(crate) use impl_mu_aliases; pub(crate) use impl_mu_complex; pub(crate) use impl_mu_simple; From bdd2e39aae685763a13f7d8574fc05b69eeabe6d Mon Sep 17 00:00:00 2001 From: Michael Richardson Date: Fri, 30 May 2025 21:56:32 +0000 Subject: [PATCH 2/2] feat: ignore fake/nonsense prerelease info from tss version, the rest of the version still has to match --- tss-esapi/build.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tss-esapi/build.rs b/tss-esapi/build.rs index 39c3a0a18..fd3c220d4 100644 --- a/tss-esapi/build.rs +++ b/tss-esapi/build.rs @@ -1,6 +1,6 @@ // Copyright 2021 Contributors to the Parsec project. // SPDX-License-Identifier: Apache-2.0 -use semver::{Version, VersionReq}; +use semver::{Version, VersionReq, Prerelease}; const TPM2_TSS_MINIMUM_VERSION: Version = Version::new(4, 1, 3); @@ -13,7 +13,7 @@ fn main() { // If documentation for Docs.rs is being built then the version is set // to the minimum supported tpm2-tss version. - let tss_version = if std::env::var("DOCS_RS").is_ok() { + let mut tss_version = if std::env::var("DOCS_RS").is_ok() { TPM2_TSS_MINIMUM_VERSION } else { let tss_version_string = std::env::var("DEP_TSS2_ESYS_VERSION") @@ -23,9 +23,14 @@ fn main() { .expect("Failed to parse the DEP_TSS2_ESYS_VERSION variable as a semver version") }; + // nuke any prerelease info, which probably is just a git repo/dirty flag + // like: 4.0.1-67-gb7bad346 + tss_version.pre = Prerelease::EMPTY; + let supported_tss_version = VersionReq::parse("<5.0.0, >=2.3.3").expect("Failed to parse supported TSS version"); + //eprintln!("tss version: {} / {:?}", supported_tss_version, tss_version); assert!( supported_tss_version.matches(&tss_version), "Unsupported TSS version {tss_version}"