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

Windows and linux packages are different #373

Open
Simkiw opened this issue Sep 26, 2024 · 1 comment
Open

Windows and linux packages are different #373

Simkiw opened this issue Sep 26, 2024 · 1 comment

Comments

@Simkiw
Copy link

Simkiw commented Sep 26, 2024

Hi,

My code which builds correctly on linux does not on windows, as if the packages were not the same based on the OS it is being built upon.
I noticed later that indeed, in the documentation, it is rendered according to the user preference (well according to the user's machine)
2024-09-26_17h47_15

E.g., on windows it's OpenTPM() and on linux it's OpenTPM(string)

I can use build constraints and provide the tag during the build.
That would imply having 2 files, one targeting windows and another linux.

I understand that the reason why they have been seperated is that access to the TPM is different from one OS to another.
It still made me wonder, is there a better way to have a code base that would work regardless of the OS ?

Cheers,

@chrisfenner
Copy link
Member

Hi @Simkiw!

So unfortunately the way you talk to a TPM on Windows and on Linux is pretty fundamentally different in ways that it's not appropriate to try to hide from the user. On Linux you need to pass the path to the TPM device file (usually /dev/tpm0 or /dev/tpmrm0) and on Windows we rely on tbs.dll to provide access to the TPM. The behavior of the OSes under the hood is pretty different too.

I'd recommend checking out #369 which discussed some of the issues with trying to hide the difference between different TPM transports. If you use the new transport packages, you at least won't run into the issue where two different functions share the same name. But you will probably want a build constraint that builds your app for Windows (using transport/windowstpm.Open) and Linux (using transport/linuxtpm.Open) separately.

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

No branches or pull requests

2 participants