NOISSUE - Simplify local agent running in non sev-snp environment (#411)

* Add vtpm attestation support to agent service and server

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* Update mockery version to v2.53.2 and refactor VM factory to include logger

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* Send event notification when computation is stopped in agentService

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* Remove redundant assignment of Stderr in qemuVM Start method

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* Rename SVM references to CVM in tracing, logging, metrics, and service layers

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

---------

Signed-off-by: Sammy Oina <sammyoina@gmail.com>
This commit is contained in:
Sammy Kerata Oina
2025-04-01 22:59:11 +03:00
committed by GitHub
parent ebe119686f
commit 7e63921896
38 changed files with 845 additions and 290 deletions
@@ -1,7 +1,7 @@
// Copyright (c) Ultraviolet
// SPDX-License-Identifier: Apache-2.0
// Code generated by mockery v2.43.2. DO NOT EDIT.
// Code generated by mockery v2.53.2. DO NOT EDIT.
package mocks
@@ -82,7 +82,7 @@ func (_c *LeveledQuoteProvider_GetRawQuoteAtLevel_Call) RunAndReturn(run func([6
return _c
}
// IsSupported provides a mock function with given fields:
// IsSupported provides a mock function with no fields
func (_m *LeveledQuoteProvider) IsSupported() bool {
ret := _m.Called()
@@ -127,7 +127,7 @@ func (_c *LeveledQuoteProvider_IsSupported_Call) RunAndReturn(run func() bool) *
return _c
}
// Product provides a mock function with given fields:
// Product provides a mock function with no fields
func (_m *LeveledQuoteProvider) Product() *sevsnp.SevProduct {
ret := _m.Called()
+7
View File
@@ -42,6 +42,8 @@ var (
ErrNoHashAlgo = errors.New("hash algo is not supported")
)
type VtpmAttest func(teeNonce []byte, vTPMNonce []byte, teeAttestaion bool) ([]byte, error)
type tpmWrapper struct {
io.ReadWriteCloser
}
@@ -163,6 +165,11 @@ func VTPMVerify(quote []byte, pubKeyTLS []byte, teeNonce []byte, vtpmNonce []byt
return nil
}
// EmptyAttest is a dummy attestation function that returns an empty attestation report.
func EmptyAttest(teeNonce []byte, vTPMNonce []byte, teeAttestaion bool) ([]byte, error) {
return []byte{}, nil
}
func publicKeyToBytes(pubKey interface{}) ([]byte, error) {
derBytes, err := x509.MarshalPKIXPublicKey(pubKey)
if err != nil {
+2 -2
View File
@@ -77,7 +77,7 @@ func TestSendAlgorithm(t *testing.T) {
req, err = os.Open(req.Name())
assert.NoError(t, err)
algoStream := new(mocks.AgentService_AlgoClient)
algoStream := new(mocks.AgentService_AlgoClient[agent.AlgoRequest, agent.AlgoResponse])
algoStream.On("Send", mock.Anything).Return(tc.sendError)
algoStream.On("CloseAndRecv").Return(&agent.AlgoResponse{}, tc.closeRecvError)
mockStream := &mockAlgoStream{stream: algoStream}
@@ -141,7 +141,7 @@ func TestSendData(t *testing.T) {
dataset, err = os.Open(dataset.Name())
assert.NoError(t, err)
dataStream := new(mocks.AgentService_DataClient)
dataStream := new(mocks.AgentService_DataClient[agent.DataRequest, agent.DataResponse])
dataStream.On("Send", mock.Anything).Return(tc.sendError)
dataStream.On("CloseAndRecv").Return(&agent.DataResponse{}, tc.closeRecvError)
mockStream := &mockDataStream{stream: dataStream}
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright (c) Ultraviolet
// SPDX-License-Identifier: Apache-2.0
// Code generated by mockery v2.43.2. DO NOT EDIT.
// Code generated by mockery v2.53.2. DO NOT EDIT.
package mocks