psanford / tpm-fido

A WebAuthn/U2F token protected by a TPM (Go/Linux)
MIT License
285 stars 17 forks source link

Shift operation with untyped int constant overflows int with 32-bit GOARCH e.g. 386 or arm #22

Closed jfkw closed 1 year ago

jfkw commented 1 year ago

Building with GOARCH=386 or GOARCH=arm fails with an untyped int overflow due to 32-bit int size:

$ git branch -v
* main cd117ce Add detection for missing gui pinentry
$ GOARCH=386 go build
# github.com/psanford/tpm-fido/fidohid
fidohid/fidohid.go:63:19: (1 << 32) - 1 (untyped int constant 4294967295) overflows int

Found when submitting to the openSUSE Open Build Service which builds OS distributions and packages for architectures including i586 and arm.

TPM 2.0 may not be applicable on any 32-bit architectures, or only amd64. A note on supported GOARCH in the README for packagers would be helpful.

Using cd117cecc088cb4fa31f0258a442bbd967dc5b28 - Add detection for missing gui pinentry (Sept 2022)

psanford commented 1 year ago

Builds for 32 bit architectures is now fixed. Thanks!