google / google/go-tpm

Windows and linux packages are different

Open
#373 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
673
Forks
188
PR merge metrics
No merged PRs in 30d

Description

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](https://github.com/user-attachments/assets/da546b41-e580-4143-838b-6d062e1b2b88)

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

I can use [build constraints](https://pkg.go.dev/go/build#hdr-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,

Contributor guide

Open the contributing guide

Research direction

Start by comparing the OpenTPM entry points and the platform-specific package documentation referenced in the issue. Review Go build constraints and the Windows and Linux TPM implementations to determine whether a common API is feasible. Done means the cross-platform behavior is clearly resolved or the platform limitation is documented with a concrete direction.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
operating-systems, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.