google / google/go-tpm

Make a marshallable interface/type constraint

Open
#292 2 comments 0 reactions 0 assignees View on GitHub
tpmdirect
Dominant language
Go
Stars
673
Forks
188
PR merge metrics
No merged PRs in 30d

Description

- [ ] [Marshal](https://github.com/google/go-tpm/blob/50ce9737c31f0789c301c91ff0d246d6f18dd5a6/direct/tpm2/reflect.go#L127) takes interface{} so will panic if you accidentally pass something that is not marshallable.

- Possible improvements:

- Define an interface for types that can be `Marshalled` in a compact way that minimizes code bloat.

- [ ] Type annotations are a bit magic.

- Someone working on this code might get the `gotpm:` type annotations incorrect or slightly incorrect. It would be interesting to look into ways to make it more obvious what to do when introducing new TPM structures from the spec.

Contributor guide

Open the contributing guide

Research direction

Start with direct/tpm2/reflect.go at the Marshal function around line 127, and inspect how interface{} values and gotpm: type annotations are used. Determine a concrete, agreed scope for a marshallable interface or clearer annotation validation; done should include a defined approach that avoids accidental panics and makes TPM structure annotations less error-prone.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.