From 7d10fb79561d620a9f06ba3ef1ec3f34a59c1149 Mon Sep 17 00:00:00 2001 From: Ruoyu Ying Date: Thu, 28 Mar 2024 14:49:48 +0800 Subject: [PATCH] sdk: update golang sdk * provide new implementation that compliant to python and rust Signed-off-by: Ruoyu Ying --- sdk/golang/ccnp/client.go | 173 +++ sdk/golang/ccnp/eventlog/eventlog.go | 166 --- sdk/golang/ccnp/eventlog/eventlog_test.go | 81 -- .../ccnp/eventlog/proto/eventlog-server.pb.go | 208 --- .../ccnp/eventlog/proto/eventlog-server.proto | 27 - .../eventlog/proto/eventlog-server_grpc.pb.go | 105 -- sdk/golang/ccnp/measurement/measurement.go | 190 --- .../ccnp/measurement/measurement_test.go | 230 ---- .../proto/measurement-server.pb.go | 213 --- .../proto/measurement-server.proto | 32 - .../proto/measurement-server_grpc.pb.go | 105 -- sdk/golang/ccnp/proto/ccnp-server.pb.go | 1215 +++++++++++++++++ sdk/golang/ccnp/proto/ccnp-server.proto | 85 ++ sdk/golang/ccnp/proto/ccnp-server_grpc.pb.go | 257 ++++ .../ccnp/quote/proto/quote-server.pb.go | 428 ------ .../ccnp/quote/proto/quote-server.proto | 31 - .../ccnp/quote/proto/quote-server_grpc.pb.go | 105 -- sdk/golang/ccnp/quote/quote.go | 191 --- sdk/golang/ccnp/quote/quote_test.go | 159 --- sdk/golang/ccnp/sdk.go | 137 ++ 20 files changed, 1867 insertions(+), 2271 deletions(-) create mode 100644 sdk/golang/ccnp/client.go delete mode 100644 sdk/golang/ccnp/eventlog/eventlog.go delete mode 100644 sdk/golang/ccnp/eventlog/eventlog_test.go delete mode 100644 sdk/golang/ccnp/eventlog/proto/eventlog-server.pb.go delete mode 100644 sdk/golang/ccnp/eventlog/proto/eventlog-server.proto delete mode 100644 sdk/golang/ccnp/eventlog/proto/eventlog-server_grpc.pb.go delete mode 100644 sdk/golang/ccnp/measurement/measurement.go delete mode 100644 sdk/golang/ccnp/measurement/measurement_test.go delete mode 100644 sdk/golang/ccnp/measurement/proto/measurement-server.pb.go delete mode 100644 sdk/golang/ccnp/measurement/proto/measurement-server.proto delete mode 100644 sdk/golang/ccnp/measurement/proto/measurement-server_grpc.pb.go create mode 100644 sdk/golang/ccnp/proto/ccnp-server.pb.go create mode 100644 sdk/golang/ccnp/proto/ccnp-server.proto create mode 100644 sdk/golang/ccnp/proto/ccnp-server_grpc.pb.go delete mode 100644 sdk/golang/ccnp/quote/proto/quote-server.pb.go delete mode 100644 sdk/golang/ccnp/quote/proto/quote-server.proto delete mode 100644 sdk/golang/ccnp/quote/proto/quote-server_grpc.pb.go delete mode 100644 sdk/golang/ccnp/quote/quote.go delete mode 100644 sdk/golang/ccnp/quote/quote_test.go create mode 100644 sdk/golang/ccnp/sdk.go diff --git a/sdk/golang/ccnp/client.go b/sdk/golang/ccnp/client.go new file mode 100644 index 0000000..c4c8dbe --- /dev/null +++ b/sdk/golang/ccnp/client.go @@ -0,0 +1,173 @@ +/* +* Copyright (c) 2024, Intel Corporation. All rights reserved.
+* SPDX-License-Identifier: Apache-2.0 + */ + +package ccnp + +import ( + "bufio" + context "context" + "log" + "os" + "strings" + "time" + + "github.com/cc-api/cc-trusted-api/common/golang/cctrusted_base" + pb "github.com/cc-api/confidential-cloud-native-primitives/sdk/golang/ccnp/proto" + "google.golang.org/grpc" +) + +const ( + UDS_PATH = "unix:/run/ccnp/uds/ccnp-server.sock" +) + +type Client struct { + client pb.CcnpClient +} + +func NewClient() (Client, error) { + conn, err := grpc.Dial(UDS_PATH, grpc.WithInsecure()) + if err != nil { + log.Fatalf("[GetCCReportFromServer] can not connect to CCNP server UDS at %v with error: %v", UDS_PATH, err) + return Client{}, err + } + + client := pb.NewCcnpClient(conn) + return Client{client: client}, nil +} + +func GetContainerId() string { + var mountinfoFile string = "/proc/self/mountinfo" + var dockerPattern string = "/docker/containers/" + var k8sPattern string = "/kubelet/pods/" + + file, err := os.Open(mountinfoFile) + if err != nil { + log.Fatalf("[GetContainerId] fail to open mountinfo file: %v", err) + } + defer file.Close() + + var lines []string + scanner := bufio.NewScanner(file) + for scanner.Scan() { + lines = append(lines, scanner.Text()) + } + + for _, line := range lines { + /* + * line format: + * ... /var/lib/docker/containers/{container-id}/{file} ... + * sample: + */ + if strings.Contains(line, dockerPattern) { + // /var/lib/docker/containers/{container-id}/{file} + var res = strings.Split(line, dockerPattern) + var res1 = res[len(res)-1] + var ContainerId = strings.Split(res1, "/")[0] + + return ContainerId + } + + /* + * line format: + * ... /var/lib/kubelet/pods/{container-id}/{file} ... + * sample: + * 2958 2938 253:1 /var/lib/kubelet/pods/a45f46f0-20be-45ab-ace6-b77e8e2f062c/containers/busybox/8f8d892c /dev/termination-log rw,relatime - ext4 /dev/vda1 rw,discard,errors=remount-ro + */ + if strings.Contains(line, k8sPattern) { + // /var/lib/kubelet/pods/{container-id}/{file} + var res = strings.Split(line, k8sPattern) + var res1 = res[len(res)-1] + var res2 = strings.Split(res1, "/")[0] + var ContainerId = strings.Replace(res2, "-", "_", -1) + + return ContainerId + } + } + + log.Fatalf("[GetContainerId] no docker or kubernetes container patter found in /proc/self/mountinfo") + return "" +} + +func (cc *Client) GetCCReportFromServer(userData string, nonce string) (pb.GetCcReportResponse, error) { + var ContainerId = GetContainerId() + ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) + defer cancel() + + response, err := cc.client.GetCcReport(ctx, &pb.GetCcReportRequest{ContainerId: ContainerId, Nonce: &nonce, UserData: &userData}) + if err != nil { + log.Fatalf("[GetCCReportFromServer] fail to get cc report with error: %v", err) + } + + return *response, nil +} + +func (cc *Client) GetDefaultAlgorithmFromServer() (pb.GetDefaultAlgorithmResponse, error) { + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + + response, err := cc.client.GetDefaultAlgorithm(ctx, &pb.GetDefaultAlgorithmRequest{}) + if err != nil { + log.Fatalf("[GetDefaultAlgorithm] fail to get default algorithm with error: %v", err) + return pb.GetDefaultAlgorithmResponse{}, err + } + + return *response, nil +} + +func (cc *Client) GetMeasurementCountFromServer() (pb.GetMeasurementCountResponse, error) { + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + + response, err := cc.client.GetMeasurementCount(ctx, &pb.GetMeasurementCountRequest{}) + if err != nil { + log.Fatalf("[GetMeasurementCount] fail to get measurement count with error: %v", err) + return pb.GetMeasurementCountResponse{}, err + } + + return *response, nil +} + +func (cc *Client) GetCCMeasurementFromServer(index int, alg cctrusted_base.TCG_ALG) (pb.GetCcMeasurementResponse, error) { + ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) + defer cancel() + + response, err := cc.client.GetCcMeasurement(ctx, &pb.GetCcMeasurementRequest{ContainerId: GetContainerId(), Index: uint32(index), AlgoId: uint32(alg)}) + if err != nil { + log.Fatalf("[GetCCMeasurement] fail to get measurement with error: %v", err) + return pb.GetCcMeasurementResponse{}, err + } + + return *response, nil +} + +func (cc *Client) GetCCEventLogFromServer(params ...int32) ([]*pb.TcgEventlog, error) { + ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) + defer cancel() + + req := pb.GetCcEventlogRequest{ContainerId: GetContainerId()} + + if len(params) != 0 { + for idx, param := range params { + // first param represents the start + if idx == 0 { + formatted_value := uint32(param) + req.Start = &formatted_value + } + // second param represents the count + if idx == 1 { + formatted_value := uint32(param) + req.Count = &formatted_value + } + } + } + + response, err := cc.client.GetCcEventlog(ctx, &req) + if err != nil { + log.Fatalf("[GetCCEventlog] fail to get event log with error: %v", err) + return nil, err + } + + return response.EventLogs, nil +} diff --git a/sdk/golang/ccnp/eventlog/eventlog.go b/sdk/golang/ccnp/eventlog/eventlog.go deleted file mode 100644 index 36243f6..0000000 --- a/sdk/golang/ccnp/eventlog/eventlog.go +++ /dev/null @@ -1,166 +0,0 @@ -/* -* Copyright (c) 2023, Intel Corporation. All rights reserved.
-* SPDX-License-Identifier: Apache-2.0 - */ - -package eventlog - -import ( - "context" - "encoding/json" - "log" - "os" - "time" - - pb "github.com/intel/confidential-cloud-native-primitives/sdk/golang/ccnp/eventlog/proto" - el "github.com/intel/confidential-cloud-native-primitives/service/eventlog-server/resources" - pkgerrors "github.com/pkg/errors" - "google.golang.org/grpc" -) - -const ( - UDS_PATH = "unix:/run/ccnp/uds/eventlog.sock" -) - -type CCEventLogEntry struct { - RegIdx uint32 - EvtType uint32 - EvtSize uint32 - AlgId uint16 - Event []uint8 - Digest []uint8 -} - -type GetPlatformEventlogOptions struct { - eventlogCategory pb.CATEGORY - startPosition int32 - count int32 -} - -func WithEventlogCategory(eventlogCategory pb.CATEGORY) func(*GetPlatformEventlogOptions) { - return func(opts *GetPlatformEventlogOptions) { - opts.eventlogCategory = eventlogCategory - } -} - -func WithStartPosition(startPosition int32) func(*GetPlatformEventlogOptions) { - return func(opts *GetPlatformEventlogOptions) { - opts.startPosition = startPosition - } -} - -func WithCount(count int32) func(*GetPlatformEventlogOptions) { - return func(opts *GetPlatformEventlogOptions) { - opts.count = count - } -} - -func isEventlogCategoryValid(eventlogCategory pb.CATEGORY) bool { - return eventlogCategory == pb.CATEGORY_TDX_EVENTLOG || eventlogCategory == pb.CATEGORY_TPM_EVENTLOG -} - -func getRawEventlogs(response *pb.GetEventlogReply) ([]byte, error) { - path := response.EventlogDataLoc - if path == "" { - log.Fatalf("[getRawEventlogs] Failed to get eventlog from server") - } - - data, err := os.ReadFile(path) - if err != nil { - log.Fatalf("[getRawEventlogs] Error reading data from %v: %v", path, err) - } - - return data, nil -} - -func parseTdxEventlog(rawEventlog []byte) ([]CCEventLogEntry, error) { - var jsonEventlog = el.TDEventLogs{} - err := json.Unmarshal(rawEventlog, &jsonEventlog) - if err != nil { - log.Fatalf("[parseEventlog] Error unmarshal raw eventlog: %v", err) - } - - rawEventLogList := jsonEventlog.EventLogs - var parsedEventLogList []CCEventLogEntry - for i := 0; i < len(rawEventLogList); i++ { - rawEventlog := rawEventLogList[i] - eventLog := CCEventLogEntry{} - - if rawEventlog.DigestCount < 1 { - continue - } - - eventLog.RegIdx = rawEventlog.Rtmr - eventLog.EvtType = rawEventlog.Etype - eventLog.EvtSize = rawEventlog.EventSize - eventLog.AlgId = rawEventlog.AlgorithmId - eventLog.Event = rawEventlog.Event - eventLog.Digest = []uint8(rawEventlog.Digests[rawEventlog.DigestCount-1]) - parsedEventLogList = append(parsedEventLogList, eventLog) - - } - - return parsedEventLogList, nil -} - -func GetPlatformEventlog(opts ...func(*GetPlatformEventlogOptions)) ([]CCEventLogEntry, error) { - - input := GetPlatformEventlogOptions{eventlogCategory: pb.CATEGORY_TDX_EVENTLOG, startPosition: 0, count: 0} - for _, opt := range opts { - opt(&input) - } - - if !isEventlogCategoryValid(input.eventlogCategory) { - log.Fatalf("[GetPlatformEventlog] Invalid eventlogCategory specified") - } - - if input.eventlogCategory == pb.CATEGORY_TPM_EVENTLOG { - log.Fatalf("[GetPlatformEventlog] TPM to be supported later") - } - - if input.startPosition < 0 { - log.Fatalf("[GetPlatformEventlog] Invalid startPosition specified") - } - - if input.count < 0 { - log.Fatalf("[GetPlatformEventlog] Invalid count specified") - } - - channel, err := grpc.Dial(UDS_PATH, grpc.WithInsecure()) - if err != nil { - log.Fatalf("[GetPlatformEventlog] can not connect to UDS: %v", err) - } - defer channel.Close() - - client := pb.NewEventlogClient(channel) - - ctx, cancel := context.WithTimeout(context.Background(), time.Second) - defer cancel() - - response, err := client.GetEventlog(ctx, &pb.GetEventlogRequest{ - EventlogLevel: pb.LEVEL_PAAS, - EventlogCategory: input.eventlogCategory, - StartPosition: input.startPosition, - Count: input.count, - }) - if err != nil { - log.Fatalf("[GetPlatformEventlog] fail to get Platform Eventlog: %v", err) - } - - switch input.eventlogCategory { - case pb.CATEGORY_TDX_EVENTLOG: - rawEventlog, err := getRawEventlogs(response) - if err != nil { - log.Fatalf("[GetPlatformEventlog] fail to get raw eventlog: %v", err) - } - - return parseTdxEventlog(rawEventlog) - - case pb.CATEGORY_TPM_EVENTLOG: - return nil, pkgerrors.New("[GetPlatformEventlog] vTPM to be supported later") - default: - log.Fatalf("[GetPlatformEventlog] unknown TEE enviroment!") - } - - return nil, nil -} diff --git a/sdk/golang/ccnp/eventlog/eventlog_test.go b/sdk/golang/ccnp/eventlog/eventlog_test.go deleted file mode 100644 index e3f1794..0000000 --- a/sdk/golang/ccnp/eventlog/eventlog_test.go +++ /dev/null @@ -1,81 +0,0 @@ -/* -* Copyright (c) 2023, Intel Corporation. All rights reserved.
-* SPDX-License-Identifier: Apache-2.0 - */ - -package eventlog - -import ( - "testing" - - pb "github.com/intel/confidential-cloud-native-primitives/sdk/golang/ccnp/eventlog/proto" -) - -func TestGetPlatformEventlogDefault(t *testing.T) { - eventlogs, err := GetPlatformEventlog() - - if err != nil { - t.Fatalf("[TestGetPlatformEventlogDefault] get Platform Eventlog error: %v", err) - } - - if len(eventlogs) == 0 { - t.Fatalf("[TestGetPlatformEventlogDefault] error: no eventlog returns") - } - -} - -func TestGetPlatformEventlogWithEventlogCategory(t *testing.T) { - - eventlogs, err := GetPlatformEventlog(WithEventlogCategory(pb.CATEGORY_TDX_EVENTLOG)) - - if err != nil { - t.Fatalf("[TestGetPlatformEventlogWithEventlogCategory] get Platform Eventlog error: %v", err) - } - - if len(eventlogs) == 0 { - t.Fatalf("[TestGetPlatformEventlogWithEventlogCategory] error: no eventlog returns") - } - -} - -func TestGetPlatformEventlogWithStartPosition(t *testing.T) { - - eventlogs, err := GetPlatformEventlog(WithStartPosition(2)) - - if err != nil { - t.Fatalf("[TestGetPlatformEventlogWithEventlogCategory] get Platform Eventlog error: %v", err) - } - - if len(eventlogs) == 0 { - t.Fatalf("[TestGetPlatformEventlogWithEventlogCategory] error: no eventlog returns") - } - -} - -func TestGetPlatformEventlogWithStartPositionAndCount(t *testing.T) { - - eventlogs, err := GetPlatformEventlog(WithStartPosition(2), WithCount(5)) - - if err != nil { - t.Fatalf("[TestGetPlatformEventlogWithStartPositionAndCount] get Platform Eventlog error: %v", err) - } - - if len(eventlogs) != 5 { - t.Fatalf("[TestGetPlatformEventlogWithStartPositionAndCount] error: expected number of logs is 5, retrieved %v", len(eventlogs)) - } - -} - -func TestGetPlatformEventlogWithAllOptions(t *testing.T) { - - eventlogs, err := GetPlatformEventlog(WithEventlogCategory(pb.CATEGORY_TDX_EVENTLOG), WithStartPosition(2), WithCount(3)) - - if err != nil { - t.Fatalf("[TestGetPlatformEventlogWithAllOptions] get Platform Eventlog error: %v", err) - } - - if len(eventlogs) != 3 { - t.Fatalf("[TestGetPlatformEventlogWithAllOptions] error: expected number of logs is 3, retrieved %v", len(eventlogs)) - } - -} diff --git a/sdk/golang/ccnp/eventlog/proto/eventlog-server.pb.go b/sdk/golang/ccnp/eventlog/proto/eventlog-server.pb.go deleted file mode 100644 index 2c0d773..0000000 --- a/sdk/golang/ccnp/eventlog/proto/eventlog-server.pb.go +++ /dev/null @@ -1,208 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: proto/eventlog-server.proto - -package getEventlog - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type CATEGORY int32 - -const ( - CATEGORY_TDX_EVENTLOG CATEGORY = 0 - CATEGORY_TPM_EVENTLOG CATEGORY = 1 -) - -var CATEGORY_name = map[int32]string{ - 0: "TDX_EVENTLOG", - 1: "TPM_EVENTLOG", -} - -var CATEGORY_value = map[string]int32{ - "TDX_EVENTLOG": 0, - "TPM_EVENTLOG": 1, -} - -func (x CATEGORY) String() string { - return proto.EnumName(CATEGORY_name, int32(x)) -} - -func (CATEGORY) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_3d123471d781508e, []int{0} -} - -type LEVEL int32 - -const ( - LEVEL_PAAS LEVEL = 0 - LEVEL_SAAS LEVEL = 1 -) - -var LEVEL_name = map[int32]string{ - 0: "PAAS", - 1: "SAAS", -} - -var LEVEL_value = map[string]int32{ - "PAAS": 0, - "SAAS": 1, -} - -func (x LEVEL) String() string { - return proto.EnumName(LEVEL_name, int32(x)) -} - -func (LEVEL) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_3d123471d781508e, []int{1} -} - -type GetEventlogRequest struct { - EventlogLevel LEVEL `protobuf:"varint,1,opt,name=eventlog_level,json=eventlogLevel,proto3,enum=LEVEL" json:"eventlog_level,omitempty"` - EventlogCategory CATEGORY `protobuf:"varint,2,opt,name=eventlog_category,json=eventlogCategory,proto3,enum=CATEGORY" json:"eventlog_category,omitempty"` - StartPosition int32 `protobuf:"varint,3,opt,name=start_position,json=startPosition,proto3" json:"start_position,omitempty"` - Count int32 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetEventlogRequest) Reset() { *m = GetEventlogRequest{} } -func (m *GetEventlogRequest) String() string { return proto.CompactTextString(m) } -func (*GetEventlogRequest) ProtoMessage() {} -func (*GetEventlogRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_3d123471d781508e, []int{0} -} - -func (m *GetEventlogRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetEventlogRequest.Unmarshal(m, b) -} -func (m *GetEventlogRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetEventlogRequest.Marshal(b, m, deterministic) -} -func (m *GetEventlogRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetEventlogRequest.Merge(m, src) -} -func (m *GetEventlogRequest) XXX_Size() int { - return xxx_messageInfo_GetEventlogRequest.Size(m) -} -func (m *GetEventlogRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetEventlogRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetEventlogRequest proto.InternalMessageInfo - -func (m *GetEventlogRequest) GetEventlogLevel() LEVEL { - if m != nil { - return m.EventlogLevel - } - return LEVEL_PAAS -} - -func (m *GetEventlogRequest) GetEventlogCategory() CATEGORY { - if m != nil { - return m.EventlogCategory - } - return CATEGORY_TDX_EVENTLOG -} - -func (m *GetEventlogRequest) GetStartPosition() int32 { - if m != nil { - return m.StartPosition - } - return 0 -} - -func (m *GetEventlogRequest) GetCount() int32 { - if m != nil { - return m.Count - } - return 0 -} - -type GetEventlogReply struct { - EventlogDataLoc string `protobuf:"bytes,1,opt,name=eventlog_data_loc,json=eventlogDataLoc,proto3" json:"eventlog_data_loc,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetEventlogReply) Reset() { *m = GetEventlogReply{} } -func (m *GetEventlogReply) String() string { return proto.CompactTextString(m) } -func (*GetEventlogReply) ProtoMessage() {} -func (*GetEventlogReply) Descriptor() ([]byte, []int) { - return fileDescriptor_3d123471d781508e, []int{1} -} - -func (m *GetEventlogReply) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetEventlogReply.Unmarshal(m, b) -} -func (m *GetEventlogReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetEventlogReply.Marshal(b, m, deterministic) -} -func (m *GetEventlogReply) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetEventlogReply.Merge(m, src) -} -func (m *GetEventlogReply) XXX_Size() int { - return xxx_messageInfo_GetEventlogReply.Size(m) -} -func (m *GetEventlogReply) XXX_DiscardUnknown() { - xxx_messageInfo_GetEventlogReply.DiscardUnknown(m) -} - -var xxx_messageInfo_GetEventlogReply proto.InternalMessageInfo - -func (m *GetEventlogReply) GetEventlogDataLoc() string { - if m != nil { - return m.EventlogDataLoc - } - return "" -} - -func init() { - proto.RegisterEnum("CATEGORY", CATEGORY_name, CATEGORY_value) - proto.RegisterEnum("LEVEL", LEVEL_name, LEVEL_value) - proto.RegisterType((*GetEventlogRequest)(nil), "GetEventlogRequest") - proto.RegisterType((*GetEventlogReply)(nil), "GetEventlogReply") -} - -func init() { proto.RegisterFile("proto/eventlog-server.proto", fileDescriptor_3d123471d781508e) } - -var fileDescriptor_3d123471d781508e = []byte{ - // 350 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0x51, 0x6b, 0xf2, 0x30, - 0x14, 0x86, 0xed, 0xf7, 0xa9, 0x68, 0x36, 0x5d, 0xcd, 0x76, 0x51, 0xe6, 0x8d, 0x08, 0x03, 0x11, - 0xda, 0x82, 0x83, 0xed, 0x6e, 0xe0, 0xb4, 0x78, 0xd3, 0x4d, 0xa9, 0x22, 0xdb, 0x6e, 0x4a, 0x8c, - 0x59, 0x17, 0x88, 0x4d, 0xd7, 0x9e, 0x16, 0xfc, 0x67, 0xfb, 0x79, 0xa3, 0xd1, 0x4e, 0xe7, 0xee, - 0x4e, 0x9f, 0xf7, 0x2d, 0x79, 0x92, 0x83, 0xda, 0x51, 0x2c, 0x41, 0xda, 0x2c, 0x63, 0x21, 0x08, - 0x19, 0x98, 0x09, 0x8b, 0x33, 0x16, 0x5b, 0x8a, 0x76, 0xbf, 0x34, 0x84, 0x27, 0x0c, 0x9c, 0x7d, - 0xe8, 0xb1, 0xcf, 0x94, 0x25, 0x80, 0x4d, 0xd4, 0x2c, 0xfa, 0xbe, 0x60, 0x19, 0x13, 0x86, 0xd6, - 0xd1, 0x7a, 0xcd, 0x41, 0xd5, 0x72, 0x9d, 0xa5, 0xe3, 0x7a, 0x8d, 0x22, 0x75, 0xf3, 0x10, 0xdf, - 0xa1, 0xd6, 0x4f, 0x9d, 0x12, 0x60, 0x81, 0x8c, 0xb7, 0xc6, 0x3f, 0xf5, 0x47, 0xdd, 0x1a, 0x0d, - 0x17, 0xce, 0x64, 0xea, 0xbd, 0x7a, 0x7a, 0xd1, 0x19, 0xed, 0x2b, 0xf8, 0x06, 0x35, 0x13, 0x20, - 0x31, 0xf8, 0x91, 0x4c, 0x38, 0x70, 0x19, 0x1a, 0xff, 0x3b, 0x5a, 0xaf, 0xe2, 0x35, 0x14, 0x9d, - 0xed, 0x21, 0xbe, 0x42, 0x15, 0x2a, 0xd3, 0x10, 0x8c, 0xb2, 0x4a, 0x77, 0x1f, 0xdd, 0x07, 0xa4, - 0xff, 0x32, 0x8f, 0xc4, 0x16, 0xf7, 0x8f, 0x44, 0xd6, 0x04, 0x88, 0x2f, 0x24, 0x55, 0xea, 0x75, - 0xef, 0xa2, 0x08, 0xc6, 0x04, 0x88, 0x2b, 0x69, 0xdf, 0x42, 0xb5, 0x42, 0x0d, 0xeb, 0xe8, 0x7c, - 0x31, 0x7e, 0xf1, 0x9d, 0xa5, 0xf3, 0xbc, 0x70, 0xa7, 0x13, 0xbd, 0xa4, 0xc8, 0xec, 0xe9, 0x40, - 0xb4, 0x7e, 0x1b, 0x55, 0xd4, 0xe5, 0x71, 0x0d, 0x95, 0x67, 0xc3, 0xe1, 0x5c, 0x2f, 0xe5, 0xd3, - 0x3c, 0x9f, 0xb4, 0xc1, 0x08, 0xd5, 0x0a, 0x13, 0x7c, 0x8f, 0xce, 0x8e, 0xc4, 0xf0, 0xa5, 0xf5, - 0xf7, 0x81, 0xaf, 0x5b, 0xd6, 0xa9, 0x7b, 0xb7, 0xf4, 0x48, 0xde, 0xfc, 0x80, 0xc3, 0x47, 0xba, - 0xb2, 0xa8, 0xdc, 0xd8, 0x3c, 0x04, 0x26, 0x6c, 0x2a, 0xc3, 0x77, 0xbe, 0x66, 0x21, 0x70, 0x22, - 0x4c, 0x2a, 0x64, 0xba, 0x36, 0x43, 0x02, 0x3c, 0x63, 0x66, 0x14, 0xf3, 0x0d, 0xcf, 0xa7, 0xc4, - 0xce, 0x57, 0xca, 0x29, 0x3b, 0xdd, 0xb1, 0xbd, 0xdb, 0x7c, 0x70, 0x38, 0x69, 0x55, 0x55, 0xe8, - 0xf6, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x51, 0xe1, 0x30, 0x36, 0x15, 0x02, 0x00, 0x00, -} diff --git a/sdk/golang/ccnp/eventlog/proto/eventlog-server.proto b/sdk/golang/ccnp/eventlog/proto/eventlog-server.proto deleted file mode 100644 index 2d17846..0000000 --- a/sdk/golang/ccnp/eventlog/proto/eventlog-server.proto +++ /dev/null @@ -1,27 +0,0 @@ -syntax = "proto3"; -option go_package = "github.com/intel/confidential-cloud-native-primitives/service/eventlog-server/proto/getEventlog"; - -enum CATEGORY { - TDX_EVENTLOG = 0; - TPM_EVENTLOG = 1; -} - -enum LEVEL { - PAAS = 0; - SAAS = 1; -} - -message GetEventlogRequest { - LEVEL eventlog_level = 1; - CATEGORY eventlog_category = 2; - int32 start_position = 3; - int32 count = 4; -} - -message GetEventlogReply { - string eventlog_data_loc = 1; -} - -service Eventlog { - rpc GetEventlog (GetEventlogRequest) returns (GetEventlogReply) {} -} diff --git a/sdk/golang/ccnp/eventlog/proto/eventlog-server_grpc.pb.go b/sdk/golang/ccnp/eventlog/proto/eventlog-server_grpc.pb.go deleted file mode 100644 index fa97032..0000000 --- a/sdk/golang/ccnp/eventlog/proto/eventlog-server_grpc.pb.go +++ /dev/null @@ -1,105 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.2.0 -// - protoc v3.11.4 -// source: proto/eventlog-server.proto - -package getEventlog - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -// EventlogClient is the client API for Eventlog service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type EventlogClient interface { - GetEventlog(ctx context.Context, in *GetEventlogRequest, opts ...grpc.CallOption) (*GetEventlogReply, error) -} - -type eventlogClient struct { - cc grpc.ClientConnInterface -} - -func NewEventlogClient(cc grpc.ClientConnInterface) EventlogClient { - return &eventlogClient{cc} -} - -func (c *eventlogClient) GetEventlog(ctx context.Context, in *GetEventlogRequest, opts ...grpc.CallOption) (*GetEventlogReply, error) { - out := new(GetEventlogReply) - err := c.cc.Invoke(ctx, "/Eventlog/GetEventlog", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// EventlogServer is the server API for Eventlog service. -// All implementations must embed UnimplementedEventlogServer -// for forward compatibility -type EventlogServer interface { - GetEventlog(context.Context, *GetEventlogRequest) (*GetEventlogReply, error) - mustEmbedUnimplementedEventlogServer() -} - -// UnimplementedEventlogServer must be embedded to have forward compatible implementations. -type UnimplementedEventlogServer struct { -} - -func (UnimplementedEventlogServer) GetEventlog(context.Context, *GetEventlogRequest) (*GetEventlogReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetEventlog not implemented") -} -func (UnimplementedEventlogServer) mustEmbedUnimplementedEventlogServer() {} - -// UnsafeEventlogServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to EventlogServer will -// result in compilation errors. -type UnsafeEventlogServer interface { - mustEmbedUnimplementedEventlogServer() -} - -func RegisterEventlogServer(s grpc.ServiceRegistrar, srv EventlogServer) { - s.RegisterService(&Eventlog_ServiceDesc, srv) -} - -func _Eventlog_GetEventlog_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetEventlogRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(EventlogServer).GetEventlog(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/Eventlog/GetEventlog", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(EventlogServer).GetEventlog(ctx, req.(*GetEventlogRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// Eventlog_ServiceDesc is the grpc.ServiceDesc for Eventlog service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Eventlog_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "Eventlog", - HandlerType: (*EventlogServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetEventlog", - Handler: _Eventlog_GetEventlog_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "proto/eventlog-server.proto", -} diff --git a/sdk/golang/ccnp/measurement/measurement.go b/sdk/golang/ccnp/measurement/measurement.go deleted file mode 100644 index 89b3ddc..0000000 --- a/sdk/golang/ccnp/measurement/measurement.go +++ /dev/null @@ -1,190 +0,0 @@ -/* -* Copyright (c) 2023, Intel Corporation. All rights reserved.
-* SPDX-License-Identifier: Apache-2.0 - */ - -package measurement - -import ( - "bytes" - "context" - "encoding/base64" - "encoding/binary" - "log" - "time" - - pb "github.com/intel/confidential-cloud-native-primitives/sdk/golang/ccnp/measurement/proto" - pkgerrors "github.com/pkg/errors" - "google.golang.org/grpc" -) - -const ( - UDS_PATH = "unix:/run/ccnp/uds/measurement.sock" - TDX_REPORT_LEN = 1024 -) - -type GetPlatformMeasurementOptions struct { - measurementType pb.CATEGORY - reportData string - registerIndex int32 -} - -type TDReportInfo struct { - TDReportRaw [TDX_REPORT_LEN]uint8 // full TD report - TDReport TDReportStruct -} - -type TDReportStruct struct { - //REPORTMACSTRUCT - ReportType [4]uint8 - Reserved1 [12]uint8 - CpuSvn [16]uint8 - TeeTcbInfoHash [48]uint8 - TeeInfoHash [48]uint8 - ReportData [64]uint8 - Reserved2 [32]uint8 - Mac [32]uint8 - - //TEE_TCB_INFO - Mrseam [48]uint8 - Mrseamsigner [48]uint8 - TeeTcbSvn [16]uint8 - SeamAttributes [8]uint8 - - //RESERVED - Reserved3 [17]uint8 - - //TDINFO_STRUCT - TdAttributes [8]uint8 - Xfam [8]uint8 - Mrtd [48]uint8 - Mrconfigid [48]uint8 - Mrowner [48]uint8 - Mrownerconfig [48]uint8 - Rtmrs [192]uint8 - Reserved4 [112]uint8 -} - -type TDXRtmrInfo struct { - TDXRtmrRaw []uint8 -} - -type TPMReportInfo struct { - TPMReportRaw []uint8 - TPMReport TPMReportStruct -} - -type TPMReportStruct struct{} - -func isMeasurementTypeValid(measurementType pb.CATEGORY) bool { - return measurementType == pb.CATEGORY_TEE_REPORT || measurementType == pb.CATEGORY_TDX_RTMR || measurementType == pb.CATEGORY_TPM -} - -func WithMeasurementType(measurementType pb.CATEGORY) func(*GetPlatformMeasurementOptions) { - return func(opts *GetPlatformMeasurementOptions) { - opts.measurementType = measurementType - } -} - -func WithReportData(reportData string) func(*GetPlatformMeasurementOptions) { - return func(opts *GetPlatformMeasurementOptions) { - opts.reportData = reportData - } -} - -func WithRegisterIndex(registerIndex int32) func(*GetPlatformMeasurementOptions) { - return func(opts *GetPlatformMeasurementOptions) { - opts.registerIndex = registerIndex - } -} - -func GetPlatformMeasurement(opts ...func(*GetPlatformMeasurementOptions)) (interface{}, error) { - input := GetPlatformMeasurementOptions{measurementType: pb.CATEGORY_TEE_REPORT, reportData: "", registerIndex: 0} - for _, opt := range opts { - opt(&input) - } - - if !isMeasurementTypeValid(input.measurementType) { - log.Fatalf("[GetPlatformMeasurement] Invalid measurementType specified") - } - - if input.measurementType == pb.CATEGORY_TPM { - log.Fatalf("[GetPlatformMeasurement] TPM to be supported later") - } - - if len(input.reportData) > 64 { - log.Fatalf("[GetPlatformMeasurement] Invalid reportData specified") - } - - if input.registerIndex < 0 || input.registerIndex > 16 { - log.Fatalf("[GetPlatformMeasurement] Invalid registerIndex specified") - } - - channel, err := grpc.Dial(UDS_PATH, grpc.WithInsecure()) - if err != nil { - log.Fatalf("[GetPlatformMeasurement] can not connect to UDS: %v", err) - } - defer channel.Close() - - client := pb.NewMeasurementClient(channel) - - ctx, cancel := context.WithTimeout(context.Background(), time.Second) - defer cancel() - - response, err := client.GetMeasurement(ctx, &pb.GetMeasurementRequest{ - MeasurementType: pb.TYPE_PAAS, - MeasurementCategory: input.measurementType, - ReportData: input.reportData, - RegisterIndex: input.registerIndex, - }) - - if err != nil { - log.Fatalf("[GetPlatformMeasurement] fail to get Platform Measurement: %v", err) - } - - measurement, err := base64.StdEncoding.DecodeString(response.Measurement) - if err != nil { - log.Fatalf("[GetPlatformMeasurement] decode tdreport error: %v", err) - } - - switch input.measurementType { - case pb.CATEGORY_TEE_REPORT: - //TODO: need to get the type of TEE: TDX, SEV, vTPM etc. - var tdReportInfo = TDReportInfo{} - err = binary.Read(bytes.NewReader(measurement[0:TDX_REPORT_LEN]), binary.LittleEndian, &tdReportInfo.TDReportRaw) - if err != nil { - log.Fatalf("[parseTDXQuote] fail to parse quote cert data: %v", err) - } - tdReportInfo.TDReport = parseTDXReport(measurement) - return tdReportInfo, nil - case pb.CATEGORY_TDX_RTMR: - var tdxRtmrInfo = TDXRtmrInfo{} - tdxRtmrInfo.TDXRtmrRaw = measurement - return tdxRtmrInfo, nil - case pb.CATEGORY_TPM: - return "", pkgerrors.New("[GetPlatformMeasurement] TPM to be supported later") - default: - log.Fatalf("[GetPlatformMeasurement] unknown TEE enviroment!") - } - - return "", pkgerrors.New("[GetPlatformMeasurement] unknown TEE enviroment!") -} - -func parseTDXReport(report []byte) TDReportStruct { - var tdreport = TDReportStruct{} - err := binary.Read(bytes.NewReader(report[0:TDX_REPORT_LEN]), binary.LittleEndian, &tdreport) - if err != nil { - log.Fatalf("[parseTDXReport] fail to parse tdreport: %v", err) - } - - return tdreport -} - -func parseTPMReport(report []byte) (interface{}, error) { - return nil, pkgerrors.New("TPM to be supported later.") -} - -func GetContainerMeasurement() (interface{}, error) { - // TODO: add Container Measurement support later - return nil, pkgerrors.New("Container Measurement support to be implemented later.") -} diff --git a/sdk/golang/ccnp/measurement/measurement_test.go b/sdk/golang/ccnp/measurement/measurement_test.go deleted file mode 100644 index cb5aa65..0000000 --- a/sdk/golang/ccnp/measurement/measurement_test.go +++ /dev/null @@ -1,230 +0,0 @@ -/* -* Copyright (c) 2023, Intel Corporation. All rights reserved.
-* SPDX-License-Identifier: Apache-2.0 - */ - -package measurement - -import ( - "testing" - - pb "github.com/intel/confidential-cloud-native-primitives/sdk/golang/ccnp/measurement/proto" -) - -const ( - EXPECTED_REPORT_DATA = "abcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefgh" - EXPECTED_REPORT_DATA_SHORT = "abcd" - TDREPORT_TYPE_LENGTH = 4 - TDREPORT_TYPE_BYTE1 = 129 - CATEGORY_UNKNOWN = 3 - TDX_RTMR_INDEX_UNKNOWN = 4 - EXPECTED_TDX_REPORT_LEN = 1024 - TEE_TYPE_TDX = 129 - TDX_TCB_SVN_LENGTH = 16 - TDX_MRSEAM_LENGTH = 48 - TDX_MRSEAMSINGER_LENGTH = 48 - TDX_SEAM_ATTRIBUTES_LENGTH = 8 - TDX_TD_ATTRIBUTES_LENGTH = 8 - TDX_XFAM_LENGTH = 8 - TDX_MRTD_LENGTH = 48 - TDX_MRCONFIGID_LENGTH = 48 - TDX_MROWNER_LENGTH = 48 - TDX_MROWNERCONFIG_LENGTH = 48 - TDX_RTMR_LENGTH = 48 - TDX_RTMRS_LENGTH = 192 - TDX_REPORT_DATA_LENGTH = 64 -) - -func parseTDXReportAndEvaluate(r TDReportInfo, reportData string, t *testing.T) { - if len(r.TDReportRaw) != EXPECTED_TDX_REPORT_LEN { - t.Fatalf("[parseTDXReportAndEvaluate] wrong TDReport size, retrieved: %v, expected: %v", len(r.TDReportRaw), EXPECTED_TDX_REPORT_LEN) - } - - tdreport := r.TDReport - - if len(tdreport.ReportType) != TDREPORT_TYPE_LENGTH { - t.Fatalf("[parseTDXReportAndEvaluate] wrong TDReport Report Type length, retrieved: %v, expected: %v", len(tdreport.ReportType), TDREPORT_TYPE_LENGTH) - } - - if tdreport.ReportType[0] != TDREPORT_TYPE_BYTE1 { - t.Fatalf("[parseTDXReportAndEvaluate] wrong TDReport ReportType[0], retrieved: %v, expected: %v", tdreport.ReportType[0], TDREPORT_TYPE_BYTE1) - } - - if len(tdreport.TeeTcbSvn) != TDX_TCB_SVN_LENGTH { - t.Fatalf("[parseTDXReportAndEvaluate] wrong TDReport TEE TCB SVN length, retrieved: %v, expected: %v", len(tdreport.TeeTcbSvn), TDX_TCB_SVN_LENGTH) - } - - if len(tdreport.Mrseam) != TDX_MRSEAM_LENGTH { - t.Fatalf("[parseTDXReportAndEvaluate] wrong TDReport Mrseam length, retrieved: %v, expected: %v", len(tdreport.Mrseam), TDX_MRSEAM_LENGTH) - } - - if len(tdreport.Mrseamsigner) != TDX_MRSEAMSINGER_LENGTH { - t.Fatalf("[parseTDXReportAndEvaluate] wrong TDReport Mrseamsigner length, retrieved: %v, expected: %v", len(tdreport.Mrseamsigner), TDX_MRSEAMSINGER_LENGTH) - } - - if len(tdreport.SeamAttributes) != TDX_SEAM_ATTRIBUTES_LENGTH { - t.Fatalf("[parseTDXReportAndEvaluate] wrong TDReport SeamAttributes length, retrieved: %v, expected: %v", len(tdreport.SeamAttributes), TDX_SEAM_ATTRIBUTES_LENGTH) - } - - if len(tdreport.TdAttributes) != TDX_TD_ATTRIBUTES_LENGTH { - t.Fatalf("[parseTDXReportAndEvaluate] wrong TDReport TdAttributes length, retrieved: %v, expected: %v", len(tdreport.TdAttributes), TDX_TD_ATTRIBUTES_LENGTH) - } - - if len(tdreport.Xfam) != TDX_XFAM_LENGTH { - t.Fatalf("[parseTDXReportAndEvaluate] wrong TDReport Xfam length, retrieved: %v, expected: %v", len(tdreport.Xfam), TDX_XFAM_LENGTH) - } - - if len(tdreport.Mrtd) != TDX_MRTD_LENGTH { - t.Fatalf("[parseTDXReportAndEvaluate] wrong TDReport Mrtd length, retrieved: %v, expected: %v", len(tdreport.Mrtd), TDX_MRTD_LENGTH) - } - - if len(tdreport.Mrconfigid) != TDX_MRCONFIGID_LENGTH { - t.Fatalf("[parseTDXReportAndEvaluate] wrong TDReport Mrconfigid length, retrieved: %v, expected: %v", len(tdreport.Mrconfigid), TDX_MRCONFIGID_LENGTH) - } - - if len(tdreport.Mrowner) != TDX_MROWNER_LENGTH { - t.Fatalf("[parseTDXReportAndEvaluate] wrong TDReport Mrowner length, retrieved: %v, expected: %v", len(tdreport.Mrowner), TDX_MROWNER_LENGTH) - } - - if len(tdreport.Mrownerconfig) != TDX_MROWNERCONFIG_LENGTH { - t.Fatalf("[parseTDXReportAndEvaluate] wrong TDReport Mrownerconfig length, retrieved: %v, expected: %v", len(tdreport.Mrownerconfig), TDX_MROWNERCONFIG_LENGTH) - } - - if len(tdreport.Rtmrs) != TDX_RTMRS_LENGTH { - t.Fatalf("[parseTDXReportAndEvaluate] wrong TDReport Rtmrs length, retrieved: %v, expected: %v", len(tdreport.Rtmrs), TDX_RTMRS_LENGTH) - } - - if len(tdreport.ReportData) != TDX_REPORT_DATA_LENGTH { - t.Fatalf("[parseTDXReportAndEvaluate] wrong TDReport Data length, retrieved: %v, expected: %v", len(tdreport.ReportData), TDX_REPORT_DATA_LENGTH) - } - - if len(reportData) != 0 { - if string(tdreport.ReportData[:len(reportData)]) != reportData { - t.Fatalf("[parseTDXReportAndEvaluate], report data retrieved = %s, expected %s", - tdreport.ReportData, reportData) - } - } else { - var empty_report_data [64]uint8 - if tdreport.ReportData != empty_report_data { - t.Fatalf("[parseTDXReportAndEvaluate], report data retrieved = %v, expected empty string", - tdreport.ReportData) - } - } -} - -func parseTDXRtmrAndEvaluate(r TDXRtmrInfo, t *testing.T) { - if len(r.TDXRtmrRaw) != TDX_RTMR_LENGTH { - t.Fatalf("[parseTDXRtmrAndEvaluate] wrong RTMT size, retrieved: %v, expected: %v", len(r.TDXRtmrRaw), TDX_RTMR_LENGTH) - } -} - -func TestGetPlatformMeasurementTDReportDefault(t *testing.T) { - ret, err := GetPlatformMeasurement() - if err != nil { - t.Fatalf("[TestGetPlatformMeasurementTDReportDefault] get Platform Measurement error: %v", err) - } - - switch ret.(type) { - case TDReportInfo: - var r, _ = ret.(TDReportInfo) - parseTDXReportAndEvaluate(r, "", t) - default: - t.Fatalf("[TestGetPlatformMeasurementTDReportDefault] unknown TEE enviroment!") - } -} - -func TestGetPlatformMeasurementTDReportCategoryOnly(t *testing.T) { - ret, err := GetPlatformMeasurement(WithMeasurementType(pb.CATEGORY_TEE_REPORT)) - if err != nil { - t.Fatalf("[TestGetPlatformMeasurementTDReportCategoryOnly] get Platform Measurement error: %v", err) - } - - switch ret.(type) { - case TDReportInfo: - var r, _ = ret.(TDReportInfo) - parseTDXReportAndEvaluate(r, "", t) - - default: - t.Fatalf("[TestGetPlatformMeasurementTDReportCategoryOnly] unknown TEE enviroment!") - } -} - -func TestGetPlatformMeasurementTDReportCategoryAndEmptyReportData(t *testing.T) { - ret, err := GetPlatformMeasurement(WithMeasurementType(pb.CATEGORY_TEE_REPORT), WithReportData("")) - if err != nil { - t.Fatalf("[TestGetPlatformMeasurementTDReportCategoryAndReportData] get Platform Measurement error: %v", err) - } - - switch ret.(type) { - case TDReportInfo: - var r, _ = ret.(TDReportInfo) - parseTDXReportAndEvaluate(r, "", t) - - default: - t.Fatalf("[TestGetPlatformMeasurementTDReportCategoryAndReportData] unknown TEE enviroment!") - } -} - -func TestGetPlatformMeasurementTDReportCategoryAndReportData(t *testing.T) { - ret, err := GetPlatformMeasurement(WithMeasurementType(pb.CATEGORY_TEE_REPORT), WithReportData(EXPECTED_REPORT_DATA)) - if err != nil { - t.Fatalf("[TestGetPlatformMeasurementTDReportCategoryAndReportData] get Platform Measurement error: %v", err) - } - - switch ret.(type) { - case TDReportInfo: - var r, _ = ret.(TDReportInfo) - parseTDXReportAndEvaluate(r, EXPECTED_REPORT_DATA, t) - - default: - t.Fatalf("[TestGetPlatformMeasurementTDReportCategoryAndReportData] unknown TEE enviroment!") - } -} - -func TestGetPlatformMeasurementTDReportCategoryAndShortReportData(t *testing.T) { - ret, err := GetPlatformMeasurement(WithMeasurementType(pb.CATEGORY_TEE_REPORT), WithReportData(EXPECTED_REPORT_DATA_SHORT)) - if err != nil { - t.Fatalf("[TestGetPlatformMeasurementTDReportCategoryAndShortReportData] get Platform Measurement error: %v", err) - } - - switch ret.(type) { - case TDReportInfo: - var r, _ = ret.(TDReportInfo) - parseTDXReportAndEvaluate(r, EXPECTED_REPORT_DATA_SHORT, t) - - default: - t.Fatalf("[TestGetPlatformMeasurementTDReportCategoryAndShortReportData] unknown TEE enviroment!") - } -} - -func TestGetPlatformMeasurementRTMRWithMeasurementType(t *testing.T) { - ret, err := GetPlatformMeasurement(WithMeasurementType(pb.CATEGORY_TDX_RTMR)) - if err != nil { - t.Fatalf("[TestGetPlatformMeasurementRTMRWithMeasurementType] get Platform Measurement error: %v", err) - } - - switch ret.(type) { - case TDXRtmrInfo: - var r, _ = ret.(TDXRtmrInfo) - parseTDXRtmrAndEvaluate(r, t) - - default: - t.Fatalf("[TestGetPlatformMeasurementRTMRWithMeasurementType] unknown TEE enviroment!") - } -} - -func TestGetPlatformMeasurementRTMRWithMeasurementTypeAndIndex(t *testing.T) { - ret, err := GetPlatformMeasurement(WithMeasurementType(pb.CATEGORY_TDX_RTMR), WithRegisterIndex(1)) - if err != nil { - t.Fatalf("[TestGetPlatformMeasurementRTMRWithMeasurementTypeAndIndex] get Platform Measurement error: %v", err) - } - - switch ret.(type) { - case TDXRtmrInfo: - var r, _ = ret.(TDXRtmrInfo) - parseTDXRtmrAndEvaluate(r, t) - - default: - t.Fatalf("[TestGetPlatformMeasurementRTMRWithMeasurementTypeAndIndex] unknown TEE enviroment!") - } -} diff --git a/sdk/golang/ccnp/measurement/proto/measurement-server.pb.go b/sdk/golang/ccnp/measurement/proto/measurement-server.pb.go deleted file mode 100644 index a8c6c12..0000000 --- a/sdk/golang/ccnp/measurement/proto/measurement-server.pb.go +++ /dev/null @@ -1,213 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: proto/measurement-server.proto - -package getMeasurement - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type TYPE int32 - -const ( - TYPE_PAAS TYPE = 0 - TYPE_SAAS TYPE = 1 -) - -var TYPE_name = map[int32]string{ - 0: "PAAS", - 1: "SAAS", -} - -var TYPE_value = map[string]int32{ - "PAAS": 0, - "SAAS": 1, -} - -func (x TYPE) String() string { - return proto.EnumName(TYPE_name, int32(x)) -} - -func (TYPE) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_52ee6f800ca253e4, []int{0} -} - -type CATEGORY int32 - -const ( - CATEGORY_TEE_REPORT CATEGORY = 0 - CATEGORY_TPM CATEGORY = 1 - CATEGORY_TDX_RTMR CATEGORY = 2 -) - -var CATEGORY_name = map[int32]string{ - 0: "TEE_REPORT", - 1: "TPM", - 2: "TDX_RTMR", -} - -var CATEGORY_value = map[string]int32{ - "TEE_REPORT": 0, - "TPM": 1, - "TDX_RTMR": 2, -} - -func (x CATEGORY) String() string { - return proto.EnumName(CATEGORY_name, int32(x)) -} - -func (CATEGORY) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_52ee6f800ca253e4, []int{1} -} - -type GetMeasurementRequest struct { - MeasurementType TYPE `protobuf:"varint,1,opt,name=measurement_type,json=measurementType,proto3,enum=measurement.TYPE" json:"measurement_type,omitempty"` - MeasurementCategory CATEGORY `protobuf:"varint,2,opt,name=measurement_category,json=measurementCategory,proto3,enum=measurement.CATEGORY" json:"measurement_category,omitempty"` - ReportData string `protobuf:"bytes,3,opt,name=report_data,json=reportData,proto3" json:"report_data,omitempty"` - RegisterIndex int32 `protobuf:"varint,4,opt,name=register_index,json=registerIndex,proto3" json:"register_index,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetMeasurementRequest) Reset() { *m = GetMeasurementRequest{} } -func (m *GetMeasurementRequest) String() string { return proto.CompactTextString(m) } -func (*GetMeasurementRequest) ProtoMessage() {} -func (*GetMeasurementRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_52ee6f800ca253e4, []int{0} -} - -func (m *GetMeasurementRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetMeasurementRequest.Unmarshal(m, b) -} -func (m *GetMeasurementRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetMeasurementRequest.Marshal(b, m, deterministic) -} -func (m *GetMeasurementRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetMeasurementRequest.Merge(m, src) -} -func (m *GetMeasurementRequest) XXX_Size() int { - return xxx_messageInfo_GetMeasurementRequest.Size(m) -} -func (m *GetMeasurementRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetMeasurementRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetMeasurementRequest proto.InternalMessageInfo - -func (m *GetMeasurementRequest) GetMeasurementType() TYPE { - if m != nil { - return m.MeasurementType - } - return TYPE_PAAS -} - -func (m *GetMeasurementRequest) GetMeasurementCategory() CATEGORY { - if m != nil { - return m.MeasurementCategory - } - return CATEGORY_TEE_REPORT -} - -func (m *GetMeasurementRequest) GetReportData() string { - if m != nil { - return m.ReportData - } - return "" -} - -func (m *GetMeasurementRequest) GetRegisterIndex() int32 { - if m != nil { - return m.RegisterIndex - } - return 0 -} - -type GetMeasurementReply struct { - Measurement string `protobuf:"bytes,1,opt,name=measurement,proto3" json:"measurement,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetMeasurementReply) Reset() { *m = GetMeasurementReply{} } -func (m *GetMeasurementReply) String() string { return proto.CompactTextString(m) } -func (*GetMeasurementReply) ProtoMessage() {} -func (*GetMeasurementReply) Descriptor() ([]byte, []int) { - return fileDescriptor_52ee6f800ca253e4, []int{1} -} - -func (m *GetMeasurementReply) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetMeasurementReply.Unmarshal(m, b) -} -func (m *GetMeasurementReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetMeasurementReply.Marshal(b, m, deterministic) -} -func (m *GetMeasurementReply) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetMeasurementReply.Merge(m, src) -} -func (m *GetMeasurementReply) XXX_Size() int { - return xxx_messageInfo_GetMeasurementReply.Size(m) -} -func (m *GetMeasurementReply) XXX_DiscardUnknown() { - xxx_messageInfo_GetMeasurementReply.DiscardUnknown(m) -} - -var xxx_messageInfo_GetMeasurementReply proto.InternalMessageInfo - -func (m *GetMeasurementReply) GetMeasurement() string { - if m != nil { - return m.Measurement - } - return "" -} - -func init() { - proto.RegisterEnum("measurement.TYPE", TYPE_name, TYPE_value) - proto.RegisterEnum("measurement.CATEGORY", CATEGORY_name, CATEGORY_value) - proto.RegisterType((*GetMeasurementRequest)(nil), "measurement.GetMeasurementRequest") - proto.RegisterType((*GetMeasurementReply)(nil), "measurement.GetMeasurementReply") -} - -func init() { proto.RegisterFile("proto/measurement-server.proto", fileDescriptor_52ee6f800ca253e4) } - -var fileDescriptor_52ee6f800ca253e4 = []byte{ - // 379 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0x86, 0xe3, 0x36, 0x40, 0x3a, 0x01, 0x63, 0xb6, 0x54, 0xb2, 0x7a, 0x00, 0xcb, 0x12, 0x52, - 0x54, 0xc9, 0xb6, 0x28, 0x07, 0x2e, 0x5c, 0x42, 0x6b, 0x15, 0x0e, 0x51, 0xad, 0xed, 0x1e, 0x12, - 0x2e, 0xd6, 0xc6, 0x1e, 0xcc, 0x4a, 0xfe, 0x62, 0xbd, 0x8e, 0xf0, 0x2f, 0xe6, 0x6f, 0x20, 0x3b, - 0x44, 0xac, 0x51, 0xd4, 0xdb, 0xe8, 0x99, 0x8f, 0x9d, 0x77, 0xf6, 0x85, 0x37, 0xb5, 0xac, 0x54, - 0x15, 0x14, 0xc8, 0x9b, 0x56, 0x62, 0x81, 0xa5, 0xf2, 0x1a, 0x94, 0x3b, 0x94, 0xfe, 0x90, 0x20, - 0x73, 0x2d, 0xe3, 0xfe, 0x36, 0xe0, 0xe2, 0x0e, 0xd5, 0xea, 0x1f, 0xa2, 0xf8, 0xb3, 0xc5, 0x46, - 0x91, 0x4f, 0x60, 0x69, 0x85, 0xb1, 0xea, 0x6a, 0xb4, 0x0d, 0xc7, 0x58, 0x98, 0xd7, 0xaf, 0x7c, - 0x2d, 0xe1, 0xb3, 0x4d, 0x14, 0xd2, 0x97, 0x1a, 0x61, 0x5d, 0x8d, 0xe4, 0x0b, 0xbc, 0xd6, 0xbb, - 0x13, 0xae, 0x30, 0xab, 0x64, 0x67, 0x9f, 0x0c, 0x13, 0x2e, 0x46, 0x13, 0x6e, 0x96, 0x2c, 0xbc, - 0xbb, 0xa7, 0x1b, 0x7a, 0xae, 0xd1, 0x9b, 0xbf, 0x1d, 0xe4, 0x2d, 0xcc, 0x25, 0xd6, 0x95, 0x54, - 0x71, 0xca, 0x15, 0xb7, 0x4f, 0x1d, 0x63, 0x71, 0x46, 0x61, 0x8f, 0x6e, 0xb9, 0xe2, 0xe4, 0x1d, - 0x98, 0x12, 0x33, 0xd1, 0x28, 0x94, 0xb1, 0x28, 0x53, 0xfc, 0x65, 0x4f, 0x1d, 0x63, 0xf1, 0x84, - 0xbe, 0x38, 0xd0, 0xaf, 0x3d, 0x74, 0x3f, 0xc2, 0xf9, 0xff, 0x42, 0xeb, 0xbc, 0x23, 0x0e, 0xe8, - 0xf7, 0x18, 0x14, 0x9e, 0x51, 0x1d, 0x5d, 0x5d, 0xc2, 0xb4, 0xd7, 0x48, 0x66, 0x30, 0x8d, 0x96, - 0xcb, 0x07, 0x6b, 0xd2, 0x47, 0x0f, 0x7d, 0x64, 0x5c, 0xbd, 0x87, 0xd9, 0x61, 0x7b, 0x62, 0x02, - 0xb0, 0x30, 0x8c, 0x69, 0x18, 0xdd, 0x53, 0x66, 0x4d, 0xc8, 0x33, 0x38, 0x65, 0xd1, 0xca, 0x32, - 0xc8, 0x73, 0x98, 0xb1, 0xdb, 0x75, 0x4c, 0xd9, 0x8a, 0x5a, 0x27, 0xd7, 0x19, 0xcc, 0xb5, 0x25, - 0xc8, 0x1a, 0xcc, 0xf1, 0x5a, 0xc4, 0x1d, 0x1d, 0xe7, 0xe8, 0xe7, 0x5c, 0x3a, 0x8f, 0xd6, 0xd4, - 0x79, 0xe7, 0x4e, 0x3e, 0x67, 0xdf, 0x30, 0x13, 0xea, 0x47, 0xbb, 0xf5, 0x93, 0xaa, 0x08, 0x44, - 0xa9, 0x30, 0x0f, 0x92, 0xaa, 0xfc, 0x2e, 0x52, 0x2c, 0x95, 0xe0, 0xb9, 0x97, 0xe4, 0x55, 0x9b, - 0x7a, 0x25, 0x57, 0x62, 0x87, 0x5e, 0x2d, 0x45, 0x21, 0xfa, 0xa8, 0x09, 0x7a, 0xb7, 0x88, 0x04, - 0x8f, 0x38, 0x28, 0xd8, 0x5b, 0x2b, 0x1b, 0xbd, 0xb7, 0x7d, 0x3a, 0xd0, 0x0f, 0x7f, 0x02, 0x00, - 0x00, 0xff, 0xff, 0x72, 0x3f, 0x43, 0x37, 0x79, 0x02, 0x00, 0x00, -} diff --git a/sdk/golang/ccnp/measurement/proto/measurement-server.proto b/sdk/golang/ccnp/measurement/proto/measurement-server.proto deleted file mode 100644 index cb9af2e..0000000 --- a/sdk/golang/ccnp/measurement/proto/measurement-server.proto +++ /dev/null @@ -1,32 +0,0 @@ -syntax = "proto3"; -option go_package = "github.com/intel/confidential-cloud-native-primitives/service/measurement-server/proto/getMeasurement"; - -package measurement; - - -enum TYPE { - PAAS = 0; - SAAS = 1; -} - -enum CATEGORY { - TEE_REPORT = 0; - TPM = 1; - TDX_RTMR = 2; -} - -message GetMeasurementRequest { - TYPE measurement_type = 1; - CATEGORY measurement_category = 2; - string report_data = 3; - int32 register_index = 4; - -} - -message GetMeasurementReply { - string measurement = 1; -} - -service Measurement { - rpc GetMeasurement (GetMeasurementRequest) returns (GetMeasurementReply) {} -} diff --git a/sdk/golang/ccnp/measurement/proto/measurement-server_grpc.pb.go b/sdk/golang/ccnp/measurement/proto/measurement-server_grpc.pb.go deleted file mode 100644 index 1465aa0..0000000 --- a/sdk/golang/ccnp/measurement/proto/measurement-server_grpc.pb.go +++ /dev/null @@ -1,105 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.2.0 -// - protoc v3.11.4 -// source: proto/measurement-server.proto - -package getMeasurement - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -// MeasurementClient is the client API for Measurement service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type MeasurementClient interface { - GetMeasurement(ctx context.Context, in *GetMeasurementRequest, opts ...grpc.CallOption) (*GetMeasurementReply, error) -} - -type measurementClient struct { - cc grpc.ClientConnInterface -} - -func NewMeasurementClient(cc grpc.ClientConnInterface) MeasurementClient { - return &measurementClient{cc} -} - -func (c *measurementClient) GetMeasurement(ctx context.Context, in *GetMeasurementRequest, opts ...grpc.CallOption) (*GetMeasurementReply, error) { - out := new(GetMeasurementReply) - err := c.cc.Invoke(ctx, "/measurement.Measurement/GetMeasurement", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MeasurementServer is the server API for Measurement service. -// All implementations must embed UnimplementedMeasurementServer -// for forward compatibility -type MeasurementServer interface { - GetMeasurement(context.Context, *GetMeasurementRequest) (*GetMeasurementReply, error) - mustEmbedUnimplementedMeasurementServer() -} - -// UnimplementedMeasurementServer must be embedded to have forward compatible implementations. -type UnimplementedMeasurementServer struct { -} - -func (UnimplementedMeasurementServer) GetMeasurement(context.Context, *GetMeasurementRequest) (*GetMeasurementReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetMeasurement not implemented") -} -func (UnimplementedMeasurementServer) mustEmbedUnimplementedMeasurementServer() {} - -// UnsafeMeasurementServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to MeasurementServer will -// result in compilation errors. -type UnsafeMeasurementServer interface { - mustEmbedUnimplementedMeasurementServer() -} - -func RegisterMeasurementServer(s grpc.ServiceRegistrar, srv MeasurementServer) { - s.RegisterService(&Measurement_ServiceDesc, srv) -} - -func _Measurement_GetMeasurement_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetMeasurementRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MeasurementServer).GetMeasurement(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/measurement.Measurement/GetMeasurement", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MeasurementServer).GetMeasurement(ctx, req.(*GetMeasurementRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// Measurement_ServiceDesc is the grpc.ServiceDesc for Measurement service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Measurement_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "measurement.Measurement", - HandlerType: (*MeasurementServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetMeasurement", - Handler: _Measurement_GetMeasurement_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "proto/measurement-server.proto", -} diff --git a/sdk/golang/ccnp/proto/ccnp-server.pb.go b/sdk/golang/ccnp/proto/ccnp-server.pb.go new file mode 100644 index 0000000..7333ee2 --- /dev/null +++ b/sdk/golang/ccnp/proto/ccnp-server.pb.go @@ -0,0 +1,1215 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v4.25.3 +// source: proto/ccnp-server.proto + +package ccnp + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type HealthCheckResponse_ServingStatus int32 + +const ( + HealthCheckResponse_UNKNOWN HealthCheckResponse_ServingStatus = 0 + HealthCheckResponse_SERVING HealthCheckResponse_ServingStatus = 1 + HealthCheckResponse_NOT_SERVING HealthCheckResponse_ServingStatus = 2 + HealthCheckResponse_SERVICE_UNKNOWN HealthCheckResponse_ServingStatus = 3 +) + +// Enum value maps for HealthCheckResponse_ServingStatus. +var ( + HealthCheckResponse_ServingStatus_name = map[int32]string{ + 0: "UNKNOWN", + 1: "SERVING", + 2: "NOT_SERVING", + 3: "SERVICE_UNKNOWN", + } + HealthCheckResponse_ServingStatus_value = map[string]int32{ + "UNKNOWN": 0, + "SERVING": 1, + "NOT_SERVING": 2, + "SERVICE_UNKNOWN": 3, + } +) + +func (x HealthCheckResponse_ServingStatus) Enum() *HealthCheckResponse_ServingStatus { + p := new(HealthCheckResponse_ServingStatus) + *p = x + return p +} + +func (x HealthCheckResponse_ServingStatus) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (HealthCheckResponse_ServingStatus) Descriptor() protoreflect.EnumDescriptor { + return file_proto_ccnp_server_proto_enumTypes[0].Descriptor() +} + +func (HealthCheckResponse_ServingStatus) Type() protoreflect.EnumType { + return &file_proto_ccnp_server_proto_enumTypes[0] +} + +func (x HealthCheckResponse_ServingStatus) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use HealthCheckResponse_ServingStatus.Descriptor instead. +func (HealthCheckResponse_ServingStatus) EnumDescriptor() ([]byte, []int) { + return file_proto_ccnp_server_proto_rawDescGZIP(), []int{1, 0} +} + +type HealthCheckRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` +} + +func (x *HealthCheckRequest) Reset() { + *x = HealthCheckRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_ccnp_server_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HealthCheckRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HealthCheckRequest) ProtoMessage() {} + +func (x *HealthCheckRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_ccnp_server_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HealthCheckRequest.ProtoReflect.Descriptor instead. +func (*HealthCheckRequest) Descriptor() ([]byte, []int) { + return file_proto_ccnp_server_proto_rawDescGZIP(), []int{0} +} + +func (x *HealthCheckRequest) GetService() string { + if x != nil { + return x.Service + } + return "" +} + +type HealthCheckResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Status HealthCheckResponse_ServingStatus `protobuf:"varint,1,opt,name=status,proto3,enum=ccnp_server_pb.HealthCheckResponse_ServingStatus" json:"status,omitempty"` +} + +func (x *HealthCheckResponse) Reset() { + *x = HealthCheckResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_ccnp_server_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HealthCheckResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HealthCheckResponse) ProtoMessage() {} + +func (x *HealthCheckResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_ccnp_server_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HealthCheckResponse.ProtoReflect.Descriptor instead. +func (*HealthCheckResponse) Descriptor() ([]byte, []int) { + return file_proto_ccnp_server_proto_rawDescGZIP(), []int{1} +} + +func (x *HealthCheckResponse) GetStatus() HealthCheckResponse_ServingStatus { + if x != nil { + return x.Status + } + return HealthCheckResponse_UNKNOWN +} + +type GetDefaultAlgorithmRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GetDefaultAlgorithmRequest) Reset() { + *x = GetDefaultAlgorithmRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_ccnp_server_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetDefaultAlgorithmRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetDefaultAlgorithmRequest) ProtoMessage() {} + +func (x *GetDefaultAlgorithmRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_ccnp_server_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetDefaultAlgorithmRequest.ProtoReflect.Descriptor instead. +func (*GetDefaultAlgorithmRequest) Descriptor() ([]byte, []int) { + return file_proto_ccnp_server_proto_rawDescGZIP(), []int{2} +} + +type GetDefaultAlgorithmResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AlgoId uint32 `protobuf:"varint,1,opt,name=algo_id,json=algoId,proto3" json:"algo_id,omitempty"` +} + +func (x *GetDefaultAlgorithmResponse) Reset() { + *x = GetDefaultAlgorithmResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_ccnp_server_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetDefaultAlgorithmResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetDefaultAlgorithmResponse) ProtoMessage() {} + +func (x *GetDefaultAlgorithmResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_ccnp_server_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetDefaultAlgorithmResponse.ProtoReflect.Descriptor instead. +func (*GetDefaultAlgorithmResponse) Descriptor() ([]byte, []int) { + return file_proto_ccnp_server_proto_rawDescGZIP(), []int{3} +} + +func (x *GetDefaultAlgorithmResponse) GetAlgoId() uint32 { + if x != nil { + return x.AlgoId + } + return 0 +} + +type GetMeasurementCountRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GetMeasurementCountRequest) Reset() { + *x = GetMeasurementCountRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_ccnp_server_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetMeasurementCountRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMeasurementCountRequest) ProtoMessage() {} + +func (x *GetMeasurementCountRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_ccnp_server_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetMeasurementCountRequest.ProtoReflect.Descriptor instead. +func (*GetMeasurementCountRequest) Descriptor() ([]byte, []int) { + return file_proto_ccnp_server_proto_rawDescGZIP(), []int{4} +} + +type GetMeasurementCountResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Count uint32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` +} + +func (x *GetMeasurementCountResponse) Reset() { + *x = GetMeasurementCountResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_ccnp_server_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetMeasurementCountResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMeasurementCountResponse) ProtoMessage() {} + +func (x *GetMeasurementCountResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_ccnp_server_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetMeasurementCountResponse.ProtoReflect.Descriptor instead. +func (*GetMeasurementCountResponse) Descriptor() ([]byte, []int) { + return file_proto_ccnp_server_proto_rawDescGZIP(), []int{5} +} + +func (x *GetMeasurementCountResponse) GetCount() uint32 { + if x != nil { + return x.Count + } + return 0 +} + +type GetCcReportRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ContainerId string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + UserData *string `protobuf:"bytes,2,opt,name=user_data,json=userData,proto3,oneof" json:"user_data,omitempty"` + Nonce *string `protobuf:"bytes,3,opt,name=nonce,proto3,oneof" json:"nonce,omitempty"` +} + +func (x *GetCcReportRequest) Reset() { + *x = GetCcReportRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_ccnp_server_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetCcReportRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCcReportRequest) ProtoMessage() {} + +func (x *GetCcReportRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_ccnp_server_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCcReportRequest.ProtoReflect.Descriptor instead. +func (*GetCcReportRequest) Descriptor() ([]byte, []int) { + return file_proto_ccnp_server_proto_rawDescGZIP(), []int{6} +} + +func (x *GetCcReportRequest) GetContainerId() string { + if x != nil { + return x.ContainerId + } + return "" +} + +func (x *GetCcReportRequest) GetUserData() string { + if x != nil && x.UserData != nil { + return *x.UserData + } + return "" +} + +func (x *GetCcReportRequest) GetNonce() string { + if x != nil && x.Nonce != nil { + return *x.Nonce + } + return "" +} + +type GetCcReportResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CcType int32 `protobuf:"varint,1,opt,name=cc_type,json=ccType,proto3" json:"cc_type,omitempty"` + CcReport []byte `protobuf:"bytes,2,opt,name=cc_report,json=ccReport,proto3" json:"cc_report,omitempty"` +} + +func (x *GetCcReportResponse) Reset() { + *x = GetCcReportResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_ccnp_server_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetCcReportResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCcReportResponse) ProtoMessage() {} + +func (x *GetCcReportResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_ccnp_server_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCcReportResponse.ProtoReflect.Descriptor instead. +func (*GetCcReportResponse) Descriptor() ([]byte, []int) { + return file_proto_ccnp_server_proto_rawDescGZIP(), []int{7} +} + +func (x *GetCcReportResponse) GetCcType() int32 { + if x != nil { + return x.CcType + } + return 0 +} + +func (x *GetCcReportResponse) GetCcReport() []byte { + if x != nil { + return x.CcReport + } + return nil +} + +type GetCcMeasurementRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ContainerId string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + Index uint32 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` + AlgoId uint32 `protobuf:"varint,3,opt,name=algo_id,json=algoId,proto3" json:"algo_id,omitempty"` +} + +func (x *GetCcMeasurementRequest) Reset() { + *x = GetCcMeasurementRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_ccnp_server_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetCcMeasurementRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCcMeasurementRequest) ProtoMessage() {} + +func (x *GetCcMeasurementRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_ccnp_server_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCcMeasurementRequest.ProtoReflect.Descriptor instead. +func (*GetCcMeasurementRequest) Descriptor() ([]byte, []int) { + return file_proto_ccnp_server_proto_rawDescGZIP(), []int{8} +} + +func (x *GetCcMeasurementRequest) GetContainerId() string { + if x != nil { + return x.ContainerId + } + return "" +} + +func (x *GetCcMeasurementRequest) GetIndex() uint32 { + if x != nil { + return x.Index + } + return 0 +} + +func (x *GetCcMeasurementRequest) GetAlgoId() uint32 { + if x != nil { + return x.AlgoId + } + return 0 +} + +type GetCcMeasurementResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Measurement *TcgDigest `protobuf:"bytes,1,opt,name=measurement,proto3" json:"measurement,omitempty"` +} + +func (x *GetCcMeasurementResponse) Reset() { + *x = GetCcMeasurementResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_ccnp_server_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetCcMeasurementResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCcMeasurementResponse) ProtoMessage() {} + +func (x *GetCcMeasurementResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_ccnp_server_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCcMeasurementResponse.ProtoReflect.Descriptor instead. +func (*GetCcMeasurementResponse) Descriptor() ([]byte, []int) { + return file_proto_ccnp_server_proto_rawDescGZIP(), []int{9} +} + +func (x *GetCcMeasurementResponse) GetMeasurement() *TcgDigest { + if x != nil { + return x.Measurement + } + return nil +} + +type GetCcEventlogRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ContainerId string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + Start *uint32 `protobuf:"varint,2,opt,name=start,proto3,oneof" json:"start,omitempty"` + Count *uint32 `protobuf:"varint,3,opt,name=count,proto3,oneof" json:"count,omitempty"` +} + +func (x *GetCcEventlogRequest) Reset() { + *x = GetCcEventlogRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_ccnp_server_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetCcEventlogRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCcEventlogRequest) ProtoMessage() {} + +func (x *GetCcEventlogRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_ccnp_server_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCcEventlogRequest.ProtoReflect.Descriptor instead. +func (*GetCcEventlogRequest) Descriptor() ([]byte, []int) { + return file_proto_ccnp_server_proto_rawDescGZIP(), []int{10} +} + +func (x *GetCcEventlogRequest) GetContainerId() string { + if x != nil { + return x.ContainerId + } + return "" +} + +func (x *GetCcEventlogRequest) GetStart() uint32 { + if x != nil && x.Start != nil { + return *x.Start + } + return 0 +} + +func (x *GetCcEventlogRequest) GetCount() uint32 { + if x != nil && x.Count != nil { + return *x.Count + } + return 0 +} + +type TcgDigest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AlgoId uint32 `protobuf:"varint,1,opt,name=algo_id,json=algoId,proto3" json:"algo_id,omitempty"` + Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` +} + +func (x *TcgDigest) Reset() { + *x = TcgDigest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_ccnp_server_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TcgDigest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TcgDigest) ProtoMessage() {} + +func (x *TcgDigest) ProtoReflect() protoreflect.Message { + mi := &file_proto_ccnp_server_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TcgDigest.ProtoReflect.Descriptor instead. +func (*TcgDigest) Descriptor() ([]byte, []int) { + return file_proto_ccnp_server_proto_rawDescGZIP(), []int{11} +} + +func (x *TcgDigest) GetAlgoId() uint32 { + if x != nil { + return x.AlgoId + } + return 0 +} + +func (x *TcgDigest) GetHash() []byte { + if x != nil { + return x.Hash + } + return nil +} + +type TcgEventlog struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RecNum uint32 `protobuf:"varint,1,opt,name=rec_num,json=recNum,proto3" json:"rec_num,omitempty"` + ImrIndex uint32 `protobuf:"varint,2,opt,name=imr_index,json=imrIndex,proto3" json:"imr_index,omitempty"` + EventType uint32 `protobuf:"varint,3,opt,name=event_type,json=eventType,proto3" json:"event_type,omitempty"` + Digests []*TcgDigest `protobuf:"bytes,4,rep,name=digests,proto3" json:"digests,omitempty"` + EventSize uint32 `protobuf:"varint,5,opt,name=event_size,json=eventSize,proto3" json:"event_size,omitempty"` + Event []byte `protobuf:"bytes,6,opt,name=event,proto3" json:"event,omitempty"` + ExtraInfo map[string]string `protobuf:"bytes,7,rep,name=extra_info,json=extraInfo,proto3" json:"extra_info,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *TcgEventlog) Reset() { + *x = TcgEventlog{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_ccnp_server_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TcgEventlog) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TcgEventlog) ProtoMessage() {} + +func (x *TcgEventlog) ProtoReflect() protoreflect.Message { + mi := &file_proto_ccnp_server_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TcgEventlog.ProtoReflect.Descriptor instead. +func (*TcgEventlog) Descriptor() ([]byte, []int) { + return file_proto_ccnp_server_proto_rawDescGZIP(), []int{12} +} + +func (x *TcgEventlog) GetRecNum() uint32 { + if x != nil { + return x.RecNum + } + return 0 +} + +func (x *TcgEventlog) GetImrIndex() uint32 { + if x != nil { + return x.ImrIndex + } + return 0 +} + +func (x *TcgEventlog) GetEventType() uint32 { + if x != nil { + return x.EventType + } + return 0 +} + +func (x *TcgEventlog) GetDigests() []*TcgDigest { + if x != nil { + return x.Digests + } + return nil +} + +func (x *TcgEventlog) GetEventSize() uint32 { + if x != nil { + return x.EventSize + } + return 0 +} + +func (x *TcgEventlog) GetEvent() []byte { + if x != nil { + return x.Event + } + return nil +} + +func (x *TcgEventlog) GetExtraInfo() map[string]string { + if x != nil { + return x.ExtraInfo + } + return nil +} + +type GetCcEventlogResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + EventLogs []*TcgEventlog `protobuf:"bytes,1,rep,name=event_logs,json=eventLogs,proto3" json:"event_logs,omitempty"` +} + +func (x *GetCcEventlogResponse) Reset() { + *x = GetCcEventlogResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_ccnp_server_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetCcEventlogResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCcEventlogResponse) ProtoMessage() {} + +func (x *GetCcEventlogResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_ccnp_server_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCcEventlogResponse.ProtoReflect.Descriptor instead. +func (*GetCcEventlogResponse) Descriptor() ([]byte, []int) { + return file_proto_ccnp_server_proto_rawDescGZIP(), []int{13} +} + +func (x *GetCcEventlogResponse) GetEventLogs() []*TcgEventlog { + if x != nil { + return x.EventLogs + } + return nil +} + +var File_proto_ccnp_server_proto protoreflect.FileDescriptor + +var file_proto_ccnp_server_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x63, 0x6e, 0x70, 0x2d, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x63, 0x63, 0x6e, 0x70, 0x5f, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x70, 0x62, 0x22, 0x2e, 0x0a, 0x12, 0x48, 0x65, 0x61, + 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x18, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x22, 0xb1, 0x01, 0x0a, 0x13, 0x48, 0x65, + 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x49, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x31, 0x2e, 0x63, 0x63, 0x6e, 0x70, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, + 0x70, 0x62, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x4f, 0x0a, 0x0d, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0b, 0x0a, + 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x45, + 0x52, 0x56, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x4f, 0x54, 0x5f, 0x53, + 0x45, 0x52, 0x56, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x45, 0x52, 0x56, + 0x49, 0x43, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x03, 0x22, 0x1c, 0x0a, + 0x1a, 0x47, 0x65, 0x74, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x41, 0x6c, 0x67, 0x6f, 0x72, + 0x69, 0x74, 0x68, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x36, 0x0a, 0x1b, 0x47, + 0x65, 0x74, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, + 0x68, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x61, 0x6c, + 0x67, 0x6f, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x61, 0x6c, 0x67, + 0x6f, 0x49, 0x64, 0x22, 0x1c, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x61, 0x73, 0x75, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x22, 0x33, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x8c, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x43, 0x63, + 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, + 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, + 0x12, 0x20, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x88, + 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x01, 0x52, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x88, 0x01, 0x01, 0x42, 0x0c, 0x0a, + 0x0a, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x42, 0x08, 0x0a, 0x06, 0x5f, + 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x22, 0x4b, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x43, 0x63, 0x52, 0x65, + 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x17, 0x0a, 0x07, + 0x63, 0x63, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x63, + 0x63, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x63, 0x5f, 0x72, 0x65, 0x70, 0x6f, + 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x63, 0x63, 0x52, 0x65, 0x70, 0x6f, + 0x72, 0x74, 0x22, 0x6b, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x43, 0x63, 0x4d, 0x65, 0x61, 0x73, 0x75, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, + 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, + 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x17, 0x0a, 0x07, 0x61, 0x6c, 0x67, 0x6f, 0x5f, 0x69, + 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x61, 0x6c, 0x67, 0x6f, 0x49, 0x64, 0x22, + 0x57, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x43, 0x63, 0x4d, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x6d, + 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x63, 0x63, 0x6e, 0x70, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x70, + 0x62, 0x2e, 0x54, 0x63, 0x67, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x52, 0x0b, 0x6d, 0x65, 0x61, + 0x73, 0x75, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x83, 0x01, 0x0a, 0x14, 0x47, 0x65, 0x74, + 0x43, 0x63, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, + 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, + 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x38, + 0x0a, 0x09, 0x54, 0x63, 0x67, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x61, + 0x6c, 0x67, 0x6f, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x61, 0x6c, + 0x67, 0x6f, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x22, 0xd5, 0x02, 0x0a, 0x0b, 0x54, 0x63, 0x67, + 0x45, 0x76, 0x65, 0x6e, 0x74, 0x6c, 0x6f, 0x67, 0x12, 0x17, 0x0a, 0x07, 0x72, 0x65, 0x63, 0x5f, + 0x6e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x72, 0x65, 0x63, 0x4e, 0x75, + 0x6d, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x6d, 0x72, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x69, 0x6d, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1d, + 0x0a, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x09, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x33, 0x0a, + 0x07, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x63, 0x63, 0x6e, 0x70, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x70, 0x62, 0x2e, + 0x54, 0x63, 0x67, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x52, 0x07, 0x64, 0x69, 0x67, 0x65, 0x73, + 0x74, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x69, 0x7a, + 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x49, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x72, 0x61, + 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x63, + 0x6e, 0x70, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x70, 0x62, 0x2e, 0x54, 0x63, 0x67, + 0x45, 0x76, 0x65, 0x6e, 0x74, 0x6c, 0x6f, 0x67, 0x2e, 0x45, 0x78, 0x74, 0x72, 0x61, 0x49, 0x6e, + 0x66, 0x6f, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x65, 0x78, 0x74, 0x72, 0x61, 0x49, 0x6e, + 0x66, 0x6f, 0x1a, 0x3c, 0x0a, 0x0e, 0x45, 0x78, 0x74, 0x72, 0x61, 0x49, 0x6e, 0x66, 0x6f, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, + 0x22, 0x53, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x43, 0x63, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x6c, 0x6f, + 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x0a, 0x65, 0x76, 0x65, + 0x6e, 0x74, 0x5f, 0x6c, 0x6f, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, + 0x63, 0x63, 0x6e, 0x70, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x70, 0x62, 0x2e, 0x54, + 0x63, 0x67, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x6c, 0x6f, 0x67, 0x52, 0x09, 0x65, 0x76, 0x65, 0x6e, + 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x32, 0x87, 0x04, 0x0a, 0x04, 0x63, 0x63, 0x6e, 0x70, 0x12, 0x6e, + 0x0a, 0x13, 0x47, 0x65, 0x74, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x41, 0x6c, 0x67, 0x6f, + 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x2a, 0x2e, 0x63, 0x63, 0x6e, 0x70, 0x5f, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x5f, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, + 0x74, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x2b, 0x2e, 0x63, 0x63, 0x6e, 0x70, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, + 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x41, 0x6c, 0x67, + 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6e, + 0x0a, 0x13, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2a, 0x2e, 0x63, 0x63, 0x6e, 0x70, 0x5f, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x5f, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x61, 0x73, 0x75, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x2b, 0x2e, 0x63, 0x63, 0x6e, 0x70, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, + 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, + 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x43, 0x63, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x22, 0x2e, + 0x63, 0x63, 0x6e, 0x70, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x70, 0x62, 0x2e, 0x47, + 0x65, 0x74, 0x43, 0x63, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x23, 0x2e, 0x63, 0x63, 0x6e, 0x70, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, + 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x63, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x43, 0x63, 0x4d, + 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x27, 0x2e, 0x63, 0x63, 0x6e, + 0x70, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x43, + 0x63, 0x4d, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x63, 0x63, 0x6e, 0x70, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x5f, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x63, 0x4d, 0x65, 0x61, 0x73, 0x75, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x5e, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x43, 0x63, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x6c, 0x6f, 0x67, + 0x12, 0x24, 0x2e, 0x63, 0x63, 0x6e, 0x70, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x70, + 0x62, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x63, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x6c, 0x6f, 0x67, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x63, 0x63, 0x6e, 0x70, 0x5f, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x5f, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x63, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, + 0x67, 0x5a, 0x65, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x69, 0x72, 0x6f, 0x6e, 0x67, 0x63, 0x68, 0x65, + 0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x2d, 0x63, + 0x6c, 0x6f, 0x75, 0x64, 0x2d, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2d, 0x70, 0x72, 0x69, 0x6d, + 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2f, 0x74, 0x72, 0x65, 0x65, 0x2f, 0x67, 0x6f, 0x5f, 0x73, + 0x64, 0x6b, 0x5f, 0x64, 0x65, 0x76, 0x31, 0x2f, 0x73, 0x64, 0x6b, 0x2f, 0x67, 0x6f, 0x6c, 0x61, + 0x6e, 0x67, 0x2f, 0x63, 0x63, 0x6e, 0x70, 0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_proto_ccnp_server_proto_rawDescOnce sync.Once + file_proto_ccnp_server_proto_rawDescData = file_proto_ccnp_server_proto_rawDesc +) + +func file_proto_ccnp_server_proto_rawDescGZIP() []byte { + file_proto_ccnp_server_proto_rawDescOnce.Do(func() { + file_proto_ccnp_server_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_ccnp_server_proto_rawDescData) + }) + return file_proto_ccnp_server_proto_rawDescData +} + +var file_proto_ccnp_server_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_proto_ccnp_server_proto_msgTypes = make([]protoimpl.MessageInfo, 15) +var file_proto_ccnp_server_proto_goTypes = []interface{}{ + (HealthCheckResponse_ServingStatus)(0), // 0: ccnp_server_pb.HealthCheckResponse.ServingStatus + (*HealthCheckRequest)(nil), // 1: ccnp_server_pb.HealthCheckRequest + (*HealthCheckResponse)(nil), // 2: ccnp_server_pb.HealthCheckResponse + (*GetDefaultAlgorithmRequest)(nil), // 3: ccnp_server_pb.GetDefaultAlgorithmRequest + (*GetDefaultAlgorithmResponse)(nil), // 4: ccnp_server_pb.GetDefaultAlgorithmResponse + (*GetMeasurementCountRequest)(nil), // 5: ccnp_server_pb.GetMeasurementCountRequest + (*GetMeasurementCountResponse)(nil), // 6: ccnp_server_pb.GetMeasurementCountResponse + (*GetCcReportRequest)(nil), // 7: ccnp_server_pb.GetCcReportRequest + (*GetCcReportResponse)(nil), // 8: ccnp_server_pb.GetCcReportResponse + (*GetCcMeasurementRequest)(nil), // 9: ccnp_server_pb.GetCcMeasurementRequest + (*GetCcMeasurementResponse)(nil), // 10: ccnp_server_pb.GetCcMeasurementResponse + (*GetCcEventlogRequest)(nil), // 11: ccnp_server_pb.GetCcEventlogRequest + (*TcgDigest)(nil), // 12: ccnp_server_pb.TcgDigest + (*TcgEventlog)(nil), // 13: ccnp_server_pb.TcgEventlog + (*GetCcEventlogResponse)(nil), // 14: ccnp_server_pb.GetCcEventlogResponse + nil, // 15: ccnp_server_pb.TcgEventlog.ExtraInfoEntry +} +var file_proto_ccnp_server_proto_depIdxs = []int32{ + 0, // 0: ccnp_server_pb.HealthCheckResponse.status:type_name -> ccnp_server_pb.HealthCheckResponse.ServingStatus + 12, // 1: ccnp_server_pb.GetCcMeasurementResponse.measurement:type_name -> ccnp_server_pb.TcgDigest + 12, // 2: ccnp_server_pb.TcgEventlog.digests:type_name -> ccnp_server_pb.TcgDigest + 15, // 3: ccnp_server_pb.TcgEventlog.extra_info:type_name -> ccnp_server_pb.TcgEventlog.ExtraInfoEntry + 13, // 4: ccnp_server_pb.GetCcEventlogResponse.event_logs:type_name -> ccnp_server_pb.TcgEventlog + 3, // 5: ccnp_server_pb.ccnp.GetDefaultAlgorithm:input_type -> ccnp_server_pb.GetDefaultAlgorithmRequest + 5, // 6: ccnp_server_pb.ccnp.GetMeasurementCount:input_type -> ccnp_server_pb.GetMeasurementCountRequest + 7, // 7: ccnp_server_pb.ccnp.GetCcReport:input_type -> ccnp_server_pb.GetCcReportRequest + 9, // 8: ccnp_server_pb.ccnp.GetCcMeasurement:input_type -> ccnp_server_pb.GetCcMeasurementRequest + 11, // 9: ccnp_server_pb.ccnp.GetCcEventlog:input_type -> ccnp_server_pb.GetCcEventlogRequest + 4, // 10: ccnp_server_pb.ccnp.GetDefaultAlgorithm:output_type -> ccnp_server_pb.GetDefaultAlgorithmResponse + 6, // 11: ccnp_server_pb.ccnp.GetMeasurementCount:output_type -> ccnp_server_pb.GetMeasurementCountResponse + 8, // 12: ccnp_server_pb.ccnp.GetCcReport:output_type -> ccnp_server_pb.GetCcReportResponse + 10, // 13: ccnp_server_pb.ccnp.GetCcMeasurement:output_type -> ccnp_server_pb.GetCcMeasurementResponse + 14, // 14: ccnp_server_pb.ccnp.GetCcEventlog:output_type -> ccnp_server_pb.GetCcEventlogResponse + 10, // [10:15] is the sub-list for method output_type + 5, // [5:10] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_proto_ccnp_server_proto_init() } +func file_proto_ccnp_server_proto_init() { + if File_proto_ccnp_server_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_proto_ccnp_server_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HealthCheckRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_ccnp_server_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HealthCheckResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_ccnp_server_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetDefaultAlgorithmRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_ccnp_server_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetDefaultAlgorithmResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_ccnp_server_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetMeasurementCountRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_ccnp_server_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetMeasurementCountResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_ccnp_server_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetCcReportRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_ccnp_server_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetCcReportResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_ccnp_server_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetCcMeasurementRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_ccnp_server_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetCcMeasurementResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_ccnp_server_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetCcEventlogRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_ccnp_server_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TcgDigest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_ccnp_server_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TcgEventlog); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_ccnp_server_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetCcEventlogResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_proto_ccnp_server_proto_msgTypes[6].OneofWrappers = []interface{}{} + file_proto_ccnp_server_proto_msgTypes[10].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_proto_ccnp_server_proto_rawDesc, + NumEnums: 1, + NumMessages: 15, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_proto_ccnp_server_proto_goTypes, + DependencyIndexes: file_proto_ccnp_server_proto_depIdxs, + EnumInfos: file_proto_ccnp_server_proto_enumTypes, + MessageInfos: file_proto_ccnp_server_proto_msgTypes, + }.Build() + File_proto_ccnp_server_proto = out.File + file_proto_ccnp_server_proto_rawDesc = nil + file_proto_ccnp_server_proto_goTypes = nil + file_proto_ccnp_server_proto_depIdxs = nil +} diff --git a/sdk/golang/ccnp/proto/ccnp-server.proto b/sdk/golang/ccnp/proto/ccnp-server.proto new file mode 100644 index 0000000..9cb8a5d --- /dev/null +++ b/sdk/golang/ccnp/proto/ccnp-server.proto @@ -0,0 +1,85 @@ +syntax = "proto3"; + +package ccnp_server_pb; + +message HealthCheckRequest { + string service = 1; +} + +message HealthCheckResponse { + enum ServingStatus { + UNKNOWN = 0; + SERVING = 1; + NOT_SERVING = 2; + SERVICE_UNKNOWN = 3; + } + ServingStatus status = 1; +} + +service ccnp { + rpc GetDefaultAlgorithm(GetDefaultAlgorithmRequest) returns (GetDefaultAlgorithmResponse); + rpc GetMeasurementCount(GetMeasurementCountRequest) returns (GetMeasurementCountResponse); + rpc GetCcReport (GetCcReportRequest) returns (GetCcReportResponse); + rpc GetCcMeasurement (GetCcMeasurementRequest) returns (GetCcMeasurementResponse) {} + rpc GetCcEventlog (GetCcEventlogRequest) returns (GetCcEventlogResponse) {} +} + +message GetDefaultAlgorithmRequest { +} + +message GetDefaultAlgorithmResponse { + uint32 algo_id = 1; +} + +message GetMeasurementCountRequest { +} + +message GetMeasurementCountResponse { + uint32 count = 1; +} + +message GetCcReportRequest { + string container_id = 1; + optional string user_data = 2; + optional string nonce = 3; +} + +message GetCcReportResponse { + int32 cc_type = 1; + bytes cc_report = 2; +} + +message GetCcMeasurementRequest { + string container_id = 1; + uint32 index = 2; + uint32 algo_id = 3; +} + +message GetCcMeasurementResponse { + TcgDigest measurement = 1; +} + +message GetCcEventlogRequest { + string container_id = 1; + optional uint32 start = 2; + optional uint32 count = 3; +} + +message TcgDigest { + uint32 algo_id = 1; + bytes hash = 2; +} + +message TcgEventlog { + uint32 rec_num = 1; + uint32 imr_index = 2; + uint32 event_type = 3; + repeated TcgDigest digests = 4; + uint32 event_size = 5; + bytes event = 6; + map extra_info = 7; +} + +message GetCcEventlogResponse { + repeated TcgEventlog event_logs = 1; +} \ No newline at end of file diff --git a/sdk/golang/ccnp/proto/ccnp-server_grpc.pb.go b/sdk/golang/ccnp/proto/ccnp-server_grpc.pb.go new file mode 100644 index 0000000..8ed546a --- /dev/null +++ b/sdk/golang/ccnp/proto/ccnp-server_grpc.pb.go @@ -0,0 +1,257 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v4.25.3 +// source: proto/ccnp-server.proto + +package ccnp + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + Ccnp_GetDefaultAlgorithm_FullMethodName = "/ccnp_server_pb.ccnp/GetDefaultAlgorithm" + Ccnp_GetMeasurementCount_FullMethodName = "/ccnp_server_pb.ccnp/GetMeasurementCount" + Ccnp_GetCcReport_FullMethodName = "/ccnp_server_pb.ccnp/GetCcReport" + Ccnp_GetCcMeasurement_FullMethodName = "/ccnp_server_pb.ccnp/GetCcMeasurement" + Ccnp_GetCcEventlog_FullMethodName = "/ccnp_server_pb.ccnp/GetCcEventlog" +) + +// CcnpClient is the client API for Ccnp service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type CcnpClient interface { + GetDefaultAlgorithm(ctx context.Context, in *GetDefaultAlgorithmRequest, opts ...grpc.CallOption) (*GetDefaultAlgorithmResponse, error) + GetMeasurementCount(ctx context.Context, in *GetMeasurementCountRequest, opts ...grpc.CallOption) (*GetMeasurementCountResponse, error) + GetCcReport(ctx context.Context, in *GetCcReportRequest, opts ...grpc.CallOption) (*GetCcReportResponse, error) + GetCcMeasurement(ctx context.Context, in *GetCcMeasurementRequest, opts ...grpc.CallOption) (*GetCcMeasurementResponse, error) + GetCcEventlog(ctx context.Context, in *GetCcEventlogRequest, opts ...grpc.CallOption) (*GetCcEventlogResponse, error) +} + +type ccnpClient struct { + cc grpc.ClientConnInterface +} + +func NewCcnpClient(cc grpc.ClientConnInterface) CcnpClient { + return &ccnpClient{cc} +} + +func (c *ccnpClient) GetDefaultAlgorithm(ctx context.Context, in *GetDefaultAlgorithmRequest, opts ...grpc.CallOption) (*GetDefaultAlgorithmResponse, error) { + out := new(GetDefaultAlgorithmResponse) + err := c.cc.Invoke(ctx, Ccnp_GetDefaultAlgorithm_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *ccnpClient) GetMeasurementCount(ctx context.Context, in *GetMeasurementCountRequest, opts ...grpc.CallOption) (*GetMeasurementCountResponse, error) { + out := new(GetMeasurementCountResponse) + err := c.cc.Invoke(ctx, Ccnp_GetMeasurementCount_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *ccnpClient) GetCcReport(ctx context.Context, in *GetCcReportRequest, opts ...grpc.CallOption) (*GetCcReportResponse, error) { + out := new(GetCcReportResponse) + err := c.cc.Invoke(ctx, Ccnp_GetCcReport_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *ccnpClient) GetCcMeasurement(ctx context.Context, in *GetCcMeasurementRequest, opts ...grpc.CallOption) (*GetCcMeasurementResponse, error) { + out := new(GetCcMeasurementResponse) + err := c.cc.Invoke(ctx, Ccnp_GetCcMeasurement_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *ccnpClient) GetCcEventlog(ctx context.Context, in *GetCcEventlogRequest, opts ...grpc.CallOption) (*GetCcEventlogResponse, error) { + out := new(GetCcEventlogResponse) + err := c.cc.Invoke(ctx, Ccnp_GetCcEventlog_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// CcnpServer is the server API for Ccnp service. +// All implementations must embed UnimplementedCcnpServer +// for forward compatibility +type CcnpServer interface { + GetDefaultAlgorithm(context.Context, *GetDefaultAlgorithmRequest) (*GetDefaultAlgorithmResponse, error) + GetMeasurementCount(context.Context, *GetMeasurementCountRequest) (*GetMeasurementCountResponse, error) + GetCcReport(context.Context, *GetCcReportRequest) (*GetCcReportResponse, error) + GetCcMeasurement(context.Context, *GetCcMeasurementRequest) (*GetCcMeasurementResponse, error) + GetCcEventlog(context.Context, *GetCcEventlogRequest) (*GetCcEventlogResponse, error) + mustEmbedUnimplementedCcnpServer() +} + +// UnimplementedCcnpServer must be embedded to have forward compatible implementations. +type UnimplementedCcnpServer struct { +} + +func (UnimplementedCcnpServer) GetDefaultAlgorithm(context.Context, *GetDefaultAlgorithmRequest) (*GetDefaultAlgorithmResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetDefaultAlgorithm not implemented") +} +func (UnimplementedCcnpServer) GetMeasurementCount(context.Context, *GetMeasurementCountRequest) (*GetMeasurementCountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetMeasurementCount not implemented") +} +func (UnimplementedCcnpServer) GetCcReport(context.Context, *GetCcReportRequest) (*GetCcReportResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCcReport not implemented") +} +func (UnimplementedCcnpServer) GetCcMeasurement(context.Context, *GetCcMeasurementRequest) (*GetCcMeasurementResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCcMeasurement not implemented") +} +func (UnimplementedCcnpServer) GetCcEventlog(context.Context, *GetCcEventlogRequest) (*GetCcEventlogResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCcEventlog not implemented") +} +func (UnimplementedCcnpServer) mustEmbedUnimplementedCcnpServer() {} + +// UnsafeCcnpServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to CcnpServer will +// result in compilation errors. +type UnsafeCcnpServer interface { + mustEmbedUnimplementedCcnpServer() +} + +func RegisterCcnpServer(s grpc.ServiceRegistrar, srv CcnpServer) { + s.RegisterService(&Ccnp_ServiceDesc, srv) +} + +func _Ccnp_GetDefaultAlgorithm_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetDefaultAlgorithmRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CcnpServer).GetDefaultAlgorithm(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Ccnp_GetDefaultAlgorithm_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CcnpServer).GetDefaultAlgorithm(ctx, req.(*GetDefaultAlgorithmRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Ccnp_GetMeasurementCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetMeasurementCountRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CcnpServer).GetMeasurementCount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Ccnp_GetMeasurementCount_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CcnpServer).GetMeasurementCount(ctx, req.(*GetMeasurementCountRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Ccnp_GetCcReport_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetCcReportRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CcnpServer).GetCcReport(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Ccnp_GetCcReport_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CcnpServer).GetCcReport(ctx, req.(*GetCcReportRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Ccnp_GetCcMeasurement_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetCcMeasurementRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CcnpServer).GetCcMeasurement(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Ccnp_GetCcMeasurement_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CcnpServer).GetCcMeasurement(ctx, req.(*GetCcMeasurementRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Ccnp_GetCcEventlog_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetCcEventlogRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CcnpServer).GetCcEventlog(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Ccnp_GetCcEventlog_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CcnpServer).GetCcEventlog(ctx, req.(*GetCcEventlogRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Ccnp_ServiceDesc is the grpc.ServiceDesc for Ccnp service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Ccnp_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "ccnp_server_pb.ccnp", + HandlerType: (*CcnpServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetDefaultAlgorithm", + Handler: _Ccnp_GetDefaultAlgorithm_Handler, + }, + { + MethodName: "GetMeasurementCount", + Handler: _Ccnp_GetMeasurementCount_Handler, + }, + { + MethodName: "GetCcReport", + Handler: _Ccnp_GetCcReport_Handler, + }, + { + MethodName: "GetCcMeasurement", + Handler: _Ccnp_GetCcMeasurement_Handler, + }, + { + MethodName: "GetCcEventlog", + Handler: _Ccnp_GetCcEventlog_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "proto/ccnp-server.proto", +} diff --git a/sdk/golang/ccnp/quote/proto/quote-server.pb.go b/sdk/golang/ccnp/quote/proto/quote-server.pb.go deleted file mode 100644 index 925689d..0000000 --- a/sdk/golang/ccnp/quote/proto/quote-server.pb.go +++ /dev/null @@ -1,428 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.1 -// protoc v3.12.4 -// source: proto/quote-server.proto - -package quoteServer - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type HealthCheckResponse_ServingStatus int32 - -const ( - HealthCheckResponse_UNKNOWN HealthCheckResponse_ServingStatus = 0 - HealthCheckResponse_SERVING HealthCheckResponse_ServingStatus = 1 - HealthCheckResponse_NOT_SERVING HealthCheckResponse_ServingStatus = 2 - HealthCheckResponse_SERVICE_UNKNOWN HealthCheckResponse_ServingStatus = 3 -) - -// Enum value maps for HealthCheckResponse_ServingStatus. -var ( - HealthCheckResponse_ServingStatus_name = map[int32]string{ - 0: "UNKNOWN", - 1: "SERVING", - 2: "NOT_SERVING", - 3: "SERVICE_UNKNOWN", - } - HealthCheckResponse_ServingStatus_value = map[string]int32{ - "UNKNOWN": 0, - "SERVING": 1, - "NOT_SERVING": 2, - "SERVICE_UNKNOWN": 3, - } -) - -func (x HealthCheckResponse_ServingStatus) Enum() *HealthCheckResponse_ServingStatus { - p := new(HealthCheckResponse_ServingStatus) - *p = x - return p -} - -func (x HealthCheckResponse_ServingStatus) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (HealthCheckResponse_ServingStatus) Descriptor() protoreflect.EnumDescriptor { - return file_proto_quote_server_proto_enumTypes[0].Descriptor() -} - -func (HealthCheckResponse_ServingStatus) Type() protoreflect.EnumType { - return &file_proto_quote_server_proto_enumTypes[0] -} - -func (x HealthCheckResponse_ServingStatus) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use HealthCheckResponse_ServingStatus.Descriptor instead. -func (HealthCheckResponse_ServingStatus) EnumDescriptor() ([]byte, []int) { - return file_proto_quote_server_proto_rawDescGZIP(), []int{1, 0} -} - -type HealthCheckRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` -} - -func (x *HealthCheckRequest) Reset() { - *x = HealthCheckRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_quote_server_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HealthCheckRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HealthCheckRequest) ProtoMessage() {} - -func (x *HealthCheckRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_quote_server_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HealthCheckRequest.ProtoReflect.Descriptor instead. -func (*HealthCheckRequest) Descriptor() ([]byte, []int) { - return file_proto_quote_server_proto_rawDescGZIP(), []int{0} -} - -func (x *HealthCheckRequest) GetService() string { - if x != nil { - return x.Service - } - return "" -} - -type HealthCheckResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Status HealthCheckResponse_ServingStatus `protobuf:"varint,1,opt,name=status,proto3,enum=quoteserver.HealthCheckResponse_ServingStatus" json:"status,omitempty"` -} - -func (x *HealthCheckResponse) Reset() { - *x = HealthCheckResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_quote_server_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HealthCheckResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HealthCheckResponse) ProtoMessage() {} - -func (x *HealthCheckResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_quote_server_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use HealthCheckResponse.ProtoReflect.Descriptor instead. -func (*HealthCheckResponse) Descriptor() ([]byte, []int) { - return file_proto_quote_server_proto_rawDescGZIP(), []int{1} -} - -func (x *HealthCheckResponse) GetStatus() HealthCheckResponse_ServingStatus { - if x != nil { - return x.Status - } - return HealthCheckResponse_UNKNOWN -} - -type GetQuoteRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserData string `protobuf:"bytes,1,opt,name=user_data,json=userData,proto3" json:"user_data,omitempty"` - Nonce string `protobuf:"bytes,2,opt,name=nonce,proto3" json:"nonce,omitempty"` -} - -func (x *GetQuoteRequest) Reset() { - *x = GetQuoteRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_quote_server_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetQuoteRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetQuoteRequest) ProtoMessage() {} - -func (x *GetQuoteRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_quote_server_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetQuoteRequest.ProtoReflect.Descriptor instead. -func (*GetQuoteRequest) Descriptor() ([]byte, []int) { - return file_proto_quote_server_proto_rawDescGZIP(), []int{2} -} - -func (x *GetQuoteRequest) GetUserData() string { - if x != nil { - return x.UserData - } - return "" -} - -func (x *GetQuoteRequest) GetNonce() string { - if x != nil { - return x.Nonce - } - return "" -} - -type GetQuoteResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Quote string `protobuf:"bytes,1,opt,name=quote,proto3" json:"quote,omitempty"` - QuoteType string `protobuf:"bytes,2,opt,name=quote_type,json=quoteType,proto3" json:"quote_type,omitempty"` -} - -func (x *GetQuoteResponse) Reset() { - *x = GetQuoteResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_quote_server_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetQuoteResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetQuoteResponse) ProtoMessage() {} - -func (x *GetQuoteResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_quote_server_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetQuoteResponse.ProtoReflect.Descriptor instead. -func (*GetQuoteResponse) Descriptor() ([]byte, []int) { - return file_proto_quote_server_proto_rawDescGZIP(), []int{3} -} - -func (x *GetQuoteResponse) GetQuote() string { - if x != nil { - return x.Quote - } - return "" -} - -func (x *GetQuoteResponse) GetQuoteType() string { - if x != nil { - return x.QuoteType - } - return "" -} - -var File_proto_quote_server_proto protoreflect.FileDescriptor - -var file_proto_quote_server_proto_rawDesc = []byte{ - 0x0a, 0x18, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x71, 0x75, 0x6f, 0x74, 0x65, 0x2d, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x71, 0x75, 0x6f, 0x74, - 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x22, 0x2e, 0x0a, 0x12, 0x48, 0x65, 0x61, 0x6c, 0x74, - 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, - 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x22, 0xae, 0x01, 0x0a, 0x13, 0x48, 0x65, 0x61, 0x6c, - 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x46, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x2e, 0x2e, 0x71, 0x75, 0x6f, 0x74, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x48, 0x65, - 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, - 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x4f, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, - 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x45, 0x52, 0x56, 0x49, 0x4e, 0x47, - 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x4f, 0x54, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x49, 0x4e, - 0x47, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x5f, 0x55, - 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x03, 0x22, 0x44, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x51, - 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x75, - 0x73, 0x65, 0x72, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x75, 0x73, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x6e, 0x63, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x22, 0x47, - 0x0a, 0x10, 0x47, 0x65, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x6f, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x71, 0x75, 0x6f, 0x74, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x71, 0x75, 0x6f, 0x74, - 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x71, 0x75, - 0x6f, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x32, 0x53, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x51, 0x75, - 0x6f, 0x74, 0x65, 0x12, 0x47, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x12, - 0x1c, 0x2e, 0x71, 0x75, 0x6f, 0x74, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x47, 0x65, - 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, - 0x71, 0x75, 0x6f, 0x74, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x51, - 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x5f, 0x5a, 0x5d, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x6c, - 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x2d, 0x63, 0x6c, - 0x6f, 0x75, 0x64, 0x2d, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2d, 0x70, 0x72, 0x69, 0x6d, 0x69, - 0x74, 0x69, 0x76, 0x65, 0x73, 0x2f, 0x73, 0x64, 0x6b, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, - 0x2f, 0x63, 0x63, 0x6e, 0x70, 0x2f, 0x71, 0x75, 0x6f, 0x74, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2f, 0x71, 0x75, 0x6f, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_proto_quote_server_proto_rawDescOnce sync.Once - file_proto_quote_server_proto_rawDescData = file_proto_quote_server_proto_rawDesc -) - -func file_proto_quote_server_proto_rawDescGZIP() []byte { - file_proto_quote_server_proto_rawDescOnce.Do(func() { - file_proto_quote_server_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_quote_server_proto_rawDescData) - }) - return file_proto_quote_server_proto_rawDescData -} - -var file_proto_quote_server_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_proto_quote_server_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_proto_quote_server_proto_goTypes = []interface{}{ - (HealthCheckResponse_ServingStatus)(0), // 0: quoteserver.HealthCheckResponse.ServingStatus - (*HealthCheckRequest)(nil), // 1: quoteserver.HealthCheckRequest - (*HealthCheckResponse)(nil), // 2: quoteserver.HealthCheckResponse - (*GetQuoteRequest)(nil), // 3: quoteserver.GetQuoteRequest - (*GetQuoteResponse)(nil), // 4: quoteserver.GetQuoteResponse -} -var file_proto_quote_server_proto_depIdxs = []int32{ - 0, // 0: quoteserver.HealthCheckResponse.status:type_name -> quoteserver.HealthCheckResponse.ServingStatus - 3, // 1: quoteserver.GetQuote.GetQuote:input_type -> quoteserver.GetQuoteRequest - 4, // 2: quoteserver.GetQuote.GetQuote:output_type -> quoteserver.GetQuoteResponse - 2, // [2:3] is the sub-list for method output_type - 1, // [1:2] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_proto_quote_server_proto_init() } -func file_proto_quote_server_proto_init() { - if File_proto_quote_server_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_proto_quote_server_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HealthCheckRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_quote_server_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HealthCheckResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_quote_server_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetQuoteRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_quote_server_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetQuoteResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_proto_quote_server_proto_rawDesc, - NumEnums: 1, - NumMessages: 4, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_proto_quote_server_proto_goTypes, - DependencyIndexes: file_proto_quote_server_proto_depIdxs, - EnumInfos: file_proto_quote_server_proto_enumTypes, - MessageInfos: file_proto_quote_server_proto_msgTypes, - }.Build() - File_proto_quote_server_proto = out.File - file_proto_quote_server_proto_rawDesc = nil - file_proto_quote_server_proto_goTypes = nil - file_proto_quote_server_proto_depIdxs = nil -} diff --git a/sdk/golang/ccnp/quote/proto/quote-server.proto b/sdk/golang/ccnp/quote/proto/quote-server.proto deleted file mode 100644 index 349aa22..0000000 --- a/sdk/golang/ccnp/quote/proto/quote-server.proto +++ /dev/null @@ -1,31 +0,0 @@ -syntax = "proto3"; -package quoteserver; -option go_package = "github.com/intel/confidential-cloud-native-primitives/sdk/golang/ccnp/quote/proto/quoteServer"; - -message HealthCheckRequest { - string service = 1; -} - -message HealthCheckResponse { - enum ServingStatus { - UNKNOWN = 0; - SERVING = 1; - NOT_SERVING = 2; - SERVICE_UNKNOWN = 3; - } - ServingStatus status = 1; -} - -service GetQuote { - rpc GetQuote (GetQuoteRequest) returns (GetQuoteResponse); -} - -message GetQuoteRequest { - string user_data = 1; - string nonce = 2; -} - -message GetQuoteResponse { - string quote = 1; - string quote_type = 2; -} diff --git a/sdk/golang/ccnp/quote/proto/quote-server_grpc.pb.go b/sdk/golang/ccnp/quote/proto/quote-server_grpc.pb.go deleted file mode 100644 index b6f7ddd..0000000 --- a/sdk/golang/ccnp/quote/proto/quote-server_grpc.pb.go +++ /dev/null @@ -1,105 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.2.0 -// - protoc v3.12.4 -// source: proto/quote-server.proto - -package quoteServer - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -// GetQuoteClient is the client API for GetQuote service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type GetQuoteClient interface { - GetQuote(ctx context.Context, in *GetQuoteRequest, opts ...grpc.CallOption) (*GetQuoteResponse, error) -} - -type getQuoteClient struct { - cc grpc.ClientConnInterface -} - -func NewGetQuoteClient(cc grpc.ClientConnInterface) GetQuoteClient { - return &getQuoteClient{cc} -} - -func (c *getQuoteClient) GetQuote(ctx context.Context, in *GetQuoteRequest, opts ...grpc.CallOption) (*GetQuoteResponse, error) { - out := new(GetQuoteResponse) - err := c.cc.Invoke(ctx, "/quoteserver.GetQuote/GetQuote", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// GetQuoteServer is the server API for GetQuote service. -// All implementations must embed UnimplementedGetQuoteServer -// for forward compatibility -type GetQuoteServer interface { - GetQuote(context.Context, *GetQuoteRequest) (*GetQuoteResponse, error) - mustEmbedUnimplementedGetQuoteServer() -} - -// UnimplementedGetQuoteServer must be embedded to have forward compatible implementations. -type UnimplementedGetQuoteServer struct { -} - -func (UnimplementedGetQuoteServer) GetQuote(context.Context, *GetQuoteRequest) (*GetQuoteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetQuote not implemented") -} -func (UnimplementedGetQuoteServer) mustEmbedUnimplementedGetQuoteServer() {} - -// UnsafeGetQuoteServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to GetQuoteServer will -// result in compilation errors. -type UnsafeGetQuoteServer interface { - mustEmbedUnimplementedGetQuoteServer() -} - -func RegisterGetQuoteServer(s grpc.ServiceRegistrar, srv GetQuoteServer) { - s.RegisterService(&GetQuote_ServiceDesc, srv) -} - -func _GetQuote_GetQuote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetQuoteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(GetQuoteServer).GetQuote(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/quoteserver.GetQuote/GetQuote", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(GetQuoteServer).GetQuote(ctx, req.(*GetQuoteRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// GetQuote_ServiceDesc is the grpc.ServiceDesc for GetQuote service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var GetQuote_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "quoteserver.GetQuote", - HandlerType: (*GetQuoteServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetQuote", - Handler: _GetQuote_GetQuote_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "proto/quote-server.proto", -} diff --git a/sdk/golang/ccnp/quote/quote.go b/sdk/golang/ccnp/quote/quote.go deleted file mode 100644 index 3465143..0000000 --- a/sdk/golang/ccnp/quote/quote.go +++ /dev/null @@ -1,191 +0,0 @@ -/* -* Copyright (c) 2023, Intel Corporation. All rights reserved.
-* SPDX-License-Identifier: Apache-2.0 - */ - -package quote - -import ( - "bytes" - "context" - "encoding/base64" - "encoding/binary" - "log" - "strings" - "time" - - pb "github.com/intel/confidential-cloud-native-primitives/sdk/golang/ccnp/quote/proto" - pkgerrors "github.com/pkg/errors" - "google.golang.org/grpc" -) - -const ( - UDS_PATH = "unix:/run/ccnp/uds/quote-server.sock" - TYPE_TDX = "TDX" - TYPE_TPM = "TPM" -) - -type TPMQuote struct{} - -type TDXQuote struct { - Quote []uint8 // full TD quote - Version uint16 // TD quote version - Tdreport [584]uint8 // full TD report - TeeType uint32 // Type of TEE for which the Quote has been generated - TeeTcbSvn [16]uint8 // Array of TEE TCB SVNs - Mrseam [48]uint8 // Measurement of the SEAM module (SHA384 hash) - Mrseamsigner [48]uint8 // Measurement of a 3rd party SEAM module’s signer (SHA384 hash) - SeamAttributes [8]uint8 // ATTRIBUTES of SEAM - TdAttributes [8]uint8 // ATTRIBUTES of TD - Xfam [8]uint8 // XFAM of TD - Mrtd [48]uint8 // Measurement of the initial contents of the TD (SHA384 hash) - Mrconfigid [48]uint8 // Software defined ID for non-owner-defined configuration of the TD - Mrowner [48]uint8 // Software defined ID for the guest TD’s owner - Mrownerconfig [48]uint8 // Software defined ID for owner-defined configuration of the TD - Rtmrs [192]uint8 // Array of 4 runtime extendable measurement registers (SHA384 hash) - ReportData [64]uint8 // Additional Report Data - Signature [64]uint8 // ECDSA signature, r component followed by s component, 2 x 32 bytes - AttestationKey [64]uint8 // Public part of ECDSA Attestation Key generated by Quoting Enclave - CertData []uint8 // Data required to certify Attestation Key used to sign the Quote -} - -// definition of the quote header and TDReport at: -// https://github.com/intel/SGXDataCenterAttestationPrimitives/blob/master/QuoteGeneration/quote_wrapper/common/inc/sgx_quote_4.h#L112 -type SGXQuoteHeader struct { - Version uint16 // The version this quote structure. - AttKeyType uint16 // sgx_attestation_algorithm_id_t. Describes the type of signature in the signature_data[] field. - TeeType uint32 // Type of Trusted Execution Environment for which the Quote has been generated. Supported values: 0 (SGX), 0x81(TDX) - Reserved uint32 // Reserved field. - VendorId [16]uint8 // Unique identifier of QE Vendor. - UserData [20]uint8 // Custom attestation key owner data. -} - -type TDReport struct { - TeeTcbSvn [16]uint8 - Mrseam [48]uint8 - Mrseamsigner [48]uint8 - SeamAttributes [8]uint8 - TdAttributes [8]uint8 - Xfam [8]uint8 - Mrtd [48]uint8 - Mrconfigid [48]uint8 - Mrowner [48]uint8 - Mrownerconfig [48]uint8 - Rtmrs [192]uint8 - ReportData [64]uint8 -} - -const ( - QuoteHeaderOffset = 0 // 48 bytes quote header, start from index 0 of quote string - QuoteTDReportOffset = 48 // 584 bytes tdreport, start from index 48 of quote string - QuoteAuthDataSizeOffset = 632 // 4 bytes auth size, start from index 632 of quote string - QuoteAuthDataContentOffset = 636 // authSize bytes in auth_data, start from index 636 of quote string - QuoteAuthDataSignatureOffset = 700 // 64 bytes of signature in auth_data, start from index 700 of quote string - QuoteAuthDataAttestationKeyOffset = 764 // 64 bytes of attestation_key in auth_data, start from index 764 of quote string - QuoteAuthDataCertDataOffset = 770 // (authSize-6-128) bytes of cert_data in auth_data, start from index 770 of quote string -) - -func GetQuote(userData string, nonce string) (interface{}, error) { - - channel, err := grpc.Dial(UDS_PATH, grpc.WithInsecure()) - if err != nil { - log.Fatalf("[GetQuote] can not connect to UDS: %v", err) - } - defer channel.Close() - - client := pb.NewGetQuoteClient(channel) - - ctx, cancel := context.WithTimeout(context.Background(), time.Second) - defer cancel() - - response, err := client.GetQuote(ctx, &pb.GetQuoteRequest{UserData: userData, Nonce: nonce}) - if err != nil { - log.Fatalf("[GetQuote] fail to get quote: %v", err) - } - - quote, err := base64.StdEncoding.DecodeString(strings.Trim(response.Quote, "\"")) - if err != nil { - log.Fatalf("[GetQuote] decode quote error: %v", err) - } - - switch response.QuoteType { - case TYPE_TDX: - return parseTDXQuote(quote) - case TYPE_TPM: - return parseTPMQuote(quote) - default: - log.Fatalf("[GetQuote] unknown TEE enviroment!") - } - - return nil, pkgerrors.New("[GetQuote] unknown TEE enviroment!") -} - -func parseTDXQuote(quote []byte) (interface{}, error) { - - var header = SGXQuoteHeader{} - var err = binary.Read(bytes.NewReader(quote[QuoteHeaderOffset:QuoteTDReportOffset]), binary.LittleEndian, &header) - if err != nil { - log.Fatalf("[parseTDXQuote] fail to parse quote header: %v", err) - } - - var tdreport = TDReport{} - err = binary.Read(bytes.NewReader(quote[QuoteTDReportOffset:QuoteAuthDataSizeOffset]), binary.LittleEndian, &tdreport) - if err != nil { - log.Fatalf("[parseTDXQuote] fail to parse quote tdreport: %v", err) - } - - var authSize uint32 = 0 - err = binary.Read(bytes.NewReader(quote[QuoteAuthDataSizeOffset:QuoteAuthDataContentOffset]), binary.LittleEndian, &authSize) - if err != nil { - log.Fatalf("[parseTDXQuote] fail to parse quote auth data size: %v", err) - } - - var signature = [64]uint8{} - err = binary.Read(bytes.NewReader(quote[QuoteAuthDataContentOffset:QuoteAuthDataSignatureOffset]), binary.LittleEndian, &signature) - if err != nil { - log.Fatalf("[parseTDXQuote] fail to parse quote signature: %v", err) - } - - var attestationKey = [64]uint8{} - err = binary.Read(bytes.NewReader(quote[QuoteAuthDataSignatureOffset:QuoteAuthDataAttestationKeyOffset]), binary.LittleEndian, &attestationKey) - if err != nil { - log.Fatalf("[parseTDXQuote] fail to parse quote attestation key: %v", err) - } - - var certData = make([]uint8, authSize-128-6) - err = binary.Read(bytes.NewReader(quote[QuoteAuthDataCertDataOffset:QuoteAuthDataCertDataOffset+authSize-6-128]), binary.LittleEndian, &certData) - if err != nil { - log.Fatalf("[parseTDXQuote] fail to parse quote cert data: %v", err) - } - - var tdquote = TDXQuote{} - var quoteLen = len(quote) - tdquote.Quote = make([]byte, quoteLen) - tdquote.Quote = quote - tdquote.Version = header.Version - copy(tdquote.Tdreport[:], quote[QuoteTDReportOffset:QuoteAuthDataSizeOffset]) - tdquote.TeeType = header.TeeType - tdquote.TeeTcbSvn = tdreport.TeeTcbSvn - tdquote.Mrseam = tdreport.Mrseam - tdquote.Mrseamsigner = tdreport.Mrseamsigner - tdquote.SeamAttributes = tdreport.SeamAttributes - tdquote.TdAttributes = tdreport.TdAttributes - tdquote.Xfam = tdreport.Xfam - tdquote.Mrtd = tdreport.Mrtd - tdquote.Mrconfigid = tdreport.Mrconfigid - tdquote.Mrowner = tdreport.Mrowner - tdquote.Mrownerconfig = tdreport.Mrownerconfig - tdquote.Rtmrs = tdreport.Rtmrs - tdquote.ReportData = tdreport.ReportData - tdquote.Signature = signature - tdquote.AttestationKey = attestationKey - tdquote.CertData = make([]byte, authSize) - tdquote.CertData = certData - - return tdquote, nil -} - -func parseTPMQuote(quote []byte) (interface{}, error) { - // TODO: add vTPM support later - return nil, pkgerrors.New("TPM support to be implemented later.") -} diff --git a/sdk/golang/ccnp/quote/quote_test.go b/sdk/golang/ccnp/quote/quote_test.go deleted file mode 100644 index 32f3142..0000000 --- a/sdk/golang/ccnp/quote/quote_test.go +++ /dev/null @@ -1,159 +0,0 @@ -/* -* Copyright (c) 2023, Intel Corporation. All rights reserved.
-* SPDX-License-Identifier: Apache-2.0 - */ - -package quote - -import ( - "encoding/base64" - "testing" -) - -const ( - VALID_QUOTE_ENCODED = "BAACAIEAAAAAAAAAk5pyM/ecTKmUCg2zlX8GB9VoWcc1+7SRKSdVsujoI7YAAAAABAAGAAAAAAAAAAAAAAAAAEj6aZSdsIAC7oQlKEf1cpiLHW5WjsE1P2TLbA/ZBTdfaa2VnA6vd0escKOSeJMCoQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAUAAAAIDnAgYAAAAAABfVphf2NgeaCjRYyuyU3/+bak+Es43vtr/WLebzXXqIeCPHAGeQloLQcHt8WhbzigAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACtXqZL6zfdtY4RHFnIhccwI8cNiRPCJYxCSIl/pJH7CnbOWGFMXGit1hwDQOnL6QamKCwEsSXOxbhdT3dbcZjkSfbq2r78jZFZt/iut8NB6bd/Gv3MyY8ivM6m68GMOVtcGEiNuFEbi2re+bkwumDYuJJXNImezouBdEdilIrnbqAfsRxX9KWcHQ76LFwLsrAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAF1HHFNzvaaCV4l+d4zRo9cNr+FlQMPEyg8lpvGNMYCdpIRDMgkgolnzv7GDBJ+caAvBEtlc18Jikb/TVbt2J1DMEAAAcP7yQBCnxpfkNObEg3cu+ZPNwlOqKtuprbxkkzvHKm7MEY3lwO4D3wpvPfuy61fLXN1g6qKL/Zalp1ku4Tpk9pqWlSV8WNbCZdEzQg6SJQuR71HTg9lnq7D/8/YM3Dicka45sYZmgTf1rHl+Ta8th1ID3dcz92Tl6DnJB47VPU0GAEYQAAAGBhMVA/8ABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVAAAAAAAAAOcAAAAAAAAAOWseNYAkJ5SHxHr5xWG93BUlhjmq0t2vdgCQ70Y/C4QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANyeKnxvlI8XR040p/xD7QMPfBVj8bq932NAyC4OVKjFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGPxraaayUhlgmee99nba2LwhwoofhQW1chDzLhCYPoVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADYMYOwjPVV15CoDdE36zBAkRjx27eeywUXxdL+CPOiBJ59J3tnoHEz/Se166mPgT2M4Ho7/wqHsqXW8GsyAbAFIAAAAQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHwUAXg4AAC0tLS0tQkVHSU4gQ0VSVElGSUNBVEUtLS0tLQpNSUlFOFRDQ0JKZWdBd0lCQWdJVkFNVUVFZWxSY2ZmQURvcFowT2N2RXpmbGNsaGRNQW9HQ0NxR1NNNDlCQU1DCk1IQXhJakFnQmdOVkJBTU1HVWx1ZEdWc0lGTkhXQ0JRUTBzZ1VHeGhkR1p2Y20wZ1EwRXhHakFZQmdOVkJBb00KRVVsdWRHVnNJRU52Y25CdmNtRjBhVzl1TVJRd0VnWURWUVFIREF0VFlXNTBZU0JEYkdGeVlURUxNQWtHQTFVRQpDQXdDUTBFeEN6QUpCZ05WQkFZVEFsVlRNQjRYRFRJek1URXdNekF5TVRNMU1Gb1hEVE13TVRFd016QXlNVE0xCk1Gb3djREVpTUNBR0ExVUVBd3daU1c1MFpXd2dVMGRZSUZCRFN5QkRaWEowYVdacFkyRjBaVEVhTUJnR0ExVUUKQ2d3UlNXNTBaV3dnUTI5eWNHOXlZWFJwYjI0eEZEQVNCZ05WQkFjTUMxTmhiblJoSUVOc1lYSmhNUXN3Q1FZRApWUVFJREFKRFFURUxNQWtHQTFVRUJoTUNWVk13V1RBVEJnY3Foa2pPUFFJQkJnZ3Foa2pPUFFNQkJ3TkNBQVIxCmg4VkJ6b3dyT043V2ZYeXNLMnhuMTJicHhKYUdiRHpMY1p2WjExM24yRUxRUGhvYWRlTExtOGxaK21LdXhDTmEKSWx1eWZkUGxkanV6eHFlTE82dnpvNElERERDQ0F3Z3dId1lEVlIwakJCZ3dGb0FVbFc5ZHpiMGI0ZWxBU2NuVQo5RFBPQVZjTDNsUXdhd1lEVlIwZkJHUXdZakJnb0Y2Z1hJWmFhSFIwY0hNNkx5OWhjR2t1ZEhKMWMzUmxaSE5sCmNuWnBZMlZ6TG1sdWRHVnNMbU52YlM5elozZ3ZZMlZ5ZEdsbWFXTmhkR2x2Ymk5Mk5DOXdZMnRqY213L1kyRTkKY0d4aGRHWnZjbTBtWlc1amIyUnBibWM5WkdWeU1CMEdBMVVkRGdRV0JCUm9jZlpWbFVBYU94cG5XR0tkOEh4bApweFQwTVRBT0JnTlZIUThCQWY4RUJBTUNCc0F3REFZRFZSMFRBUUgvQkFJd0FEQ0NBamtHQ1NxR1NJYjRUUUVOCkFRU0NBaW93Z2dJbU1CNEdDaXFHU0liNFRRRU5BUUVFRUU4SGJRZ1drdUp4Njh3RXRVVU11RFF3Z2dGakJnb3EKaGtpRytFMEJEUUVDTUlJQlV6QVFCZ3NxaGtpRytFMEJEUUVDQVFJQkJqQVFCZ3NxaGtpRytFMEJEUUVDQWdJQgpCakFRQmdzcWhraUcrRTBCRFFFQ0F3SUJBakFRQmdzcWhraUcrRTBCRFFFQ0JBSUJBakFRQmdzcWhraUcrRTBCCkRRRUNCUUlCQXpBUUJnc3Foa2lHK0UwQkRRRUNCZ0lCQVRBUUJnc3Foa2lHK0UwQkRRRUNCd0lCQURBUUJnc3EKaGtpRytFMEJEUUVDQ0FJQkF6QVFCZ3NxaGtpRytFMEJEUUVDQ1FJQkFEQVFCZ3NxaGtpRytFMEJEUUVDQ2dJQgpBREFRQmdzcWhraUcrRTBCRFFFQ0N3SUJBREFRQmdzcWhraUcrRTBCRFFFQ0RBSUJBREFRQmdzcWhraUcrRTBCCkRRRUNEUUlCQURBUUJnc3Foa2lHK0UwQkRRRUNEZ0lCQURBUUJnc3Foa2lHK0UwQkRRRUNEd0lCQURBUUJnc3EKaGtpRytFMEJEUUVDRUFJQkFEQVFCZ3NxaGtpRytFMEJEUUVDRVFJQkN6QWZCZ3NxaGtpRytFMEJEUUVDRWdRUQpCZ1lDQWdNQkFBTUFBQUFBQUFBQUFEQVFCZ29xaGtpRytFMEJEUUVEQkFJQUFEQVVCZ29xaGtpRytFMEJEUUVFCkJBWUFnRzhGQUFBd0R3WUtLb1pJaHZoTkFRMEJCUW9CQVRBZUJnb3Foa2lHK0UwQkRRRUdCQkJKMnlLQ3ZIY1kKcG03RDBzeld0M0o4TUVRR0NpcUdTSWI0VFFFTkFRY3dOakFRQmdzcWhraUcrRTBCRFFFSEFRRUIvekFRQmdzcQpoa2lHK0UwQkRRRUhBZ0VCQURBUUJnc3Foa2lHK0UwQkRRRUhBd0VCL3pBS0JnZ3Foa2pPUFFRREFnTklBREJGCkFpRUFzODNLOWlmZWhRS09FSWJMNnZWdTBoUTVreUlwejViNkVEWGlHOC8yckZRQ0lFU2NoT2U0N0pQaHNsY00KeFdLTys3NGlaOEZ5aTlJZUJIT25EckptdlVYegotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCi0tLS0tQkVHSU4gQ0VSVElGSUNBVEUtLS0tLQpNSUlDbGpDQ0FqMmdBd0lCQWdJVkFKVnZYYzI5RytIcFFFbkoxUFF6emdGWEM5NVVNQW9HQ0NxR1NNNDlCQU1DCk1HZ3hHakFZQmdOVkJBTU1FVWx1ZEdWc0lGTkhXQ0JTYjI5MElFTkJNUm93R0FZRFZRUUtEQkZKYm5SbGJDQkQKYjNKd2IzSmhkR2x2YmpFVU1CSUdBMVVFQnd3TFUyRnVkR0VnUTJ4aGNtRXhDekFKQmdOVkJBZ01Ba05CTVFzdwpDUVlEVlFRR0V3SlZVekFlRncweE9EQTFNakV4TURVd01UQmFGdzB6TXpBMU1qRXhNRFV3TVRCYU1IQXhJakFnCkJnTlZCQU1NR1VsdWRHVnNJRk5IV0NCUVEwc2dVR3hoZEdadmNtMGdRMEV4R2pBWUJnTlZCQW9NRVVsdWRHVnMKSUVOdmNuQnZjbUYwYVc5dU1SUXdFZ1lEVlFRSERBdFRZVzUwWVNCRGJHRnlZVEVMTUFrR0ExVUVDQXdDUTBFeApDekFKQmdOVkJBWVRBbFZUTUZrd0V3WUhLb1pJemowQ0FRWUlLb1pJemowREFRY0RRZ0FFTlNCLzd0MjFsWFNPCjJDdXpweHc3NGVKQjcyRXlER2dXNXJYQ3R4MnRWVExxNmhLazZ6K1VpUlpDbnFSN3BzT3ZncUZlU3hsbVRsSmwKZVRtaTJXWXozcU9CdXpDQnVEQWZCZ05WSFNNRUdEQVdnQlFpWlF6V1dwMDBpZk9EdEpWU3YxQWJPU2NHckRCUwpCZ05WSFI4RVN6QkpNRWVnUmFCRGhrRm9kSFJ3Y3pvdkwyTmxjblJwWm1sallYUmxjeTUwY25WemRHVmtjMlZ5CmRtbGpaWE11YVc1MFpXd3VZMjl0TDBsdWRHVnNVMGRZVW05dmRFTkJMbVJsY2pBZEJnTlZIUTRFRmdRVWxXOWQKemIwYjRlbEFTY25VOURQT0FWY0wzbFF3RGdZRFZSMFBBUUgvQkFRREFnRUdNQklHQTFVZEV3RUIvd1FJTUFZQgpBZjhDQVFBd0NnWUlLb1pJemowRUF3SURSd0F3UkFJZ1hzVmtpMHcraTZWWUdXM1VGLzIydWFYZTBZSkRqMVVlCm5BK1RqRDFhaTVjQ0lDWWIxU0FtRDV4a2ZUVnB2bzRVb3lpU1l4ckRXTG1VUjRDSTlOS3lmUE4rCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0KLS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUNqekNDQWpTZ0F3SUJBZ0lVSW1VTTFscWROSW56ZzdTVlVyOVFHemtuQnF3d0NnWUlLb1pJemowRUF3SXcKYURFYU1CZ0dBMVVFQXd3UlNXNTBaV3dnVTBkWUlGSnZiM1FnUTBFeEdqQVlCZ05WQkFvTUVVbHVkR1ZzSUVOdgpjbkJ2Y21GMGFXOXVNUlF3RWdZRFZRUUhEQXRUWVc1MFlTQkRiR0Z5WVRFTE1Ba0dBMVVFQ0F3Q1EwRXhDekFKCkJnTlZCQVlUQWxWVE1CNFhEVEU0TURVeU1URXdORFV4TUZvWERUUTVNVEl6TVRJek5UazFPVm93YURFYU1CZ0cKQTFVRUF3d1JTVzUwWld3Z1UwZFlJRkp2YjNRZ1EwRXhHakFZQmdOVkJBb01FVWx1ZEdWc0lFTnZjbkJ2Y21GMAphVzl1TVJRd0VnWURWUVFIREF0VFlXNTBZU0JEYkdGeVlURUxNQWtHQTFVRUNBd0NRMEV4Q3pBSkJnTlZCQVlUCkFsVlRNRmt3RXdZSEtvWkl6ajBDQVFZSUtvWkl6ajBEQVFjRFFnQUVDNm5Fd01ESVlaT2ovaVBXc0N6YUVLaTcKMU9pT1NMUkZoV0dqYm5CVkpmVm5rWTR1M0lqa0RZWUwwTXhPNG1xc3lZamxCYWxUVll4RlAyc0pCSzV6bEtPQgp1ekNCdURBZkJnTlZIU01FR0RBV2dCUWlaUXpXV3AwMGlmT0R0SlZTdjFBYk9TY0dyREJTQmdOVkhSOEVTekJKCk1FZWdSYUJEaGtGb2RIUndjem92TDJObGNuUnBabWxqWVhSbGN5NTBjblZ6ZEdWa2MyVnlkbWxqWlhNdWFXNTAKWld3dVkyOXRMMGx1ZEdWc1UwZFlVbTl2ZEVOQkxtUmxjakFkQmdOVkhRNEVGZ1FVSW1VTTFscWROSW56ZzdTVgpVcjlRR3prbkJxd3dEZ1lEVlIwUEFRSC9CQVFEQWdFR01CSUdBMVVkRXdFQi93UUlNQVlCQWY4Q0FRRXdDZ1lJCktvWkl6ajBFQXdJRFNRQXdSZ0loQU9XLzVRa1IrUzlDaVNEY05vb3dMdVBSTHNXR2YvWWk3R1NYOTRCZ3dUd2cKQWlFQTRKMGxySG9NcytYbzVvL3NYNk85UVd4SFJBdlpVR09kUlE3Y3ZxUlhhcUk9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0KAA==" - EXPECTED_REPORT_DATA_ENCODED = "XUccU3O9poJXiX53jNGj1w2v4WVAw8TKDyWm8Y0xgJ2khEMyCSCiWfO/sYMEn5xoC8ES2VzXwmKRv9NVu3YnUA==" - USER_DATA_ENCODED = "YWJjZGVmZw==" - NONCE_ENCODED = "MTIzNDU2Nzg=" - TDX_QUOTE_VERSION = 4 - TEE_TYPE_TDX = 129 - TDX_TCB_SVN_LENGTH = 16 - TDX_MRSEAM_LENGTH = 48 - TDX_MRSINGERSEAM_LENGTH = 48 - TDX_SEAM_ATTRIBUTES_LENGTH = 8 - TDX_TD_ATTRIBUTES_LENGTH = 8 - TDX_XFAM_LENGTH = 8 - TDX_MRTD_LENGTH = 48 - TDX_MRCONFIGID_LENGTH = 48 - TDX_MROWNER_LENGTH = 48 - TDX_MROWNERCONFIG_LENGTH = 48 - TDX_RTMR_LENGTH = 192 - TDX_REPORT_DATA_LENGTH = 64 - TDX_SIGNATURE_LENGTH = 64 - TDX_ATTESTATION_KEY_LENGTH = 64 -) - -func TestParseTDXQuote(t *testing.T) { - quoteRaw, errDecode := base64.StdEncoding.DecodeString(VALID_QUOTE_ENCODED) - if errDecode != nil { - t.Fatalf("[parseTDXQuote] decode quote error: %v", errDecode) - } - - var ret interface{} - ret, errParse := parseTDXQuote(quoteRaw) - if errParse != nil { - t.Fatalf("[parseTDXQuote] parse quote error: %v", errParse) - } - - switch ret.(type) { - case TDXQuote: - var q, _ = ret.(TDXQuote) - reportSlice := make([]byte, len(q.ReportData)) - copy(reportSlice[:], q.ReportData[:]) - reportDataEncoded := base64.StdEncoding.EncodeToString(reportSlice) - if reportDataEncoded != EXPECTED_REPORT_DATA_ENCODED { - t.Fatalf(`parseTDXQuote, Report Data retrieve = %v, want %v`, - reportDataEncoded, EXPECTED_REPORT_DATA_ENCODED) - } - default: - t.Fatalf(`parseTDXQuote, unexpected quote type`) - } -} - -func TestGetQuote(t *testing.T) { - var ret interface{} - ret, err := GetQuote(USER_DATA_ENCODED, NONCE_ENCODED) - if err != nil { - t.Fatalf("[parseTDXQuote] get quote error: %v", err) - } - switch ret.(type) { - case TDXQuote: - var q, _ = ret.(TDXQuote) - if len(q.Quote) == 0 { - t.Fatalf("[GetQuote] quote length is 0") - } - - if q.Version != TDX_QUOTE_VERSION { - t.Fatalf("[GetQuote] quote version retrieve: %v, expected: %v", q.Version, TDX_QUOTE_VERSION) - } - - if len(q.Tdreport) == 0 { - t.Fatalf("[GetQuote] TDReport length is 0") - } - - if q.TeeType != TEE_TYPE_TDX { - t.Fatalf("[GetQuote] TeeType retrieve: %v, expected: %v", q.TeeType, TEE_TYPE_TDX) - } - - if len(q.TeeTcbSvn) != TDX_TCB_SVN_LENGTH { - t.Fatalf("[GetQuote] TeeType retrieve: %v, expected: %v", len(q.TeeTcbSvn), TDX_TCB_SVN_LENGTH) - } - - if len(q.Mrseam) != TDX_MRSEAM_LENGTH { - t.Fatalf("[GetQuote] Mrseam retrieve: %v, expected: %v", len(q.Mrseam), TDX_MRSEAM_LENGTH) - } - - if len(q.Mrseamsigner) != TDX_MRSINGERSEAM_LENGTH { - t.Fatalf("[GetQuote] Mrseamsigner retrieve: %v, expected: %v", len(q.Mrseamsigner), TDX_MRSINGERSEAM_LENGTH) - } - - if len(q.SeamAttributes) != TDX_SEAM_ATTRIBUTES_LENGTH { - t.Fatalf("[GetQuote] SeamAttributes length retrieve: %v, expected: %v", len(q.SeamAttributes), TDX_SEAM_ATTRIBUTES_LENGTH) - } - - if len(q.TdAttributes) != TDX_TD_ATTRIBUTES_LENGTH { - t.Fatalf("[GetQuote] TdAttributes length retrieve: %v, expected: %v", len(q.TdAttributes), TDX_TD_ATTRIBUTES_LENGTH) - } - - if len(q.Xfam) != TDX_XFAM_LENGTH { - t.Fatalf("[GetQuote] Xfam length retrieve: %v, expected: %v", len(q.Xfam), TDX_XFAM_LENGTH) - } - - if len(q.Mrtd) != TDX_MRTD_LENGTH { - t.Fatalf("[GetQuote] Mrtd length retrieve: %v, expected: %v", len(q.Mrtd), TDX_MRTD_LENGTH) - } - - if len(q.Mrconfigid) != TDX_MRCONFIGID_LENGTH { - t.Fatalf("[GetQuote] Mrconfigid length retrieve: %v, expected: %v", len(q.Mrconfigid), TDX_MRCONFIGID_LENGTH) - } - - if len(q.Mrowner) != TDX_MROWNER_LENGTH { - t.Fatalf("[GetQuote] Mrowner length retrieve: %v, expected: %v", len(q.Mrowner), TDX_MROWNER_LENGTH) - } - - if len(q.Mrownerconfig) != TDX_MROWNERCONFIG_LENGTH { - t.Fatalf("[GetQuote] Mrownerconfig length retrieve: %v, expected: %v", len(q.Mrownerconfig), TDX_MROWNERCONFIG_LENGTH) - } - - if len(q.Rtmrs) != TDX_RTMR_LENGTH { - t.Fatalf("[GetQuote] Rtmrs length retrieve: %v, expected: %v", len(q.Rtmrs), TDX_RTMR_LENGTH) - } - - if len(q.ReportData) != TDX_REPORT_DATA_LENGTH { - t.Fatalf("[GetQuote] ReportData length retrieve: %v, expected: %v", len(q.ReportData), TDX_REPORT_DATA_LENGTH) - } - - reportSlice := make([]byte, len(q.ReportData)) - copy(reportSlice[:], q.ReportData[:]) - reportDataEncoded := base64.StdEncoding.EncodeToString(reportSlice) - if reportDataEncoded != EXPECTED_REPORT_DATA_ENCODED { - t.Fatalf(`parseTDXQuote, report data retrieve = %v, want %v`, - reportDataEncoded, EXPECTED_REPORT_DATA_ENCODED) - } - - if len(q.Signature) != TDX_SIGNATURE_LENGTH { - t.Fatalf("[GetQuote] Signature length retrieve: %v, expected: %v", len(q.Signature), TDX_SIGNATURE_LENGTH) - } - - if len(q.AttestationKey) != TDX_ATTESTATION_KEY_LENGTH { - t.Fatalf("[GetQuote] AttestationKey length retrieve: %v, expected: %v", len(q.AttestationKey), TDX_ATTESTATION_KEY_LENGTH) - } - - if len(q.CertData) == 0 { - t.Fatalf("[GetQuote] CertData length is 0") - } - - default: - t.Fatalf(`parseTDXQuote, unexpected quote type`) - } -} diff --git a/sdk/golang/ccnp/sdk.go b/sdk/golang/ccnp/sdk.go new file mode 100644 index 0000000..d2f1ad5 --- /dev/null +++ b/sdk/golang/ccnp/sdk.go @@ -0,0 +1,137 @@ +/* +* Copyright (c) 2024, Intel Corporation. All rights reserved.
+* SPDX-License-Identifier: Apache-2.0 + */ + +package ccnp + +import ( + "errors" + "log" + + "github.com/cc-api/cc-trusted-api/common/golang/cctrusted_base" + "github.com/cc-api/cc-trusted-api/common/golang/cctrusted_base/tdx" +) + +var _ cctrusted_base.CCTrustedAPI = (*SDK)(nil) + +type SDK struct { +} + +// GetCCReport implements CCTrustedAPI +func (s *SDK) GetCCReport(nonce string, userData string, _ any) (cctrusted_base.Report, error) { + client, err := NewClient() + if err != nil { + log.Fatalf("[GetCCReport] failed to connect to client with error %v", err) + return nil, err + } + + result, err := client.GetCCReportFromServer(userData, nonce) + if err != nil { + return nil, err + } + + switch cctrusted_base.CC_Type(result.CcType) { + case cctrusted_base.TYPE_CC_TDX: + report, err := tdx.NewTdxReportFromBytes(result.CcReport) + if err != nil { + return nil, err + } + return report, nil + default: + } + return nil, errors.New("[GetCCReport] get CC report failed") +} + +// DumpCCReport implements cctrusted_base.CCTrustedAPI. +func (s *SDK) DumpCCReport(reportBytes []byte) error { + return nil +} + +// GetCCMeasurement implements cctrusted_base.CCTrustedAPI. +func (s *SDK) GetCCMeasurement(index int, alg cctrusted_base.TCG_ALG) (cctrusted_base.TcgDigest, error) { + client, err := NewClient() + if err != nil { + log.Fatalf("[GetCCMeasurement] failed to connect to client with error %v", err) + return cctrusted_base.TcgDigest{}, err + } + + result, err := client.GetCCMeasurementFromServer(index, alg) + if err != nil { + return cctrusted_base.TcgDigest{}, err + } + return cctrusted_base.TcgDigest{AlgID: cctrusted_base.TCG_ALG(result.Measurement.AlgoId), Hash: result.Measurement.Hash}, nil +} + +// GetMeasurementCount implements cctrusted_base.CCTrustedAPI. +func (s *SDK) GetMeasurementCount() (int, error) { + client, err := NewClient() + if err != nil { + log.Fatalf("[GetMeasurementCount] failed to connect to client with error %v", err) + return -1, err + } + + result, err := client.GetMeasurementCountFromServer() + if err != nil { + return -1, err + } + return int(result.Count), nil +} + +// ReplayCCEventLog implements cctrusted_base.CCTrustedAPI. +func (s *SDK) ReplayCCEventLog(formatedEventLogs []cctrusted_base.FormatedTcgEvent) map[int]map[cctrusted_base.TCG_ALG][]byte { + return cctrusted_base.ReplayFormatedEventLog(formatedEventLogs) +} + +// GetDefaultAlgorithm implements cctrusted_base.CCTrustedAPI. +func (s *SDK) GetDefaultAlgorithm() (cctrusted_base.TCG_ALG, error) { + client, err := NewClient() + if err != nil { + log.Fatalf("[GetDefaultAlgorithm] failed to connect to client with error %v", err) + return cctrusted_base.TPM_ALG_ERROR, err + } + + result, err := client.GetDefaultAlgorithmFromServer() + if err != nil { + return cctrusted_base.TPM_ALG_ERROR, err + } + return cctrusted_base.TCG_ALG(result.AlgoId), nil +} + +// GetCCEventlog implements CCTrustedAPI. +func (s *SDK) GetCCEventLog(params ...int32) ([]cctrusted_base.FormatedTcgEvent, error) { + if len(params) > 2 { + log.Fatalf("Invalid params specified for [GetCCEventlog].") + return nil, errors.New("Invalid params.") + } + + client, err := NewClient() + if err != nil { + log.Fatalf("[GetCCEventLog] failed to connect to client with error %v", err) + return nil, err + } + + result, err := client.GetCCEventLogFromServer(params...) + if err != nil { + return nil, err + } + + formatted_log_list := make([]cctrusted_base.FormatedTcgEvent, len(result)) + for idx, log := range result { + digests := make([]cctrusted_base.TcgDigest, len(log.Digests)) + for idx, digest := range log.Digests { + formattedData := cctrusted_base.TcgDigest{AlgID: cctrusted_base.TCG_ALG(digest.AlgoId), Hash: digest.Hash} + digests[idx] = formattedData + } + logParser := cctrusted_base.TcgEventLogParser{RecNum: int(log.RecNum), ImrIndex: int(log.ImrIndex), EventType: cctrusted_base.TcgEventType(log.EventType), Digests: digests, EventSize: int(log.EventSize), Event: log.Event, ExtraInfo: log.ExtraInfo} + if cctrusted_base.TcgEventType(log.EventType) != cctrusted_base.IMA_MEASUREMENT_EVENT { + formattedLog := logParser.Format(cctrusted_base.TCG_PCCLIENT_FORMAT) + formatted_log_list[idx] = formattedLog + } else { + formattedLog := logParser.Format(cctrusted_base.TCG_CANONICAL_FORMAT) + formatted_log_list[idx] = formattedLog + } + } + + return formatted_log_list, nil +}