From 8d0979eb8a74ab430ceac617b710fd284fa9c6d0 Mon Sep 17 00:00:00 2001 From: Christian Schmucker Date: Mon, 4 Mar 2024 08:07:31 +0000 Subject: [PATCH 1/3] implemented sgx report generation --- .gitignore | 2 + attestationreport/attestationreport.go | 10 +- attestationreport/intel_helpers.go | 28 +- attestationreport/sgx.go | 6 +- attestationreport/sgx_test.go | 9 +- attestationreport/tdx.go | 2 +- cmc/sgx.go | 25 ++ example-setup/enclave.json | 19 ++ go.mod | 1 + go.sum | 26 ++ sgxdriver/sgxdriver.go | 435 +++++++++++++++++++++++++ testtool/Makefile | 12 +- 12 files changed, 553 insertions(+), 22 deletions(-) create mode 100644 cmc/sgx.go create mode 100644 example-setup/enclave.json create mode 100644 sgxdriver/sgxdriver.go diff --git a/.gitignore b/.gitignore index c3808ecf..7fbc4730 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ example-setup/metadata-signed/* tpmdriver/test_encrypted_ak.json est/server/server attestationreport/cache/* +testtool/private.pem +testtool/public.pem \ No newline at end of file diff --git a/attestationreport/attestationreport.go b/attestationreport/attestationreport.go index c0abc37e..d8fede03 100644 --- a/attestationreport/attestationreport.go +++ b/attestationreport/attestationreport.go @@ -344,8 +344,14 @@ type CompanyDescription struct { // DeviceConfig contains the local device configuration parameters type DeviceConfig struct { MetaInfo - AkCsr CsrParams `json:"akCsr" cbor:"3,keyasint"` - IkCsr CsrParams `json:"ikCsr" cbor:"4,keyasint"` + AkCsr CsrParams `json:"akCsr" cbor:"3,keyasint"` + IkCsr CsrParams `json:"ikCsr" cbor:"4,keyasint"` + SgxValues struct { + EncryptedPPID HexByte `json:"encryptedPPID" cbor:"5,keyasint"` + Pceid HexByte `json:"pceid" cbor:"6,keyasint"` + Cpusvn HexByte `json:"cpusvn" cbor:"7,keyasint"` + Pcesvn HexByte `json:"pcesvn" cbor:"8,keyasint"` + } } // CsrParams contains certificate signing request parameters diff --git a/attestationreport/intel_helpers.go b/attestationreport/intel_helpers.go index 32e83c46..7973a0fc 100644 --- a/attestationreport/intel_helpers.go +++ b/attestationreport/intel_helpers.go @@ -20,6 +20,7 @@ import ( "crypto/ecdsa" "crypto/elliptic" "crypto/sha256" + "crypto/tls" "crypto/x509" "encoding/asn1" "encoding/binary" @@ -282,7 +283,7 @@ type Configuration struct { // ------------------------- end SGX Extensions ------------------------- -func parseSGXExtensions(extensions []byte) (SGXExtensionsValue, error) { +func ParseSGXExtensions(extensions []byte) (SGXExtensionsValue, error) { var sgx_extensions SGXExtensionsValue rest, err := asn1.Unmarshal(extensions, &sgx_extensions.Ppid) @@ -464,7 +465,7 @@ func parseECDSASignature(buf *bytes.Buffer, sig *ECDSA256QuoteSignatureDataStruc return fmt.Errorf("failed to parse QECertDataSize") } tmp = make([]byte, sig.QECertDataSize) - binary.Read(buf, binary.LittleEndian, &tmp) + err = binary.Read(buf, binary.LittleEndian, &tmp) if err != nil { return fmt.Errorf("failed to parse QECertData") } @@ -613,7 +614,7 @@ func VerifyIntelQuoteSignature(reportRaw []byte, quoteSignature any, case TDX_QUOTE_TYPE: x509Chains, code = VerifyIntelCertChainFull(certs, CA_PLATFORM, intelCache) } - if err != nil { + if code != NotSet { log.Tracef("Failed to verify certificate chain: %v", err) result.CertChainCheck.SetErr(code) return result, false @@ -658,12 +659,11 @@ func verifyTcbInfo(tcbInfo *TcbInfo, tcbInfoBodyRaw string, tcbKeyCert *x509.Cer return result } - regex := regexp.MustCompile(`\s+`) - // remove whitespaces - regex.ReplaceAllString(tcbInfoBodyRaw, "") + regex := regexp.MustCompile(`("(?:\\.|[^"])*")|\s+`) + // remove whitespaces from json while preserving strings + tcbInfoBodyRaw = regex.ReplaceAllString(tcbInfoBodyRaw, "$1") // remove "{"tcbInfo":" from beginning and signature + rest from the end tcbInfoBodyRaw = tcbInfoBodyRaw[len(`{"tcbInfo":`) : len(tcbInfoBodyRaw)-128-16] - // get checksum of tcb info body digest := sha256.Sum256([]byte(tcbInfoBodyRaw)) @@ -783,7 +783,7 @@ func VerifyQEIdentity(qeReportBody *EnclaveReportBody, qeIdentity *QEIdentity, q } regex := regexp.MustCompile(`\s+`) - regex.ReplaceAllString(qeIdentityBodyRaw, "") // remove whitespace + qeIdentityBodyRaw = regex.ReplaceAllString(qeIdentityBodyRaw, "") // remove whitespace qeIdentityBodyRaw = qeIdentityBodyRaw[len(`{"enclaveIdentity":`) : len(qeIdentityBodyRaw)-128-16] // remove "{"enclaveIdentity":" from beginning and signature + rest from the end // get checksum of qe identity body @@ -1013,13 +1013,21 @@ func fetchCRL(uri string, name string, ca string, cache string) (*x509.Revocatio if err != nil { return nil, err } + return crl, nil } return nil, err } // Download CRL from the Intel PCS func downloadCRL(uri string) (*x509.RevocationList, error) { - resp, err := http.Get(uri) + req, err := http.NewRequest("GET", uri, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %v", err) + + } + tlsConfig := &tls.Config{InsecureSkipVerify: true} + client := http.Client{Transport: &http.Transport{TLSClientConfig: tlsConfig}} + resp, err := client.Do(req) if err != nil { return nil, err } @@ -1057,7 +1065,7 @@ func VerifyIntelCertChainFull(quoteCerts SgxCertificates, ca string, intelCache // download CRLs from PCS root_ca_crl, err := fetchCRL(PCS_ROOT_CA_CRL_URI, ROOT_CA_CRL_NAME, "", intelCache) if err != nil { - log.Tracef("downloading ROOT CA CRL from PCS failed: %v", err) + log.Tracef("downloading Root CA CRL from PCS failed: %v", err) return nil, DownloadRootCRL } diff --git a/attestationreport/sgx.go b/attestationreport/sgx.go index 3cc89ed8..f208e431 100644 --- a/attestationreport/sgx.go +++ b/attestationreport/sgx.go @@ -199,7 +199,7 @@ func verifySgxMeasurements(sgxM Measurement, nonce []byte, intelCache string, re } // Parse and verify PCK certificate extensions - sgxExtensions, err := parseSGXExtensions(quoteCerts.PCKCert.Extensions[SGX_EXTENSION_INDEX].Value[4:]) // skip the first value (not relevant) + sgxExtensions, err := ParseSGXExtensions(quoteCerts.PCKCert.Extensions[SGX_EXTENSION_INDEX].Value[4:]) // skip the first value (not relevant) if err != nil { log.Tracef("failed to parse SGX Extensions from PCK Certificate: %v", err) result.Summary.SetErr(ParseExtensions) @@ -305,7 +305,7 @@ func VerifySgxQuoteBody(body *EnclaveReportBody, tcbInfo *TcbInfo, result.Artifacts = append(result.Artifacts, DigestResult{ Name: "MrSigner", - Digest: hex.EncodeToString(body.MRENCLAVE[:]), + Digest: hex.EncodeToString(body.MRSIGNER[:]), Success: strings.EqualFold(sgxReferenceValue.Sgx.MrSigner, hex.EncodeToString(body.MRSIGNER[:])), Type: "Measurement", }, @@ -331,7 +331,7 @@ func VerifySgxQuoteBody(body *EnclaveReportBody, tcbInfo *TcbInfo, for _, v := range result.Artifacts { if !v.Success { - return fmt.Errorf("TDX Quote Body Verification failed. %v: (Got: %v)", v.Name, v.Digest) + return fmt.Errorf("SGX Quote Body Verification failed. %v: (Got: %v)", v.Name, v.Digest) } } diff --git a/attestationreport/sgx_test.go b/attestationreport/sgx_test.go index 7ba9b379..f6da6638 100644 --- a/attestationreport/sgx_test.go +++ b/attestationreport/sgx_test.go @@ -429,7 +429,7 @@ func TestParseSGXExtensions(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - got, err := parseSGXExtensions(tt.args.extensions) + got, err := ParseSGXExtensions(tt.args.extensions) if (err != nil) != tt.wantErr { t.Errorf("ParseSGXExtensions() error = %v, wantErr %v", err, tt.wantErr) fmt.Println(got) @@ -1229,10 +1229,9 @@ var ( sgx_extensions_short = []byte{0x30, 0x1E, 0x06, 0x0A, 0x2A, 0x86, 0x48, 0x86, 0xF8, 0x4D, 0x01, 0x0D, 0x01, 0x01, 0x04, 0x10, 0x68, 0x7F, 0x27, 0x16, 0xC8, 0xB5, 0x33, 0xAE, 0x4F, 0x4A, 0x44, 0x2C, 0x07, 0x9D, 0xB2, 0x04} sgx_extensions, _ = hex.DecodeString("301E060A2A864886F84D010D01010410687F2716C8B533AE4F4A442C079DB20430820163060A2A864886F84D010D0102308201533010060B2A864886F84D010D0102010201073010060B2A864886F84D010D0102020201073010060B2A864886F84D010D0102030201003010060B2A864886F84D010D0102040201003010060B2A864886F84D010D0102050201003010060B2A864886F84D010D0102060201003010060B2A864886F84D010D0102070201003010060B2A864886F84D010D0102080201003010060B2A864886F84D010D0102090201003010060B2A864886F84D010D01020A0201003010060B2A864886F84D010D01020B0201003010060B2A864886F84D010D01020C0201003010060B2A864886F84D010D01020D0201003010060B2A864886F84D010D01020E0201003010060B2A864886F84D010D01020F0201003010060B2A864886F84D010D0102100201003010060B2A864886F84D010D01021102010D301F060B2A864886F84D010D0102120410070700000000000000000000000000003010060A2A864886F84D010D0103040200003014060A2A864886F84D010D0104040600706A100000300F060A2A864886F84D010D01050A0100") validSGXVersion uint16 = 0x03 - //validSGXAttributes [16]byte = [16]byte{0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - validIsvProdId uint16 = 0x00 - validIsvSvn uint16 = 0 - validMRSIGNER = "37E0543F5597B0F0E028FA18955E1307CB7A8CF54B37F513FF64961EADEF94C4" + validIsvProdId uint16 = 0x00 + validIsvSvn uint16 = 0 + validMRSIGNER = "37E0543F5597B0F0E028FA18955E1307CB7A8CF54B37F513FF64961EADEF94C4" // old/invalid values tcb_info_old = []byte(`{"tcbInfo":{"id":"SGX","version":3,"issueDate":"2023-05-20T23:45:45Z","nextUpdate":"2023-06-19T23:45:45Z","fmspc":"00706A100000","pceId":"0000","tcbType":0,"tcbEvaluationDataNumber":15,"tcbLevels":[{"tcb":{"sgxtcbcomponents":[{"svn":8},{"svn":8},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0}],"pcesvn":13},"tcbDate":"2023-02-15T00:00:00Z","tcbStatus":"UpToDate"},{"tcb":{"sgxtcbcomponents":[{"svn":7},{"svn":7},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0}],"pcesvn":13},"tcbDate":"2022-11-09T00:00:00Z","tcbStatus":"OutOfDate","advisoryIDs":["INTEL-SA-00657","INTEL-SA-00767"]},{"tcb":{"sgxtcbcomponents":[{"svn":5},{"svn":5},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0}],"pcesvn":11},"tcbDate":"2021-11-10T00:00:00Z","tcbStatus":"OutOfDate","advisoryIDs":["INTEL-SA-00617","INTEL-SA-00657","INTEL-SA-00767"]},{"tcb":{"sgxtcbcomponents":[{"svn":4},{"svn":4},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0}],"pcesvn":11},"tcbDate":"2021-06-09T00:00:00Z","tcbStatus":"OutOfDate","advisoryIDs":["INTEL-SA-00528","INTEL-SA-00617","INTEL-SA-00657","INTEL-SA-00767"]},{"tcb":{"sgxtcbcomponents":[{"svn":3},{"svn":3},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0}],"pcesvn":10},"tcbDate":"2020-11-11T00:00:00Z","tcbStatus":"OutOfDate","advisoryIDs":["INTEL-SA-00465","INTEL-SA-00477","INTEL-SA-00528","INTEL-SA-00617","INTEL-SA-00657","INTEL-SA-00767"]},{"tcb":{"sgxtcbcomponents":[{"svn":2},{"svn":2},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0}],"pcesvn":9},"tcbDate":"2020-06-10T00:00:00Z","tcbStatus":"OutOfDate","advisoryIDs":["INTEL-SA-00381","INTEL-SA-00389","INTEL-SA-00465","INTEL-SA-00477","INTEL-SA-00528","INTEL-SA-00617","INTEL-SA-00657","INTEL-SA-00767"]},{"tcb":{"sgxtcbcomponents":[{"svn":2},{"svn":2},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0}],"pcesvn":7},"tcbDate":"2019-05-15T00:00:00Z","tcbStatus":"OutOfDate","advisoryIDs":["INTEL-SA-00220","INTEL-SA-00270","INTEL-SA-00293","INTEL-SA-00381","INTEL-SA-00389","INTEL-SA-00465","INTEL-SA-00477","INTEL-SA-00528","INTEL-SA-00617","INTEL-SA-00657","INTEL-SA-00767"]},{"tcb":{"sgxtcbcomponents":[{"svn":2},{"svn":2},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0}],"pcesvn":6},"tcbDate":"2018-08-15T00:00:00Z","tcbStatus":"OutOfDate","advisoryIDs":["INTEL-SA-00203","INTEL-SA-00220","INTEL-SA-00270","INTEL-SA-00293","INTEL-SA-00381","INTEL-SA-00389","INTEL-SA-00465","INTEL-SA-00477","INTEL-SA-00528","INTEL-SA-00617","INTEL-SA-00657","INTEL-SA-00767"]},{"tcb":{"sgxtcbcomponents":[{"svn":1},{"svn":1},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0}],"pcesvn":5},"tcbDate":"2018-01-04T00:00:00Z","tcbStatus":"OutOfDate","advisoryIDs":["INTEL-SA-00106","INTEL-SA-00115","INTEL-SA-00135","INTEL-SA-00203","INTEL-SA-00220","INTEL-SA-00270","INTEL-SA-00293","INTEL-SA-00381","INTEL-SA-00389","INTEL-SA-00465","INTEL-SA-00477","INTEL-SA-00528","INTEL-SA-00617","INTEL-SA-00657","INTEL-SA-00767"]},{"tcb":{"sgxtcbcomponents":[{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0},{"svn":0}],"pcesvn":4},"tcbDate":"2017-07-26T00:00:00Z","tcbStatus":"OutOfDate","advisoryIDs":["INTEL-SA-00088","INTEL-SA-00106","INTEL-SA-00115","INTEL-SA-00135","INTEL-SA-00203","INTEL-SA-00220","INTEL-SA-00270","INTEL-SA-00293","INTEL-SA-00381","INTEL-SA-00389","INTEL-SA-00465","INTEL-SA-00477","INTEL-SA-00528","INTEL-SA-00617","INTEL-SA-00657","INTEL-SA-00767"]}]},"signature":"0f0dcda69af0014b69e2af1a826d5cf5caee7fdcac2ec10740d7b6caedf04871005976e4cc0803bc50e824fb23c82b21078da45d867c30925a56e6d23fe53119"}`) diff --git a/attestationreport/tdx.go b/attestationreport/tdx.go index 33535b9b..f240338e 100644 --- a/attestationreport/tdx.go +++ b/attestationreport/tdx.go @@ -275,7 +275,7 @@ func verifyTdxMeasurements(tdxM Measurement, nonce []byte, intelCache string, re } // Parse and verify PCK certificate extensions - sgxExtensions, err := parseSGXExtensions(quoteCerts.PCKCert.Extensions[SGX_EXTENSION_INDEX].Value[4:]) // skip the first value (not relevant) + sgxExtensions, err := ParseSGXExtensions(quoteCerts.PCKCert.Extensions[SGX_EXTENSION_INDEX].Value[4:]) // skip the first value (not relevant) if err != nil { log.Tracef("failed to parse SGX Extensions from PCK Certificate: %v", err) result.Summary.SetErr(ParseCert) diff --git a/cmc/sgx.go b/cmc/sgx.go new file mode 100644 index 00000000..adebbef2 --- /dev/null +++ b/cmc/sgx.go @@ -0,0 +1,25 @@ +// Copyright (c) 2021 Fraunhofer AISEC +// Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build !nodefaults || sgx + +package cmc + +import "github.com/Fraunhofer-AISEC/cmc/sgxdriver" + +func init() { + log.Info("Adding SGX driver to supported drivers") + drivers["sgx"] = &sgxdriver.Sgx{} +} diff --git a/example-setup/enclave.json b/example-setup/enclave.json new file mode 100644 index 00000000..3c793491 --- /dev/null +++ b/example-setup/enclave.json @@ -0,0 +1,19 @@ +{ + "exe": "testtool", + "key": "private.pem", + "debug": false, + "heapSize": 512, + "executableHeap": false, + "productID": 1, + "securityVersion": 1, + "mounts": [ + { + "source": "../../cmc-data", + "target": "cmc-data", + "type": "hostfs", + "readOnly": false + } + ], + "env": null, + "files": null +} \ No newline at end of file diff --git a/go.mod b/go.mod index ddce168b..b30ac550 100644 --- a/go.mod +++ b/go.mod @@ -21,6 +21,7 @@ require ( require ( github.com/dsnet/golib/memfile v1.0.0 // indirect + github.com/edgelesssys/ego v1.4.1 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/certificate-transparency-go v1.1.6 // indirect github.com/google/go-tspi v0.3.0 // indirect diff --git a/go.sum b/go.sum index 3b3dbca3..c1c1b94e 100644 --- a/go.sum +++ b/go.sum @@ -1,12 +1,20 @@ github.com/Fraunhofer-AISEC/go-attestation v0.3.3-0.20230623144130-44bece0a4cef h1:eeRBtxG9XjrWyV/gyGPG66EYCIkFOp4RlnGboitPzFk= github.com/Fraunhofer-AISEC/go-attestation v0.3.3-0.20230623144130-44bece0a4cef/go.mod h1:piGYUJYVR/LCzIFh+YKgu5ZQWzgMdipIEwT2OpztbvY= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dsnet/golib/memfile v1.0.0 h1:J9pUspY2bDCbF9o+YGwcf3uG6MdyITfh/Fk3/CaEiFs= github.com/dsnet/golib/memfile v1.0.0/go.mod h1:tXGNW9q3RwvWt1VV2qrRKlSSz0npnh12yftCSCy2T64= +github.com/edgelesssys/ego v1.4.1 h1:Ef2UQvGVEf0RqarDidWywhOVLik/LnZbJG0ygdVJDAA= +github.com/edgelesssys/ego v1.4.1/go.mod h1:8xFWTj9hcHyYL7s7fMmKgdYTi5zETPy6PeZip7OBTNA= github.com/fxamacker/cbor/v2 v2.4.0 h1:ri0ArlOR+5XunOP8CRUowT0pSJOwhW098ZCUyskZD88= github.com/fxamacker/cbor/v2 v2.4.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= @@ -22,13 +30,21 @@ github.com/google/go-tpm v0.9.0/go.mod h1:FkNVkc6C+IsvDI9Jw1OveJmxGZUUaKxtrpOS47 github.com/google/go-tpm-tools v0.3.13-0.20230620182252-4639ecce2aba h1:qJEJcuLzH5KDR0gKc0zcktin6KSAwL7+jWKBYceddTc= github.com/google/go-tspi v0.3.0 h1:ADtq8RKfP+jrTyIWIZDIYcKOMecRqNJFOew2IT0Inus= github.com/google/go-tspi v0.3.0/go.mod h1:xfMGI3G0PhxCdNVcYr1C4C+EizojDg/TXuX5by8CiHI= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/letsencrypt/pkcs11key/v4 v4.0.0/go.mod h1:EFUvBDay26dErnNb70Nd0/VW3tJiIbETBPTl9ATXQag= github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y= github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= +github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/pion/dtls/v2 v2.2.7 h1:cSUBsETxepsCSFSxC3mc/aDo14qQLMSL+O6IjG28yV8= github.com/pion/dtls/v2 v2.2.7/go.mod h1:8WiMkebSHFD0T+dIU+UeBaoV7kDhOW5oDCzZ7WZ/F9s= github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY= @@ -46,6 +62,8 @@ github.com/robertkrimen/otto v0.2.1 h1:FVP0PJ0AHIjC+N4pKCG9yCDz6LHNPCwi/GKID5pGG github.com/robertkrimen/otto v0.2.1/go.mod h1:UPwtJ1Xu7JrLcZjNWN8orJaM5n5YEtqL//farB5FlRY= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= @@ -55,10 +73,14 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce/go.mod h1:o8v6yHRoik09Xen7gje4m9ERNah1d1PPsVq1VEx9vE4= github.com/veraison/go-cose v1.1.0 h1:AalPS4VGiKavpAzIlBjrn7bhqXiXi4jbMYY/2+UC+4o= github.com/veraison/go-cose v1.1.0/go.mod h1:7ziE85vSq4ScFTg6wyoMXjucIGOf4JkFEZi/an96Ct4= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 h1:CCriYyAfq1Br1aIYettdHZTy8mBTIPo7We18TuO/bak= go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352/go.mod h1:SNgMg+EgDFwmvSmLRTNKC5fegJjB7v23qTQ0XLGUNHk= @@ -113,6 +135,7 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= google.golang.org/grpc v1.56.3 h1:8I4C0Yq1EjstUzUJzpcRVbuYA2mODtEmpWiQoN/b2nc= @@ -122,10 +145,13 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= +gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/sourcemap.v1 v1.0.5 h1:inv58fC9f9J3TK2Y2R1NPntXEn3/wjWHkonhIUODNTI= gopkg.in/sourcemap.v1 v1.0.5/go.mod h1:2RlvNNSMglmRrcvhfuzp4hQHwOtjxlbjX7UPY/GXb78= gopkg.in/square/go-jose.v2 v2.6.0 h1:NGk74WTnPKBNUhNzQX7PYcTLUjoq7mzKk2OKbvwk2iI= gopkg.in/square/go-jose.v2 v2.6.0/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sgxdriver/sgxdriver.go b/sgxdriver/sgxdriver.go new file mode 100644 index 00000000..cc972294 --- /dev/null +++ b/sgxdriver/sgxdriver.go @@ -0,0 +1,435 @@ +// Copyright (c) 2021 Fraunhofer AISEC +// Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package sgxdriver + +import ( + "crypto" + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rand" + "crypto/tls" + "crypto/x509" + "encoding/hex" + "encoding/pem" + "errors" + "fmt" + "io" + "net/http" + "net/url" + "os" + "strings" + "time" + + ar "github.com/Fraunhofer-AISEC/cmc/attestationreport" + est "github.com/Fraunhofer-AISEC/cmc/est/estclient" + "github.com/Fraunhofer-AISEC/cmc/internal" + "github.com/edgelesssys/ego/enclave" + "github.com/sirupsen/logrus" + + _ "github.com/mattn/go-sqlite3" +) + +var log = logrus.WithField("service", "sgxdriver") + +var ( + tcbInfoUrl = "https://api.trustedservices.intel.com/sgx/certification/v4/tcb?fmspc=%s" + pckCertUrl = "https://api.trustedservices.intel.com/sgx/certification/v4/pckcert?encrypted_ppid=%s&cpusvn=%s&pceid=%s&pcesvn=%s" + ROOT_CA_CERT_NAME = "Intel_SGX_Root_CA" + INTERMEDIATE_CERT_NAME = "Intel_SGX_PCK_Processor_CA" + PCK_CERT_NAME = "Intel_SGX_PCK_Certificate" + TCB_SIGNING_CERT_NAME = "Intel_SGX_TCB_Signing" +) + +// Sgx is a structure required for implementing the Measure method +// of the attestation report Measurer interface +type Sgx struct { + sgxCertChain []*x509.Certificate + signingCertChain []*x509.Certificate + priv crypto.PrivateKey +} + +// Init initializes the SGX driver with the specifified configuration +func (sgx *Sgx) Init(c *ar.DriverConfig) error { + + // Initial checks + if sgx == nil { + return errors.New("internal error: SNP object is nil") + } + + // Create storage folder for storage of internal data if not existing + if c.StoragePath != "" { + if _, err := os.Stat(c.StoragePath); err != nil { + if err := os.MkdirAll(c.StoragePath, 0755); err != nil { + return fmt.Errorf("failed to create directory for internal data '%v': %w", + c.StoragePath, err) + } + } + } + + // Create new private key for signing + priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + return fmt.Errorf("failed to generate private key: %w", err) + } + sgx.priv = priv + + // Create IK CSR and fetch new certificate including its chain from EST server + sgx.signingCertChain, err = getSigningCertChain(priv, c.Serializer, c.Metadata, + c.ServerAddr) + if err != nil { + return fmt.Errorf("failed to get signing cert chain: %w", err) + } + + // Fetch SGX certificate chain + sgx.sgxCertChain, err = getSgxCertChain(c) + if err != nil { + return fmt.Errorf("failed to get SGX cert chain: %w", err) + } + + return nil +} + +// Measure implements the attestation reports generic Measure interface to be called +// as a plugin during attestation report generation +func (sgx *Sgx) Measure(nonce []byte) (ar.Measurement, error) { + + if sgx == nil { + return ar.Measurement{}, errors.New("internal error: SGX object is nil") + } + + data, err := enclave.GetRemoteReport(nonce) + if err != nil { + return ar.Measurement{}, fmt.Errorf("failed to get SGX Measurement: %w", err) + } + + measurement := ar.Measurement{ + Type: "SGX Measurement", + Evidence: data[16:], + Certs: internal.WriteCertsDer(sgx.sgxCertChain), + } + + return measurement, nil +} + +// Lock implements the locking method for the attestation report signer interface +func (sgx *Sgx) Lock() error { + // No locking mechanism required for software key + return nil +} + +// Lock implements the unlocking method for the attestation report signer interface +func (sgx *Sgx) Unlock() error { + // No unlocking mechanism required for software key + return nil +} + +// GetSigningKeys returns the TLS private and public key as a generic crypto interface +func (sgx *Sgx) GetSigningKeys() (crypto.PrivateKey, crypto.PublicKey, error) { + if sgx == nil { + return nil, nil, errors.New("internal error: SW object is nil") + } + return sgx.priv, &sgx.priv.(*ecdsa.PrivateKey).PublicKey, nil +} + +func (sgx *Sgx) GetCertChain() ([]*x509.Certificate, error) { + if sgx == nil { + return nil, errors.New("internal error: SW object is nil") + } + log.Tracef("Returning %v certificates", len(sgx.signingCertChain)) + return sgx.signingCertChain, nil +} + +func getSigningCertChain(priv crypto.PrivateKey, s ar.Serializer, metadata [][]byte, + addr string, +) ([]*x509.Certificate, error) { + + csr, err := ar.CreateCsr(priv, s, metadata) + if err != nil { + return nil, fmt.Errorf("failed to create CSRs: %w", err) + } + + // Get CA certificates and enroll newly created CSR + // TODO provision EST server certificate with a different mechanism, + // otherwise this step has to happen in a secure environment. Allow + // different CAs for metadata and the EST server authentication + log.Warn("Creating new EST client without server authentication") + client := est.NewClient(nil) + + log.Info("Retrieving CA certs") + caCerts, err := client.CaCerts(addr) + if err != nil { + return nil, fmt.Errorf("failed to retrieve certs: %w", err) + } + log.Debug("Received certs:") + for _, c := range caCerts { + log.Debugf("\t%v", c.Subject.CommonName) + } + if len(caCerts) == 0 { + return nil, fmt.Errorf("no certs provided") + } + + log.Warn("Setting retrieved cert for future authentication") + err = client.SetCAs([]*x509.Certificate{caCerts[len(caCerts)-1]}) + if err != nil { + return nil, fmt.Errorf("failed to set EST CA: %w", err) + } + + cert, err := client.SimpleEnroll(addr, csr) + if err != nil { + return nil, fmt.Errorf("failed to enroll cert: %w", err) + } + + return append([]*x509.Certificate{cert}, caCerts...), nil +} + +func readCertFromFile(filePath string) (*x509.Certificate, error) { + // Read Certificate + cert_raw, err := os.ReadFile(filePath) + if err != nil { + return nil, fmt.Errorf("failed to read certificate: %w", err) + } + + // Parse Certificate + cert, err := x509.ParseCertificate(cert_raw) + if err != nil { + return nil, err + } + return cert, nil +} + +func isCertValid(cert *x509.Certificate) bool { + currentTime := time.Now() + return currentTime.After(cert.NotAfter) || currentTime.Before(cert.NotBefore) +} + +// retrieve PCK Certificate Chain + TCB Signing Cert with caching mechanism +func getSgxCertChain(c *ar.DriverConfig) ([]*x509.Certificate, error) { + if c.StoragePath == "" { + log.Traceln("No cache storage available, downloading cert chain") + return downloadSgxCertChain(c) + } + + fileNames := []string{PCK_CERT_NAME, INTERMEDIATE_CERT_NAME, ROOT_CA_CERT_NAME, TCB_SIGNING_CERT_NAME} + certificates := []*x509.Certificate{} + + // Use cache or download if not present + for _, fileName := range fileNames { + filePath := fmt.Sprintf("%s/%s.pem", c.StoragePath, fileName) + _, err := os.Stat(filePath) + + if err != nil { + certs, err := downloadAndCacheCertChain(c) + if err != nil { + return nil, fmt.Errorf("error downloading and caching Sgx Certificate Chain: %v", err) + } + certificates = append(certificates, certs...) + return certificates, nil + } + + cert, err := readCertFromFile(filePath) + if err != nil || !isCertValid(cert) { + certs, err := downloadAndCacheCertChain(c) + if err != nil { + return nil, fmt.Errorf("error downloading and caching Sgx Certificate Chain: %v", err) + } + certificates = append(certificates, certs...) + break + } + certificates = append(certificates, cert) + } + + return certificates, nil +} + +func downloadAndCacheCertChain(c *ar.DriverConfig) ([]*x509.Certificate, error) { + certs, err := downloadSgxCertChain(c) + if err != nil { + return nil, err + } + + // Store certificates in cache + for _, cert := range certs { + fileName := fmt.Sprintf("%s/%s.pem", c.StoragePath, strings.ReplaceAll(cert.Subject.CommonName, " ", "_")) + err = os.WriteFile(fileName, cert.Raw, 0644) + if err != nil { + return nil, err + } + } + return certs, nil +} + +// download PCK Certificate Chain + TCB Signing Cert from Intel API +func downloadSgxCertChain(c *ar.DriverConfig) ([]*x509.Certificate, error) { + certificates := []*x509.Certificate{} + + // Get sgx values from device.config.json + config, err := extractDeviceConfig(c) + if err != nil { + return certificates, err + } + encrypted_ppid := hex.EncodeToString(config.SgxValues.EncryptedPPID) + cpusvn := hex.EncodeToString(config.SgxValues.Cpusvn) + pceid := hex.EncodeToString(config.SgxValues.Pceid) + pcesvn := hex.EncodeToString(config.SgxValues.Pcesvn) + pckCertUrl = fmt.Sprintf(pckCertUrl, encrypted_ppid, cpusvn, pceid, pcesvn) + + // 1. GET PCK Certificate and Certificte Chain + req, err := http.NewRequest("GET", pckCertUrl, nil) + if err != nil { + return certificates, fmt.Errorf("error creating request: %v", err) + } + + // Perform untrusted GET request (ego has no access to root certificates in enclave) + // Should be ok, since root ca certificate fingerpint is checked by verifier + tlsConfig := &tls.Config{InsecureSkipVerify: true} + client := http.Client{Transport: &http.Transport{TLSClientConfig: tlsConfig}} + resp, err := client.Do(req) + if err != nil { + return certificates, fmt.Errorf("error performing request: %v", err) + } + + // Extract PCK-Certificate-Chain from the header + sgxPckIssuerChain := resp.Header.Get("SGX-PCK-Certificate-Issuer-Chain") + + decoded, err := url.QueryUnescape(sgxPckIssuerChain) + if err != nil { + return certificates, fmt.Errorf("error decoding URL-encoded string: %v", err) + } + + // Split the PEM certificates + certs := strings.SplitAfter(decoded, "-----END CERTIFICATE-----\n") + for _, certPEM := range certs { + if certPEM != "" { + + // Decode the PEM block + block, _ := pem.Decode([]byte(certPEM)) + if block == nil { + return certificates, fmt.Errorf("error decoding PCK cert chain") + } + + // Parse the certificate + cert, err := x509.ParseCertificate(block.Bytes) + if err != nil { + return certificates, fmt.Errorf("error parsing certificate: %v", err) + } + + certificates = append(certificates, cert) + } + } + + // Read the PCK certificate + body, err := io.ReadAll(resp.Body) + if err != nil { + return certificates, fmt.Errorf("error reading response body: %v", err) + } + + // Decode the PEM block + block, _ := pem.Decode([]byte(body)) + if block == nil { + return certificates, fmt.Errorf("error decoding PCK cert") + } + + // Parse the certificate + pckCert, err := x509.ParseCertificate(block.Bytes) + if err != nil { + return certificates, fmt.Errorf("error parsing certificate: %v", err) + + } + certificates = append(certificates, pckCert) + resp.Body.Close() + + // Extract FMSPC from PCK certificate SGX Extensions + sgxExtensions, err := ar.ParseSGXExtensions(pckCert.Extensions[ar.SGX_EXTENSION_INDEX].Value[4:]) + if err != nil { + return certificates, err + } + tcbInfoUrl = fmt.Sprintf(tcbInfoUrl, hex.EncodeToString(sgxExtensions.Fmspc.Value)) + + // 2. GET TCB Signing Certificate + req, err = http.NewRequest("GET", tcbInfoUrl, nil) + if err != nil { + return certificates, fmt.Errorf("error creating request: %v", err) + } + + // Perform the request + resp, err = client.Do(req) + if err != nil { + return certificates, fmt.Errorf("error performing request: %v", err) + } + + // Extract and print TCB-Info-Issuer-Chain from the header + tcbInfoIssuerChain := resp.Header.Get("TCB-Info-Issuer-Chain") + + decoded, err = url.QueryUnescape(tcbInfoIssuerChain) + if err != nil { + return certificates, fmt.Errorf("error decoding URL-encoded string: %v", err) + } + + // Split the PEM certificates + certs = strings.SplitAfter(decoded, "-----END CERTIFICATE-----\n") + tcbSigningCert := certs[0] + if tcbSigningCert != "" { + // Decode the PEM block + block, _ := pem.Decode([]byte(tcbSigningCert)) + if block == nil { + return certificates, fmt.Errorf("error decoding TCB Signing Cert") + } + + // Parse the certificate + cert, err := x509.ParseCertificate(block.Bytes) + if err != nil { + return certificates, fmt.Errorf("error parsing certificate: %v", err) + } + + certificates = append(certificates, cert) + } + + resp.Body.Close() + + return certificates, nil +} + +func extractDeviceConfig(c *ar.DriverConfig) (*ar.DeviceConfig, error) { + // Get device configuration from metadata + for i, m := range c.Metadata { + // Extract plain payload of metadata + payload, err := c.Serializer.GetPayload(m) + if err != nil { + log.Warnf("Failed to parse metadata object %v: %v", i, err) + continue + } + + // Unmarshal the Type field of the metadata file to determine the type + info := new(ar.MetaInfo) + err = c.Serializer.Unmarshal(payload, info) + if err != nil { + log.Warnf("Failed to unmarshal data from metadata object: %v", err) + continue + } + + if info.Type == "Device Config" { + log.Tracef("Found Device Config") + var deviceConfig ar.DeviceConfig + err = c.Serializer.Unmarshal(payload, &deviceConfig) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal DeviceConfig: %w", err) + } + + return &deviceConfig, nil + } + } + return nil, errors.New("failed to find device configuration") +} diff --git a/testtool/Makefile b/testtool/Makefile index d3fd7daa..cd12cd48 100644 --- a/testtool/Makefile +++ b/testtool/Makefile @@ -1,3 +1,13 @@ -.PHONY: all +SGX_SDK ?= /opt/intel/sgxsdk +SGX_LIBRARY_PATH := $(SGX_SDK)/lib4 +Enclave_Include_Paths := -I$(SGX_SDK)/include + + +.PHONY: all egocmc all: go build + +egocmc: + CGO_CFLAGS=-D_FORTIFY_SOURCE=0 ego-go build && ego sign testtool + + From 3417217517762e1884396a106a4779a4a8ea350a Mon Sep 17 00:00:00 2001 From: Christian Schmucker Date: Mon, 18 Mar 2024 17:12:54 +0000 Subject: [PATCH 2/3] added sgx setup script --- example-setup/libapi-sgx-config.json | 23 ++++ example-setup/sgx-setup-sample | 156 +++++++++++++++++++++++++++ 2 files changed, 179 insertions(+) create mode 100644 example-setup/libapi-sgx-config.json create mode 100755 example-setup/sgx-setup-sample diff --git a/example-setup/libapi-sgx-config.json b/example-setup/libapi-sgx-config.json new file mode 100644 index 00000000..4e59e921 --- /dev/null +++ b/example-setup/libapi-sgx-config.json @@ -0,0 +1,23 @@ +{ + "mode": "generate", + "addr": [ + "localhost:4443" + ], + "report": "cmc-data/attestation-report", + "result": "cmc-data/attestation-result.json", + "nonce": "cmc-data/nonce", + "ca": "cmc-data/pki/ca.pem", + "mtls": true, + "api": "libapi", + "logLevel": "trace", + "provServerAddr": "https://localhost:9000/", + "drivers": [ + "sgx" + ], + "metadata": [ + "file://./cmc-data/metadata-signed" + ], + "storage": "cmc-data/testtool-internal", + "cache": "cmc-data/testtool-cache" +} + diff --git a/example-setup/sgx-setup-sample b/example-setup/sgx-setup-sample new file mode 100755 index 00000000..fa21463b --- /dev/null +++ b/example-setup/sgx-setup-sample @@ -0,0 +1,156 @@ +#!/bin/bash + +set -euo pipefail + +trap '[ $? -eq 0 ] && exit 0; printf "%s failed\n" "$0"' EXIT +export PATH=${PATH}:${HOME}/go/bin + +abs_path() { + if [[ -d "$(dirname "$1")" ]] + then + echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")" || true + fi +} + +if [[ "$#" -ne 5 ]]; then + echo "Usage: ./setup-full-simple " + exit +fi + + +cmc="$(abs_path "${1}")" +data="$(abs_path "${2}")" +ser="${3}" +mrenclave="${4}" +mrsigner="${5}" + +if [[ ! -d "$cmc" ]]; then + echo "cmc directory does not exist. Did you clone the repository? Abort.." + exit 1 +fi + +if [[ ! -d "${data}" ]]; then + mkdir -p "${data}" +fi + +echo "Using cmc: ${cmc}" +echo "Using $data as directory for local data" + + +# Install dependencies +sudo apt install -y moreutils golang-cfssl build-essential zlib1g-dev libssl-dev jq openssl + +# Build cmc +cd "${cmc}" +echo "Building cmc.." +go build ./... + +# Install cmc to $GOPATH/bin +echo "Installing cmc" +go install ./... + +# Copy metadata templates +cp -r "${cmc}/example-setup/"* "${data}" + +# Generate a PKI suitable for your needs. You can use the simple PKI example-setup for testing: +"${data}/setup-pki-simple" -i "${data}" -o "${data}/pki" + +cd "${data}" + +# Retrieve values from PCKIDRetrievalTool +sudo PCKIDRetrievalTool -f pckid_retrieval.csv +pckid_retrieval="$(cat pckid_retrieval.csv)" +encrypted_ppid="$(echo "${pckid_retrieval}" | cut -d ',' -f1)" +pceid="$(echo "${pckid_retrieval}" | cut -d ',' -f2)" +cpusvn="$(echo "${pckid_retrieval}" | cut -d ',' -f3)" +pcesvn="$(echo "${pckid_retrieval}" | cut -d ',' -f4)" +rm -f pckid_retrieval.csv + +# GET PCK Certificate and extract FMSPC +pck_cert="$(curl -s -X GET "https://api.trustedservices.intel.com/sgx/certification/v4/pckcert?encrypted_ppid=$encrypted_ppid&cpusvn=$cpusvn&pceid=$pceid&pcesvn=$pcesvn")" +FMSPC="$(openssl asn1parse -inform PEM -in <(echo -n "$pck_cert") -strparse 626 | grep -oP '427:d=2.*' | awk -F: '/HEX DUMP/{print $NF}')" + +# GET root CA certificate fingerprint +cert_chain=$(curl -I -X GET "https://api.trustedservices.intel.com/sgx/certification/v4/pckcert?encrypted_ppid=$encrypted_ppid&cpusvn=$cpusvn&pceid=$pceid&pcesvn=$pcesvn" | grep 'SGX-PCK-Certificate-Issuer-Chain') +decoded=$(printf '%b' "$(echo "$cert_chain" | sed 's/SGX-PCK-Certificate-Issuer-Chain: //' | sed 's/+/ /g; s/%/\\x/g')") +root_ca=$(echo -e "$decoded" | sed -n '/-----END CERTIFICATE-----/,$p' | sed '1d') +ca_fingerprint=$(openssl x509 -in <(echo "$root_ca") -noout -sha256 -fingerprint | awk -F= '{print $2}' | tr -d ': ' | tr '[:upper:]' '[:lower:]') + +# GET TCB Info +tcb_info="$(curl -s -X GET "https://api.trustedservices.intel.com/sgx/certification/v4/tcb?fmspc=$FMSPC" | jq -c .)" +echo "$tcb_info" > "${data}/metadata-raw/tcb_info.json" + +# GET Quoting Enclave Identity +qe_identity="$(curl -s -X GET "https://api.trustedservices.intel.com/sgx/certification/v4/qe/identity" | jq -c .)" +echo "$qe_identity" > "${data}/metadata-raw/qe_identity.json" + +# Calculate the sizes in bytes +tcb_info_size="$(echo -n "$tcb_info" | wc -c | jq 'tonumber')" +qe_identity_size="$(echo -n "$qe_identity" | wc -c | jq 'tonumber')" + +jq --argjson tcb_info "$tcb_info" --argjson qe_identity "$qe_identity" --argjson tcb_info_size "$tcb_info_size" --argjson qe_identity_size "$qe_identity_size" '.referenceValues = [{ + "type": "SGX Reference Value", + "sha256": "'"$mrenclave"'", + "sgx": { + "version": 3, + "collateral": { + "teeType": 0, + "tcbInfo": $tcb_info, + "tcbInfoSize": $tcb_info_size, + "qeIdentity": $qe_identity, + "qeIdentitySize": $qe_identity_size + }, + "caFingerprint": "'"$ca_fingerprint"'", + "attributes": { + "initted": true, + "mode64Bit": true, + "legacy": true + }, + "isvProdId": 1, + "isvSvn": 1, + "mrSigner": "'"$mrsigner"'" + } +}]' "$data/metadata-raw/rtm.manifest.json" | sponge "$data/metadata-raw/rtm.manifest.json" + +# Add PCKIDRetrievalTool values to device.config.json +jq --arg encrypted_ppid "${encrypted_ppid}" --arg pceid "${pceid}" --arg cpusvn "${cpusvn}" --arg pcesvn "${pcesvn}" '.sgxValues = { + "encryptedPPID": $encrypted_ppid, + "pceid": $pceid, + "cpusvn": $cpusvn, + "pcesvn": $pcesvn + }' "$data/metadata-raw/device.config.json" | sponge "$data/metadata-raw/device.config.json" + +# Sign the metadata* +input="${data}/metadata-raw" +tmp="${data}/metadata-tmp" +out="${data}/metadata-signed" +key="${data}/pki/signing-cert-key.pem" +chain="${data}/pki/signing-cert.pem,${data}/pki/ca.pem" + +rm -rf "${tmp}" +rm -rf "${out}" + +mkdir -p "${tmp}" +mkdir -p "${out}" + +if [[ "${ser,,}" = "json" ]]; then + echo "using json serialization" + cp "${input}/rtm.manifest.json" "${tmp}/rtm.manifest.json" + cp "${input}/os.manifest.json" "${tmp}/os.manifest.json" + cp "${input}/device.description.json" "${tmp}/device.description.json" + cp "${input}/device.config.json" "${tmp}/device.config.json" +elif [[ "${ser,,}" = "cbor" ]]; then + echo "using cbor serialiation" + cmc-converter -in "${input}/rtm.manifest.json" -out "${tmp}/rtm.manifest.cbor" -outform cbor + cmc-converter -in "${input}/os.manifest.json" -out "${tmp}/os.manifest.cbor" -outform cbor + cmc-converter -in "${input}/device.description.json" -out "${tmp}/device.description.cbor" -outform cbor + cmc-converter -in "${input}/device.config.json" -out "${tmp}/device.config.cbor" -outform cbor +else + echo "serialization format ${ser} is not supported" + exit 1 +fi + +cmc-signing-tool -in "${tmp}/rtm.manifest.${ser}" -out "${out}/rtm.manifest.${ser}" -keys "${key}" -x5cs "${chain}" +cmc-signing-tool -in "${tmp}/os.manifest.${ser}" -out "${out}/os.manifest.${ser}" -keys "${key}" -x5cs "${chain}" +cmc-signing-tool -in "${tmp}/device.description.${ser}" -out "${out}/device.description.${ser}" -keys "${key}" -x5cs "${chain}" +cmc-signing-tool -in "${tmp}/device.config.${ser}" -out "${out}/device.config.${ser}" -keys "${key}" -x5cs "${chain}" \ No newline at end of file From dc1eca2f06639b0108fc7795eb387cdffe3da6df Mon Sep 17 00:00:00 2001 From: Christian Schmucker Date: Tue, 19 Mar 2024 14:09:10 +0000 Subject: [PATCH 3/3] updated documentation for SGX --- doc/Architecture.md | 6 + doc/architecture.drawio | 140 ++++++- doc/architecture.drawio.svg | 4 +- doc/attestation_report.drawio | 630 ++++++++++++++++++++++++++++- doc/attestation_report.drawio.svg | 4 +- doc/build.md | 17 +- doc/manual-setup.md | 5 +- doc/overview.drawio | 178 +++++++- doc/overview.drawio.svg | 4 +- doc/sgx-reference-value.drawio | 111 +++++ doc/sgx-reference-value.drawio.svg | 4 + 11 files changed, 1092 insertions(+), 11 deletions(-) create mode 100644 doc/sgx-reference-value.drawio create mode 100644 doc/sgx-reference-value.drawio.svg diff --git a/doc/Architecture.md b/doc/Architecture.md index 65355290..6f4a61cc 100644 --- a/doc/Architecture.md +++ b/doc/Architecture.md @@ -65,6 +65,12 @@ The *snpdriver* interfaces with the AMD SEV-SNP SP. It retrieves SNP measurement an SNP attestation report as well as the certificate chain for this attestation report from the respective AMD servers. Currently, it can only act as *Measurement* interface. +__sgxdriver:__ +The *sgxdriver* interfaces with the Intel SGX CPU. It retrieves SGX measurements in the form of an SGX attestation report signed by the SGX quoting enclave. It implements a small caching mechanism to fetch and store the certificate chain used for report verification from the Intel SGX API. Currently, the driver only acts as a *Measurement* interface. + +__tdxdriver:__ +*Will be implemented as soon as Intel TDX hardware is available.* + __swdriver:__ The *swdriver* simply creates keys in software for testing purposes and can be used as *Signer* interface. **Note**: This should mainly be used for testing purposes. diff --git a/doc/architecture.drawio b/doc/architecture.drawio index 3c265bf6..0601147c 100644 --- a/doc/architecture.drawio +++ b/doc/architecture.drawio @@ -1 +1,139 @@ -7Vvtc6I4GP9rnNn90A4QsfZjq7V7M+tu5+zcXT+mEDC3gXAhvu1ffwkEIYZat6LSujqj5EmIye95f4IdMIiW9wwm0zH1Eek4lr/sgGHHcWzQ7YsvSVnllH7Xzgkhw74aVBIm+CdSREtRZ9hHqTaQU0o4TnSiR+MYeVyjQcboQh8WUKL/agJDZBAmHiQm9W/s86nahWuV9C8Ih9Pil21L9USwGKwI6RT6dFEhgbsOGDBKeX4VLQeISPAKXPL7Ri/0rhfGUMx3ueHb6JElkD/RyXg4jOF0cf/z+4VznU8zh2Smdq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qPk3YrkpfTFgNpEKToICcwtpmzDyGKaJyBAb0pfM4iYCFCMtSVtgDHYUfuZJRrKA5WOcWjUSLCV1XPP89IuK4EanePGgmbSeDdEkZ5HgOThAjwOM74G8EfOedEJiNzmEDyeSova6vLH5iJ7mvO47g8rKti94gE38dzjSm9/2by8a0MlYs0g+VGDLCtZJlhU/SLq1B9k2L8XhONEUxnTBYVLBgLWRllKXMx/TNrZJVi2nyhBjnDQae2Bhp51pcBozt7SmAcfj4NQu8jxNhU7cOeBO56vu78WjRxYV1egeIc6izO3Htbh+tH7kcNbfqGGc0DmMz/MZQIsd4vkWkkcdF52jN9z3GPUJ0659NkttfmR+nAVd2TjCb69sHQNw+DKkdogyLCPkBsRlDAWxeZbWgHqNGO2gdND6cdZrrUrHY0IdPdtgm1mZLk0ZCgPQj3Lv8BcSYCvelb6yT6uKfP5qNF2Znhyd3iBk7OqXEyq8s346EU4MlDC9BqGViHtpIn+VPP5rOlJ7eroOa8n81Snh1LjzCLLors3PoCmZ8HEedhZ50d7KwNjqoTZjay9n1WkFVPwvyh4bwml/OtWl+tJC9Zainzl3Mutdax9KhlusIe1JZas2pqwugc++jAGvhOGFbnlpp6SkQ0yz+y5gWE8u/A4O5/ \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/architecture.drawio.svg b/doc/architecture.drawio.svg index 197e804b..73b8807b 100644 --- a/doc/architecture.drawio.svg +++ b/doc/architecture.drawio.svg @@ -1,4 +1,4 @@ - + -
Generate(), Sign(), Verify()
Generate(), Sign(), Verify()
cmcd
cmcd
/dev/sev-guest
/dev/sev-guest
SNP driver
SNP driver
Software driver
Software driv...
/dev/tpm0
/dev/tpm0
TPM driver
TPM driver
One or multiple drivers can be used at once
One or multiple drivers can be...
aTLS
aTLS
testtool (client)
testtool (client)
testtool (server)
testtool (server)
CMC Interface (gRPC)
CMC Interface (gRPC)
Daemon reachable to attesting / verifying components
Daemon reachable to attesting...
Example application making use of the cmcd
Example application making us...
Measurer and/or
Signer Interface (golang)
Measurer and/or...
attestationreport
attestationreport
Software Component
Software Component
golang Package
golang Package
TPM
TPM
AMD PSP
AMD PSP
Trusted Firm- and Hardware
Trusted Firm- and Hardware
Package for generating and verifying attestation reports
Package for generating and ve...
Example of provided Hardware
Example of provided Hardware
Text is not SVG - cannot display
\ No newline at end of file +
Generate(), Sign(), Verify()
cmcd
/dev/sev-guest
SNP driver
SGX driver
/dev/tpm0
TPM driver
One or multiple drivers can be used at once
aTLS
testtool (client)
testtool (server)
CMC Interface (gRPC)
Daemon reachable to attesting / verifying components
Example application making use of the cmcd
Measurer and/or
Signer Interface (golang)
attestationreport
Software Component
golang Package
TPM
AMD PSP
Trusted Firm- and Hardware
Package for generating and verifying attestation reports
Example of provided Hardware
Intel SGX CPU
Software driver
\ No newline at end of file diff --git a/doc/attestation_report.drawio b/doc/attestation_report.drawio index 01bfb5cc..a908566d 100644 --- a/doc/attestation_report.drawio +++ b/doc/attestation_report.drawio @@ -1 +1,629 @@ -7V1Zd5s4G/41PmfmIjnsy2XiZmknSd04X9LpzXdkI9s0GBzAcdxfPxKLDZJYbANeQmdOawRi0fNIeje96ojd6ceNC2aTe8eAVkfgjI+O+KUjCJKuob9xwTIs4HWJD0vGrmlEZeuCvvkHpgvnpgG9VJHvOJZvztKFQ8e24dBPlQHXdRbpy0aOFT2UCwtmYJx+IC7oD4FFl76Yhj8JSzU5Uf0WmuNJ/GSei85MQXxxVOBNgOEsEkXiVUfsuo7jh7+mH11o4bYzU294nXF29WIutP0yFYD0ML/p/ZKXxqX3+mTcPbw9u2e8EN7mHVjz6Iujt/WXcRO4ztw2IL4L1xEvFxPTh/0ZGOKzC4Q5Kpv4Uwsd8ejnyLH9rmM5blBX5II/uNy0rLjcgCMwt9BLX9LfEH3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3DhpIV1l5nhYp8PvPgyXqUHXK5tXLd3li9KrEbohgNqIuUZQGWpwMKpIN5QkcstckTEfxymiql5RxqQdbSzYArd+inZhgtHbF6zQuXMPd60LezjBPOxWlQSRfocxtGG0czMH8DPdue2b5dPy7UKfrZaYbrE6QFPJ1QFMAsn6eZMUYmwIyOCDAd/NeOFxNlZVgtLQnrCx/pQLicCYZGsDhNac04B4zshfoI/G3+4676YBV1MElzEEVznWNmOHE7QyY63cZEfhWesOo9k3HpeuPmYWsJHQ5eCBzxmhv25Qi06wGoN+X1lBXofkpDjIHNIi5SmVHn8zPWqInoUjVClNaop0okA6Z2FfTviuAGSdTAovq7S2I0Q7eqW1nc0zmqJD18FTzlrqw8DcOwbEV/wH \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/attestation_report.drawio.svg b/doc/attestation_report.drawio.svg index d3c53e69..0beeaccb 100644 --- a/doc/attestation_report.drawio.svg +++ b/doc/attestation_report.drawio.svg @@ -1,4 +1,4 @@ - + -App ManifestType: App ManifestName (unique)VersionOSs (list)Reference Values (list)...App DescriptionType: App DescriptionName (unique)App Manifest...Device DescriptionType: Device DescriptionFQDN (unique)App Descriptions (list)OS ManifestRTM Manifest...Attestation ReportType: Attestation ReportVersion (of AR Scheme)Measurements (list)RTM ManifestOS ManifestApp Manifests (list)Device Description...Software Reference ValueType: SW Reference ValueNameSHA-512TPM MeasurementType: TPM MeasurementTPM Quote [Nonce, ...]Hash Chain (list)Certificate ChainSoftware MeasurementType: SW MeasurementNameSHA-512RTM ManifestType: RTM ManifestName (unique)VersionReference Values (list)...OS ManifestType: OS ManifestName (unique)VersionRTMs (list)Reference Values (list)...
Following block
directly integrated
Following...
Hash ChainType: Hash ChainPCR (int)SHA256 (list)
Link to the following block
through unique name
Link to the following b...
SNP MeasurementType: SNP MeasurementSNP Report [Nonce, ...]Certificate ChainIAS MeasurementType: IAS MeasurementIAT [Nonce, ...]Certificate ChainSNP Reference ValueType: SNP Reference ValueNameSHA-384SNP MetadataTPM Reference ValueType: TPM Reference ValueNameSHA-256PCR (int)
signed by operator and
possibly certifiers
signed by operator and...
Signed by the HW Trust Anchor, generated at runtime
Signed by the HW Trust Anc...
Signed by the device, generated at runtime
Signed by the device...
Signed by software provider and possibly certifiers
Signed by software provide...
Explanation of Graphical Elements
Explanation of Graphical Elements
Text is not SVG - cannot display
\ No newline at end of file +App ManifestType: App ManifestName (unique)VersionOSs (list)Reference Values (list)...App DescriptionType: App DescriptionName (unique)App Manifest...Device DescriptionType: Device DescriptionFQDN (unique)App Descriptions (list)OS ManifestRTM Manifest...Attestation ReportType: Attestation ReportVersion (of AR Scheme)Measurements (list)RTM ManifestOS ManifestApp Manifests (list)Device Description...Software Reference ValueType: SW Reference ValueNameSHA-512TPM MeasurementType: TPM MeasurementTPM Quote [Nonce, ...]Hash Chain (list)Certificate ChainSoftware MeasurementType: SW MeasurementNameSHA-512RTM ManifestType: RTM ManifestName (unique)VersionReference Values (list)...OS ManifestType: OS ManifestName (unique)VersionRTMs (list)Reference Values (list)...
Following block
directly integrated
Hash ChainType: Hash ChainPCR (int)SHA256 (list)
Link to the following block
through unique name
SNP MeasurementType: SNP MeasurementSNP Report [Nonce, ...]Certificate ChainIAS MeasurementType: IAS MeasurementIAT [Nonce, ...]Certificate ChainSNP Reference ValueType: SNP Reference ValueNameSHA-384SNP MetadataTPM Reference ValueType: TPM Reference ValueNameSHA-256PCR (int)
signed by operator and
possibly certifiers
Signed by the HW Trust Anchor, generated at runtime
Signed by the device, generated at runtime
Signed by software provider and possibly certifiers
Explanation of Graphical Elements
SGX MeasurementType: SGX MeasurementSGX Report [Nonce, ...]Certificate ChainSGX Reference ValueType: SGX Reference ValueNameSHA-256SGX MetadataTDX Reference ValueType: TDX Reference ValueNameSHA-384TDX MetadataTDX MeasurementType: TDX MeasurementTDX Report [Nonce, ...]Certificate Chain
\ No newline at end of file diff --git a/doc/build.md b/doc/build.md index 6edaae13..f4d6d393 100644 --- a/doc/build.md +++ b/doc/build.md @@ -77,4 +77,19 @@ go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28 go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2 cd grpcapi/ make -``` \ No newline at end of file +``` + +### SGX Build + +The SGX integration is build on top of the [EGo Framework](https://github.com/edgelesssys/ego) for the development of confidential apps in Go. +Since SGX enclaves are designed to execute only one process inside an isolated environment, the libapi implementation has to be used for the generation and verification of attestation reports. + +Once you have developed your application and integrated the cmc library following the instructions provided in the [integration documentation](integration.md), compile, sign and run it like this: +``` +CGO_CFLAGS=-D_FORTIFY_SOURCE=0 ego-go build && ego sign $CMC_ROOT/cmc-data/enclave.json +ego run testtool +``` + +Additional information for the enclave such as heapSize, mount points, security version (ISV SVN) and enclave product ID (ISV Prod ID) can be specified in the enclave.json file. + +See https://docs.edgeless.systems/ego/reference/config for more information. diff --git a/doc/manual-setup.md b/doc/manual-setup.md index fd8c72e4..a212582d 100644 --- a/doc/manual-setup.md +++ b/doc/manual-setup.md @@ -149,7 +149,10 @@ tbd ##### Intel SGX Reference Values -tbs +The reference values for Intel SGX consist of a fingerprint of the Intel Root CA certificate, the TCB Info and QE Identity structures, the enclave product ID (ISV Prod ID), the security version of the enclave (ISVSVN), expected enclave attributes (e.g. DEBUG, Mode64Bit, etc.), a hash of the enclave measurement (MRENCLAVE) and a hash of the enclave signing key (MRSIGNER). + +The Root CA certificate, TCB Info and QE Identity structures can be retrieved from the [Intel API](https://api.portal.trustedservices.intel.com/content/documentation.html). ISV SVN and ISV Prod ID are assigned by the enclave author. The EGo framework sets these values to 1 by default. +The MRENCLAVE and MRSIGNER values for an enclave can be retrieved via the EGo CLI tool with the commands ```ego uniqueid $ENCLAVE_PROGRAM``` and ```ego signerid $ENCLAVE_PROGRAM```. ### 4. Sign the metadata diff --git a/doc/overview.drawio b/doc/overview.drawio index bab21c86..959a408e 100644 --- a/doc/overview.drawio +++ b/doc/overview.drawio @@ -1 +1,177 @@ -7VxdU6s4GP41ndm90AFS2nqp1npmR4+dqTt73JudCGlhDYQNqW3Pr98EQvkIp0ULFK11RslLCOR53q+8ofbAtbe+pTBw7omNcM/Q7HUPjHuGoYP+iP8Rkk0sGfX1WLCgri07pYKZ+xNJoSalS9dGYa4jIwQzN8gLLeL7yGI5GaSUrPLd5gTn7xrABVIEMwtiVfqXazNHzsLUUvk35C6c5M66Js94MOksBaEDbbLKiMBND1xTQlh85K2vERbgJbjE101+cXb7YBT5rMoF3yePNIDsiczux2MfOqvbnw9nxkU8zCvESzlj+bRsk0BAydK3kRhF64GrleMyNAugJc6uOOlc5jAP85bOD+fEZ5JFXXSfuxhfE0xoNBawTTSy+1weMkpeUObMyHgGgwE/o85LTvUVUYbWGZGc5y0iHmJ0w7us88ojdQ4k7VXKoDGSMifDXsIqlEqz2I6c4soPJLRvgdloF+a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DMteLFPR1xtDX63bZ3Y7rpOMqYFYi9GcdS7SFqwDlFhH6Xt/zVmHmv7Wax116HS/a0qtppgLgmGUSk55rBcvpJ+IQhdja5lGt7tRqL7zEe31HD0sFnAyjo2TWhW8vB8LBZ5NO4BWx8Bq2kse5TsWxRf6ju5XQck+LV2GLNpOnLjUOxN39UXrG6R2nESchp81KvhZHbRqE+pqZBv7tHm0UbxAPqJQ1sti3rL1ssziJVpaivXLKZfOyihtteyS+IPS0llUHQsoeXVt1LAFfhDCysJSY7v7N/off/7QyMXk8fW/6T+27//ts5L3WxU2kG+rm6IZbvKoVatF7S0dZQAxS3xSIjuwmlTMqfpa/3xYGGXvDkMy1mD/WHFlrY5vb5SSqSZkD4HwjRDHK2Vv6W9L1ycS9AqkgLKvyRkNBb1SjqoUpt9kcF23Mb3MLLT003+fuQ3fNmzDlqfWqO5cfxvzTtL0hu1ZHm+mX6GPKU3/EQG4+R8= \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/overview.drawio.svg b/doc/overview.drawio.svg index 1769c929..8d27fc6a 100644 --- a/doc/overview.drawio.svg +++ b/doc/overview.drawio.svg @@ -1,4 +1,4 @@ - + -
cmcd
cmcd
SNP driver
SNP driver
Software driver
Software driv...
TPM driver
TPM driver
One or multiple drivers can be used at once
One or multiple drivers can be...
aTLS
aTLS
testtool (client)
testtool (client)
testtool (server)
testtool (server)
Daemon reachable to attesting / verifying components
Daemon reachable to attesting...
Example application making use of the cmcd
Example application making us...
attestationreport
attestationreport
Software Component
Software Component
golang Package
golang Package
TPM
TPM
AMD PSP
AMD PSP
Trusted Firm- and Hardware
Trusted Firm- and Hardware
Package for generating and verifying attestation reports
Package for generating and ve...
Example of provided Hardware
Example of provided Hardware
Optional Communication
Optional Communication
Line of Communication
Line of Communication
Text is not SVG - cannot display
\ No newline at end of file +
cmcd
SNP driver
SGX driver
Software driver
One or multiple drivers can be used at once
aTLS
testtool (client)
testtool (server)
Daemon reachable to attesting / verifying components
Example application making use of the cmcd
attestationreport
Software Component
golang Package
TPM
AMD PSP
Trusted Firm- and Hardware
Package for generating and verifying attestation reports
Example of provided Hardware
Optional Communication
Line of Communication
Intel SGX CPU
TPM driver
\ No newline at end of file diff --git a/doc/sgx-reference-value.drawio b/doc/sgx-reference-value.drawio new file mode 100644 index 00000000..b9c9a099 --- /dev/null +++ b/doc/sgx-reference-value.drawio @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/sgx-reference-value.drawio.svg b/doc/sgx-reference-value.drawio.svg new file mode 100644 index 00000000..4924a1bb --- /dev/null +++ b/doc/sgx-reference-value.drawio.svg @@ -0,0 +1,4 @@ + + + +SGX Reference ValueType: SGX Reference ValueNameSHA-256SGX MetadataSGX MetadataVersionCollateralCA FingerprintISV Prod IDMRSIGNERISV SVNAttributesIntel CollateralTEE TypeTCB InfoTCB Info SizeQE IdentityQE Identity SizeSGX AttributesInnitedDebugMode 64 BitProvision KeyEnclave Init TokenKSSLegacyAVX \ No newline at end of file