Skip to content

Commit

Permalink
Don't need to pass in RPMB to ctl.
Browse files Browse the repository at this point in the history
  • Loading branch information
jiggoha committed Feb 1, 2024
1 parent 5376aac commit 51555b4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions trusted_os/ctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type controlInterface struct {
ota *otaBuffer
}

func (ctl *controlInterface) getStatus(rpmb *RPMB) (s *api.Status) {
func (ctl *controlInterface) getStatus() (s *api.Status) {
version, _ := parseVersion(Version)

s = &api.Status{
Expand All @@ -61,10 +61,10 @@ func (ctl *controlInterface) getStatus(rpmb *RPMB) (s *api.Status) {
Build: Build,
Version: version,
Runtime: fmt.Sprintf("%s %s/%s", runtime.Version(), runtime.GOOS, runtime.GOARCH),
// TODO(jayhou): set IdentityCounter here.
}
if rpmb == nil {
log.Printf("cannot get witness identity counter because no RPMB passed in to controlInterface")

if rpmb := ctl.RPC.RPMB; rpmb == nil {
log.Printf("cannot get witness identity counter because RPMB is nil")
} else {
count, err := rpmb.witnessIdentity()
if err != nil {
Expand All @@ -73,6 +73,7 @@ func (ctl *controlInterface) getStatus(rpmb *RPMB) (s *api.Status) {
s.IdentityCounter = count
}
}

if witnessStatus != nil {
s.Witness = &api.WitnessStatus{
Identity: witnessStatus.Identity,
Expand All @@ -97,7 +98,7 @@ func (ctl *controlInterface) HandleMessage(_ []byte) (_ []byte) {
}

func (ctl *controlInterface) Status(_ []byte) (res []byte) {
res, _ = proto.Marshal(ctl.getStatus(nil))
res, _ = proto.Marshal(ctl.getStatus())
return
}

Expand Down
2 changes: 1 addition & 1 deletion trusted_os/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (r *RPC) Status(_ any, status *api.Status) error {
return errors.New("invalid argument")
}

s := r.Ctl.getStatus(r.RPMB)
s := r.Ctl.getStatus()
*status = *s

return nil
Expand Down

0 comments on commit 51555b4

Please sign in to comment.