diff --git a/api/api.go b/api/api.go index fe71a31..cfd959d 100644 --- a/api/api.go +++ b/api/api.go @@ -98,10 +98,10 @@ func (p *Status) Print() string { status.WriteString(fmt.Sprintf("Version ....................: %d (%s)\n", p.Version, time.Unix(int64(p.Version), 0))) status.WriteString(fmt.Sprintf("Runtime ....................: %s\n", p.Runtime)) status.WriteString(fmt.Sprintf("Link .......................: %v\n", p.Link)) + status.WriteString(fmt.Sprintf("IdentityCounter ............: %d", p.IdentityCounter)) if p.Witness != nil { status.WriteString(fmt.Sprintf("Witness/Identity ...........: %v\n", p.Witness.Identity)) status.WriteString(fmt.Sprintf("Witness/IP .................: %v", p.Witness.IP)) - status.WriteString(fmt.Sprintf("Witness/IdentityCounter ....: %d", p.Witness.IdentityCounter)) } else { status.WriteString(fmt.Sprint("Witness ....................: ")) } diff --git a/api/api.pb.go b/api/api.pb.go index 0aed4b4..b106ed1 100644 --- a/api/api.pb.go +++ b/api/api.pb.go @@ -291,6 +291,9 @@ type Status struct { Runtime string `protobuf:"bytes,6,opt,name=Runtime,proto3" json:"Runtime,omitempty"` Link bool `protobuf:"varint,7,opt,name=Link,proto3" json:"Link,omitempty"` Witness *WitnessStatus `protobuf:"bytes,8,opt,name=Witness,proto3" json:"Witness,omitempty"` + // IdentityCounter is incremented when the device is recovered and the device + // needs a new witness identity. + IdentityCounter uint32 `protobuf:"varint,9,opt,name=IdentityCounter,proto3" json:"IdentityCounter,omitempty"` } func (x *Status) Reset() { @@ -381,6 +384,13 @@ func (x *Status) GetWitness() *WitnessStatus { return nil } +func (x *Status) GetIdentityCounter() uint32 { + if x != nil { + return x.IdentityCounter + } + return 0 +} + // WitnessStatus contains witness-applet specific status information. // // This is embedded in the general Status message if the applet has provided @@ -395,9 +405,6 @@ type WitnessStatus struct { Identity string `protobuf:"bytes,1,opt,name=Identity,proto3" json:"Identity,omitempty"` // IP is a string representation of the witness applet's current IP address. IP string `protobuf:"bytes,2,opt,name=IP,proto3" json:"IP,omitempty"` - // IdentityCounter is incremented when the device is recovered and the device - // needs a new witness identity. - IdentityCounter uint32 `protobuf:"varint,3,opt,name=IdentityCounter,proto3" json:"IdentityCounter,omitempty"` } func (x *WitnessStatus) Reset() { @@ -446,13 +453,6 @@ func (x *WitnessStatus) GetIP() string { return "" } -func (x *WitnessStatus) GetIdentityCounter() uint32 { - if x != nil { - return x.IdentityCounter - } - return 0 -} - type Configuration struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -619,7 +619,7 @@ var file_api_proto_rawDesc = []byte{ 0x18, 0x04, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0e, 0x49, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x1a, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x4c, 0x6f, 0x67, 0x49, 0x6e, 0x64, - 0x65, 0x78, 0x22, 0xda, 0x01, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, + 0x65, 0x78, 0x22, 0x84, 0x02, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x12, 0x10, 0x0a, 0x03, 0x48, 0x41, 0x42, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x48, 0x41, 0x42, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x65, 0x76, 0x69, 0x73, @@ -632,14 +632,14 @@ var file_api_proto_rawDesc = []byte{ 0x04, 0x4c, 0x69, 0x6e, 0x6b, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x2c, 0x0a, 0x07, 0x57, 0x69, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x57, 0x69, 0x74, 0x6e, 0x65, 0x73, 0x73, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x07, 0x57, 0x69, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x22, - 0x65, 0x0a, 0x0d, 0x57, 0x69, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x12, 0x1a, 0x0a, 0x08, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x0e, 0x0a, 0x02, - 0x49, 0x50, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x50, 0x12, 0x28, 0x0a, 0x0f, - 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x22, 0xa1, 0x01, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x07, 0x57, 0x69, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x12, + 0x28, 0x0a, 0x0f, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x22, 0x3b, 0x0a, 0x0d, 0x57, 0x69, 0x74, + 0x6e, 0x65, 0x73, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x49, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x49, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x50, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x49, 0x50, 0x22, 0xa1, 0x01, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x48, 0x43, 0x50, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x44, 0x48, 0x43, 0x50, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x50, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x50, 0x12, 0x18, 0x0a, 0x07, diff --git a/api/api.proto b/api/api.proto index 471f4aa..d98b383 100644 --- a/api/api.proto +++ b/api/api.proto @@ -129,6 +129,9 @@ message Status { string Runtime = 6; bool Link = 7; WitnessStatus Witness = 8; + // IdentityCounter is incremented when the device is recovered and the device + // needs a new witness identity. + uint32 IdentityCounter = 9; } /* @@ -145,9 +148,6 @@ message WitnessStatus { string Identity = 1; // IP is a string representation of the witness applet's current IP address. string IP = 2; - // IdentityCounter is incremented when the device is recovered and the device - // needs a new witness identity. - uint32 IdentityCounter = 3; } /* diff --git a/api/rpc/rpc.go b/api/rpc/rpc.go index 9a4545a..19d8a97 100644 --- a/api/rpc/rpc.go +++ b/api/rpc/rpc.go @@ -49,9 +49,6 @@ type WitnessStatus struct { Identity string // IP is the currently-assigned IP address of the witness applet. IP string - // IdentityCounter is incremented when the device is recovered and the device - // needs a new witness identity. - IdentityCounter uint32 } // FirmwareUpdate represents a firmware update. diff --git a/trusted_os/ctl.go b/trusted_os/ctl.go index 5fa8f7e..8ff11a5 100644 --- a/trusted_os/ctl.go +++ b/trusted_os/ctl.go @@ -61,6 +61,7 @@ func getStatus() (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 witnessStatus != nil { s.Witness = &api.WitnessStatus{