Skip to content

Commit

Permalink
Fix OS handling of version string (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCutter authored Mar 27, 2024
1 parent 95e31fe commit 447b4d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
10 changes: 1 addition & 9 deletions trusted_os/ctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,11 @@ type controlInterface struct {
}

func getStatus() (s *api.Status) {
version, err := parseVersion(Version)
versionString := "unknown"
if err != nil {
log.Printf("failed to get version: %v", err)
} else {
versionString = version.String()
}

s = &api.Status{
SRKHash: SRKHash,
Revision: Revision,
Build: Build,
Version: versionString,
Version: osVersion.String(),
Runtime: fmt.Sprintf("%s %s/%s", runtime.Version(), runtime.GOOS, runtime.GOARCH),
// TODO(jayhou): set IdentityCounter here.
}
Expand Down
4 changes: 3 additions & 1 deletion trusted_os/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ func main() {
if imx6ul.Native && imx6ul.OCOTP != nil {
imx6ul.OCOTP.Timeout = 100 * time.Millisecond
}
// Strip off v from GitTag so we can semver parse it.
Version = strings.TrimPrefix(Version, "v")

var err error

Expand Down Expand Up @@ -195,7 +197,7 @@ func main() {
log.Fatalf("SM failed to create OS bundle verifier: %v", err)
}

if v, err := semver.NewVersion(strings.TrimPrefix(Version, "v")); err != nil {
if v, err := semver.NewVersion(Version); err != nil {
log.Printf("Failed to parse OS version %q: %v", Version, err)
} else {
osVersion = *v
Expand Down

0 comments on commit 447b4d7

Please sign in to comment.