Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial profile changes #180

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions verification/certifyKey_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@ func testCertifyKey(d TestDPEInstance, t *testing.T) {
}
defer d.PowerOff()
}
client, err := NewClient256(d)
client, err := NewClient384(d)
if err != nil {
t.Fatalf("Could not initialize client: %v", err)
}

certifyKeyReq := CertifyKeyReq[SHA256Digest]{
certifyKeyReq := CertifyKeyReq[SHA384Digest]{
ContextHandle: [16]byte{0},
Flags: 0,
Label: [32]byte{0},
Label: [48]byte{0},
Format: CertifyKeyX509,
}

Expand Down
18 changes: 9 additions & 9 deletions verification/emulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ const (

DPE_EMULATOR_AUTO_INIT_LOCALITY uint32 = 0
DPE_EMULATOR_OTHER_LOCALITY uint32 = 0
DPE_EMULATOR_PROFILE Profile = 0
DPE_EMULATOR_MAX_TCI_NODES uint32 = 0
DPE_EMULATOR_PROFILE Profile = ProfileP384SHA384
DPE_EMULATOR_MAX_TCI_NODES uint32 = 0x00000018
DPE_EMULATOR_MAJOR_PROFILE_VERSION uint16 = 0
DPE_EMULATOR_MINOR_PROFILE_VERSION uint16 = 0
DPE_EMULATOR_VENDOR_ID uint32 = 0
DPE_EMULATOR_VENDOR_SKU uint32 = 0
DPE_EMULATOR_MINOR_PROFILE_VERSION uint16 = 8
DPE_EMULATOR_VENDOR_ID uint32 = 0x43545241
DPE_EMULATOR_VENDOR_SKU uint32 = 0x43545241
)

// Added dummy support for emulator .This is to verify against the support_needed list
var emulator_supports = []string{"AutoInit", "X509"}
var emulator_supports = []string{"AutoInit", "X509", "Simulation"}

//TODO code for emulator to start, stop, getsupport

Expand Down Expand Up @@ -116,7 +116,7 @@ func (s *DpeEmulator) waitForPower(on bool) bool {

for i := 0; i < checks_per_sec*timeout_seconds; i++ {
// Check if the socket file has been created.
if fileExists(simulatorSocketPath) == on {
if fileExists(emulatorSocketPath) == on {
return true
}
time.Sleep(time.Duration(1000/checks_per_sec) * time.Millisecond)
Expand All @@ -126,7 +126,7 @@ func (s *DpeEmulator) waitForPower(on bool) bool {

func (s *DpeEmulator) SendCmd(buf []byte) ([]byte, error) {
// Connect to DPE instance.
conn, err := net.Dial("unix", simulatorSocketPath)
conn, err := net.Dial("unix", emulatorSocketPath)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -158,7 +158,7 @@ func (s *DpeEmulator) GetSupport() *Support {
}

func (s *DpeEmulator) GetProfile() Profile {
return DPE_SIMULATOR_PROFILE
return DPE_EMULATOR_PROFILE
}

func (s *DpeEmulator) GetSupportedLocalities() []uint32 {
Expand Down
2 changes: 1 addition & 1 deletion verification/getProfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ func testGetProfile(d TestDPEInstance, t *testing.T) {
}
defer d.PowerOff()
}
client, err := NewClient256(d)
client, err := NewClient384(d)
if err != nil {
t.Fatalf("Could not initialize client: %v", err)
}
Expand Down
17 changes: 0 additions & 17 deletions verification/go.mod
jhand2 marked this conversation as resolved.
Show resolved Hide resolved

This file was deleted.

123 changes: 0 additions & 123 deletions verification/go.sum
jhand2 marked this conversation as resolved.
Show resolved Hide resolved

This file was deleted.

2 changes: 1 addition & 1 deletion verification/initializeContext_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func testInitContext(d TestDPEInstance, t *testing.T) {
defer d.PowerOff()
}

client, err := NewClient256(d)
client, err := NewClient384(d)
if err != nil {
t.Fatalf("Could not initialize client: %v", err)
}
Expand Down
5 changes: 3 additions & 2 deletions verification/verification_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,14 @@ func GetTestTarget(support_needed []string) (TestDPEInstance, error) {
// Get the emulator target
func GetEmulatorTarget(support_needed []string) (TestDPEInstance, error) {

value := reflect.ValueOf(DpeEmulator{}.supports)
/*value := reflect.ValueOf(DpeEmulator{}.supports)
for i := 0; i < len(support_needed); i++ {
support := reflect.Indirect(value).FieldByName(support_needed[i])
if !support.Bool() {
return nil, errors.New("Error in creating dpe instances - supported feature is not enabled in emulator")
}
}
}*/
// TODO : Get the supported modes from emulator and then check.
jhand2 marked this conversation as resolved.
Show resolved Hide resolved
var instance TestDPEInstance = &DpeEmulator{exe_path: *target_exe}
return instance, nil
}
Expand Down