Skip to content

Commit

Permalink
Merge pull request #29 from deeglaze/fixlog
Browse files Browse the repository at this point in the history
Change log statements in attest to logger
  • Loading branch information
deeglaze authored Dec 14, 2022
2 parents 84fa29b + 7471382 commit 1e85fc4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
13 changes: 6 additions & 7 deletions tools/attest/attest.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"flag"
"fmt"
"io"
"log"
"os"

"github.com/google/go-sev-guest/abi"
Expand Down Expand Up @@ -158,17 +157,17 @@ func main() {
}

if !(*outform == "bin" || *outform == "proto" || *outform == "textproto") {
log.Fatalf("-outform is %s. Expect \"bin\", \"proto\", or \"textproto\"",
logger.Fatalf("-outform is %s. Expect \"bin\", \"proto\", or \"textproto\"",
*outform)
}

if *vmpl < 0 || *vmpl > 3 {
log.Fatalf("-vmpl is %d. Expect 0-3.", *vmpl)
logger.Fatalf("-vmpl is %d. Expect 0-3.", *vmpl)
}

outwriter, filetoclose, err := outWriter()
if err != nil {
log.Fatal(err)
logger.Fatal(err)
}
defer func() {
if filetoclose != nil {
Expand All @@ -178,18 +177,18 @@ func main() {

device, err := client.OpenDevice()
if err != nil {
log.Fatal(err)
logger.Fatal(err)
}
defer device.Close()
var reportData64 [abi.ReportDataSize]byte
copy(reportData64[:], reportData)
if *extended {
if err := outputExtendedReport(device, reportData64, outwriter); err != nil {
log.Fatal(err)
logger.Fatal(err)
}
} else {
if err := outputReport(device, reportData64, outwriter); err != nil {
log.Fatal(err)
logger.Fatal(err)
}
}
}
7 changes: 7 additions & 0 deletions verify/verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"encoding/asn1"
"math/big"
"math/rand"
"os"
"strings"
"sync"
"testing"
Expand All @@ -34,6 +35,7 @@ import (
test "github.com/google/go-sev-guest/testing"
testclient "github.com/google/go-sev-guest/testing/client"
"github.com/google/go-sev-guest/verify/trust"
"github.com/google/logger"
)

// These certificates are committed regardless of its expiration date since we adjust the
Expand Down Expand Up @@ -61,6 +63,11 @@ func initSigner() {
signer = newSigner
}

func TestMain(m *testing.M) {
logger.Init("VerifyTestLog", false, false, os.Stderr)
os.Exit(m.Run())
}

func TestEmbeddedCertsAppendixB3Expectations(t *testing.T) {
// https://www.amd.com/system/files/TechDocs/55766_SEV-KM_API_Specification.pdf
// Appendix B.1
Expand Down

0 comments on commit 1e85fc4

Please sign in to comment.