Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds a TBS TctiNameConf. #545

Merged
merged 1 commit into from
Oct 14, 2024
Merged

Conversation

Superhepper
Copy link
Collaborator

@Superhepper Superhepper commented Sep 13, 2024

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.

Copy link
Member

@ionut-arm ionut-arm left a comment

Choose a reason for hiding this comment

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

Awesome stuff :)

When parallaxsecond#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 parallaxsecond#523 into a
separate commit.

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

Co-authored-by: Thomas Epperson <[email protected]>
Signed-off-by: Jesper Brynolf <[email protected]>
@wiktor-k
Copy link
Collaborator

wiktor-k commented Oct 7, 2024

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 🤔

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? 🤔

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

@uglyoldbob
Copy link
Contributor

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

@wiktor-k
Copy link
Collaborator

wiktor-k commented Oct 7, 2024

I should be able to test it on Saturday morning.

Thank you! 🙏 It would be greatly appreciated!

@Superhepper
Copy link
Collaborator Author

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

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

@wiktor-k
Copy link
Collaborator

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.

@Superhepper Superhepper merged commit 66a901b into parallaxsecond:main Oct 14, 2024
12 checks passed
@uglyoldbob
Copy link
Contributor

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.

@Superhepper
Copy link
Collaborator Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants