From 1991748e88effaa7533d1f7edfb2052c7e867db4 Mon Sep 17 00:00:00 2001 From: Ionut Mihalcea Date: Tue, 26 Jan 2021 14:29:54 +0000 Subject: [PATCH] Split repo into two crates This commit splits the repository into two crates: `tss-esapi` for the Rust-native, idiomatic interface, and `tss-esapi-sys` for the FFI bindings. This is the first step in the process and probably multiple other PRs will be needed to clean up. Signed-off-by: Ionut Mihalcea --- .github/workflows/ci.yml | 26 +- .gitignore | 4 +- Cargo.toml | 40 +- README.md | 34 +- build.rs | 68 - tss-esapi-sys/Cargo.toml | 20 + tss-esapi-sys/LICENSE | 202 ++ tss-esapi-sys/README.md | 41 + tss-esapi-sys/build.rs | 95 + .../src/bindings/x86_64-unknown-linux-gnu.rs | 2321 ++++++++++++++++- tss-esapi-sys/src/lib.rs | 32 + tss-esapi/Cargo.toml | 31 + tss-esapi/LICENSE | 202 ++ tss-esapi/README.md | 27 + {src => tss-esapi/src}/abstraction/ak.rs | 0 {src => tss-esapi/src}/abstraction/ek.rs | 0 {src => tss-esapi/src}/abstraction/mod.rs | 0 {src => tss-esapi/src}/abstraction/nv.rs | 0 .../src}/abstraction/transient.rs | 0 {src => tss-esapi/src}/constants/algorithm.rs | 0 {src => tss-esapi/src}/constants/mod.rs | 0 .../src}/constants/response_code.rs | 0 {src => tss-esapi/src}/constants/tags/mod.rs | 0 .../src}/constants/tags/property.rs | 0 .../src}/constants/tags/structure.rs | 0 {src => tss-esapi/src}/constants/tss.rs | 0 {src => tss-esapi/src}/constants/types.rs | 0 {src => tss-esapi/src}/context.rs | 0 .../src}/context/handle_manager.rs | 0 {src => tss-esapi/src}/error.rs | 0 {src => tss-esapi/src}/handles/handle.rs | 0 {src => tss-esapi/src}/handles/mod.rs | 0 {src => tss-esapi/src}/handles/tpm.rs | 0 .../src}/interface_types/dynamic_handles.rs | 0 {src => tss-esapi/src}/interface_types/mod.rs | 0 .../src}/interface_types/resource_handles.rs | 0 {src => tss-esapi/src}/lib.rs | 20 +- {src => tss-esapi/src}/macros/mod.rs | 0 {src => tss-esapi/src}/nv/mod.rs | 0 {src => tss-esapi/src}/nv/storage/index.rs | 0 {src => tss-esapi/src}/nv/storage/mod.rs | 0 {src => tss-esapi/src}/nv/storage/public.rs | 0 {src => tss-esapi/src}/session.rs | 0 {src => tss-esapi/src}/session/attributes.rs | 0 {src => tss-esapi/src}/session/specific.rs | 0 {src => tss-esapi/src}/structures/buffers.rs | 0 .../src}/structures/capabilitydata.rs | 0 {src => tss-esapi/src}/structures/creation.rs | 0 .../src}/structures/hash/agile.rs | 22 +- {src => tss-esapi/src}/structures/hash/mod.rs | 0 .../src}/structures/lists/digest.rs | 0 .../src}/structures/lists/digest_values.rs | 5 +- .../src}/structures/lists/mod.rs | 0 .../src}/structures/lists/pcr_selection.rs | 0 {src => tss-esapi/src}/structures/mod.rs | 2 +- .../src}/structures/names/mod.rs | 0 .../src}/structures/names/name.rs | 0 {src => tss-esapi/src}/structures/pcr/mod.rs | 0 .../src}/structures/pcr/select.rs | 0 .../src}/structures/pcr/selection.rs | 0 {src => tss-esapi/src}/structures/result.rs | 0 {src => tss-esapi/src}/structures/tickets.rs | 0 {src => tss-esapi/src}/tcti.rs | 0 {src => tss-esapi/src}/utils/mod.rs | 0 {tests => tss-esapi/tests}/Dockerfile-fedora | 0 {tests => tss-esapi/tests}/Dockerfile-ubuntu | 0 .../tests}/abstraction_ak_tests.rs | 0 .../tests}/abstraction_ek_tests.rs | 0 .../tests}/abstraction_nv_tests.rs | 0 .../tests}/algorithm_specifier_tests.rs | 0 {tests => tss-esapi/tests}/all-fedora.sh | 9 +- {tests => tss-esapi/tests}/all-ubuntu.sh | 0 {tests => tss-esapi/tests}/common.rs | 0 {tests => tss-esapi/tests}/context_tests.rs | 0 .../tests}/handles_handle_test.rs | 0 .../tests}/handles_tpm_tests.rs | 0 .../interface_types_resource_handle_tests.rs | 0 .../nv_storage_nv_index_attributes_tests.rs | 0 .../tests}/nv_storage_nv_index_type_tests.rs | 0 .../pcr_selection_list_builder_tests.rs | 0 .../tests}/pcr_selection_list_tests.rs | 0 .../tests}/structure_buffers_auth_tests.rs | 0 .../tests}/structure_buffers_data_tests.rs | 0 .../tests}/structure_buffers_digest_tests.rs | 0 .../structure_buffers_max_buffer_tests.rs | 0 .../tests}/structure_buffers_nonce_tests.rs | 0 .../structure_lists_digest_list_tests.rs | 0 .../tests}/structures_capabilitydata.rs | 0 .../tests}/structures_pcr_select_tests.rs | 0 .../tests}/structures_pcr_selection_tests.rs | 0 .../tests}/transient_key_context.rs | 0 {tests => tss-esapi/tests}/utils_tests.rs | 0 92 files changed, 2979 insertions(+), 222 deletions(-) delete mode 100644 build.rs create mode 100644 tss-esapi-sys/Cargo.toml create mode 100644 tss-esapi-sys/LICENSE create mode 100644 tss-esapi-sys/README.md create mode 100644 tss-esapi-sys/build.rs rename doc_bindings.rs => tss-esapi-sys/src/bindings/x86_64-unknown-linux-gnu.rs (88%) create mode 100644 tss-esapi-sys/src/lib.rs create mode 100644 tss-esapi/Cargo.toml create mode 100644 tss-esapi/LICENSE create mode 100644 tss-esapi/README.md rename {src => tss-esapi/src}/abstraction/ak.rs (100%) rename {src => tss-esapi/src}/abstraction/ek.rs (100%) rename {src => tss-esapi/src}/abstraction/mod.rs (100%) rename {src => tss-esapi/src}/abstraction/nv.rs (100%) rename {src => tss-esapi/src}/abstraction/transient.rs (100%) rename {src => tss-esapi/src}/constants/algorithm.rs (100%) rename {src => tss-esapi/src}/constants/mod.rs (100%) rename {src => tss-esapi/src}/constants/response_code.rs (100%) rename {src => tss-esapi/src}/constants/tags/mod.rs (100%) rename {src => tss-esapi/src}/constants/tags/property.rs (100%) rename {src => tss-esapi/src}/constants/tags/structure.rs (100%) rename {src => tss-esapi/src}/constants/tss.rs (100%) rename {src => tss-esapi/src}/constants/types.rs (100%) rename {src => tss-esapi/src}/context.rs (100%) rename {src => tss-esapi/src}/context/handle_manager.rs (100%) rename {src => tss-esapi/src}/error.rs (100%) rename {src => tss-esapi/src}/handles/handle.rs (100%) rename {src => tss-esapi/src}/handles/mod.rs (100%) rename {src => tss-esapi/src}/handles/tpm.rs (100%) rename {src => tss-esapi/src}/interface_types/dynamic_handles.rs (100%) rename {src => tss-esapi/src}/interface_types/mod.rs (100%) rename {src => tss-esapi/src}/interface_types/resource_handles.rs (100%) rename {src => tss-esapi/src}/lib.rs (90%) rename {src => tss-esapi/src}/macros/mod.rs (100%) rename {src => tss-esapi/src}/nv/mod.rs (100%) rename {src => tss-esapi/src}/nv/storage/index.rs (100%) rename {src => tss-esapi/src}/nv/storage/mod.rs (100%) rename {src => tss-esapi/src}/nv/storage/public.rs (100%) rename {src => tss-esapi/src}/session.rs (100%) rename {src => tss-esapi/src}/session/attributes.rs (100%) rename {src => tss-esapi/src}/session/specific.rs (100%) rename {src => tss-esapi/src}/structures/buffers.rs (100%) rename {src => tss-esapi/src}/structures/capabilitydata.rs (100%) rename {src => tss-esapi/src}/structures/creation.rs (100%) rename {src => tss-esapi/src}/structures/hash/agile.rs (70%) rename {src => tss-esapi/src}/structures/hash/mod.rs (100%) rename {src => tss-esapi/src}/structures/lists/digest.rs (100%) rename {src => tss-esapi/src}/structures/lists/digest_values.rs (90%) rename {src => tss-esapi/src}/structures/lists/mod.rs (100%) rename {src => tss-esapi/src}/structures/lists/pcr_selection.rs (100%) rename {src => tss-esapi/src}/structures/mod.rs (98%) rename {src => tss-esapi/src}/structures/names/mod.rs (100%) rename {src => tss-esapi/src}/structures/names/name.rs (100%) rename {src => tss-esapi/src}/structures/pcr/mod.rs (100%) rename {src => tss-esapi/src}/structures/pcr/select.rs (100%) rename {src => tss-esapi/src}/structures/pcr/selection.rs (100%) rename {src => tss-esapi/src}/structures/result.rs (100%) rename {src => tss-esapi/src}/structures/tickets.rs (100%) rename {src => tss-esapi/src}/tcti.rs (100%) rename {src => tss-esapi/src}/utils/mod.rs (100%) rename {tests => tss-esapi/tests}/Dockerfile-fedora (100%) rename {tests => tss-esapi/tests}/Dockerfile-ubuntu (100%) rename {tests => tss-esapi/tests}/abstraction_ak_tests.rs (100%) rename {tests => tss-esapi/tests}/abstraction_ek_tests.rs (100%) rename {tests => tss-esapi/tests}/abstraction_nv_tests.rs (100%) rename {tests => tss-esapi/tests}/algorithm_specifier_tests.rs (100%) rename {tests => tss-esapi/tests}/all-fedora.sh (86%) rename {tests => tss-esapi/tests}/all-ubuntu.sh (100%) rename {tests => tss-esapi/tests}/common.rs (100%) rename {tests => tss-esapi/tests}/context_tests.rs (100%) rename {tests => tss-esapi/tests}/handles_handle_test.rs (100%) rename {tests => tss-esapi/tests}/handles_tpm_tests.rs (100%) rename {tests => tss-esapi/tests}/interface_types_resource_handle_tests.rs (100%) rename {tests => tss-esapi/tests}/nv_storage_nv_index_attributes_tests.rs (100%) rename {tests => tss-esapi/tests}/nv_storage_nv_index_type_tests.rs (100%) rename {tests => tss-esapi/tests}/pcr_selection_list_builder_tests.rs (100%) rename {tests => tss-esapi/tests}/pcr_selection_list_tests.rs (100%) rename {tests => tss-esapi/tests}/structure_buffers_auth_tests.rs (100%) rename {tests => tss-esapi/tests}/structure_buffers_data_tests.rs (100%) rename {tests => tss-esapi/tests}/structure_buffers_digest_tests.rs (100%) rename {tests => tss-esapi/tests}/structure_buffers_max_buffer_tests.rs (100%) rename {tests => tss-esapi/tests}/structure_buffers_nonce_tests.rs (100%) rename {tests => tss-esapi/tests}/structure_lists_digest_list_tests.rs (100%) rename {tests => tss-esapi/tests}/structures_capabilitydata.rs (100%) rename {tests => tss-esapi/tests}/structures_pcr_select_tests.rs (100%) rename {tests => tss-esapi/tests}/structures_pcr_selection_tests.rs (100%) rename {tests => tss-esapi/tests}/transient_key_context.rs (100%) rename {tests => tss-esapi/tests}/utils_tests.rs (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 35e00712..4cc95b5b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,9 +7,9 @@ jobs: name: Check formatting runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Check formatting - run: cargo fmt --all -- --check + - uses: actions/checkout@v2 + - name: Check formatting + run: cargo fmt --all -- --check # All in one job as I think it is a big overhead to build and run the Docker # container? @@ -17,19 +17,19 @@ jobs: name: Ubuntu tests runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Build the container - run: docker build -t ubuntucontainer tests/ --file tests/Dockerfile-ubuntu - - name: Run the container - run: docker run -v $(pwd):/tmp/rust-tss-esapi -w /tmp/rust-tss-esapi ubuntucontainer /tmp/rust-tss-esapi/tests/all-ubuntu.sh + - uses: actions/checkout@v2 + - name: Build the container + run: docker build -t ubuntucontainer tss-esapi/tests/ --file tss-esapi/tests/Dockerfile-ubuntu + - name: Run the container + run: docker run -v $(pwd):/tmp/rust-tss-esapi -w /tmp/rust-tss-esapi/tss-esapi ubuntucontainer /tmp/rust-tss-esapi/tss-esapi/tests/all-ubuntu.sh tests-fedora: name: Fedora tests # We just build a container... GitHub doesn't like Fedora :( runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Build the container - run: docker build -t fedoracontainer tests/ --file tests/Dockerfile-fedora - - name: Run the tests - run: docker run -v $(pwd):/tmp/rust-tss-esapi -w /tmp/rust-tss-esapi fedoracontainer dbus-run-session -- /tmp/rust-tss-esapi/tests/all-fedora.sh + - uses: actions/checkout@v2 + - name: Build the container + run: docker build -t fedoracontainer tss-esapi/tests/ --file tss-esapi/tests/Dockerfile-fedora + - name: Run the tests + run: docker run -v $(pwd):/tmp/rust-tss-esapi -w /tmp/rust-tss-esapi/tss-esapi fedoracontainer dbus-run-session -- /tmp/rust-tss-esapi/tss-esapi/tests/all-fedora.sh diff --git a/.gitignore b/.gitignore index 9e57ed21..4b619ea8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ -/target +*target **/*.rs.bk -Cargo.lock +*Cargo.lock *.swp *DS_Store *.patch diff --git a/Cargo.toml b/Cargo.toml index b05f45bb..324e058b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,38 +1,2 @@ -[package] -name = "tss-esapi" -version = "4.0.10-alpha.2" -authors = ["Ionut Mihalcea ", - "Hugues de Valon "] -edition = "2018" -description = "Wrapper around TSS 2.0 Enhanced System API" -readme = "README.md" -keywords = ["tpm", "tss", "esys", "esapi"] -categories = ["api-bindings", "external-ffi-bindings", "cryptography"] -license = "Apache-2.0" -repository = "https://github.com/parallaxsecond/rust-tss-esapi" -documentation = "https://docs.rs/crate/tss-esapi" - -[dependencies] -bitfield = "0.13.2" -serde = { version = "1.0.115", features = ["derive"] } -mbox = "0.5.0" -log = "0.4.11" -enumflags2 = "0.6.4" -num-derive = "0.3.2" -num-traits = "0.2.12" -hostname-validator = "1.0.0" -regex = "1.3.9" -zeroize = { version = "1.1.0", features = ["zeroize_derive"] } - -[dev-dependencies] -env_logger = "0.7.1" - -[build-dependencies] -bindgen = "0.56.0" -pkg-config = "0.3.18" - -[features] -docs = [] - -[package.metadata.docs.rs] -features = ["docs"] +[workspace] +members = ["tss-esapi", "tss-esapi-sys"] \ No newline at end of file diff --git a/README.md b/README.md index 05cfd5a9..23fc535e 100644 --- a/README.md +++ b/README.md @@ -3,35 +3,9 @@ -- SPDX-License-Identifier: Apache-2.0 ---> -# TSS 2.0 Enhanced System API Rust Wrapper +# TSS 2.0 Enhanced System API Rust Wrapper -

- Crates.io - Code documentation - CI tests -

- -The `tss-esapi` Rust crate provides an idiomatic interface to the TCG TSS 2.0 Enhanced System API. We expose both direct FFI bindings and abstracted versions, aimed at improved convenience of using the API. - -Our end-goal is to achieve a fully Rust-native interface that offers strong safety and security guarantees. Check out our [documentation](https://docs.rs/tss-esapi/*/tss_esapi/#notes-on-code-safety) for an overview of our code safety approach. - -## Versioning - -The crate is still under development and thus the interface is not stable (despite the version number). As a rule of thumb, all versions marked `alpha` are expected to be short-lived and superseded by a better, more complete interface that relies on breaking changes. - -## Requirements - -This crate has currently only been tested with the TSS 2.0 -[open-source implementation](https://github.com/tpm2-software/tpm2-tss). -It uses `pkg-config` to find the include and library files for the `tss2-esys` and `tss2-tctildr` -libraries. A minimum version of `2.3.3` is required for both. `pkg-config` tool is needed to build this crate. - -Having installed the open-source implementation libraries at `/usr/local/lib` (by default), it -might happen that `pkg-config` can not find them. Run the following command if that is the -case: -```bash -$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig -``` +The `tss-esapi` Rust crate provides an idiomatic interface to the TCG TSS 2.0 Enhanced System API. We expose both direct FFI bindings (under the `tss-esapi-sys` crate) and abstracted versions, aimed at improved convenience of using the API. ## Minimum Supported Rust Version (MSRV) @@ -44,8 +18,8 @@ If you need support for other versions of the compiler, get in touch with us to ## Community channel -Come and talk to us in [our Slack channel](https://app.slack.com/client/T0JK1PCN6/CPMQ9D4H1)! -[Here](http://dockr.ly/slack) is how to join the workspace. +Come and talk to us in [our Slack channel](https://cloud-native.slack.com/archives/C01EARH2ZB3)! +[Here](https://slack.cncf.io/) is where you can join the workspace. ## Contributing diff --git a/build.rs b/build.rs deleted file mode 100644 index 650337a7..00000000 --- a/build.rs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2019 Contributors to the Parsec project. -// SPDX-License-Identifier: Apache-2.0 -use std::env; -use std::path::PathBuf; - -// Minimum version of the TSS 2.0 libraries that this crate can use. -const MINIMUM_VERSION: &str = "2.3.3"; - -fn main() { - if cfg!(not(feature = "docs")) { - let tss2_esys = pkg_config::Config::new() - .atleast_version(MINIMUM_VERSION) - .probe("tss2-esys") - .expect("Error with pkg-config finding tss2-esys."); - let tss2_tctildr = pkg_config::Config::new() - .atleast_version(MINIMUM_VERSION) - .probe("tss2-tctildr") - .expect("Error with pkg-config finding tss2-tctildr."); - let tss2_mu = pkg_config::Config::new() - .atleast_version(MINIMUM_VERSION) - .probe("tss2-mu") - .expect("Error with pkg-config finding tss2-mu."); - - // Check version to automatically set compatability flag. - match tss2_esys.version.chars().next().unwrap() { - '2' => println!("cargo:rustc-cfg=tpm2_tss_version=\"2\""), - '3' => println!("cargo:rustc-cfg=tpm2_tss_version=\"3\""), - major => panic!("Unsupported TSS version: {}", major), - } - - // These three pkg-config files should contain only one include/lib path. - let tss2_esys_include_path = tss2_esys.include_paths[0] - .clone() - .into_os_string() - .into_string() - .expect("Error converting OsString to String."); - let tss2_tctildr_include_path = tss2_tctildr.include_paths[0] - .clone() - .into_os_string() - .into_string() - .expect("Error converting OsString to String."); - let tss2_mu_include_path = tss2_mu.include_paths[0] - .clone() - .into_os_string() - .into_string() - .expect("Error converting OsString to String."); - - let bindings = bindgen::Builder::default() - .clang_arg(format!("-I{}/tss2/", tss2_esys_include_path)) - .clang_arg(format!("-I{}/tss2/", tss2_tctildr_include_path)) - .clang_arg(format!("-I{}/tss2/", tss2_mu_include_path)) - .rustfmt_bindings(true) - .header(format!("{}/tss2/tss2_esys.h", tss2_esys_include_path)) - .header(format!("{}/tss2/tss2_tctildr.h", tss2_tctildr_include_path)) - .header(format!("{}/tss2/tss2_mu.h", tss2_mu_include_path)) - .generate_comments(false) - .derive_default(true) - .generate() - .expect("Unable to generate bindings to TSS2 ESYS APIs."); - - let out_path = PathBuf::from( - env::var("OUT_DIR").expect("Error while getting the OUT_DIR environment variable."), - ); - bindings - .write_to_file(out_path.join("tss2_esys_bindings.rs")) - .unwrap_or_else(|_| panic!("Couldn't write bindings to {:?}!", out_path)); - } -} diff --git a/tss-esapi-sys/Cargo.toml b/tss-esapi-sys/Cargo.toml new file mode 100644 index 00000000..0885f478 --- /dev/null +++ b/tss-esapi-sys/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "tss-esapi-sys" +version = "0.1.0" +authors = ["Parsec Project Contributors"] +edition = "2018" +description = "FFI wrapper around TSS 2.0 Enhanced System API" +readme = "README.md" +keywords = ["tpm", "tss", "esys", "esapi"] +categories = ["api-bindings", "external-ffi-bindings", "cryptography"] +license = "Apache-2.0" +repository = "https://github.com/parallaxsecond/rust-tss-esapi" +documentation = "https://docs.rs/crate/tss-esapi-sys" +links = "tss2-esys" + +[build-dependencies] +bindgen = { version = "0.56.0", optional = true } +pkg-config = "0.3.18" + +[features] +generate-bindings = ["bindgen"] diff --git a/tss-esapi-sys/LICENSE b/tss-esapi-sys/LICENSE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/tss-esapi-sys/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/tss-esapi-sys/README.md b/tss-esapi-sys/README.md new file mode 100644 index 00000000..59977dbc --- /dev/null +++ b/tss-esapi-sys/README.md @@ -0,0 +1,41 @@ + + +# TPM2 Software Stack Rust Wrapper + +This is the lower-level wrapper that exposes a minimal, low-level C +interface to Rust to [TSS](https://github.com/tpm2-software/tpm2-tss). + +## Dependencies + +This crate exposes an interface for the TSS Enhanced System API and thus +links to libraries that expose this interface. In order to allow proper use +of the ESAPI, this FFI layer includes bindings to TCTI and MU headers, and +must therefore link to all of them at build time. + +The paths to the libraries are discovered using `pkg-config` - make sure they +are discoverable in this way on your system. Our build script looks for +`tss2-esys`, `tss2-tctildr` and `tss2-mu`. A minimum version of `2.3.3` is +required for all of them. + +Having installed the open-source implementation libraries at `/usr/local/lib` (by default), it +might happen that `pkg-config` can not find them. Run the following command if that is the +case: +```bash +$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig +``` + +The FFI bindings presented by this crate can be either those commited in the +crate under `src/bindings` or generated on the fly from the library headers +found on the system, at build time. For generating the bindings at build time +please enable the `generate-bindings` feature, as it is not enabled by default. +The build script will then identify the header files using `pkg-config` and +generate fresh bindings from them. + +NOTE: Only a limited set of bindings are committed and their target triplet +is included in the name of the file - if the triplet you require is not +available, feel free to raise a Pull Request to add it or to use build-time +generation of bindings. All the committed bindings **MUST** be generated from +the library version found under the `vendor` submodule. \ No newline at end of file diff --git a/tss-esapi-sys/build.rs b/tss-esapi-sys/build.rs new file mode 100644 index 00000000..feb71c01 --- /dev/null +++ b/tss-esapi-sys/build.rs @@ -0,0 +1,95 @@ +// Copyright 2021 Contributors to the Parsec project. +// SPDX-License-Identifier: Apache-2.0 + +#[cfg(feature = "generate-bindings")] +use std::path::PathBuf; + +const MINIMUM_VERSION: &str = "2.3.3"; + +fn main() { + #[cfg(feature = "generate-bindings")] + { + let out_path = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap()); + let esys_path = out_path.join("tss_esapi_bindings.rs"); + generate_from_system(esys_path); + } + + #[cfg(not(feature = "generate-bindings"))] + { + let supported_platforms = vec![String::from("x86_64-unknown-linux-gnu")]; + let target = std::env::var("TARGET").unwrap(); + + // check if target is in the list of supported ones or panic with nice message + if !supported_platforms.contains(&target) { + panic!(format!("Compilation target ({}) is not part of the supported targets ({:?}). Please compile with the \"generate-bindings\" feature or add support for your platform :)", target, supported_platforms)); + } + + pkg_config::Config::new() + .atleast_version(MINIMUM_VERSION) + .probe("tss2-esys") + .expect("Failed to find tss2-esys library."); + pkg_config::Config::new() + .atleast_version(MINIMUM_VERSION) + .probe("tss2-tctildr") + .expect("Failed to find tss2-tctildr library."); + pkg_config::Config::new() + .atleast_version(MINIMUM_VERSION) + .probe("tss2-mu") + .expect("Failed to find tss2-mu library."); + } +} + +#[cfg(feature = "generate-bindings")] +pub fn generate_from_system(esapi_out: PathBuf) { + let tss2_esys = pkg_config::Config::new() + .atleast_version(MINIMUM_VERSION) + .probe("tss2-esys") + .expect("Failed to find tss2-esys"); + let tss2_tctildr = pkg_config::Config::new() + .atleast_version(MINIMUM_VERSION) + .probe("tss2-tctildr") + .expect("Failed to find tss2-tctildr"); + let tss2_mu = pkg_config::Config::new() + .atleast_version(MINIMUM_VERSION) + .probe("tss2-mu") + .expect("Failed to find tss2-mu"); + + // Check version to automatically set compatability flag. + match tss2_esys.version.chars().next().unwrap() { + '2' => println!("cargo:rustc-cfg=tpm2_tss_version=\"2\""), + '3' => println!("cargo:rustc-cfg=tpm2_tss_version=\"3\""), + major => panic!("Unsupported TSS version: {}", major), + } + + // These three pkg-config files should contain only one include/lib path. + let tss2_esys_include_path = tss2_esys.include_paths[0] + .clone() + .into_os_string() + .into_string() + .expect("Error converting OsString to String."); + let tss2_tctildr_include_path = tss2_tctildr.include_paths[0] + .clone() + .into_os_string() + .into_string() + .expect("Error converting OsString to String."); + let tss2_mu_include_path = tss2_mu.include_paths[0] + .clone() + .into_os_string() + .into_string() + .expect("Error converting OsString to String."); + + bindgen::Builder::default() + .clang_arg(format!("-I{}/tss2/", tss2_esys_include_path)) + .clang_arg(format!("-I{}/tss2/", tss2_tctildr_include_path)) + .clang_arg(format!("-I{}/tss2/", tss2_mu_include_path)) + .rustfmt_bindings(true) + .header(format!("{}/tss2/tss2_esys.h", tss2_esys_include_path)) + .header(format!("{}/tss2/tss2_tctildr.h", tss2_tctildr_include_path)) + .header(format!("{}/tss2/tss2_mu.h", tss2_mu_include_path)) + .generate_comments(false) + .derive_default(true) + .generate() + .expect("Unable to generate bindings to TSS2 ESYS APIs.") + .write_to_file(esapi_out) + .expect("Couldn't write ESYS bindings!"); +} diff --git a/doc_bindings.rs b/tss-esapi-sys/src/bindings/x86_64-unknown-linux-gnu.rs similarity index 88% rename from doc_bindings.rs rename to tss-esapi-sys/src/bindings/x86_64-unknown-linux-gnu.rs index ed0f7b8d..c21d8383 100644 --- a/doc_bindings.rs +++ b/tss-esapi-sys/src/bindings/x86_64-unknown-linux-gnu.rs @@ -1,5 +1,4 @@ -// This file is used to build the crate for generating docs (for docs.rs). -/* automatically generated by rust-bindgen */ +/* automatically generated by rust-bindgen 0.56.0 */ pub const _STDINT_H: u32 = 1; pub const _FEATURES_H: u32 = 1; @@ -565,6 +564,7 @@ pub type uint_fast32_t = ::std::os::raw::c_ulong; pub type uint_fast64_t = ::std::os::raw::c_ulong; pub type intmax_t = __intmax_t; pub type uintmax_t = __uintmax_t; +pub type size_t = ::std::os::raw::c_ulong; pub type wchar_t = ::std::os::raw::c_int; #[repr(C)] #[repr(align(16))] @@ -6981,14 +6981,14 @@ pub type TSS2_TCTI_CONTEXT = TSS2_TCTI_OPAQUE_CONTEXT_BLOB; pub type TSS2_TCTI_TRANSMIT_FCN = ::std::option::Option< unsafe extern "C" fn( tctiContext: *mut TSS2_TCTI_CONTEXT, - size: usize, + size: size_t, command: *const u8, ) -> TSS2_RC, >; pub type TSS2_TCTI_RECEIVE_FCN = ::std::option::Option< unsafe extern "C" fn( tctiContext: *mut TSS2_TCTI_CONTEXT, - size: *mut usize, + size: *mut size_t, response: *mut u8, timeout: i32, ) -> TSS2_RC, @@ -7001,7 +7001,7 @@ pub type TSS2_TCTI_GET_POLL_HANDLES_FCN = ::std::option::Option< unsafe extern "C" fn( tctiContext: *mut TSS2_TCTI_CONTEXT, handles: *mut TSS2_TCTI_POLL_HANDLE, - num_handles: *mut usize, + num_handles: *mut size_t, ) -> TSS2_RC, >; pub type TSS2_TCTI_SET_LOCALITY_FCN = ::std::option::Option< @@ -7017,7 +7017,7 @@ pub type TSS2_TCTI_MAKE_STICKY_FCN = ::std::option::Option< pub type TSS2_TCTI_INIT_FUNC = ::std::option::Option< unsafe extern "C" fn( tctiContext: *mut TSS2_TCTI_CONTEXT, - size: *mut usize, + size: *mut size_t, config: *const ::std::os::raw::c_char, ) -> TSS2_RC, >; @@ -7359,12 +7359,12 @@ impl Default for TSS2L_SYS_AUTH_RESPONSE { } } extern "C" { - pub fn Tss2_Sys_GetContextSize(maxCommandResponseSize: usize) -> usize; + pub fn Tss2_Sys_GetContextSize(maxCommandResponseSize: size_t) -> size_t; } extern "C" { pub fn Tss2_Sys_Initialize( sysContext: *mut TSS2_SYS_CONTEXT, - contextSize: usize, + contextSize: size_t, tctiContext: *mut TSS2_TCTI_CONTEXT, abiVersion: *mut TSS2_ABI_VERSION, ) -> TSS2_RC; @@ -7381,21 +7381,21 @@ extern "C" { extern "C" { pub fn Tss2_Sys_GetDecryptParam( sysContext: *mut TSS2_SYS_CONTEXT, - decryptParamSize: *mut usize, + decryptParamSize: *mut size_t, decryptParamBuffer: *mut *const u8, ) -> TSS2_RC; } extern "C" { pub fn Tss2_Sys_SetDecryptParam( sysContext: *mut TSS2_SYS_CONTEXT, - decryptParamSize: usize, + decryptParamSize: size_t, decryptParamBuffer: *const u8, ) -> TSS2_RC; } extern "C" { pub fn Tss2_Sys_GetCpBuffer( sysContext: *mut TSS2_SYS_CONTEXT, - cpBufferUsedSize: *mut usize, + cpBufferUsedSize: *mut size_t, cpBuffer: *mut *const u8, ) -> TSS2_RC; } @@ -7429,21 +7429,21 @@ extern "C" { extern "C" { pub fn Tss2_Sys_GetEncryptParam( sysContext: *mut TSS2_SYS_CONTEXT, - encryptParamSize: *mut usize, + encryptParamSize: *mut size_t, encryptParamBuffer: *mut *const u8, ) -> TSS2_RC; } extern "C" { pub fn Tss2_Sys_SetEncryptParam( sysContext: *mut TSS2_SYS_CONTEXT, - encryptParamSize: usize, + encryptParamSize: size_t, encryptParamBuffer: *const u8, ) -> TSS2_RC; } extern "C" { pub fn Tss2_Sys_GetRpBuffer( sysContext: *mut TSS2_SYS_CONTEXT, - rpBufferUsedSize: *mut usize, + rpBufferUsedSize: *mut size_t, rpBuffer: *mut *const u8, ) -> TSS2_RC; } @@ -10176,7 +10176,7 @@ extern "C" { pub fn Esys_GetPollHandles( esys_context: *mut ESYS_CONTEXT, handles: *mut *mut TSS2_TCTI_POLL_HANDLE, - count: *mut usize, + count: *mut size_t, ) -> TSS2_RC; } extern "C" { @@ -10187,14 +10187,14 @@ extern "C" { esys_context: *mut ESYS_CONTEXT, object: ESYS_TR, buffer: *mut *mut u8, - buffer_size: *mut usize, + buffer_size: *mut size_t, ) -> TSS2_RC; } extern "C" { pub fn Esys_TR_Deserialize( esys_context: *mut ESYS_CONTEXT, buffer: *const u8, - buffer_size: usize, + buffer_size: size_t, esys_handle: *mut ESYS_TR, ) -> TSS2_RC; } @@ -13404,7 +13404,7 @@ extern "C" { pub const idtype_t_P_ALL: idtype_t = 0; pub const idtype_t_P_PID: idtype_t = 1; pub const idtype_t_P_PGID: idtype_t = 2; -pub type idtype_t = u32; +pub type idtype_t = ::std::os::raw::c_uint; pub type _Float32 = f32; pub type _Float64 = f64; pub type _Float32x = f64; @@ -13527,7 +13527,7 @@ fn bindgen_test_layout_lldiv_t() { ); } extern "C" { - pub fn __ctype_get_mb_cur_max() -> usize; + pub fn __ctype_get_mb_cur_max() -> size_t; } extern "C" { pub fn atof(__nptr: *const ::std::os::raw::c_char) -> f64; @@ -13624,6 +13624,7 @@ pub type uid_t = __uid_t; pub type off_t = __off_t; pub type pid_t = __pid_t; pub type id_t = __id_t; +pub type ssize_t = __ssize_t; pub type daddr_t = __daddr_t; pub type caddr_t = __caddr_t; pub type key_t = __key_t; @@ -14863,7 +14864,7 @@ extern "C" { pub fn initstate( __seed: ::std::os::raw::c_uint, __statebuf: *mut ::std::os::raw::c_char, - __statelen: usize, + __statelen: size_t, ) -> *mut ::std::os::raw::c_char; } extern "C" { @@ -14981,7 +14982,7 @@ extern "C" { pub fn initstate_r( __seed: ::std::os::raw::c_uint, __statebuf: *mut ::std::os::raw::c_char, - __statelen: usize, + __statelen: size_t, __buf: *mut random_data, ) -> ::std::os::raw::c_int; } @@ -15175,17 +15176,17 @@ extern "C" { pub fn alloca(__size: ::std::os::raw::c_ulong) -> *mut ::std::os::raw::c_void; } extern "C" { - pub fn valloc(__size: usize) -> *mut ::std::os::raw::c_void; + pub fn valloc(__size: size_t) -> *mut ::std::os::raw::c_void; } extern "C" { pub fn posix_memalign( __memptr: *mut *mut ::std::os::raw::c_void, - __alignment: usize, - __size: usize, + __alignment: size_t, + __size: size_t, ) -> ::std::os::raw::c_int; } extern "C" { - pub fn aligned_alloc(__alignment: usize, __size: usize) -> *mut ::std::os::raw::c_void; + pub fn aligned_alloc(__alignment: size_t, __size: size_t) -> *mut ::std::os::raw::c_void; } extern "C" { pub fn abort(); @@ -15271,16 +15272,16 @@ extern "C" { pub fn bsearch( __key: *const ::std::os::raw::c_void, __base: *const ::std::os::raw::c_void, - __nmemb: usize, - __size: usize, + __nmemb: size_t, + __size: size_t, __compar: __compar_fn_t, ) -> *mut ::std::os::raw::c_void; } extern "C" { pub fn qsort( __base: *mut ::std::os::raw::c_void, - __nmemb: usize, - __size: usize, + __nmemb: size_t, + __size: size_t, __compar: __compar_fn_t, ); } @@ -15358,7 +15359,7 @@ extern "C" { __decpt: *mut ::std::os::raw::c_int, __sign: *mut ::std::os::raw::c_int, __buf: *mut ::std::os::raw::c_char, - __len: usize, + __len: size_t, ) -> ::std::os::raw::c_int; } extern "C" { @@ -15368,7 +15369,7 @@ extern "C" { __decpt: *mut ::std::os::raw::c_int, __sign: *mut ::std::os::raw::c_int, __buf: *mut ::std::os::raw::c_char, - __len: usize, + __len: size_t, ) -> ::std::os::raw::c_int; } extern "C" { @@ -15378,7 +15379,7 @@ extern "C" { __decpt: *mut ::std::os::raw::c_int, __sign: *mut ::std::os::raw::c_int, __buf: *mut ::std::os::raw::c_char, - __len: usize, + __len: size_t, ) -> ::std::os::raw::c_int; } extern "C" { @@ -15388,27 +15389,35 @@ extern "C" { __decpt: *mut ::std::os::raw::c_int, __sign: *mut ::std::os::raw::c_int, __buf: *mut ::std::os::raw::c_char, - __len: usize, + __len: size_t, ) -> ::std::os::raw::c_int; } extern "C" { - pub fn mblen(__s: *const ::std::os::raw::c_char, __n: usize) -> ::std::os::raw::c_int; + pub fn mblen(__s: *const ::std::os::raw::c_char, __n: size_t) -> ::std::os::raw::c_int; } extern "C" { pub fn mbtowc( __pwc: *mut wchar_t, __s: *const ::std::os::raw::c_char, - __n: usize, + __n: size_t, ) -> ::std::os::raw::c_int; } extern "C" { pub fn wctomb(__s: *mut ::std::os::raw::c_char, __wchar: wchar_t) -> ::std::os::raw::c_int; } extern "C" { - pub fn mbstowcs(__pwcs: *mut wchar_t, __s: *const ::std::os::raw::c_char, __n: usize) -> usize; + pub fn mbstowcs( + __pwcs: *mut wchar_t, + __s: *const ::std::os::raw::c_char, + __n: size_t, + ) -> size_t; } extern "C" { - pub fn wcstombs(__s: *mut ::std::os::raw::c_char, __pwcs: *const wchar_t, __n: usize) -> usize; + pub fn wcstombs( + __s: *mut ::std::os::raw::c_char, + __pwcs: *const wchar_t, + __n: size_t, + ) -> size_t; } extern "C" { pub fn rpmatch(__response: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; @@ -15449,3 +15458,2241 @@ extern "C" { extern "C" { pub fn Tss2_TctiLdr_FreeInfo(info: *mut *mut TSS2_TCTI_INFO); } +extern "C" { + pub fn Tss2_MU_BYTE_Marshal( + src: BYTE, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_BYTE_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut BYTE, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_INT8_Marshal( + src: INT8, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_INT8_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut INT8, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_INT16_Marshal( + src: INT16, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_INT16_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut INT16, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_INT32_Marshal( + src: INT32, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_INT32_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut INT32, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_INT64_Marshal( + src: INT64, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_INT64_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut INT64, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_UINT8_Marshal( + src: UINT8, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_UINT8_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut UINT8, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_UINT16_Marshal( + src: UINT16, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_UINT16_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut UINT16, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_UINT32_Marshal( + src: UINT32, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_UINT32_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut UINT32, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_UINT64_Marshal( + src: UINT64, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_UINT64_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut UINT64, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2_CC_Marshal( + src: TPM2_CC, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2_CC_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2_CC, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2_ST_Marshal( + src: TPM2_ST, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2_ST_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2_ST, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMA_ALGORITHM_Marshal( + src: TPMA_ALGORITHM, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMA_ALGORITHM_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMA_ALGORITHM, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMA_CC_Marshal( + src: TPMA_CC, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMA_CC_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMA_CC, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMA_LOCALITY_Marshal( + src: TPMA_LOCALITY, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMA_LOCALITY_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMA_LOCALITY, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMA_NV_Marshal( + src: TPMA_NV, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMA_NV_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMA_NV, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMA_OBJECT_Marshal( + src: TPMA_OBJECT, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMA_OBJECT_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMA_OBJECT, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMA_PERMANENT_Marshal( + src: TPMA_PERMANENT, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMA_PERMANENT_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMA_PERMANENT, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMA_SESSION_Marshal( + src: TPMA_SESSION, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMA_SESSION_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMA_SESSION, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMA_STARTUP_CLEAR_Marshal( + src: TPMA_STARTUP_CLEAR, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMA_STARTUP_CLEAR_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMA_STARTUP_CLEAR, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_DIGEST_Marshal( + src: *const TPM2B_DIGEST, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_DIGEST_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_DIGEST, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_ATTEST_Marshal( + src: *const TPM2B_ATTEST, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_ATTEST_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_ATTEST, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_NAME_Marshal( + src: *const TPM2B_NAME, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_NAME_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_NAME, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_MAX_NV_BUFFER_Marshal( + src: *const TPM2B_MAX_NV_BUFFER, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_MAX_NV_BUFFER_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_MAX_NV_BUFFER, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_SENSITIVE_DATA_Marshal( + src: *const TPM2B_SENSITIVE_DATA, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_SENSITIVE_DATA_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_SENSITIVE_DATA, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_ECC_PARAMETER_Marshal( + src: *const TPM2B_ECC_PARAMETER, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_ECC_PARAMETER_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_ECC_PARAMETER, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_PUBLIC_KEY_RSA_Marshal( + src: *const TPM2B_PUBLIC_KEY_RSA, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_PUBLIC_KEY_RSA_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_PUBLIC_KEY_RSA, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_PRIVATE_KEY_RSA_Marshal( + src: *const TPM2B_PRIVATE_KEY_RSA, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_PRIVATE_KEY_RSA_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_PRIVATE_KEY_RSA, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_PRIVATE_Marshal( + src: *const TPM2B_PRIVATE, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_PRIVATE_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_PRIVATE, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_CONTEXT_SENSITIVE_Marshal( + src: *const TPM2B_CONTEXT_SENSITIVE, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_CONTEXT_SENSITIVE_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_CONTEXT_SENSITIVE, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_CONTEXT_DATA_Marshal( + src: *const TPM2B_CONTEXT_DATA, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_CONTEXT_DATA_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_CONTEXT_DATA, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_DATA_Marshal( + src: *const TPM2B_DATA, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_DATA_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_DATA, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_SYM_KEY_Marshal( + src: *const TPM2B_SYM_KEY, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_SYM_KEY_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_SYM_KEY, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_ECC_POINT_Marshal( + src: *const TPM2B_ECC_POINT, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_ECC_POINT_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_ECC_POINT, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_NV_PUBLIC_Marshal( + src: *const TPM2B_NV_PUBLIC, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_NV_PUBLIC_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_NV_PUBLIC, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_SENSITIVE_Marshal( + src: *const TPM2B_SENSITIVE, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_SENSITIVE_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_SENSITIVE, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_SENSITIVE_CREATE_Marshal( + src: *const TPM2B_SENSITIVE_CREATE, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_SENSITIVE_CREATE_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_SENSITIVE_CREATE, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_CREATION_DATA_Marshal( + src: *const TPM2B_CREATION_DATA, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_CREATION_DATA_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_CREATION_DATA, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_PUBLIC_Marshal( + src: *const TPM2B_PUBLIC, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_PUBLIC_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_PUBLIC, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_ENCRYPTED_SECRET_Marshal( + src: *const TPM2B_ENCRYPTED_SECRET, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_ENCRYPTED_SECRET_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_ENCRYPTED_SECRET, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_ID_OBJECT_Marshal( + src: *const TPM2B_ID_OBJECT, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_ID_OBJECT_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_ID_OBJECT, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_IV_Marshal( + src: *const TPM2B_IV, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_IV_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_IV, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_AUTH_Marshal( + src: *const TPM2B_AUTH, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_AUTH_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_AUTH, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_EVENT_Marshal( + src: *const TPM2B_EVENT, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_EVENT_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_EVENT, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_MAX_BUFFER_Marshal( + src: *const TPM2B_MAX_BUFFER, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_MAX_BUFFER_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_MAX_BUFFER, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_NONCE_Marshal( + src: *const TPM2B_NONCE, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_NONCE_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_NONCE, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_OPERAND_Marshal( + src: *const TPM2B_OPERAND, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_OPERAND_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_OPERAND, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_TIMEOUT_Marshal( + src: *const TPM2B_TIMEOUT, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_TIMEOUT_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_TIMEOUT, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_TEMPLATE_Marshal( + src: *const TPM2B_TEMPLATE, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2B_TEMPLATE_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPM2B_TEMPLATE, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_CONTEXT_Marshal( + src: *const TPMS_CONTEXT, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_CONTEXT_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_CONTEXT, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_TIME_INFO_Marshal( + src: *const TPMS_TIME_INFO, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_TIME_INFO_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_TIME_INFO, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_ECC_POINT_Marshal( + src: *const TPMS_ECC_POINT, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_ECC_POINT_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_ECC_POINT, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_NV_PUBLIC_Marshal( + src: *const TPMS_NV_PUBLIC, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_NV_PUBLIC_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_NV_PUBLIC, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_ALG_PROPERTY_Marshal( + src: *const TPMS_ALG_PROPERTY, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_ALG_PROPERTY_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_ALG_PROPERTY, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_ALGORITHM_DESCRIPTION_Marshal( + src: *const TPMS_ALGORITHM_DESCRIPTION, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_ALGORITHM_DESCRIPTION_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_ALGORITHM_DESCRIPTION, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_TAGGED_PROPERTY_Marshal( + src: *const TPMS_TAGGED_PROPERTY, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_TAGGED_PROPERTY_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_TAGGED_PROPERTY, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_TAGGED_POLICY_Marshal( + src: *const TPMS_TAGGED_POLICY, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_TAGGED_POLICY_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_TAGGED_POLICY, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_CLOCK_INFO_Marshal( + src: *const TPMS_CLOCK_INFO, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_CLOCK_INFO_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_CLOCK_INFO, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_TIME_ATTEST_INFO_Marshal( + src: *const TPMS_TIME_ATTEST_INFO, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_TIME_ATTEST_INFO_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_TIME_ATTEST_INFO, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_CERTIFY_INFO_Marshal( + src: *const TPMS_CERTIFY_INFO, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_CERTIFY_INFO_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_CERTIFY_INFO, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_COMMAND_AUDIT_INFO_Marshal( + src: *const TPMS_COMMAND_AUDIT_INFO, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_COMMAND_AUDIT_INFO_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_COMMAND_AUDIT_INFO, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_SESSION_AUDIT_INFO_Marshal( + src: *const TPMS_SESSION_AUDIT_INFO, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_SESSION_AUDIT_INFO_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_SESSION_AUDIT_INFO, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_CREATION_INFO_Marshal( + src: *const TPMS_CREATION_INFO, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_CREATION_INFO_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_CREATION_INFO, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_NV_CERTIFY_INFO_Marshal( + src: *const TPMS_NV_CERTIFY_INFO, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_NV_CERTIFY_INFO_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_NV_CERTIFY_INFO, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_AUTH_COMMAND_Marshal( + src: *const TPMS_AUTH_COMMAND, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_AUTH_COMMAND_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_AUTH_COMMAND, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_AUTH_RESPONSE_Marshal( + src: *const TPMS_AUTH_RESPONSE, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_AUTH_RESPONSE_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_AUTH_RESPONSE, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_SENSITIVE_CREATE_Marshal( + src: *const TPMS_SENSITIVE_CREATE, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_SENSITIVE_CREATE_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_SENSITIVE_CREATE, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_SCHEME_HASH_Marshal( + src: *const TPMS_SCHEME_HASH, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_SCHEME_HASH_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_SCHEME_HASH, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_SCHEME_ECDAA_Marshal( + src: *const TPMS_SCHEME_ECDAA, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_SCHEME_ECDAA_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_SCHEME_ECDAA, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_SCHEME_XOR_Marshal( + src: *const TPMS_SCHEME_XOR, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_SCHEME_XOR_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_SCHEME_XOR, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_SIGNATURE_RSA_Marshal( + src: *const TPMS_SIGNATURE_RSA, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_SIGNATURE_RSA_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_SIGNATURE_RSA, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_SIGNATURE_ECC_Marshal( + src: *const TPMS_SIGNATURE_ECC, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_SIGNATURE_ECC_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_SIGNATURE_ECC, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_NV_PIN_COUNTER_PARAMETERS_Marshal( + src: *const TPMS_NV_PIN_COUNTER_PARAMETERS, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_NV_PIN_COUNTER_PARAMETERS_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_NV_PIN_COUNTER_PARAMETERS, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_CONTEXT_DATA_Marshal( + src: *const TPMS_CONTEXT_DATA, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_CONTEXT_DATA_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_CONTEXT_DATA, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_PCR_SELECT_Marshal( + src: *const TPMS_PCR_SELECT, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_PCR_SELECT_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_PCR_SELECT, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_PCR_SELECTION_Marshal( + src: *const TPMS_PCR_SELECTION, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_PCR_SELECTION_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_PCR_SELECTION, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_TAGGED_PCR_SELECT_Marshal( + src: *const TPMS_TAGGED_PCR_SELECT, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_TAGGED_PCR_SELECT_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_TAGGED_PCR_SELECT, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_QUOTE_INFO_Marshal( + src: *const TPMS_QUOTE_INFO, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_QUOTE_INFO_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_QUOTE_INFO, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_CREATION_DATA_Marshal( + src: *const TPMS_CREATION_DATA, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_CREATION_DATA_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_CREATION_DATA, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_ECC_PARMS_Marshal( + src: *const TPMS_ECC_PARMS, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_ECC_PARMS_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_ECC_PARMS, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_ATTEST_Marshal( + src: *const TPMS_ATTEST, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_ATTEST_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_ATTEST, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_ALGORITHM_DETAIL_ECC_Marshal( + src: *const TPMS_ALGORITHM_DETAIL_ECC, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_ALGORITHM_DETAIL_ECC_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_ALGORITHM_DETAIL_ECC, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_CAPABILITY_DATA_Marshal( + src: *const TPMS_CAPABILITY_DATA, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_CAPABILITY_DATA_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_CAPABILITY_DATA, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_KEYEDHASH_PARMS_Marshal( + src: *const TPMS_KEYEDHASH_PARMS, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_KEYEDHASH_PARMS_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_KEYEDHASH_PARMS, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_RSA_PARMS_Marshal( + src: *const TPMS_RSA_PARMS, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_RSA_PARMS_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_RSA_PARMS, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_SYMCIPHER_PARMS_Marshal( + src: *const TPMS_SYMCIPHER_PARMS, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_SYMCIPHER_PARMS_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_SYMCIPHER_PARMS, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_AC_OUTPUT_Marshal( + src: *const TPMS_AC_OUTPUT, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_AC_OUTPUT_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_AC_OUTPUT, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_ID_OBJECT_Marshal( + src: *const TPMS_ID_OBJECT, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_ID_OBJECT_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMS_ID_OBJECT, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPML_CC_Marshal( + src: *const TPML_CC, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPML_CC_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPML_CC, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPML_CCA_Marshal( + src: *const TPML_CCA, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPML_CCA_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPML_CCA, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPML_ALG_Marshal( + src: *const TPML_ALG, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPML_ALG_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPML_ALG, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPML_HANDLE_Marshal( + src: *const TPML_HANDLE, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPML_HANDLE_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPML_HANDLE, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPML_DIGEST_Marshal( + src: *const TPML_DIGEST, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPML_DIGEST_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPML_DIGEST, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPML_DIGEST_VALUES_Marshal( + src: *const TPML_DIGEST_VALUES, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPML_DIGEST_VALUES_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPML_DIGEST_VALUES, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPML_PCR_SELECTION_Marshal( + src: *const TPML_PCR_SELECTION, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPML_PCR_SELECTION_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPML_PCR_SELECTION, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPML_ALG_PROPERTY_Marshal( + src: *const TPML_ALG_PROPERTY, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPML_ALG_PROPERTY_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPML_ALG_PROPERTY, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPML_ECC_CURVE_Marshal( + src: *const TPML_ECC_CURVE, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPML_ECC_CURVE_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPML_ECC_CURVE, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPML_TAGGED_PCR_PROPERTY_Marshal( + src: *const TPML_TAGGED_PCR_PROPERTY, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPML_TAGGED_PCR_PROPERTY_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPML_TAGGED_PCR_PROPERTY, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPML_TAGGED_TPM_PROPERTY_Marshal( + src: *const TPML_TAGGED_TPM_PROPERTY, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPML_TAGGED_TPM_PROPERTY_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPML_TAGGED_TPM_PROPERTY, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPML_INTEL_PTT_PROPERTY_Marshal( + src: *const TPML_INTEL_PTT_PROPERTY, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPML_INTEL_PTT_PROPERTY_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPML_INTEL_PTT_PROPERTY, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPML_AC_CAPABILITIES_Marshal( + src: *const TPML_AC_CAPABILITIES, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPML_AC_CAPABILITIES_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPML_AC_CAPABILITIES, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_HA_Marshal( + src: *const TPMU_HA, + selector_value: u32, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_HA_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + selector_value: u32, + dest: *mut TPMU_HA, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_CAPABILITIES_Marshal( + src: *const TPMU_CAPABILITIES, + selector_value: u32, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_CAPABILITIES_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + selector_value: u32, + dest: *mut TPMU_CAPABILITIES, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_ATTEST_Marshal( + src: *const TPMU_ATTEST, + selector_value: u32, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_ATTEST_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + selector_value: u32, + dest: *mut TPMU_ATTEST, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_SYM_KEY_BITS_Marshal( + src: *const TPMU_SYM_KEY_BITS, + selector_value: u32, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_SYM_KEY_BITS_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + selector_value: u32, + dest: *mut TPMU_SYM_KEY_BITS, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_SYM_MODE_Marshal( + src: *const TPMU_SYM_MODE, + selector_value: u32, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_SYM_MODE_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + selector_value: u32, + dest: *mut TPMU_SYM_MODE, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_SIG_SCHEME_Marshal( + src: *const TPMU_SIG_SCHEME, + selector_value: u32, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_SIG_SCHEME_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + selector_value: u32, + dest: *mut TPMU_SIG_SCHEME, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_KDF_SCHEME_Marshal( + src: *const TPMU_KDF_SCHEME, + selector_value: u32, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_KDF_SCHEME_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + selector_value: u32, + dest: *mut TPMU_KDF_SCHEME, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_ASYM_SCHEME_Marshal( + src: *const TPMU_ASYM_SCHEME, + selector_value: u32, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_ASYM_SCHEME_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + selector_value: u32, + dest: *mut TPMU_ASYM_SCHEME, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_SCHEME_KEYEDHASH_Marshal( + src: *const TPMU_SCHEME_KEYEDHASH, + selector_value: u32, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_SCHEME_KEYEDHASH_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + selector_value: u32, + dest: *mut TPMU_SCHEME_KEYEDHASH, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_SIGNATURE_Marshal( + src: *const TPMU_SIGNATURE, + selector_value: u32, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_SIGNATURE_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + selector_value: u32, + dest: *mut TPMU_SIGNATURE, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_SENSITIVE_COMPOSITE_Marshal( + src: *const TPMU_SENSITIVE_COMPOSITE, + selector_value: u32, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_SENSITIVE_COMPOSITE_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + selector_value: u32, + dest: *mut TPMU_SENSITIVE_COMPOSITE, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_ENCRYPTED_SECRET_Marshal( + src: *const TPMU_ENCRYPTED_SECRET, + selector_value: u32, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_ENCRYPTED_SECRET_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + selector_value: u32, + dest: *mut TPMU_ENCRYPTED_SECRET, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_PUBLIC_PARMS_Marshal( + src: *const TPMU_PUBLIC_PARMS, + selector_value: u32, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_PUBLIC_PARMS_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + selector_value: u32, + dest: *mut TPMU_PUBLIC_PARMS, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_PUBLIC_ID_Marshal( + src: *const TPMU_PUBLIC_ID, + selector_value: u32, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_PUBLIC_ID_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + selector_value: u32, + dest: *mut TPMU_PUBLIC_ID, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_NAME_Marshal( + src: *const TPMU_NAME, + selector_value: u32, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMU_NAME_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + selector_value: u32, + dest: *mut TPMU_NAME, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_HA_Marshal( + src: *const TPMT_HA, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_HA_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMT_HA, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_SYM_DEF_Marshal( + src: *const TPMT_SYM_DEF, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_SYM_DEF_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMT_SYM_DEF, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_SYM_DEF_OBJECT_Marshal( + src: *const TPMT_SYM_DEF_OBJECT, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_SYM_DEF_OBJECT_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMT_SYM_DEF_OBJECT, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_KEYEDHASH_SCHEME_Marshal( + src: *const TPMT_KEYEDHASH_SCHEME, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_KEYEDHASH_SCHEME_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMT_KEYEDHASH_SCHEME, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_SIG_SCHEME_Marshal( + src: *const TPMT_SIG_SCHEME, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_SIG_SCHEME_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMT_SIG_SCHEME, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_KDF_SCHEME_Marshal( + src: *const TPMT_KDF_SCHEME, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_KDF_SCHEME_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMT_KDF_SCHEME, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_ASYM_SCHEME_Marshal( + src: *const TPMT_ASYM_SCHEME, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_ASYM_SCHEME_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMT_ASYM_SCHEME, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_RSA_SCHEME_Marshal( + src: *const TPMT_RSA_SCHEME, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_RSA_SCHEME_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMT_RSA_SCHEME, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_RSA_DECRYPT_Marshal( + src: *const TPMT_RSA_DECRYPT, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_RSA_DECRYPT_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMT_RSA_DECRYPT, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_ECC_SCHEME_Marshal( + src: *const TPMT_ECC_SCHEME, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_ECC_SCHEME_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMT_ECC_SCHEME, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_SIGNATURE_Marshal( + src: *const TPMT_SIGNATURE, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_SIGNATURE_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMT_SIGNATURE, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_SENSITIVE_Marshal( + src: *const TPMT_SENSITIVE, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_SENSITIVE_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMT_SENSITIVE, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_PUBLIC_Marshal( + src: *const TPMT_PUBLIC, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_PUBLIC_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMT_PUBLIC, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_PUBLIC_PARMS_Marshal( + src: *const TPMT_PUBLIC_PARMS, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_PUBLIC_PARMS_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMT_PUBLIC_PARMS, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_TK_CREATION_Marshal( + src: *const TPMT_TK_CREATION, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_TK_CREATION_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMT_TK_CREATION, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_TK_VERIFIED_Marshal( + src: *const TPMT_TK_VERIFIED, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_TK_VERIFIED_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMT_TK_VERIFIED, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_TK_AUTH_Marshal( + src: *const TPMT_TK_AUTH, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_TK_AUTH_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMT_TK_AUTH, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_TK_HASHCHECK_Marshal( + src: *const TPMT_TK_HASHCHECK, + buffer: *mut u8, + buffer_size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMT_TK_HASHCHECK_Unmarshal( + buffer: *const u8, + buffer_size: size_t, + offset: *mut size_t, + dest: *mut TPMT_TK_HASHCHECK, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2_HANDLE_Marshal( + in_: TPM2_HANDLE, + buffer: *mut u8, + size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2_HANDLE_Unmarshal( + buffer: *const u8, + size: size_t, + offset: *mut size_t, + out: *mut TPM2_HANDLE, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMI_ALG_HASH_Marshal( + in_: TPMI_ALG_HASH, + buffer: *mut u8, + size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMI_ALG_HASH_Unmarshal( + buffer: *const u8, + size: size_t, + offset: *mut size_t, + out: *mut TPMI_ALG_HASH, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2_SE_Marshal( + in_: TPM2_SE, + buffer: *mut u8, + size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2_SE_Unmarshal( + buffer: *const u8, + size: size_t, + offset: *mut size_t, + out: *mut TPM2_SE, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2_NT_Marshal( + in_: TPM2_NT, + buffer: *mut u8, + size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPM2_NT_Unmarshal( + buffer: *const u8, + size: size_t, + offset: *mut size_t, + out: *mut TPM2_NT, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_EMPTY_Marshal( + in_: *const TPMS_EMPTY, + buffer: *mut u8, + size: size_t, + offset: *mut size_t, + ) -> TSS2_RC; +} +extern "C" { + pub fn Tss2_MU_TPMS_EMPTY_Unmarshal( + buffer: *const u8, + size: size_t, + offset: *mut size_t, + out: *mut TPMS_EMPTY, + ) -> TSS2_RC; +} diff --git a/tss-esapi-sys/src/lib.rs b/tss-esapi-sys/src/lib.rs new file mode 100644 index 00000000..055f9f82 --- /dev/null +++ b/tss-esapi-sys/src/lib.rs @@ -0,0 +1,32 @@ +// Copyright 2021 Contributors to the Parsec project. +// SPDX-License-Identifier: Apache-2.0 +#![allow( + non_snake_case, + non_camel_case_types, + non_upper_case_globals, + clippy::unseparated_literal_suffix, + improper_ctypes, + missing_debug_implementations, + trivial_casts, + clippy::all, + unused +)] +///! This crate provides a basic interface for accessing the TSS Enhanced +///! System API from Rust. No abstraction is provided beyond what is +///! automatically generated by `bindgen` - the `tss-esapi` crate is the +///! one exposing an idiomatic Rust interface built on top of this FFI. + +// For supported targets: use the generated and committed bindings. +#[cfg(all( + not(feature = "generate-bindings"), + target_arch = "x86_64", + target_os = "linux" +))] +include!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/src/bindings/x86_64-unknown-linux-gnu.rs" +)); + +// If the "generate-bindings" feature is on, use the generated bindings. +#[cfg(feature = "generate-bindings")] +include!(concat!(env!("OUT_DIR"), "/tss_esapi_bindings.rs")); diff --git a/tss-esapi/Cargo.toml b/tss-esapi/Cargo.toml new file mode 100644 index 00000000..a465691f --- /dev/null +++ b/tss-esapi/Cargo.toml @@ -0,0 +1,31 @@ +[package] +name = "tss-esapi" +version = "4.0.10-alpha.2" +authors = ["Parsec Project Contributors"] +edition = "2018" +description = "Rust-native wrapper around TSS 2.0 Enhanced System API" +readme = "README.md" +keywords = ["tpm", "tss", "esys", "esapi"] +categories = ["api-bindings", "external-ffi-bindings", "cryptography"] +license = "Apache-2.0" +repository = "https://github.com/parallaxsecond/rust-tss-esapi" +documentation = "https://docs.rs/crate/tss-esapi" + +[dependencies] +bitfield = "0.13.2" +serde = { version = "1.0.115", features = ["derive"] } +mbox = "0.5.0" +log = "0.4.11" +enumflags2 = "0.6.4" +num-derive = "0.3.2" +num-traits = "0.2.12" +hostname-validator = "1.0.0" +regex = "1.3.9" +zeroize = { version = "1.1.0", features = ["zeroize_derive"] } +tss-esapi-sys = { path = "../tss-esapi-sys" } + +[dev-dependencies] +env_logger = "0.7.1" + +[features] +generate-bindings = ["tss-esapi-sys/generate-bindings"] diff --git a/tss-esapi/LICENSE b/tss-esapi/LICENSE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/tss-esapi/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/tss-esapi/README.md b/tss-esapi/README.md new file mode 100644 index 00000000..18e08da1 --- /dev/null +++ b/tss-esapi/README.md @@ -0,0 +1,27 @@ + + +# TPM2 Software Stack Rust Wrapper + +

+ Crates.io + Code documentation + CI tests +

+ +This is the high-level, Rust idiomatic wrapper crate that exposes an interface +to [TSS](https://github.com/tpm2-software/tpm2-tss). + +This crate depends on the [`tss-esapi-sys`](../tss-esapi-sys/) crate for its +FFI interface. By default, pre-generated bindings are used. If you'd like the +bindings to be generated at build time, please enable either the +`generate-bindings` feature - the FFI bindings will then be generated at build +time using the headers identified on the system. + +Our end-goal is to achieve a fully Rust-native interface that offers strong safety and security guarantees. Check out our [documentation](https://docs.rs/tss-esapi/*/tss_esapi/#notes-on-code-safety) for an overview of our code safety approach. + +## Versioning + +The `tss-esapi` crate is still under development and thus the interface is not stable (despite the version number). As a rule of thumb, all versions marked `alpha` are expected to be short-lived and superseded by a better, more complete interface that relies on breaking changes. \ No newline at end of file diff --git a/src/abstraction/ak.rs b/tss-esapi/src/abstraction/ak.rs similarity index 100% rename from src/abstraction/ak.rs rename to tss-esapi/src/abstraction/ak.rs diff --git a/src/abstraction/ek.rs b/tss-esapi/src/abstraction/ek.rs similarity index 100% rename from src/abstraction/ek.rs rename to tss-esapi/src/abstraction/ek.rs diff --git a/src/abstraction/mod.rs b/tss-esapi/src/abstraction/mod.rs similarity index 100% rename from src/abstraction/mod.rs rename to tss-esapi/src/abstraction/mod.rs diff --git a/src/abstraction/nv.rs b/tss-esapi/src/abstraction/nv.rs similarity index 100% rename from src/abstraction/nv.rs rename to tss-esapi/src/abstraction/nv.rs diff --git a/src/abstraction/transient.rs b/tss-esapi/src/abstraction/transient.rs similarity index 100% rename from src/abstraction/transient.rs rename to tss-esapi/src/abstraction/transient.rs diff --git a/src/constants/algorithm.rs b/tss-esapi/src/constants/algorithm.rs similarity index 100% rename from src/constants/algorithm.rs rename to tss-esapi/src/constants/algorithm.rs diff --git a/src/constants/mod.rs b/tss-esapi/src/constants/mod.rs similarity index 100% rename from src/constants/mod.rs rename to tss-esapi/src/constants/mod.rs diff --git a/src/constants/response_code.rs b/tss-esapi/src/constants/response_code.rs similarity index 100% rename from src/constants/response_code.rs rename to tss-esapi/src/constants/response_code.rs diff --git a/src/constants/tags/mod.rs b/tss-esapi/src/constants/tags/mod.rs similarity index 100% rename from src/constants/tags/mod.rs rename to tss-esapi/src/constants/tags/mod.rs diff --git a/src/constants/tags/property.rs b/tss-esapi/src/constants/tags/property.rs similarity index 100% rename from src/constants/tags/property.rs rename to tss-esapi/src/constants/tags/property.rs diff --git a/src/constants/tags/structure.rs b/tss-esapi/src/constants/tags/structure.rs similarity index 100% rename from src/constants/tags/structure.rs rename to tss-esapi/src/constants/tags/structure.rs diff --git a/src/constants/tss.rs b/tss-esapi/src/constants/tss.rs similarity index 100% rename from src/constants/tss.rs rename to tss-esapi/src/constants/tss.rs diff --git a/src/constants/types.rs b/tss-esapi/src/constants/types.rs similarity index 100% rename from src/constants/types.rs rename to tss-esapi/src/constants/types.rs diff --git a/src/context.rs b/tss-esapi/src/context.rs similarity index 100% rename from src/context.rs rename to tss-esapi/src/context.rs diff --git a/src/context/handle_manager.rs b/tss-esapi/src/context/handle_manager.rs similarity index 100% rename from src/context/handle_manager.rs rename to tss-esapi/src/context/handle_manager.rs diff --git a/src/error.rs b/tss-esapi/src/error.rs similarity index 100% rename from src/error.rs rename to tss-esapi/src/error.rs diff --git a/src/handles/handle.rs b/tss-esapi/src/handles/handle.rs similarity index 100% rename from src/handles/handle.rs rename to tss-esapi/src/handles/handle.rs diff --git a/src/handles/mod.rs b/tss-esapi/src/handles/mod.rs similarity index 100% rename from src/handles/mod.rs rename to tss-esapi/src/handles/mod.rs diff --git a/src/handles/tpm.rs b/tss-esapi/src/handles/tpm.rs similarity index 100% rename from src/handles/tpm.rs rename to tss-esapi/src/handles/tpm.rs diff --git a/src/interface_types/dynamic_handles.rs b/tss-esapi/src/interface_types/dynamic_handles.rs similarity index 100% rename from src/interface_types/dynamic_handles.rs rename to tss-esapi/src/interface_types/dynamic_handles.rs diff --git a/src/interface_types/mod.rs b/tss-esapi/src/interface_types/mod.rs similarity index 100% rename from src/interface_types/mod.rs rename to tss-esapi/src/interface_types/mod.rs diff --git a/src/interface_types/resource_handles.rs b/tss-esapi/src/interface_types/resource_handles.rs similarity index 100% rename from src/interface_types/resource_handles.rs rename to tss-esapi/src/interface_types/resource_handles.rs diff --git a/src/lib.rs b/tss-esapi/src/lib.rs similarity index 90% rename from src/lib.rs rename to tss-esapi/src/lib.rs index eb4ef11a..eaad1a90 100644 --- a/src/lib.rs +++ b/tss-esapi/src/lib.rs @@ -99,25 +99,7 @@ pub use context::Context; pub use error::{Error, Result, WrapperErrorKind}; pub use tcti::Tcti; -#[allow( - non_snake_case, - non_camel_case_types, - non_upper_case_globals, - clippy::unseparated_literal_suffix, - // There is an issue where long double become u128 in extern blocks. Check this issue: - // https://github.com/rust-lang/rust-bindgen/issues/1549 - improper_ctypes, - missing_debug_implementations, - trivial_casts, - clippy::all, -)] -pub mod tss2_esys { - #[cfg(not(feature = "docs"))] - include!(concat!(env!("OUT_DIR"), "/tss2_esys_bindings.rs")); - - #[cfg(feature = "docs")] - include!(concat!(env!("CARGO_MANIFEST_DIR"), "/doc_bindings.rs")); -} +pub use tss_esapi_sys as tss2_esys; pub mod abstraction; pub mod constants; mod context; diff --git a/src/macros/mod.rs b/tss-esapi/src/macros/mod.rs similarity index 100% rename from src/macros/mod.rs rename to tss-esapi/src/macros/mod.rs diff --git a/src/nv/mod.rs b/tss-esapi/src/nv/mod.rs similarity index 100% rename from src/nv/mod.rs rename to tss-esapi/src/nv/mod.rs diff --git a/src/nv/storage/index.rs b/tss-esapi/src/nv/storage/index.rs similarity index 100% rename from src/nv/storage/index.rs rename to tss-esapi/src/nv/storage/index.rs diff --git a/src/nv/storage/mod.rs b/tss-esapi/src/nv/storage/mod.rs similarity index 100% rename from src/nv/storage/mod.rs rename to tss-esapi/src/nv/storage/mod.rs diff --git a/src/nv/storage/public.rs b/tss-esapi/src/nv/storage/public.rs similarity index 100% rename from src/nv/storage/public.rs rename to tss-esapi/src/nv/storage/public.rs diff --git a/src/session.rs b/tss-esapi/src/session.rs similarity index 100% rename from src/session.rs rename to tss-esapi/src/session.rs diff --git a/src/session/attributes.rs b/tss-esapi/src/session/attributes.rs similarity index 100% rename from src/session/attributes.rs rename to tss-esapi/src/session/attributes.rs diff --git a/src/session/specific.rs b/tss-esapi/src/session/specific.rs similarity index 100% rename from src/session/specific.rs rename to tss-esapi/src/session/specific.rs diff --git a/src/structures/buffers.rs b/tss-esapi/src/structures/buffers.rs similarity index 100% rename from src/structures/buffers.rs rename to tss-esapi/src/structures/buffers.rs diff --git a/src/structures/capabilitydata.rs b/tss-esapi/src/structures/capabilitydata.rs similarity index 100% rename from src/structures/capabilitydata.rs rename to tss-esapi/src/structures/capabilitydata.rs diff --git a/src/structures/creation.rs b/tss-esapi/src/structures/creation.rs similarity index 100% rename from src/structures/creation.rs rename to tss-esapi/src/structures/creation.rs diff --git a/src/structures/hash/agile.rs b/tss-esapi/src/structures/hash/agile.rs similarity index 70% rename from src/structures/hash/agile.rs rename to tss-esapi/src/structures/hash/agile.rs index fd73665d..03df4d59 100644 --- a/src/structures/hash/agile.rs +++ b/tss-esapi/src/structures/hash/agile.rs @@ -6,14 +6,26 @@ use crate::tss2_esys::{TPMT_HA, TPMU_HA}; use crate::{Error, Result, WrapperErrorKind}; use std::convert::{TryFrom, TryInto}; -impl TryFrom<(HashingAlgorithm, Digest)> for TPMT_HA { +#[derive(Debug)] +pub struct HashAgile { + algorithm: HashingAlgorithm, + digest: Digest, +} + +impl HashAgile { + pub fn new(algorithm: HashingAlgorithm, digest: Digest) -> Self { + HashAgile { algorithm, digest } + } +} + +impl TryFrom for TPMT_HA { type Error = Error; - fn try_from(digest: (HashingAlgorithm, Digest)) -> Result { - let algid: crate::tss2_esys::TPM2_ALG_ID = digest.0.into(); - let digest_val = digest.1; + fn try_from(ha: HashAgile) -> Result { + let algid: crate::tss2_esys::TPM2_ALG_ID = ha.algorithm.into(); + let digest_val = ha.digest; Ok(TPMT_HA { hashAlg: algid, - digest: match digest.0 { + digest: match ha.algorithm { HashingAlgorithm::Sha1 => TPMU_HA { sha1: digest_val.try_into()?, }, diff --git a/src/structures/hash/mod.rs b/tss-esapi/src/structures/hash/mod.rs similarity index 100% rename from src/structures/hash/mod.rs rename to tss-esapi/src/structures/hash/mod.rs diff --git a/src/structures/lists/digest.rs b/tss-esapi/src/structures/lists/digest.rs similarity index 100% rename from src/structures/lists/digest.rs rename to tss-esapi/src/structures/lists/digest.rs diff --git a/src/structures/lists/digest_values.rs b/tss-esapi/src/structures/lists/digest_values.rs similarity index 90% rename from src/structures/lists/digest_values.rs rename to tss-esapi/src/structures/lists/digest_values.rs index 99ca18d3..40092969 100644 --- a/src/structures/lists/digest_values.rs +++ b/tss-esapi/src/structures/lists/digest_values.rs @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use crate::constants::algorithm::HashingAlgorithm; use crate::structures::Digest; +use crate::structures::HashAgile; use crate::tss2_esys::TPML_DIGEST_VALUES; use crate::{Error, Result}; use std::collections::HashMap; @@ -30,8 +31,8 @@ impl TryFrom for TPML_DIGEST_VALUES { let mut digest_values = digest_values; let mut tss_digest_values: TPML_DIGEST_VALUES = Default::default(); for (digest_hash, digest_val) in digest_values.digests.drain() { - tss_digest_values.digests[tss_digest_values.count as usize] = - (digest_hash, digest_val).try_into()?; + let ha = HashAgile::new(digest_hash, digest_val); + tss_digest_values.digests[tss_digest_values.count as usize] = ha.try_into()?; tss_digest_values.count += 1; } Ok(tss_digest_values) diff --git a/src/structures/lists/mod.rs b/tss-esapi/src/structures/lists/mod.rs similarity index 100% rename from src/structures/lists/mod.rs rename to tss-esapi/src/structures/lists/mod.rs diff --git a/src/structures/lists/pcr_selection.rs b/tss-esapi/src/structures/lists/pcr_selection.rs similarity index 100% rename from src/structures/lists/pcr_selection.rs rename to tss-esapi/src/structures/lists/pcr_selection.rs diff --git a/src/structures/mod.rs b/tss-esapi/src/structures/mod.rs similarity index 98% rename from src/structures/mod.rs rename to tss-esapi/src/structures/mod.rs index 2745008c..b0b63a5d 100644 --- a/src/structures/mod.rs +++ b/tss-esapi/src/structures/mod.rs @@ -66,7 +66,7 @@ pub use self::creation::CreationData; /// The hash section ///////////////////////////////////////////////////////// mod hash; -pub use self::hash::agile; +pub use self::hash::agile::HashAgile; ///////////////////////////////////////////////////////// /// The pcr section ///////////////////////////////////////////////////////// diff --git a/src/structures/names/mod.rs b/tss-esapi/src/structures/names/mod.rs similarity index 100% rename from src/structures/names/mod.rs rename to tss-esapi/src/structures/names/mod.rs diff --git a/src/structures/names/name.rs b/tss-esapi/src/structures/names/name.rs similarity index 100% rename from src/structures/names/name.rs rename to tss-esapi/src/structures/names/name.rs diff --git a/src/structures/pcr/mod.rs b/tss-esapi/src/structures/pcr/mod.rs similarity index 100% rename from src/structures/pcr/mod.rs rename to tss-esapi/src/structures/pcr/mod.rs diff --git a/src/structures/pcr/select.rs b/tss-esapi/src/structures/pcr/select.rs similarity index 100% rename from src/structures/pcr/select.rs rename to tss-esapi/src/structures/pcr/select.rs diff --git a/src/structures/pcr/selection.rs b/tss-esapi/src/structures/pcr/selection.rs similarity index 100% rename from src/structures/pcr/selection.rs rename to tss-esapi/src/structures/pcr/selection.rs diff --git a/src/structures/result.rs b/tss-esapi/src/structures/result.rs similarity index 100% rename from src/structures/result.rs rename to tss-esapi/src/structures/result.rs diff --git a/src/structures/tickets.rs b/tss-esapi/src/structures/tickets.rs similarity index 100% rename from src/structures/tickets.rs rename to tss-esapi/src/structures/tickets.rs diff --git a/src/tcti.rs b/tss-esapi/src/tcti.rs similarity index 100% rename from src/tcti.rs rename to tss-esapi/src/tcti.rs diff --git a/src/utils/mod.rs b/tss-esapi/src/utils/mod.rs similarity index 100% rename from src/utils/mod.rs rename to tss-esapi/src/utils/mod.rs diff --git a/tests/Dockerfile-fedora b/tss-esapi/tests/Dockerfile-fedora similarity index 100% rename from tests/Dockerfile-fedora rename to tss-esapi/tests/Dockerfile-fedora diff --git a/tests/Dockerfile-ubuntu b/tss-esapi/tests/Dockerfile-ubuntu similarity index 100% rename from tests/Dockerfile-ubuntu rename to tss-esapi/tests/Dockerfile-ubuntu diff --git a/tests/abstraction_ak_tests.rs b/tss-esapi/tests/abstraction_ak_tests.rs similarity index 100% rename from tests/abstraction_ak_tests.rs rename to tss-esapi/tests/abstraction_ak_tests.rs diff --git a/tests/abstraction_ek_tests.rs b/tss-esapi/tests/abstraction_ek_tests.rs similarity index 100% rename from tests/abstraction_ek_tests.rs rename to tss-esapi/tests/abstraction_ek_tests.rs diff --git a/tests/abstraction_nv_tests.rs b/tss-esapi/tests/abstraction_nv_tests.rs similarity index 100% rename from tests/abstraction_nv_tests.rs rename to tss-esapi/tests/abstraction_nv_tests.rs diff --git a/tests/algorithm_specifier_tests.rs b/tss-esapi/tests/algorithm_specifier_tests.rs similarity index 100% rename from tests/algorithm_specifier_tests.rs rename to tss-esapi/tests/algorithm_specifier_tests.rs diff --git a/tests/all-fedora.sh b/tss-esapi/tests/all-fedora.sh similarity index 86% rename from tests/all-fedora.sh rename to tss-esapi/tests/all-fedora.sh index d248c1cf..eae7a430 100755 --- a/tests/all-fedora.sh +++ b/tss-esapi/tests/all-fedora.sh @@ -40,14 +40,9 @@ cargo clippy --all-targets --all-features -- -D clippy::all -D clippy::cargo ################### # Build the crate # ################### -RUST_BACKTRACE=1 cargo build +RUST_BACKTRACE=1 cargo build --features generate-bindings ################# # Run the tests # ################# -TEST_TCTI=tabrmd:bus_type=session RUST_BACKTRACE=1 RUST_LOG=info cargo test -- --test-threads=1 --nocapture - -#################### -# Verify doc build # -#################### -cargo doc --features docs --verbose --no-deps +TEST_TCTI=tabrmd:bus_type=session RUST_BACKTRACE=1 RUST_LOG=info cargo test --features generate-bindings -- --test-threads=1 --nocapture diff --git a/tests/all-ubuntu.sh b/tss-esapi/tests/all-ubuntu.sh similarity index 100% rename from tests/all-ubuntu.sh rename to tss-esapi/tests/all-ubuntu.sh diff --git a/tests/common.rs b/tss-esapi/tests/common.rs similarity index 100% rename from tests/common.rs rename to tss-esapi/tests/common.rs diff --git a/tests/context_tests.rs b/tss-esapi/tests/context_tests.rs similarity index 100% rename from tests/context_tests.rs rename to tss-esapi/tests/context_tests.rs diff --git a/tests/handles_handle_test.rs b/tss-esapi/tests/handles_handle_test.rs similarity index 100% rename from tests/handles_handle_test.rs rename to tss-esapi/tests/handles_handle_test.rs diff --git a/tests/handles_tpm_tests.rs b/tss-esapi/tests/handles_tpm_tests.rs similarity index 100% rename from tests/handles_tpm_tests.rs rename to tss-esapi/tests/handles_tpm_tests.rs diff --git a/tests/interface_types_resource_handle_tests.rs b/tss-esapi/tests/interface_types_resource_handle_tests.rs similarity index 100% rename from tests/interface_types_resource_handle_tests.rs rename to tss-esapi/tests/interface_types_resource_handle_tests.rs diff --git a/tests/nv_storage_nv_index_attributes_tests.rs b/tss-esapi/tests/nv_storage_nv_index_attributes_tests.rs similarity index 100% rename from tests/nv_storage_nv_index_attributes_tests.rs rename to tss-esapi/tests/nv_storage_nv_index_attributes_tests.rs diff --git a/tests/nv_storage_nv_index_type_tests.rs b/tss-esapi/tests/nv_storage_nv_index_type_tests.rs similarity index 100% rename from tests/nv_storage_nv_index_type_tests.rs rename to tss-esapi/tests/nv_storage_nv_index_type_tests.rs diff --git a/tests/pcr_selection_list_builder_tests.rs b/tss-esapi/tests/pcr_selection_list_builder_tests.rs similarity index 100% rename from tests/pcr_selection_list_builder_tests.rs rename to tss-esapi/tests/pcr_selection_list_builder_tests.rs diff --git a/tests/pcr_selection_list_tests.rs b/tss-esapi/tests/pcr_selection_list_tests.rs similarity index 100% rename from tests/pcr_selection_list_tests.rs rename to tss-esapi/tests/pcr_selection_list_tests.rs diff --git a/tests/structure_buffers_auth_tests.rs b/tss-esapi/tests/structure_buffers_auth_tests.rs similarity index 100% rename from tests/structure_buffers_auth_tests.rs rename to tss-esapi/tests/structure_buffers_auth_tests.rs diff --git a/tests/structure_buffers_data_tests.rs b/tss-esapi/tests/structure_buffers_data_tests.rs similarity index 100% rename from tests/structure_buffers_data_tests.rs rename to tss-esapi/tests/structure_buffers_data_tests.rs diff --git a/tests/structure_buffers_digest_tests.rs b/tss-esapi/tests/structure_buffers_digest_tests.rs similarity index 100% rename from tests/structure_buffers_digest_tests.rs rename to tss-esapi/tests/structure_buffers_digest_tests.rs diff --git a/tests/structure_buffers_max_buffer_tests.rs b/tss-esapi/tests/structure_buffers_max_buffer_tests.rs similarity index 100% rename from tests/structure_buffers_max_buffer_tests.rs rename to tss-esapi/tests/structure_buffers_max_buffer_tests.rs diff --git a/tests/structure_buffers_nonce_tests.rs b/tss-esapi/tests/structure_buffers_nonce_tests.rs similarity index 100% rename from tests/structure_buffers_nonce_tests.rs rename to tss-esapi/tests/structure_buffers_nonce_tests.rs diff --git a/tests/structure_lists_digest_list_tests.rs b/tss-esapi/tests/structure_lists_digest_list_tests.rs similarity index 100% rename from tests/structure_lists_digest_list_tests.rs rename to tss-esapi/tests/structure_lists_digest_list_tests.rs diff --git a/tests/structures_capabilitydata.rs b/tss-esapi/tests/structures_capabilitydata.rs similarity index 100% rename from tests/structures_capabilitydata.rs rename to tss-esapi/tests/structures_capabilitydata.rs diff --git a/tests/structures_pcr_select_tests.rs b/tss-esapi/tests/structures_pcr_select_tests.rs similarity index 100% rename from tests/structures_pcr_select_tests.rs rename to tss-esapi/tests/structures_pcr_select_tests.rs diff --git a/tests/structures_pcr_selection_tests.rs b/tss-esapi/tests/structures_pcr_selection_tests.rs similarity index 100% rename from tests/structures_pcr_selection_tests.rs rename to tss-esapi/tests/structures_pcr_selection_tests.rs diff --git a/tests/transient_key_context.rs b/tss-esapi/tests/transient_key_context.rs similarity index 100% rename from tests/transient_key_context.rs rename to tss-esapi/tests/transient_key_context.rs diff --git a/tests/utils_tests.rs b/tss-esapi/tests/utils_tests.rs similarity index 100% rename from tests/utils_tests.rs rename to tss-esapi/tests/utils_tests.rs