rust-tss-esapi icon indicating copy to clipboard operation
rust-tss-esapi copied to clipboard

Adds a TBS TctiNameConf.

Open Superhepper opened this issue 1 year ago • 3 comments

When #477 got merged it became possible to build using a path to the tpm2-tss installation instead of depending on pkg-config.

This made it possible to build under Windows. To further increase the support for the windows platform this commit moves the option for TBS TCTI that is being introduced in #523 into a separate commit.

This commit also updates the documentation regarding building using an installation folder.

Superhepper avatar Sep 13 '24 20:09 Superhepper

Thanks for the PR. It's something that's really needed.

I tried building it on my Windows computer and after making the correct folder structure (setting up correct OpenSSL dirs and moving files around was a chore but doable) I still get the error: couldn't find any v alid shared libraries matching ['clang.dll']... (when doing --generate-bindings without that it complains about unsupported tuple).

I'm wondering how far should the instructions go explaining all steps required :thinking:

Edit: just for the record I fixed that by choco install llvm

Edit 2: everything compiled and I copied dirs where necessary. I've created this sample program:

use tss_esapi::Context;
use tss_esapi::TctiNameConf;

fn main() -> tss_esapi::Result<()> {
    let mut context = Context::new(TctiNameConf::Tbs)?;

    println!("Hello, world: {:?}", context.get_tpm_property(tss_esapi::constants::PropertyTag::DayOfYear)?);
// also get_random
    Ok(())
}

But it fails at runtime:

>cargo run
   Compiling rando-tpm v0.1.0 (C:\Users\test\src\rando-tpm)
    Finished dev [unoptimized + debuginfo] target(s) in 1.62s
     Running `target\debug\rando-tpm.exe`
error: process didn't exit successfully: `target\debug\rando-tpm.exe` (exit code: 0xc0000374, STATUS_HEAP_CORRUPTION)

The tss version is 4.1.0 (actually 55 commits ahead from their master branch).

Any ideas? Maybe downgrading to 4.0.1? :thinking:

I'm wondering if @uglyoldbob can test this PR. It'd be really nice :)

wiktor-k avatar Oct 07 '24 10:10 wiktor-k

@wiktor-k I should be able to test it on Saturday morning.

uglyoldbob avatar Oct 07 '24 12:10 uglyoldbob

I should be able to test it on Saturday morning.

Thank you! :pray: It would be greatly appreciated!

wiktor-k avatar Oct 07 '24 13:10 wiktor-k

I tested it with a test app. And it seems to work fine for me.

https://github.com/Superhepper/rust-tss-esapi-test-app

Superhepper avatar Oct 12 '24 07:10 Superhepper

I tested it with a test app. And it seems to work fine for me.

https://github.com/Superhepper/rust-tss-esapi-test-app

Okay, I'm going to approve it not to have the code bitrot. Still, if you'd be able to confirm it's working even afterwards @uglyoldbob it'd be nice. All in all I don't think this PR is particularly dangerous and it clearly improves things.

wiktor-k avatar Oct 14 '24 08:10 wiktor-k

Oh it looks like tpm2-tss was updated to supported visual studio 2019/2022. I was expecting the bundled feature to still be in this pull request. I'll have to take some more time later to do the support for that.

uglyoldbob avatar Oct 14 '24 11:10 uglyoldbob

No as I

Oh it looks like tpm2-tss was updated to supported visual studio 2019/2022. I was expecting the bundled feature to still be in this pull request. I'll have to take some more time later to do the support for that.

No, as I mentioned. This was only for the TCTI part so that it will be possible to run things you build from an installation folder on windows as well. If you want I can try to adapt the bundled feature code as well?

Superhepper avatar Oct 14 '24 18:10 Superhepper